< prev index next >

src/hotspot/share/gc/g1/c2/g1BarrierSetC2.cpp

Print this page




 455     // Does the store cause us to cross regions?
 456 
 457     // Should be able to do an unsigned compare of region_size instead of
 458     // and extra shift. Do we have an unsigned compare??
 459     // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes);
 460     Node* xor_res =  __ URShiftX ( __ XorX( cast,  __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes));
 461 
 462     // if (xor_res == 0) same region so skip
 463     __ if_then(xor_res, BoolTest::ne, zeroX); {
 464 
 465       // No barrier if we are storing a NULL
 466       __ if_then(val, BoolTest::ne, kit->null(), unlikely); {
 467 
 468         // Ok must mark the card if not already dirty
 469 
 470         // load the original value of the card
 471         Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 472 
 473         __ if_then(card_val, BoolTest::ne, young_card); {
 474           kit->sync_kit(ideal);
 475           kit->insert_store_load_for_barrier();
 476           __ sync_kit(kit);
 477 
 478           Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 479           __ if_then(card_val_reload, BoolTest::ne, dirty_card); {
 480             g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
 481           } __ end_if();
 482         } __ end_if();
 483       } __ end_if();
 484     } __ end_if();
 485   } else {
 486     // The Object.clone() intrinsic uses this path if !ReduceInitialCardMarks.
 487     // We don't need a barrier here if the destination is a newly allocated object
 488     // in Eden. Otherwise, GC verification breaks because we assume that cards in Eden
 489     // are set to 'g1_young_gen' (see G1CardTable::verify_g1_young_region()).
 490     assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
 491     Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 492     __ if_then(card_val, BoolTest::ne, young_card); {
 493       g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
 494     } __ end_if();
 495   }




 455     // Does the store cause us to cross regions?
 456 
 457     // Should be able to do an unsigned compare of region_size instead of
 458     // and extra shift. Do we have an unsigned compare??
 459     // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes);
 460     Node* xor_res =  __ URShiftX ( __ XorX( cast,  __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes));
 461 
 462     // if (xor_res == 0) same region so skip
 463     __ if_then(xor_res, BoolTest::ne, zeroX); {
 464 
 465       // No barrier if we are storing a NULL
 466       __ if_then(val, BoolTest::ne, kit->null(), unlikely); {
 467 
 468         // Ok must mark the card if not already dirty
 469 
 470         // load the original value of the card
 471         Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 472 
 473         __ if_then(card_val, BoolTest::ne, young_card); {
 474           kit->sync_kit(ideal);
 475           kit->insert_mem_bar(Op_MemBarVolatile, oop_store);
 476           __ sync_kit(kit);
 477 
 478           Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 479           __ if_then(card_val_reload, BoolTest::ne, dirty_card); {
 480             g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
 481           } __ end_if();
 482         } __ end_if();
 483       } __ end_if();
 484     } __ end_if();
 485   } else {
 486     // The Object.clone() intrinsic uses this path if !ReduceInitialCardMarks.
 487     // We don't need a barrier here if the destination is a newly allocated object
 488     // in Eden. Otherwise, GC verification breaks because we assume that cards in Eden
 489     // are set to 'g1_young_gen' (see G1CardTable::verify_g1_young_region()).
 490     assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
 491     Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
 492     __ if_then(card_val, BoolTest::ne, young_card); {
 493       g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
 494     } __ end_if();
 495   }


< prev index next >