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




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


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


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


1891     if (index_op->is_illegal() || log2_scale == 0) {
1892 #ifdef _LP64
1893       if (!index_op->is_illegal() && index_op->type() == T_INT) {
1894         LIR_Opr tmp = new_pointer_register();
1895         __ convert(Bytecodes::_i2l, index_op, tmp);
1896         index_op = tmp;
1897       }
1898 #endif
1899       addr = new LIR_Address(base_op, index_op, dst_type);
1900     } else {
1901       LIR_Opr tmp = new_pointer_register();
1902       __ shift_left(index_op, log2_scale, tmp);
1903       addr = new LIR_Address(base_op, tmp, dst_type);
1904     }
1905 #endif
1906   }
1907 
1908   if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) {
1909     __ unaligned_move(addr, reg);
1910   } else {



1911     __ move(addr, reg);
1912   }

1913 }
1914 
1915 
1916 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) {
1917   int  log2_scale = 0;
1918   BasicType type = x->basic_type();
1919 
1920   if (x->has_index()) {
1921     assert(x->index()->type()->tag() == intTag, "should not find non-int index");
1922     log2_scale = x->log2_scale();
1923   }
1924 
1925   LIRItem base(x->base(), this);
1926   LIRItem value(x->value(), this);
1927   LIRItem idx(this);
1928 
1929   base.load_item();
1930   if (x->has_index()) {
1931     idx.set_instruction(x->index());
1932     idx.load_item();


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


2335 
2336 void LIRGenerator::do_OsrEntry(OsrEntry* x) {
2337   // construct our frame and model the production of incoming pointer
2338   // to the OSR buffer.
2339   __ osr_entry(LIR_Assembler::osrBufferPointer());
2340   LIR_Opr result = rlock_result(x);
2341   __ move(LIR_Assembler::osrBufferPointer(), result);
2342 }
2343 
2344 
2345 void LIRGenerator::invoke_load_arguments(Invoke* x, LIRItemList* args, const LIR_OprList* arg_list) {
2346   int i = (x->has_receiver() || x->is_invokedynamic()) ? 1 : 0;
2347   for (; i < args->length(); i++) {
2348     LIRItem* param = args->at(i);
2349     LIR_Opr loc = arg_list->at(i);
2350     if (loc->is_register()) {
2351       param->load_item_force(loc);
2352     } else {
2353       LIR_Address* addr = loc->as_address_ptr();
2354       param->load_for_store(addr->type());



2355       if (addr->type() == T_LONG || addr->type() == T_DOUBLE) {
2356         __ unaligned_move(param->result(), addr);
2357       } else {
2358         __ move(param->result(), addr);
2359       }
2360     }
2361   }
2362 
2363   if (x->has_receiver()) {
2364     LIRItem* receiver = args->at(0);
2365     LIR_Opr loc = arg_list->at(0);
2366     if (loc->is_register()) {
2367       receiver->load_item_force(loc);
2368     } else {
2369       assert(loc->is_address(), "just checking");
2370       receiver->load_for_store(T_OBJECT);
2371       __ move(receiver->result(), loc);
2372     }
2373   }
2374 }
2375 
2376 
2377 // Visits all arguments, returns appropriate items without loading them
2378 LIRItemList* LIRGenerator::invoke_visit_arguments(Invoke* x) {
2379   LIRItemList* argument_items = new LIRItemList();
2380   if (x->has_receiver()) {
2381     LIRItem* receiver = new LIRItem(x->receiver(), this);
2382     argument_items->append(receiver);
2383   }
2384   if (x->is_invokedynamic()) {
2385     // Insert a dummy for the synthetic MethodHandle argument.
2386     argument_items->append(NULL);
2387   }
2388   int idx = x->has_receiver() ? 1 : 0;
2389   for (int i = 0; i < x->number_of_arguments(); i++) {
2390     LIRItem* param = new LIRItem(x->argument_at(i), this);
2391     argument_items->append(param);




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


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


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


1891     if (index_op->is_illegal() || log2_scale == 0) {
1892 #ifdef _LP64
1893       if (!index_op->is_illegal() && index_op->type() == T_INT) {
1894         LIR_Opr tmp = new_pointer_register();
1895         __ convert(Bytecodes::_i2l, index_op, tmp);
1896         index_op = tmp;
1897       }
1898 #endif
1899       addr = new LIR_Address(base_op, index_op, dst_type);
1900     } else {
1901       LIR_Opr tmp = new_pointer_register();
1902       __ shift_left(index_op, log2_scale, tmp);
1903       addr = new LIR_Address(base_op, tmp, dst_type);
1904     }
1905 #endif
1906   }
1907 
1908   if (x->may_be_unaligned() && (dst_type == T_LONG || dst_type == T_DOUBLE)) {
1909     __ unaligned_move(addr, reg);
1910   } else {
1911     if (dst_type == T_OBJECT && x->is_wide()) {
1912       __ move_wide(addr, reg);
1913     } else {
1914       __ move(addr, reg);
1915     }
1916   }
1917 }
1918 
1919 
1920 void LIRGenerator::do_UnsafePutRaw(UnsafePutRaw* x) {
1921   int  log2_scale = 0;
1922   BasicType type = x->basic_type();
1923 
1924   if (x->has_index()) {
1925     assert(x->index()->type()->tag() == intTag, "should not find non-int index");
1926     log2_scale = x->log2_scale();
1927   }
1928 
1929   LIRItem base(x->base(), this);
1930   LIRItem value(x->value(), this);
1931   LIRItem idx(this);
1932 
1933   base.load_item();
1934   if (x->has_index()) {
1935     idx.set_instruction(x->index());
1936     idx.load_item();


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


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


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