hotspot/src/cpu/x86/vm/methodHandles_x86.cpp
changeset 10004 190e88f7edd1
parent 9980 a330de5dea17
child 10031 e81ae8b523dc
equal deleted inserted replaced
9982:edcf2d7e7b84 10004:190e88f7edd1
   600 
   600 
   601   __ jump_to_method_handle_entry(rcx_recv, rdi_temp);
   601   __ jump_to_method_handle_entry(rcx_recv, rdi_temp);
   602 
   602 
   603   // error path for invokeExact (only)
   603   // error path for invokeExact (only)
   604   __ bind(invoke_exact_error_path);
   604   __ bind(invoke_exact_error_path);
   605   // jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry()));
   605   // Stub wants expected type in rax and the actual type in rcx
   606   Register rdx_last_Java_sp = rdx_temp;
   606   __ jump(ExternalAddress(StubRoutines::throw_WrongMethodTypeException_entry()));
   607   __ lea(rdx_last_Java_sp, __ argument_address(constant(0)));
       
   608   __ super_call_VM(noreg,
       
   609                    rdx_last_Java_sp,
       
   610                    CAST_FROM_FN_PTR(address,
       
   611                                     InterpreterRuntime::throw_WrongMethodTypeException),
       
   612                    // pass required type, then failing mh object
       
   613                    rax_mtype, rcx_recv);
       
   614 
   607 
   615   // for invokeGeneric (only), apply argument and result conversions on the fly
   608   // for invokeGeneric (only), apply argument and result conversions on the fly
   616   __ bind(invoke_generic_slow_path);
   609   __ bind(invoke_generic_slow_path);
   617 #ifdef ASSERT
   610 #ifdef ASSERT
   618   if (VerifyMethodHandles) {
   611   if (VerifyMethodHandles) {
  1173       const Register rdi_pc = rax;
  1166       const Register rdi_pc = rax;
  1174       __ pop(rdi_pc);  // caller PC
  1167       __ pop(rdi_pc);  // caller PC
  1175       __ mov(rsp, saved_last_sp);  // cut the stack back to where the caller started
  1168       __ mov(rsp, saved_last_sp);  // cut the stack back to where the caller started
  1176 
  1169 
  1177       Register rbx_method = rbx_temp;
  1170       Register rbx_method = rbx_temp;
  1178       Label L_no_method;
       
  1179       // FIXME: fill in _raise_exception_method with a suitable java.lang.invoke method
       
  1180       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
  1171       __ movptr(rbx_method, ExternalAddress((address) &_raise_exception_method));
  1181       __ testptr(rbx_method, rbx_method);
       
  1182       __ jccb(Assembler::zero, L_no_method);
       
  1183 
  1172 
  1184       const int jobject_oop_offset = 0;
  1173       const int jobject_oop_offset = 0;
  1185       __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset));  // dereference the jobject
  1174       __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset));  // dereference the jobject
  1186       __ testptr(rbx_method, rbx_method);
       
  1187       __ jccb(Assembler::zero, L_no_method);
       
  1188       __ verify_oop(rbx_method);
  1175       __ verify_oop(rbx_method);
  1189 
  1176 
  1190       NOT_LP64(__ push(rarg2_required));
  1177       NOT_LP64(__ push(rarg2_required));
  1191       __ push(rdi_pc);         // restore caller PC
  1178       __ push(rdi_pc);         // restore caller PC
  1192       __ jmp(rbx_method_fce);  // jump to compiled entry
  1179       __ jmp(rbx_method_fce);  // jump to compiled entry
  1193 
       
  1194       // Do something that is at least causes a valid throw from the interpreter.
       
  1195       __ bind(L_no_method);
       
  1196       __ push(rarg2_required);
       
  1197       __ push(rarg1_actual);
       
  1198       __ jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry()));
       
  1199     }
  1180     }
  1200     break;
  1181     break;
  1201 
  1182 
  1202   case _invokestatic_mh:
  1183   case _invokestatic_mh:
  1203   case _invokespecial_mh:
  1184   case _invokespecial_mh: