src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 7032314 Sdiff src/share/vm/opto

src/share/vm/opto/library_call.cpp

Print this page




1103   const int value_offset  = java_lang_String::value_offset_in_bytes();
1104   const int count_offset  = java_lang_String::count_offset_in_bytes();
1105   const int offset_offset = java_lang_String::offset_offset_in_bytes();
1106 
1107   ciInstanceKlass* klass = env()->String_klass();
1108   const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
1109   const TypeAryPtr*  source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0);
1110 
1111   Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset);
1112   Node* sourceOffset  = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
1113   Node* sourceCounta  = basic_plus_adr(string_object, string_object, count_offset);
1114   Node* sourceCount   = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
1115   Node* sourcea       = basic_plus_adr(string_object, string_object, value_offset);
1116   Node* source        = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
1117 
1118   Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
1119   jint target_length = target_array->length();
1120   const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
1121   const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
1122 
1123   IdealKit kit(gvn(), control(), merged_memory(), false, true);
1124 #define __ kit.
1125   Node* zero             = __ ConI(0);
1126   Node* one              = __ ConI(1);
1127   Node* cache            = __ ConI(cache_i);
1128   Node* md2              = __ ConI(md2_i);
1129   Node* lastChar         = __ ConI(target_array->char_at(target_length - 1));
1130   Node* targetCount      = __ ConI(target_length);
1131   Node* targetCountLess1 = __ ConI(target_length - 1);
1132   Node* targetOffset     = __ ConI(targetOffset_i);
1133   Node* sourceEnd        = __ SubI(__ AddI(sourceOffset, sourceCount), targetCountLess1);
1134 
1135   IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done();
1136   Node* outer_loop = __ make_label(2 /* goto */);
1137   Node* return_    = __ make_label(1);
1138 
1139   __ set(rtn,__ ConI(-1));
1140   __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
1141        Node* i2  = __ AddI(__ value(i), targetCountLess1);
1142        // pin to prohibit loading of "next iteration" value which may SEGV (rare)
1143        Node* src = load_array_element(__ ctrl(), source, i2, TypeAryPtr::CHARS);


2301       break;
2302     case T_ADDRESS:
2303       // Repackage the long as a pointer.
2304       val = ConvL2X(val);
2305       val = _gvn.transform( new (C, 2) CastX2PNode(val) );
2306       break;
2307     }
2308 
2309     if (type != T_OBJECT ) {
2310       (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile);
2311     } else {
2312       // Possibly an oop being stored to Java heap or native memory
2313       if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
2314         // oop to Java heap.
2315         (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
2316       } else {
2317         // We can't tell at compile time if we are storing in the Java heap or outside
2318         // of it. So we need to emit code to conditionally do the proper type of
2319         // store.
2320 
2321         IdealKit ideal(gvn(), control(),  merged_memory());
2322 #define __ ideal.
2323         // QQQ who knows what probability is here??
2324         __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
2325           // Sync IdealKit and graphKit.
2326           set_all_memory( __ merged_memory());
2327           set_control(__ ctrl());
2328           Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
2329           // Update IdealKit memory.
2330           __ set_all_memory(merged_memory());
2331           __ set_ctrl(control());
2332         } __ else_(); {
2333           __ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile);
2334         } __ end_if();
2335         // Final sync IdealKit and GraphKit.
2336         sync_kit(ideal);
2337 #undef __
2338       }
2339     }
2340   }
2341 
2342   if (is_volatile) {
2343     if (!is_store)
2344       insert_mem_bar(Op_MemBarAcquire);
2345     else
2346       insert_mem_bar(Op_MemBarVolatile);
2347   }
2348 
2349   if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder);
2350 
2351   return true;




1103   const int value_offset  = java_lang_String::value_offset_in_bytes();
1104   const int count_offset  = java_lang_String::count_offset_in_bytes();
1105   const int offset_offset = java_lang_String::offset_offset_in_bytes();
1106 
1107   ciInstanceKlass* klass = env()->String_klass();
1108   const TypeOopPtr* string_type = TypeOopPtr::make_from_klass(klass);
1109   const TypeAryPtr*  source_type = TypeAryPtr::make(TypePtr::NotNull, TypeAry::make(TypeInt::CHAR,TypeInt::POS), ciTypeArrayKlass::make(T_CHAR), true, 0);
1110 
1111   Node* sourceOffseta = basic_plus_adr(string_object, string_object, offset_offset);
1112   Node* sourceOffset  = make_load(no_ctrl, sourceOffseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset));
1113   Node* sourceCounta  = basic_plus_adr(string_object, string_object, count_offset);
1114   Node* sourceCount   = make_load(no_ctrl, sourceCounta, TypeInt::INT, T_INT, string_type->add_offset(count_offset));
1115   Node* sourcea       = basic_plus_adr(string_object, string_object, value_offset);
1116   Node* source        = make_load(no_ctrl, sourcea, source_type, T_OBJECT, string_type->add_offset(value_offset));
1117 
1118   Node* target = _gvn.transform( makecon(TypeOopPtr::make_from_constant(target_array, true)) );
1119   jint target_length = target_array->length();
1120   const TypeAry* target_array_type = TypeAry::make(TypeInt::CHAR, TypeInt::make(0, target_length, Type::WidenMin));
1121   const TypeAryPtr* target_type = TypeAryPtr::make(TypePtr::BotPTR, target_array_type, target_array->klass(), true, Type::OffsetBot);
1122 
1123   IdealKit kit(this, false, true);
1124 #define __ kit.
1125   Node* zero             = __ ConI(0);
1126   Node* one              = __ ConI(1);
1127   Node* cache            = __ ConI(cache_i);
1128   Node* md2              = __ ConI(md2_i);
1129   Node* lastChar         = __ ConI(target_array->char_at(target_length - 1));
1130   Node* targetCount      = __ ConI(target_length);
1131   Node* targetCountLess1 = __ ConI(target_length - 1);
1132   Node* targetOffset     = __ ConI(targetOffset_i);
1133   Node* sourceEnd        = __ SubI(__ AddI(sourceOffset, sourceCount), targetCountLess1);
1134 
1135   IdealVariable rtn(kit), i(kit), j(kit); __ declarations_done();
1136   Node* outer_loop = __ make_label(2 /* goto */);
1137   Node* return_    = __ make_label(1);
1138 
1139   __ set(rtn,__ ConI(-1));
1140   __ loop(this, nargs, i, sourceOffset, BoolTest::lt, sourceEnd); {
1141        Node* i2  = __ AddI(__ value(i), targetCountLess1);
1142        // pin to prohibit loading of "next iteration" value which may SEGV (rare)
1143        Node* src = load_array_element(__ ctrl(), source, i2, TypeAryPtr::CHARS);


2301       break;
2302     case T_ADDRESS:
2303       // Repackage the long as a pointer.
2304       val = ConvL2X(val);
2305       val = _gvn.transform( new (C, 2) CastX2PNode(val) );
2306       break;
2307     }
2308 
2309     if (type != T_OBJECT ) {
2310       (void) store_to_memory(control(), adr, val, type, adr_type, is_volatile);
2311     } else {
2312       // Possibly an oop being stored to Java heap or native memory
2313       if (!TypePtr::NULL_PTR->higher_equal(_gvn.type(heap_base_oop))) {
2314         // oop to Java heap.
2315         (void) store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
2316       } else {
2317         // We can't tell at compile time if we are storing in the Java heap or outside
2318         // of it. So we need to emit code to conditionally do the proper type of
2319         // store.
2320 
2321         IdealKit ideal(this);
2322 #define __ ideal.
2323         // QQQ who knows what probability is here??
2324         __ if_then(heap_base_oop, BoolTest::ne, null(), PROB_UNLIKELY(0.999)); {
2325           // Sync IdealKit and graphKit.
2326           sync_kit(ideal, false);

2327           Node* st = store_oop_to_unknown(control(), heap_base_oop, adr, adr_type, val, type);
2328           // Update IdealKit memory.
2329           __ sync_kit(this);

2330         } __ else_(); {
2331           __ store(__ ctrl(), adr, val, type, alias_type->index(), is_volatile);
2332         } __ end_if();
2333         // Final sync IdealKit and GraphKit.
2334         sync_kit(ideal);
2335 #undef __
2336       }
2337     }
2338   }
2339 
2340   if (is_volatile) {
2341     if (!is_store)
2342       insert_mem_bar(Op_MemBarAcquire);
2343     else
2344       insert_mem_bar(Op_MemBarVolatile);
2345   }
2346 
2347   if (need_mem_bar) insert_mem_bar(Op_MemBarCPUOrder);
2348 
2349   return true;


src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File