src/share/vm/opto/graphKit.cpp

Print this page
rev 5363 : imported patch filtering.diff
rev 5364 : [mq]: graphkit-comment


3696     const Type* t = val->bottom_type();
3697     assert(t == Type::TOP || t == TypePtr::NULL_PTR, "must be NULL");
3698     // No post barrier if writing NULLx
3699     return;
3700   }
3701 
3702   if (!use_precise) {
3703     // All card marks for a (non-array) instance are in one place:
3704     adr = obj;
3705   }
3706   // (Else it's an array (or unknown), and we want more precise card marks.)
3707   assert(adr != NULL, "");
3708 
3709   IdealKit ideal(this, true);
3710 
3711   Node* tls = __ thread(); // ThreadLocalStorage
3712 
3713   Node* no_base = __ top();
3714   float likely  = PROB_LIKELY(0.999);
3715   float unlikely  = PROB_UNLIKELY(0.999);
3716   Node* zero = __ ConI(0);

3717   Node* zeroX = __ ConX(0);
3718 
3719   // Get the alias_index for raw card-mark memory
3720   const TypePtr* card_type = TypeRawPtr::BOTTOM;
3721 
3722   const TypeFunc *tf = OptoRuntime::g1_wb_post_Type();
3723 
3724   // Offsets into the thread
3725   const int index_offset  = in_bytes(JavaThread::dirty_card_queue_offset() +
3726                                      PtrQueue::byte_offset_of_index());
3727   const int buffer_offset = in_bytes(JavaThread::dirty_card_queue_offset() +
3728                                      PtrQueue::byte_offset_of_buf());
3729 
3730   // Pointers into the thread
3731 
3732   Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
3733   Node* index_adr =  __ AddP(no_base, tls, __ ConX(index_offset));
3734 
3735   // Now some values
3736   // Use ctrl to avoid hoisting these values past a safepoint, which could


3752 
3753   if (val != NULL) {
3754     // Does the store cause us to cross regions?
3755 
3756     // Should be able to do an unsigned compare of region_size instead of
3757     // and extra shift. Do we have an unsigned compare??
3758     // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes);
3759     Node* xor_res =  __ URShiftX ( __ XorX( cast,  __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes));
3760 
3761     // if (xor_res == 0) same region so skip
3762     __ if_then(xor_res, BoolTest::ne, zeroX); {
3763 
3764       // No barrier if we are storing a NULL
3765       __ if_then(val, BoolTest::ne, null(), unlikely); {
3766 
3767         // Ok must mark the card if not already dirty
3768 
3769         // load the original value of the card
3770         Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
3771 
3772         __ if_then(card_val, BoolTest::ne, zero); {







3773           g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);

3774         } __ end_if();
3775       } __ end_if();
3776     } __ end_if();
3777   } else {
3778     // Object.clone() instrinsic uses this path.
3779     g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
3780   }
3781 
3782   // Final sync IdealKit and GraphKit.
3783   final_sync(ideal);
3784 }
3785 #undef __
3786 
3787 
3788 
3789 Node* GraphKit::load_String_offset(Node* ctrl, Node* str) {
3790   if (java_lang_String::has_offset_field()) {
3791     int offset_offset = java_lang_String::offset_offset_in_bytes();
3792     const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3793                                                        false, NULL, 0);




3696     const Type* t = val->bottom_type();
3697     assert(t == Type::TOP || t == TypePtr::NULL_PTR, "must be NULL");
3698     // No post barrier if writing NULLx
3699     return;
3700   }
3701 
3702   if (!use_precise) {
3703     // All card marks for a (non-array) instance are in one place:
3704     adr = obj;
3705   }
3706   // (Else it's an array (or unknown), and we want more precise card marks.)
3707   assert(adr != NULL, "");
3708 
3709   IdealKit ideal(this, true);
3710 
3711   Node* tls = __ thread(); // ThreadLocalStorage
3712 
3713   Node* no_base = __ top();
3714   float likely  = PROB_LIKELY(0.999);
3715   float unlikely  = PROB_UNLIKELY(0.999);
3716   Node* young_card = __ ConI((jint)G1SATBCardTableModRefBS::g1_young_card_val());
3717   Node* dirty_card = __ ConI((jint)CardTableModRefBS::dirty_card_val());
3718   Node* zeroX = __ ConX(0);
3719 
3720   // Get the alias_index for raw card-mark memory
3721   const TypePtr* card_type = TypeRawPtr::BOTTOM;
3722 
3723   const TypeFunc *tf = OptoRuntime::g1_wb_post_Type();
3724 
3725   // Offsets into the thread
3726   const int index_offset  = in_bytes(JavaThread::dirty_card_queue_offset() +
3727                                      PtrQueue::byte_offset_of_index());
3728   const int buffer_offset = in_bytes(JavaThread::dirty_card_queue_offset() +
3729                                      PtrQueue::byte_offset_of_buf());
3730 
3731   // Pointers into the thread
3732 
3733   Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
3734   Node* index_adr =  __ AddP(no_base, tls, __ ConX(index_offset));
3735 
3736   // Now some values
3737   // Use ctrl to avoid hoisting these values past a safepoint, which could


3753 
3754   if (val != NULL) {
3755     // Does the store cause us to cross regions?
3756 
3757     // Should be able to do an unsigned compare of region_size instead of
3758     // and extra shift. Do we have an unsigned compare??
3759     // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes);
3760     Node* xor_res =  __ URShiftX ( __ XorX( cast,  __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes));
3761 
3762     // if (xor_res == 0) same region so skip
3763     __ if_then(xor_res, BoolTest::ne, zeroX); {
3764 
3765       // No barrier if we are storing a NULL
3766       __ if_then(val, BoolTest::ne, null(), unlikely); {
3767 
3768         // Ok must mark the card if not already dirty
3769 
3770         // load the original value of the card
3771         Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
3772 
3773         __ if_then(card_val, BoolTest::ne, young_card); {
3774           sync_kit(ideal);
3775           // Use Op_MemBarVolatile to achieve the effect of a StoreLoad barrier.
3776           insert_mem_bar(Op_MemBarVolatile, oop_store);
3777           __ sync_kit(this);
3778 
3779           Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
3780           __ if_then(card_val_reload, BoolTest::ne, dirty_card); {
3781             g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
3782           } __ end_if();
3783         } __ end_if();
3784       } __ end_if();
3785     } __ end_if();
3786   } else {
3787     // Object.clone() instrinsic uses this path.
3788     g1_mark_card(ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
3789   }
3790 
3791   // Final sync IdealKit and GraphKit.
3792   final_sync(ideal);
3793 }
3794 #undef __
3795 
3796 
3797 
3798 Node* GraphKit::load_String_offset(Node* ctrl, Node* str) {
3799   if (java_lang_String::has_offset_field()) {
3800     int offset_offset = java_lang_String::offset_offset_in_bytes();
3801     const TypeInstPtr* string_type = TypeInstPtr::make(TypePtr::NotNull, C->env()->String_klass(),
3802                                                        false, NULL, 0);