1117 1118 assert(!vfst.at_end(), "Java frame must exist"); 1119 1120 // Find caller and bci from vframe 1121 methodHandle caller(THREAD, vfst.method()); 1122 int bci = vfst.bci(); 1123 1124 Bytecode_invoke bytecode(caller, bci); 1125 int bytecode_index = bytecode.index(); 1126 1127 methodHandle attached_method = extract_attached_method(vfst); 1128 if (attached_method.not_null()) { 1129 methodHandle callee = bytecode.static_target(CHECK_NH); 1130 vmIntrinsics::ID id = callee->intrinsic_id(); 1131 // When VM replaces MH.invokeBasic/linkTo* call with a direct/virtual call, 1132 // it attaches statically resolved method to the call site. 1133 if (MethodHandles::is_signature_polymorphic(id) && 1134 MethodHandles::is_signature_polymorphic_intrinsic(id)) { 1135 bc = MethodHandles::signature_polymorphic_intrinsic_bytecode(id); 1136 1137 // Need to adjust invokehandle since inlining through signature-polymorphic 1138 // method happened. 1139 if (bc == Bytecodes::_invokehandle && 1140 !MethodHandles::is_signature_polymorphic_method(attached_method())) { 1141 bc = attached_method->is_static() ? Bytecodes::_invokestatic 1142 : Bytecodes::_invokevirtual; 1143 } 1144 } 1145 } else { 1146 bc = bytecode.invoke_code(); 1147 } 1148 1149 bool has_receiver = bc != Bytecodes::_invokestatic && 1150 bc != Bytecodes::_invokedynamic && 1151 bc != Bytecodes::_invokehandle; 1152 1153 // Find receiver for non-static call 1154 if (has_receiver) { 1155 // This register map must be update since we need to find the receiver for 1156 // compiled frames. The receiver might be in a register. 1157 RegisterMap reg_map2(thread); 1158 frame stubFrame = thread->last_frame(); 1159 // Caller-frame is a compiled frame 1160 frame callerFrame = stubFrame.sender(®_map2); 1161 1162 if (attached_method.is_null()) { 1163 methodHandle callee = bytecode.static_target(CHECK_NH); | 1117 1118 assert(!vfst.at_end(), "Java frame must exist"); 1119 1120 // Find caller and bci from vframe 1121 methodHandle caller(THREAD, vfst.method()); 1122 int bci = vfst.bci(); 1123 1124 Bytecode_invoke bytecode(caller, bci); 1125 int bytecode_index = bytecode.index(); 1126 1127 methodHandle attached_method = extract_attached_method(vfst); 1128 if (attached_method.not_null()) { 1129 methodHandle callee = bytecode.static_target(CHECK_NH); 1130 vmIntrinsics::ID id = callee->intrinsic_id(); 1131 // When VM replaces MH.invokeBasic/linkTo* call with a direct/virtual call, 1132 // it attaches statically resolved method to the call site. 1133 if (MethodHandles::is_signature_polymorphic(id) && 1134 MethodHandles::is_signature_polymorphic_intrinsic(id)) { 1135 bc = MethodHandles::signature_polymorphic_intrinsic_bytecode(id); 1136 1137 // Adjust invocation mode according to the attached method. 1138 switch (bc) { 1139 case Bytecodes::_invokeinterface: 1140 if (!attached_method->method_holder()->is_interface()) { 1141 bc = Bytecodes::_invokevirtual; 1142 } 1143 break; 1144 case Bytecodes::_invokehandle: 1145 if (!MethodHandles::is_signature_polymorphic_method(attached_method())) { 1146 bc = attached_method->is_static() ? Bytecodes::_invokestatic 1147 : Bytecodes::_invokevirtual; 1148 } 1149 break; 1150 } 1151 } 1152 } else { 1153 bc = bytecode.invoke_code(); 1154 } 1155 1156 bool has_receiver = bc != Bytecodes::_invokestatic && 1157 bc != Bytecodes::_invokedynamic && 1158 bc != Bytecodes::_invokehandle; 1159 1160 // Find receiver for non-static call 1161 if (has_receiver) { 1162 // This register map must be update since we need to find the receiver for 1163 // compiled frames. The receiver might be in a register. 1164 RegisterMap reg_map2(thread); 1165 frame stubFrame = thread->last_frame(); 1166 // Caller-frame is a compiled frame 1167 frame callerFrame = stubFrame.sender(®_map2); 1168 1169 if (attached_method.is_null()) { 1170 methodHandle callee = bytecode.static_target(CHECK_NH); |