< prev index next >

src/hotspot/share/c1/c1_LIRGenerator.cpp

Print this page




1529     // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
1530     __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
1531   }
1532 
1533   DecoratorSet decorators = IN_HEAP;
1534   if (is_volatile) {
1535     decorators |= MO_SEQ_CST;
1536   }
1537   if (needs_patching) {
1538     decorators |= C1_NEEDS_PATCHING;
1539   }
1540 
1541   access_store_at(decorators, field_type, object, LIR_OprFact::intConst(x->offset()),
1542                   value.result(), info != NULL ? new CodeEmitInfo(info) : NULL, info);
1543 }
1544 
1545 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
1546   assert(x->is_pinned(),"");
1547   bool needs_range_check = x->compute_needs_range_check();
1548   bool use_length = x->length() != NULL;
1549   bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT;
1550   bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
1551                                          !get_jobject_constant(x->value())->is_null_object() ||
1552                                          x->should_profile());
1553 
1554   LIRItem array(x->array(), this);
1555   LIRItem index(x->index(), this);
1556   LIRItem value(x->value(), this);
1557   LIRItem length(this);
1558 
1559   array.load_item();
1560   index.load_nonconstant();
1561 
1562   if (use_length && needs_range_check) {
1563     length.set_instruction(x->length());
1564     length.load_item();
1565 
1566   }
1567   if (needs_store_check || x->check_boolean()) {
1568     value.load_item();
1569   } else {


2146   __ move(value.result(), addr);
2147 }
2148 
2149 
2150 void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) {
2151   BasicType type = x->basic_type();
2152   LIRItem src(x->object(), this);
2153   LIRItem off(x->offset(), this);
2154 
2155   off.load_item();
2156   src.load_item();
2157 
2158   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS;
2159 
2160   if (x->is_volatile()) {
2161     decorators |= MO_SEQ_CST;
2162   }
2163   if (type == T_BOOLEAN) {
2164     decorators |= C1_MASK_BOOLEAN;
2165   }
2166   if (type == T_ARRAY || type == T_OBJECT) {
2167     decorators |= ON_UNKNOWN_OOP_REF;
2168   }
2169 
2170   LIR_Opr result = rlock_result(x, type);
2171   access_load_at(decorators, type,
2172                  src, off.result(), result);
2173 }
2174 
2175 
2176 void LIRGenerator::do_UnsafePutObject(UnsafePutObject* x) {
2177   BasicType type = x->basic_type();
2178   LIRItem src(x->object(), this);
2179   LIRItem off(x->offset(), this);
2180   LIRItem data(x->value(), this);
2181 
2182   src.load_item();
2183   if (type == T_BOOLEAN || type == T_BYTE) {
2184     data.load_byte_item();
2185   } else {
2186     data.load_item();
2187   }
2188   off.load_item();
2189 
2190   set_no_result(x);
2191 
2192   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS;
2193   if (type == T_ARRAY || type == T_OBJECT) {
2194     decorators |= ON_UNKNOWN_OOP_REF;
2195   }
2196   if (x->is_volatile()) {
2197     decorators |= MO_SEQ_CST;
2198   }
2199   access_store_at(decorators, type, src, off.result(), data.result());
2200 }
2201 
2202 void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {
2203   BasicType type = x->basic_type();
2204   LIRItem src(x->object(), this);
2205   LIRItem off(x->offset(), this);
2206   LIRItem value(x->value(), this);
2207 
2208   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS | MO_SEQ_CST;
2209 
2210   if (type == T_ARRAY || type == T_OBJECT) {
2211     decorators |= ON_UNKNOWN_OOP_REF;
2212   }
2213 
2214   LIR_Opr result;
2215   if (x->is_add()) {
2216     result = access_atomic_add_at(decorators, type, src, off, value);
2217   } else {
2218     result = access_atomic_xchg_at(decorators, type, src, off, value);
2219   }
2220   set_result(x, result);
2221 }
2222 
2223 void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux) {
2224   int lng = x->length();
2225 
2226   for (int i = 0; i < lng; i++) {
2227     SwitchRange* one_range = x->at(i);
2228     int low_key = one_range->low_key();
2229     int high_key = one_range->high_key();
2230     BlockBegin* dest = one_range->sux();


2583   __ profile_type(new LIR_Address(mdp, md_offset, T_METADATA),
2584                   value.result(), exact_klass, profiled_k, new_pointer_register(), not_null, exact_signature_k != NULL);
2585   return result;
2586 }
2587 
2588 // profile parameters on entry to the root of the compilation
2589 void LIRGenerator::profile_parameters(Base* x) {
2590   if (compilation()->profile_parameters()) {
2591     CallingConvention* args = compilation()->frame_map()->incoming_arguments();
2592     ciMethodData* md = scope()->method()->method_data_or_null();
2593     assert(md != NULL, "Sanity");
2594 
2595     if (md->parameters_type_data() != NULL) {
2596       ciParametersTypeData* parameters_type_data = md->parameters_type_data();
2597       ciTypeStackSlotEntries* parameters =  parameters_type_data->parameters();
2598       LIR_Opr mdp = LIR_OprFact::illegalOpr;
2599       for (int java_index = 0, i = 0, j = 0; j < parameters_type_data->number_of_parameters(); i++) {
2600         LIR_Opr src = args->at(i);
2601         assert(!src->is_illegal(), "check");
2602         BasicType t = src->type();
2603         if (t == T_OBJECT || t == T_ARRAY) {
2604           intptr_t profiled_k = parameters->type(j);
2605           Local* local = x->state()->local_at(java_index)->as_Local();
2606           ciKlass* exact = profile_type(md, md->byte_offset_of_slot(parameters_type_data, ParametersTypeData::type_offset(0)),
2607                                         in_bytes(ParametersTypeData::type_offset(j)) - in_bytes(ParametersTypeData::type_offset(0)),
2608                                         profiled_k, local, mdp, false, local->declared_type()->as_klass(), NULL);
2609           // If the profile is known statically set it once for all and do not emit any code
2610           if (exact != NULL) {
2611             md->set_parameter_type(j, exact);
2612           }
2613           j++;
2614         }
2615         java_index += type2size[t];
2616       }
2617     }
2618   }
2619 }
2620 
2621 void LIRGenerator::do_Base(Base* x) {
2622   __ std_entry(LIR_OprFact::illegalOpr);
2623   // Emit moves from physical registers / stack slots to virtual registers




1529     // NoClassDefFoundError in the interpreter instead of an implicit NPE from compiled code.
1530     __ null_check(object.result(), new CodeEmitInfo(info), /* deoptimize */ needs_patching);
1531   }
1532 
1533   DecoratorSet decorators = IN_HEAP;
1534   if (is_volatile) {
1535     decorators |= MO_SEQ_CST;
1536   }
1537   if (needs_patching) {
1538     decorators |= C1_NEEDS_PATCHING;
1539   }
1540 
1541   access_store_at(decorators, field_type, object, LIR_OprFact::intConst(x->offset()),
1542                   value.result(), info != NULL ? new CodeEmitInfo(info) : NULL, info);
1543 }
1544 
1545 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
1546   assert(x->is_pinned(),"");
1547   bool needs_range_check = x->compute_needs_range_check();
1548   bool use_length = x->length() != NULL;
1549   bool obj_store = is_reference_type(x->elt_type());
1550   bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
1551                                          !get_jobject_constant(x->value())->is_null_object() ||
1552                                          x->should_profile());
1553 
1554   LIRItem array(x->array(), this);
1555   LIRItem index(x->index(), this);
1556   LIRItem value(x->value(), this);
1557   LIRItem length(this);
1558 
1559   array.load_item();
1560   index.load_nonconstant();
1561 
1562   if (use_length && needs_range_check) {
1563     length.set_instruction(x->length());
1564     length.load_item();
1565 
1566   }
1567   if (needs_store_check || x->check_boolean()) {
1568     value.load_item();
1569   } else {


2146   __ move(value.result(), addr);
2147 }
2148 
2149 
2150 void LIRGenerator::do_UnsafeGetObject(UnsafeGetObject* x) {
2151   BasicType type = x->basic_type();
2152   LIRItem src(x->object(), this);
2153   LIRItem off(x->offset(), this);
2154 
2155   off.load_item();
2156   src.load_item();
2157 
2158   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS;
2159 
2160   if (x->is_volatile()) {
2161     decorators |= MO_SEQ_CST;
2162   }
2163   if (type == T_BOOLEAN) {
2164     decorators |= C1_MASK_BOOLEAN;
2165   }
2166   if (is_reference_type(type)) {
2167     decorators |= ON_UNKNOWN_OOP_REF;
2168   }
2169 
2170   LIR_Opr result = rlock_result(x, type);
2171   access_load_at(decorators, type,
2172                  src, off.result(), result);
2173 }
2174 
2175 
2176 void LIRGenerator::do_UnsafePutObject(UnsafePutObject* x) {
2177   BasicType type = x->basic_type();
2178   LIRItem src(x->object(), this);
2179   LIRItem off(x->offset(), this);
2180   LIRItem data(x->value(), this);
2181 
2182   src.load_item();
2183   if (type == T_BOOLEAN || type == T_BYTE) {
2184     data.load_byte_item();
2185   } else {
2186     data.load_item();
2187   }
2188   off.load_item();
2189 
2190   set_no_result(x);
2191 
2192   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS;
2193   if (is_reference_type(type)) {
2194     decorators |= ON_UNKNOWN_OOP_REF;
2195   }
2196   if (x->is_volatile()) {
2197     decorators |= MO_SEQ_CST;
2198   }
2199   access_store_at(decorators, type, src, off.result(), data.result());
2200 }
2201 
2202 void LIRGenerator::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {
2203   BasicType type = x->basic_type();
2204   LIRItem src(x->object(), this);
2205   LIRItem off(x->offset(), this);
2206   LIRItem value(x->value(), this);
2207 
2208   DecoratorSet decorators = IN_HEAP | C1_UNSAFE_ACCESS | MO_SEQ_CST;
2209 
2210   if (is_reference_type(type)) {
2211     decorators |= ON_UNKNOWN_OOP_REF;
2212   }
2213 
2214   LIR_Opr result;
2215   if (x->is_add()) {
2216     result = access_atomic_add_at(decorators, type, src, off, value);
2217   } else {
2218     result = access_atomic_xchg_at(decorators, type, src, off, value);
2219   }
2220   set_result(x, result);
2221 }
2222 
2223 void LIRGenerator::do_SwitchRanges(SwitchRangeArray* x, LIR_Opr value, BlockBegin* default_sux) {
2224   int lng = x->length();
2225 
2226   for (int i = 0; i < lng; i++) {
2227     SwitchRange* one_range = x->at(i);
2228     int low_key = one_range->low_key();
2229     int high_key = one_range->high_key();
2230     BlockBegin* dest = one_range->sux();


2583   __ profile_type(new LIR_Address(mdp, md_offset, T_METADATA),
2584                   value.result(), exact_klass, profiled_k, new_pointer_register(), not_null, exact_signature_k != NULL);
2585   return result;
2586 }
2587 
2588 // profile parameters on entry to the root of the compilation
2589 void LIRGenerator::profile_parameters(Base* x) {
2590   if (compilation()->profile_parameters()) {
2591     CallingConvention* args = compilation()->frame_map()->incoming_arguments();
2592     ciMethodData* md = scope()->method()->method_data_or_null();
2593     assert(md != NULL, "Sanity");
2594 
2595     if (md->parameters_type_data() != NULL) {
2596       ciParametersTypeData* parameters_type_data = md->parameters_type_data();
2597       ciTypeStackSlotEntries* parameters =  parameters_type_data->parameters();
2598       LIR_Opr mdp = LIR_OprFact::illegalOpr;
2599       for (int java_index = 0, i = 0, j = 0; j < parameters_type_data->number_of_parameters(); i++) {
2600         LIR_Opr src = args->at(i);
2601         assert(!src->is_illegal(), "check");
2602         BasicType t = src->type();
2603         if (is_reference_type(t)) {
2604           intptr_t profiled_k = parameters->type(j);
2605           Local* local = x->state()->local_at(java_index)->as_Local();
2606           ciKlass* exact = profile_type(md, md->byte_offset_of_slot(parameters_type_data, ParametersTypeData::type_offset(0)),
2607                                         in_bytes(ParametersTypeData::type_offset(j)) - in_bytes(ParametersTypeData::type_offset(0)),
2608                                         profiled_k, local, mdp, false, local->declared_type()->as_klass(), NULL);
2609           // If the profile is known statically set it once for all and do not emit any code
2610           if (exact != NULL) {
2611             md->set_parameter_type(j, exact);
2612           }
2613           j++;
2614         }
2615         java_index += type2size[t];
2616       }
2617     }
2618   }
2619 }
2620 
2621 void LIRGenerator::do_Base(Base* x) {
2622   __ std_entry(LIR_OprFact::illegalOpr);
2623   // Emit moves from physical registers / stack slots to virtual registers


< prev index next >