comparison src/cpu/x86/vm/methodHandles_x86.cpp @ 2321:1b4e6a5d98e0

7012914: JSR 292 MethodHandlesTest C1: frame::verify_return_pc(return_address) failed: must be a return pc Reviewed-by: never, bdelsart
author twisti
date Mon, 28 Feb 2011 06:07:12 -0800
parents 28bf941f445e
children 8033953d67ff
comparison
equal deleted inserted replaced
2320:41d4973cf100 2321:1b4e6a5d98e0
417 417
418 guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); 418 guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets");
419 419
420 // some handy addresses 420 // some handy addresses
421 Address rbx_method_fie( rbx, methodOopDesc::from_interpreted_offset() ); 421 Address rbx_method_fie( rbx, methodOopDesc::from_interpreted_offset() );
422 Address rbx_method_fce( rbx, methodOopDesc::from_compiled_offset() );
422 423
423 Address rcx_mh_vmtarget( rcx_recv, java_dyn_MethodHandle::vmtarget_offset_in_bytes() ); 424 Address rcx_mh_vmtarget( rcx_recv, java_dyn_MethodHandle::vmtarget_offset_in_bytes() );
424 Address rcx_dmh_vmindex( rcx_recv, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes() ); 425 Address rcx_dmh_vmindex( rcx_recv, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes() );
425 426
426 Address rcx_bmh_vmargslot( rcx_recv, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes() ); 427 Address rcx_bmh_vmargslot( rcx_recv, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes() );
446 447
447 switch ((int) ek) { 448 switch ((int) ek) {
448 case _raise_exception: 449 case _raise_exception:
449 { 450 {
450 // Not a real MH entry, but rather shared code for raising an 451 // Not a real MH entry, but rather shared code for raising an
451 // exception. Since we use a C2I adapter to set up the 452 // exception. Since we use the compiled entry, arguments are
452 // interpreter state, arguments are expected in compiler 453 // expected in compiler argument registers.
453 // argument registers.
454 assert(raise_exception_method(), "must be set"); 454 assert(raise_exception_method(), "must be set");
455 address c2i_entry = raise_exception_method()->get_c2i_entry(); 455 assert(raise_exception_method()->from_compiled_entry(), "method must be linked");
456 assert(c2i_entry, "method must be linked");
457 456
458 const Register rdi_pc = rax; 457 const Register rdi_pc = rax;
459 __ pop(rdi_pc); // caller PC 458 __ pop(rdi_pc); // caller PC
460 __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started 459 __ mov(rsp, saved_last_sp); // cut the stack back to where the caller started
461 460
470 __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject 469 __ movptr(rbx_method, Address(rbx_method, jobject_oop_offset)); // dereference the jobject
471 __ testptr(rbx_method, rbx_method); 470 __ testptr(rbx_method, rbx_method);
472 __ jccb(Assembler::zero, L_no_method); 471 __ jccb(Assembler::zero, L_no_method);
473 __ verify_oop(rbx_method); 472 __ verify_oop(rbx_method);
474 473
475 // 32-bit: push remaining arguments as if coming from the compiler.
476 NOT_LP64(__ push(rarg2_required)); 474 NOT_LP64(__ push(rarg2_required));
477 475 __ push(rdi_pc); // restore caller PC
478 __ push(rdi_pc); // restore caller PC 476 __ jmp(rbx_method_fce); // jump to compiled entry
479 __ jump(ExternalAddress(c2i_entry)); // do C2I transition 477
480
481 // If we get here, the Java runtime did not do its job of creating the exception.
482 // Do something that is at least causes a valid throw from the interpreter. 478 // Do something that is at least causes a valid throw from the interpreter.
483 __ bind(L_no_method); 479 __ bind(L_no_method);
484 __ push(rarg2_required); 480 __ push(rarg2_required);
485 __ push(rarg1_actual); 481 __ push(rarg1_actual);
486 __ jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry())); 482 __ jump(ExternalAddress(Interpreter::throw_WrongMethodType_entry()));