src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File tiered-aastore Sdiff src/cpu/x86/vm

src/cpu/x86/vm/c1_LIRGenerator_x86.cpp

Print this page




 250   return false;
 251 }
 252 
 253 
 254 void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp) {
 255   BasicType type = item->type();
 256   __ store(item, new LIR_Address(FrameMap::rsp_opr, in_bytes(offset_from_sp), type));
 257 }
 258 
 259 //----------------------------------------------------------------------
 260 //             visitor functions
 261 //----------------------------------------------------------------------
 262 
 263 
 264 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
 265   assert(x->is_pinned(),"");
 266   bool needs_range_check = true;
 267   bool use_length = x->length() != NULL;
 268   bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT;
 269   bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
 270                                          !get_jobject_constant(x->value())->is_null_object());

 271 
 272   LIRItem array(x->array(), this);
 273   LIRItem index(x->index(), this);
 274   LIRItem value(x->value(), this);
 275   LIRItem length(this);
 276 
 277   array.load_item();
 278   index.load_nonconstant();
 279 
 280   if (use_length) {
 281     needs_range_check = x->compute_needs_range_check();
 282     if (needs_range_check) {
 283       length.set_instruction(x->length());
 284       length.load_item();
 285     }
 286   }
 287   if (needs_store_check) {
 288     value.load_item();
 289   } else {
 290     value.load_for_store(x->elt_type());


 304   // emit array address setup early so it schedules better
 305   LIR_Address* array_addr = emit_array_address(array.result(), index.result(), x->elt_type(), obj_store);
 306 
 307   if (GenerateRangeChecks && needs_range_check) {
 308     if (use_length) {
 309       __ cmp(lir_cond_belowEqual, length.result(), index.result());
 310       __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result()));
 311     } else {
 312       array_range_check(array.result(), index.result(), null_check_info, range_check_info);
 313       // range_check also does the null check
 314       null_check_info = NULL;
 315     }
 316   }
 317 
 318   if (GenerateArrayStoreCheck && needs_store_check) {
 319     LIR_Opr tmp1 = new_register(objectType);
 320     LIR_Opr tmp2 = new_register(objectType);
 321     LIR_Opr tmp3 = new_register(objectType);
 322 
 323     CodeEmitInfo* store_check_info = new CodeEmitInfo(range_check_info);
 324     __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info);
 325   }
 326 
 327   if (obj_store) {
 328     // Needs GC write barriers.
 329     pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
 330                 true /* do_load */, false /* patch */, NULL);
 331     __ move(value.result(), array_addr, null_check_info);
 332     // Seems to be a precise
 333     post_barrier(LIR_OprFact::address(array_addr), value.result());
 334   } else {
 335     __ move(value.result(), array_addr, null_check_info);
 336   }
 337 }
 338 
 339 
 340 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
 341   assert(x->is_pinned(),"");
 342   LIRItem obj(x->obj(), this);
 343   obj.load_item();
 344 




 250   return false;
 251 }
 252 
 253 
 254 void LIRGenerator::store_stack_parameter (LIR_Opr item, ByteSize offset_from_sp) {
 255   BasicType type = item->type();
 256   __ store(item, new LIR_Address(FrameMap::rsp_opr, in_bytes(offset_from_sp), type));
 257 }
 258 
 259 //----------------------------------------------------------------------
 260 //             visitor functions
 261 //----------------------------------------------------------------------
 262 
 263 
 264 void LIRGenerator::do_StoreIndexed(StoreIndexed* x) {
 265   assert(x->is_pinned(),"");
 266   bool needs_range_check = true;
 267   bool use_length = x->length() != NULL;
 268   bool obj_store = x->elt_type() == T_ARRAY || x->elt_type() == T_OBJECT;
 269   bool needs_store_check = obj_store && (x->value()->as_Constant() == NULL ||
 270                                          !get_jobject_constant(x->value())->is_null_object() ||
 271                                          x->should_profile());
 272 
 273   LIRItem array(x->array(), this);
 274   LIRItem index(x->index(), this);
 275   LIRItem value(x->value(), this);
 276   LIRItem length(this);
 277 
 278   array.load_item();
 279   index.load_nonconstant();
 280 
 281   if (use_length) {
 282     needs_range_check = x->compute_needs_range_check();
 283     if (needs_range_check) {
 284       length.set_instruction(x->length());
 285       length.load_item();
 286     }
 287   }
 288   if (needs_store_check) {
 289     value.load_item();
 290   } else {
 291     value.load_for_store(x->elt_type());


 305   // emit array address setup early so it schedules better
 306   LIR_Address* array_addr = emit_array_address(array.result(), index.result(), x->elt_type(), obj_store);
 307 
 308   if (GenerateRangeChecks && needs_range_check) {
 309     if (use_length) {
 310       __ cmp(lir_cond_belowEqual, length.result(), index.result());
 311       __ branch(lir_cond_belowEqual, T_INT, new RangeCheckStub(range_check_info, index.result()));
 312     } else {
 313       array_range_check(array.result(), index.result(), null_check_info, range_check_info);
 314       // range_check also does the null check
 315       null_check_info = NULL;
 316     }
 317   }
 318 
 319   if (GenerateArrayStoreCheck && needs_store_check) {
 320     LIR_Opr tmp1 = new_register(objectType);
 321     LIR_Opr tmp2 = new_register(objectType);
 322     LIR_Opr tmp3 = new_register(objectType);
 323 
 324     CodeEmitInfo* store_check_info = new CodeEmitInfo(range_check_info);
 325     __ store_check(value.result(), array.result(), tmp1, tmp2, tmp3, store_check_info, x->profiled_method(), x->profiled_bci());
 326   }
 327 
 328   if (obj_store) {
 329     // Needs GC write barriers.
 330     pre_barrier(LIR_OprFact::address(array_addr), LIR_OprFact::illegalOpr /* pre_val */,
 331                 true /* do_load */, false /* patch */, NULL);
 332     __ move(value.result(), array_addr, null_check_info);
 333     // Seems to be a precise
 334     post_barrier(LIR_OprFact::address(array_addr), value.result());
 335   } else {
 336     __ move(value.result(), array_addr, null_check_info);
 337   }
 338 }
 339 
 340 
 341 void LIRGenerator::do_MonitorEnter(MonitorEnter* x) {
 342   assert(x->is_pinned(),"");
 343   LIRItem obj(x->obj(), this);
 344   obj.load_item();
 345 


src/cpu/x86/vm/c1_LIRGenerator_x86.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File