src/share/vm/c1/c1_LIRGenerator.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File c1-coops Sdiff src/share/vm/c1

src/share/vm/c1/c1_LIRGenerator.cpp

Print this page




 833     int taken_count_offset     = md->byte_offset_of_slot(data, BranchData::taken_offset());
 834     int not_taken_count_offset = md->byte_offset_of_slot(data, BranchData::not_taken_offset());
 835     if (if_instr->is_swapped()) {
 836       int t = taken_count_offset;
 837       taken_count_offset = not_taken_count_offset;
 838       not_taken_count_offset = t;
 839     }
 840 
 841     LIR_Opr md_reg = new_register(T_OBJECT);
 842     __ oop2reg(md->constant_encoding(), md_reg);
 843 
 844     LIR_Opr data_offset_reg = new_pointer_register();
 845     __ cmove(lir_cond(cond),
 846              LIR_OprFact::intptrConst(taken_count_offset),
 847              LIR_OprFact::intptrConst(not_taken_count_offset),
 848              data_offset_reg);
 849 
 850     // MDO cells are intptr_t, so the data_reg width is arch-dependent.
 851     LIR_Opr data_reg = new_pointer_register();
 852     LIR_Address* data_addr = new LIR_Address(md_reg, data_offset_reg, data_reg->type());
 853     __ move(LIR_OprFact::address(data_addr), data_reg);
 854     // Use leal instead of add to avoid destroying condition codes on x86
 855     LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT);
 856     __ leal(LIR_OprFact::address(fake_incr_value), data_reg);
 857     __ move(data_reg, LIR_OprFact::address(data_addr));
 858   }
 859 }
 860 
 861 // Phi technique:
 862 // This is about passing live values from one basic block to the other.
 863 // In code generated with Java it is rather rare that more than one
 864 // value is on the stack from one basic block to the other.
 865 // We optimize our technique for efficient passing of one value
 866 // (of type long, int, double..) but it can be extended.
 867 // When entering or leaving a basic block, all registers and all spill
 868 // slots are release and empty. We use the released registers
 869 // and spill slots to pass the live values from one block
 870 // to the other. The topmost value, i.e., the value on TOS of expression
 871 // stack is passed in registers. All other values are stored in spilling
 872 // area. Every Phi has an index which designates its spill slot
 873 // At exit of a basic block, we fill the register(s) and spill slots.
 874 // At entry of a basic block, the block_prolog sets up the content of phi nodes
 875 // and locks necessary registers and spilling slots.
 876 
 877 


 978 //---------------------------------------------------------------------
 979 ciObject* LIRGenerator::get_jobject_constant(Value value) {
 980   ObjectType* oc = value->type()->as_ObjectType();
 981   if (oc) {
 982     return oc->constant_value();
 983   }
 984   return NULL;
 985 }
 986 
 987 
 988 void LIRGenerator::do_ExceptionObject(ExceptionObject* x) {
 989   assert(block()->is_set(BlockBegin::exception_entry_flag), "ExceptionObject only allowed in exception handler block");
 990   assert(block()->next() == x, "ExceptionObject must be first instruction of block");
 991 
 992   // no moves are created for phi functions at the begin of exception
 993   // handlers, so assign operands manually here
 994   for_each_phi_fun(block(), phi,
 995                    operand_for_instruction(phi));
 996 
 997   LIR_Opr thread_reg = getThreadPointer();
 998   __ move(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT),
 999           exceptionOopOpr());
1000   __ move(LIR_OprFact::oopConst(NULL),
1001           new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT));
1002   __ move(LIR_OprFact::oopConst(NULL),
1003           new LIR_Address(thread_reg, in_bytes(JavaThread::exception_pc_offset()), T_OBJECT));
1004 
1005   LIR_Opr result = new_register(T_OBJECT);
1006   __ move(exceptionOopOpr(), result);
1007   set_result(x, result);
1008 }
1009 
1010 
1011 //----------------------------------------------------------------------
1012 //----------------------------------------------------------------------
1013 //----------------------------------------------------------------------
1014 //----------------------------------------------------------------------
1015 //                        visitor functions
1016 //----------------------------------------------------------------------
1017 //----------------------------------------------------------------------
1018 //----------------------------------------------------------------------
1019 //----------------------------------------------------------------------
1020 
1021 void LIRGenerator::do_Phi(Phi* x) {
1022   // phi functions are never visited directly


1054     set_result(x, LIR_OprFact::value_type(x->type()));
1055   }
1056 }
1057 
1058 
1059 void LIRGenerator::do_Local(Local* x) {
1060   // operand_for_instruction has the side effect of setting the result
1061   // so there's no need to do it here.
1062   operand_for_instruction(x);
1063 }
1064 
1065 
1066 void LIRGenerator::do_IfInstanceOf(IfInstanceOf* x) {
1067   Unimplemented();
1068 }
1069 
1070 
1071 void LIRGenerator::do_Return(Return* x) {
1072   if (compilation()->env()->dtrace_method_probes()) {
1073     BasicTypeList signature;
1074     signature.append(T_INT);    // thread
1075     signature.append(T_OBJECT); // methodOop
1076     LIR_OprList* args = new LIR_OprList();
1077     args->append(getThreadPointer());
1078     LIR_Opr meth = new_register(T_OBJECT);
1079     __ oop2reg(method()->constant_encoding(), meth);
1080     args->append(meth);
1081     call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), voidType, NULL);
1082   }
1083 
1084   if (x->type()->is_void()) {
1085     __ return_op(LIR_OprFact::illegalOpr);
1086   } else {
1087     LIR_Opr reg = result_register_for(x->type(), /*callee=*/true);
1088     LIRItem result(x->result(), this);
1089 
1090     result.load_item_force(reg);
1091     __ return_op(result.result());
1092   }
1093   set_no_result(x);
1094 }
1095 
1096 
1097 // Example: object.getClass ()
1098 void LIRGenerator::do_getClass(Intrinsic* x) {
1099   assert(x->number_of_arguments() == 1, "wrong type");
1100 
1101   LIRItem rcvr(x->argument_at(0), this);
1102   rcvr.load_item();
1103   LIR_Opr result = rlock_result(x);
1104 
1105   // need to perform the null check on the rcvr
1106   CodeEmitInfo* info = NULL;
1107   if (x->needs_null_check()) {
1108     info = state_for(x);
1109   }
1110   __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), result, info);
1111   __ move(new LIR_Address(result, Klass::java_mirror_offset_in_bytes() +
1112                           klassOopDesc::klass_part_offset_in_bytes(), T_OBJECT), result);
1113 }
1114 
1115 
1116 // Example: Thread.currentThread()
1117 void LIRGenerator::do_currentThread(Intrinsic* x) {
1118   assert(x->number_of_arguments() == 0, "wrong type");
1119   LIR_Opr reg = rlock_result(x);
1120   __ load(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_OBJECT), reg);
1121 }
1122 
1123 
1124 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) {
1125   assert(x->number_of_arguments() == 1, "wrong type");
1126   LIRItem receiver(x->argument_at(0), this);
1127 
1128   receiver.load_item();
1129   BasicTypeList signature;
1130   signature.append(T_OBJECT); // receiver
1131   LIR_OprList* args = new LIR_OprList();
1132   args->append(receiver.result());
1133   CodeEmitInfo* info = state_for(x, x->state());
1134   call_runtime(&signature, args,
1135                CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::register_finalizer_id)),
1136                voidType, info);
1137 
1138   set_no_result(x);
1139 }
1140 


1877     if (index_op->is_illegal() || log2_scale == 0) {
1878 #ifdef _LP64
1879       if (!index_op->is_illegal() && index_op->type() == T_INT) {
1880         LIR_Opr tmp = new_pointer_register();
1881         __ convert(Bytecodes::_i2l, index_op, tmp);
1882         index_op = tmp;
1883       }
1884 #endif
1885       addr = new LIR_Address(base_op, index_op, dst_type);
1886     } else {
1887       LIR_Opr tmp = new_pointer_register();
1888       __ shift_left(index_op, log2_scale, tmp);
1889       addr = new LIR_Address(base_op, tmp, dst_type);
1890     }
1891 #endif
1892   }
1893 
1894   if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) {
1895     __ unaligned_move(addr, reg);
1896   } else {



1897     __ move(addr, reg);
1898   }

1899 }
1900 
1901 
1902 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) {
1903   int  log2_scale = 0;
1904   BasicType type = x->basic_type();
1905 
1906   if (x->has_index()) {
1907     assert(x->index()->type()->tag() == intTag, "should not find non-int index");
1908     log2_scale = x->log2_scale();
1909   }
1910 
1911   LIRItem base(x->base(), this);
1912   LIRItem value(x->value(), this);
1913   LIRItem idx(this);
1914 
1915   base.load_item();
1916   if (x->has_index()) {
1917     idx.set_instruction(x->index());
1918     idx.load_item();


2256       break;
2257     }
2258 
2259     LIR_Opr dest = new_register(t);
2260     __ move(src, dest);
2261 
2262     // Assign new location to Local instruction for this local
2263     Local* local = x->state()->local_at(java_index)->as_Local();
2264     assert(local != NULL, "Locals for incoming arguments must have been created");
2265 #ifndef __SOFTFP__
2266     // The java calling convention passes double as long and float as int.
2267     assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
2268 #endif // __SOFTFP__
2269     local->set_operand(dest);
2270     _instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
2271     java_index += type2size[t];
2272   }
2273 
2274   if (compilation()->env()->dtrace_method_probes()) {
2275     BasicTypeList signature;
2276     signature.append(T_INT);    // thread
2277     signature.append(T_OBJECT); // methodOop
2278     LIR_OprList* args = new LIR_OprList();
2279     args->append(getThreadPointer());
2280     LIR_Opr meth = new_register(T_OBJECT);
2281     __ oop2reg(method()->constant_encoding(), meth);
2282     args->append(meth);
2283     call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), voidType, NULL);
2284   }
2285 
2286   if (method()->is_synchronized()) {
2287     LIR_Opr obj;
2288     if (method()->is_static()) {
2289       obj = new_register(T_OBJECT);
2290       __ oop2reg(method()->holder()->java_mirror()->constant_encoding(), obj);
2291     } else {
2292       Local* receiver = x->state()->local_at(0)->as_Local();
2293       assert(receiver != NULL, "must already exist");
2294       obj = receiver->operand();
2295     }
2296     assert(obj->is_valid(), "must be valid");


2321 
2322 void LIRGenerator::do_OsrEntry(OsrEntry* x) {
2323   // construct our frame and model the production of incoming pointer
2324   // to the OSR buffer.
2325   __ osr_entry(LIR_Assembler::osrBufferPointer());
2326   LIR_Opr result = rlock_result(x);
2327   __ move(LIR_Assembler::osrBufferPointer(), result);
2328 }
2329 
2330 
2331 void LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) {
2332   int i = (x->has_receiver() || x->is_invokedynamic()) ? 1 : 0;
2333   for (; i < args->length(); i++) {
2334     LIRItem* param = args->at(i);
2335     LIR_Opr loc = arg_list->at(i);
2336     if (loc->is_register()) {
2337       param->load_item_force(loc);
2338     } else {
2339       LIR_Address* addr = loc->as_address_ptr();
2340       param->load_for_store(addr->type());



2341       if (addr->type() == T_LONG || addr->type() == T_DOUBLE) {
2342         __ unaligned_move(param->result(), addr);
2343       } else {
2344         __ move(param->result(), addr);
2345       }
2346     }
2347   }
2348 
2349   if (x->has_receiver()) {
2350     LIRItem* receiver = args->at(0);
2351     LIR_Opr loc = arg_list->at(0);
2352     if (loc->is_register()) {
2353       receiver->load_item_force(loc);
2354     } else {
2355       assert(loc->is_address(), "just checking");
2356       receiver->load_for_store(T_OBJECT);
2357       __ move(receiver->result(), loc);
2358     }
2359   }
2360 }
2361 
2362 
2363 // Visits all arguments, returns appropriate items without loading them
2364 LIRItemList* LIRGenerator::invoke_visit_arguments(Invoke* x) {
2365   LIRItemList* argument_items = new LIRItemList();
2366   if (x->has_receiver()) {
2367     LIRItem* receiver = new LIRItem(x->receiver(), this);
2368     argument_items->append(receiver);
2369   }
2370   if (x->is_invokedynamic()) {
2371     // Insert a dummy for the synthetic MethodHandle argument.
2372     argument_items->append(NULL);
2373   }
2374   int idx = x->has_receiver() ? 1 : 0;
2375   for (int i = 0; i < x->number_of_arguments(); i++) {
2376     LIRItem* param = new LIRItem(x->argument_at(i), this);
2377     argument_items->append(param);




 833     int taken_count_offset     = md->byte_offset_of_slot(data, BranchData::taken_offset());
 834     int not_taken_count_offset = md->byte_offset_of_slot(data, BranchData::not_taken_offset());
 835     if (if_instr->is_swapped()) {
 836       int t = taken_count_offset;
 837       taken_count_offset = not_taken_count_offset;
 838       not_taken_count_offset = t;
 839     }
 840 
 841     LIR_Opr md_reg = new_register(T_OBJECT);
 842     __ oop2reg(md->constant_encoding(), md_reg);
 843 
 844     LIR_Opr data_offset_reg = new_pointer_register();
 845     __ cmove(lir_cond(cond),
 846              LIR_OprFact::intptrConst(taken_count_offset),
 847              LIR_OprFact::intptrConst(not_taken_count_offset),
 848              data_offset_reg);
 849 
 850     // MDO cells are intptr_t, so the data_reg width is arch-dependent.
 851     LIR_Opr data_reg = new_pointer_register();
 852     LIR_Address* data_addr = new LIR_Address(md_reg, data_offset_reg, data_reg->type());
 853     __ move(data_addr, data_reg);
 854     // Use leal instead of add to avoid destroying condition codes on x86
 855     LIR_Address* fake_incr_value = new LIR_Address(data_reg, DataLayout::counter_increment, T_INT);
 856     __ leal(LIR_OprFact::address(fake_incr_value), data_reg);
 857     __ move(data_reg, data_addr);
 858   }
 859 }
 860 
 861 // Phi technique:
 862 // This is about passing live values from one basic block to the other.
 863 // In code generated with Java it is rather rare that more than one
 864 // value is on the stack from one basic block to the other.
 865 // We optimize our technique for efficient passing of one value
 866 // (of type long, int, double..) but it can be extended.
 867 // When entering or leaving a basic block, all registers and all spill
 868 // slots are release and empty. We use the released registers
 869 // and spill slots to pass the live values from one block
 870 // to the other. The topmost value, i.e., the value on TOS of expression
 871 // stack is passed in registers. All other values are stored in spilling
 872 // area. Every Phi has an index which designates its spill slot
 873 // At exit of a basic block, we fill the register(s) and spill slots.
 874 // At entry of a basic block, the block_prolog sets up the content of phi nodes
 875 // and locks necessary registers and spilling slots.
 876 
 877 


 978 //---------------------------------------------------------------------
 979 ciObject* LIRGenerator::get_jobject_constant(Value value) {
 980   ObjectType* oc = value->type()->as_ObjectType();
 981   if (oc) {
 982     return oc->constant_value();
 983   }
 984   return NULL;
 985 }
 986 
 987 
 988 void LIRGenerator::do_ExceptionObject(ExceptionObject* x) {
 989   assert(block()->is_set(BlockBegin::exception_entry_flag), "ExceptionObject only allowed in exception handler block");
 990   assert(block()->next() == x, "ExceptionObject must be first instruction of block");
 991 
 992   // no moves are created for phi functions at the begin of exception
 993   // handlers, so assign operands manually here
 994   for_each_phi_fun(block(), phi,
 995                    operand_for_instruction(phi));
 996 
 997   LIR_Opr thread_reg = getThreadPointer();
 998   __ move_wide(new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT),
 999                exceptionOopOpr());
1000   __ move_wide(LIR_OprFact::oopConst(NULL),
1001                new LIR_Address(thread_reg, in_bytes(JavaThread::exception_oop_offset()), T_OBJECT));
1002   __ move_wide(LIR_OprFact::oopConst(NULL),
1003                new LIR_Address(thread_reg, in_bytes(JavaThread::exception_pc_offset()), T_OBJECT));
1004 
1005   LIR_Opr result = new_register(T_OBJECT);
1006   __ move(exceptionOopOpr(), result);
1007   set_result(x, result);
1008 }
1009 
1010 
1011 //----------------------------------------------------------------------
1012 //----------------------------------------------------------------------
1013 //----------------------------------------------------------------------
1014 //----------------------------------------------------------------------
1015 //                        visitor functions
1016 //----------------------------------------------------------------------
1017 //----------------------------------------------------------------------
1018 //----------------------------------------------------------------------
1019 //----------------------------------------------------------------------
1020 
1021 void LIRGenerator::do_Phi(Phi* x) {
1022   // phi functions are never visited directly


1054     set_result(x, LIR_OprFact::value_type(x->type()));
1055   }
1056 }
1057 
1058 
1059 void LIRGenerator::do_Local(Local* x) {
1060   // operand_for_instruction has the side effect of setting the result
1061   // so there's no need to do it here.
1062   operand_for_instruction(x);
1063 }
1064 
1065 
1066 void LIRGenerator::do_IfInstanceOf(IfInstanceOf* x) {
1067   Unimplemented();
1068 }
1069 
1070 
1071 void LIRGenerator::do_Return(Return* x) {
1072   if (compilation()->env()->dtrace_method_probes()) {
1073     BasicTypeList signature;
1074     signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT));    // thread
1075     signature.append(T_OBJECT); // methodOop
1076     LIR_OprList* args = new LIR_OprList();
1077     args->append(getThreadPointer());
1078     LIR_Opr meth = new_register(T_OBJECT);
1079     __ oop2reg(method()->constant_encoding(), meth);
1080     args->append(meth);
1081     call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), voidType, NULL);
1082   }
1083 
1084   if (x->type()->is_void()) {
1085     __ return_op(LIR_OprFact::illegalOpr);
1086   } else {
1087     LIR_Opr reg = result_register_for(x->type(), /*callee=*/true);
1088     LIRItem result(x->result(), this);
1089 
1090     result.load_item_force(reg);
1091     __ return_op(result.result());
1092   }
1093   set_no_result(x);
1094 }
1095 
1096 
1097 // Example: object.getClass ()
1098 void LIRGenerator::do_getClass(Intrinsic* x) {
1099   assert(x->number_of_arguments() == 1, "wrong type");
1100 
1101   LIRItem rcvr(x->argument_at(0), this);
1102   rcvr.load_item();
1103   LIR_Opr result = rlock_result(x);
1104 
1105   // need to perform the null check on the rcvr
1106   CodeEmitInfo* info = NULL;
1107   if (x->needs_null_check()) {
1108     info = state_for(x);
1109   }
1110   __ move(new LIR_Address(rcvr.result(), oopDesc::klass_offset_in_bytes(), T_OBJECT), result, info);
1111   __ move_wide(new LIR_Address(result, Klass::java_mirror_offset_in_bytes() +
1112                                klassOopDesc::klass_part_offset_in_bytes(), T_OBJECT), result);
1113 }
1114 
1115 
1116 // Example: Thread.currentThread()
1117 void LIRGenerator::do_currentThread(Intrinsic* x) {
1118   assert(x->number_of_arguments() == 0, "wrong type");
1119   LIR_Opr reg = rlock_result(x);
1120   __ move_wide(new LIR_Address(getThreadPointer(), in_bytes(JavaThread::threadObj_offset()), T_OBJECT), reg);
1121 }
1122 
1123 
1124 void LIRGenerator::do_RegisterFinalizer(Intrinsic* x) {
1125   assert(x->number_of_arguments() == 1, "wrong type");
1126   LIRItem receiver(x->argument_at(0), this);
1127 
1128   receiver.load_item();
1129   BasicTypeList signature;
1130   signature.append(T_OBJECT); // receiver
1131   LIR_OprList* args = new LIR_OprList();
1132   args->append(receiver.result());
1133   CodeEmitInfo* info = state_for(x, x->state());
1134   call_runtime(&signature, args,
1135                CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::register_finalizer_id)),
1136                voidType, info);
1137 
1138   set_no_result(x);
1139 }
1140 


1877     if (index_op->is_illegal() || log2_scale == 0) {
1878 #ifdef _LP64
1879       if (!index_op->is_illegal() && index_op->type() == T_INT) {
1880         LIR_Opr tmp = new_pointer_register();
1881         __ convert(Bytecodes::_i2l, index_op, tmp);
1882         index_op = tmp;
1883       }
1884 #endif
1885       addr = new LIR_Address(base_op, index_op, dst_type);
1886     } else {
1887       LIR_Opr tmp = new_pointer_register();
1888       __ shift_left(index_op, log2_scale, tmp);
1889       addr = new LIR_Address(base_op, tmp, dst_type);
1890     }
1891 #endif
1892   }
1893 
1894   if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) {
1895     __ unaligned_move(addr, reg);
1896   } else {
1897     if (dst_type == T_OBJECT && x->is_wide()) {
1898       __ move_wide(addr, reg);
1899     } else {
1900       __ move(addr, reg);
1901     }
1902   }
1903 }
1904 
1905 
1906 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) {
1907   int  log2_scale = 0;
1908   BasicType type = x->basic_type();
1909 
1910   if (x->has_index()) {
1911     assert(x->index()->type()->tag() == intTag, "should not find non-int index");
1912     log2_scale = x->log2_scale();
1913   }
1914 
1915   LIRItem base(x->base(), this);
1916   LIRItem value(x->value(), this);
1917   LIRItem idx(this);
1918 
1919   base.load_item();
1920   if (x->has_index()) {
1921     idx.set_instruction(x->index());
1922     idx.load_item();


2260       break;
2261     }
2262 
2263     LIR_Opr dest = new_register(t);
2264     __ move(src, dest);
2265 
2266     // Assign new location to Local instruction for this local
2267     Local* local = x->state()->local_at(java_index)->as_Local();
2268     assert(local != NULL, "Locals for incoming arguments must have been created");
2269 #ifndef __SOFTFP__
2270     // The java calling convention passes double as long and float as int.
2271     assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
2272 #endif // __SOFTFP__
2273     local->set_operand(dest);
2274     _instruction_for_operand.at_put_grow(dest->vreg_number(), local, NULL);
2275     java_index += type2size[t];
2276   }
2277 
2278   if (compilation()->env()->dtrace_method_probes()) {
2279     BasicTypeList signature;
2280     signature.append(LP64_ONLY(T_LONG) NOT_LP64(T_INT));    // thread
2281     signature.append(T_OBJECT); // methodOop
2282     LIR_OprList* args = new LIR_OprList();
2283     args->append(getThreadPointer());
2284     LIR_Opr meth = new_register(T_OBJECT);
2285     __ oop2reg(method()->constant_encoding(), meth);
2286     args->append(meth);
2287     call_runtime(&signature, args, CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), voidType, NULL);
2288   }
2289 
2290   if (method()->is_synchronized()) {
2291     LIR_Opr obj;
2292     if (method()->is_static()) {
2293       obj = new_register(T_OBJECT);
2294       __ oop2reg(method()->holder()->java_mirror()->constant_encoding(), obj);
2295     } else {
2296       Local* receiver = x->state()->local_at(0)->as_Local();
2297       assert(receiver != NULL, "must already exist");
2298       obj = receiver->operand();
2299     }
2300     assert(obj->is_valid(), "must be valid");


2325 
2326 void LIRGenerator::do_OsrEntry(OsrEntry* x) {
2327   // construct our frame and model the production of incoming pointer
2328   // to the OSR buffer.
2329   __ osr_entry(LIR_Assembler::osrBufferPointer());
2330   LIR_Opr result = rlock_result(x);
2331   __ move(LIR_Assembler::osrBufferPointer(), result);
2332 }
2333 
2334 
2335 void LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) {
2336   int i = (x->has_receiver() || x->is_invokedynamic()) ? 1 : 0;
2337   for (; i < args->length(); i++) {
2338     LIRItem* param = args->at(i);
2339     LIR_Opr loc = arg_list->at(i);
2340     if (loc->is_register()) {
2341       param->load_item_force(loc);
2342     } else {
2343       LIR_Address* addr = loc->as_address_ptr();
2344       param->load_for_store(addr->type());
2345       if (addr->type() == T_OBJECT) {
2346         __ move_wide(param->result(), addr);
2347       } else
2348         if (addr->type() == T_LONG || addr->type() == T_DOUBLE) {
2349           __ unaligned_move(param->result(), addr);
2350         } else {
2351           __ move(param->result(), addr);
2352         }
2353     }
2354   }
2355 
2356   if (x->has_receiver()) {
2357     LIRItem* receiver = args->at(0);
2358     LIR_Opr loc = arg_list->at(0);
2359     if (loc->is_register()) {
2360       receiver->load_item_force(loc);
2361     } else {
2362       assert(loc->is_address(), "just checking");
2363       receiver->load_for_store(T_OBJECT);
2364       __ move_wide(receiver->result(), loc->as_address_ptr());
2365     }
2366   }
2367 }
2368 
2369 
2370 // Visits all arguments, returns appropriate items without loading them
2371 LIRItemList* LIRGenerator::invoke_visit_arguments(Invoke* x) {
2372   LIRItemList* argument_items = new LIRItemList();
2373   if (x->has_receiver()) {
2374     LIRItem* receiver = new LIRItem(x->receiver(), this);
2375     argument_items->append(receiver);
2376   }
2377   if (x->is_invokedynamic()) {
2378     // Insert a dummy for the synthetic MethodHandle argument.
2379     argument_items->append(NULL);
2380   }
2381   int idx = x->has_receiver() ? 1 : 0;
2382   for (int i = 0; i < x->number_of_arguments(); i++) {
2383     LIRItem* param = new LIRItem(x->argument_at(i), this);
2384     argument_items->append(param);


src/share/vm/c1/c1_LIRGenerator.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File