3430 3431 if (!use_precise) { 3432 // All card marks for a (non-array) instance are in one place: 3433 adr = obj; 3434 } 3435 // (Else it's an array (or unknown), and we want more precise card marks.) 3436 assert(adr != NULL, ""); 3437 3438 IdealKit ideal(gvn(), control(), merged_memory(), true); 3439 3440 // Convert the pointer to an int prior to doing math on it 3441 Node* cast = __ CastPX(__ ctrl(), adr); 3442 3443 // Divide by card size 3444 assert(Universe::heap()->barrier_set()->kind() == BarrierSet::CardTableModRef, 3445 "Only one we handle so far."); 3446 Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) ); 3447 3448 // Combine card table base and card offset 3449 Node* card_adr = __ AddP(__ top(), byte_map_base_node(), card_offset ); 3450 3451 // Get the alias_index for raw card-mark memory 3452 int adr_type = Compile::AliasIdxRaw; 3453 // Smash zero into card 3454 Node* zero = __ ConI(0); 3455 BasicType bt = T_BYTE; 3456 if( !UseConcMarkSweepGC ) { 3457 __ store(__ ctrl(), card_adr, zero, bt, adr_type); 3458 } else { 3459 // Specialized path for CM store barrier 3460 __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type); 3461 } 3462 3463 // Final sync IdealKit and GraphKit. 3464 sync_kit(ideal); 3465 } 3466 3467 // G1 pre/post barriers 3468 void GraphKit::g1_write_barrier_pre(Node* obj, 3469 Node* adr, 3470 uint alias_idx, 3471 Node* val, 3472 const TypeOopPtr* val_type, 3473 BasicType bt) { 3474 IdealKit ideal(gvn(), control(), merged_memory(), true); 3475 3476 Node* tls = __ thread(); // ThreadLocalStorage 3477 3478 Node* no_ctrl = NULL; 3479 Node* no_base = __ top(); 3480 Node* zero = __ ConI(0); 3481 3482 float likely = PROB_LIKELY(0.999); | 3430 3431 if (!use_precise) { 3432 // All card marks for a (non-array) instance are in one place: 3433 adr = obj; 3434 } 3435 // (Else it's an array (or unknown), and we want more precise card marks.) 3436 assert(adr != NULL, ""); 3437 3438 IdealKit ideal(gvn(), control(), merged_memory(), true); 3439 3440 // Convert the pointer to an int prior to doing math on it 3441 Node* cast = __ CastPX(__ ctrl(), adr); 3442 3443 // Divide by card size 3444 assert(Universe::heap()->barrier_set()->kind() == BarrierSet::CardTableModRef, 3445 "Only one we handle so far."); 3446 Node* card_offset = __ URShiftX( cast, __ ConI(CardTableModRefBS::card_shift) ); 3447 3448 // Combine card table base and card offset 3449 Node* card_adr = __ AddP(__ top(), byte_map_base_node(), card_offset ); 3450 // Get the alias_index for raw card-mark memory 3451 int adr_type = Compile::AliasIdxRaw; 3452 Node* zero = __ ConI(0); // Dirty card value 3453 BasicType bt = T_BYTE; 3454 3455 if (UseCondCardMark) { 3456 // The classic GC reference write barrier is typically implemented 3457 // as a store into the global card mark table. Unfortunately 3458 // unconditional stores can result in false sharing and excessive 3459 // coherence traffic as well as false transactional aborts. 3460 // UseCondCardMark enables MP "polite" conditional card mark 3461 // stores. In theory we could relax the load from ctrl() to 3462 // no_ctrl, but that doesn't buy much latitude. 3463 Node* card_val = __ load( __ ctrl(), card_adr, TypeInt::BYTE, bt, adr_type); 3464 __ if_then(card_val, BoolTest::ne, zero); 3465 } 3466 3467 // Smash zero into card 3468 if( !UseConcMarkSweepGC ) { 3469 __ store(__ ctrl(), card_adr, zero, bt, adr_type); 3470 } else { 3471 // Specialized path for CM store barrier 3472 __ storeCM(__ ctrl(), card_adr, zero, oop_store, adr_idx, bt, adr_type); 3473 } 3474 3475 if (UseCondCardMark) { 3476 __ end_if(); 3477 } 3478 3479 // Final sync IdealKit and GraphKit. 3480 sync_kit(ideal); 3481 } 3482 3483 // G1 pre/post barriers 3484 void GraphKit::g1_write_barrier_pre(Node* obj, 3485 Node* adr, 3486 uint alias_idx, 3487 Node* val, 3488 const TypeOopPtr* val_type, 3489 BasicType bt) { 3490 IdealKit ideal(gvn(), control(), merged_memory(), true); 3491 3492 Node* tls = __ thread(); // ThreadLocalStorage 3493 3494 Node* no_ctrl = NULL; 3495 Node* no_base = __ top(); 3496 Node* zero = __ ConI(0); 3497 3498 float likely = PROB_LIKELY(0.999); |