400 // as set up by generate_method_handle_interpreter_entry(): 401 // - G5: garbage temp (was MethodHandle.invoke methodOop, unused) 402 // - G3: receiver method handle 403 // - O5_savedSP: sender SP (must preserve) 404 405 const Register O0_argslot = O0; 406 const Register O1_scratch = O1; 407 const Register O2_scratch = O2; 408 const Register O3_scratch = O3; 409 const Register G5_index = G5; 410 411 // Argument registers for _raise_exception. 412 const Register O0_code = O0; 413 const Register O1_actual = O1; 414 const Register O2_required = O2; 415 416 guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); 417 418 // Some handy addresses: 419 Address G5_method_fie( G5_method, in_bytes(methodOopDesc::from_interpreted_offset())); 420 421 Address G3_mh_vmtarget( G3_method_handle, java_dyn_MethodHandle::vmtarget_offset_in_bytes()); 422 423 Address G3_dmh_vmindex( G3_method_handle, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes()); 424 425 Address G3_bmh_vmargslot( G3_method_handle, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes()); 426 Address G3_bmh_argument( G3_method_handle, sun_dyn_BoundMethodHandle::argument_offset_in_bytes()); 427 428 Address G3_amh_vmargslot( G3_method_handle, sun_dyn_AdapterMethodHandle::vmargslot_offset_in_bytes()); 429 Address G3_amh_argument ( G3_method_handle, sun_dyn_AdapterMethodHandle::argument_offset_in_bytes()); 430 Address G3_amh_conversion(G3_method_handle, sun_dyn_AdapterMethodHandle::conversion_offset_in_bytes()); 431 432 const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes(); 433 434 if (have_entry(ek)) { 435 __ nop(); // empty stubs make SG sick 436 return; 437 } 438 439 address interp_entry = __ pc(); 440 441 trace_method_handle(_masm, entry_name(ek)); 442 443 switch ((int) ek) { 444 case _raise_exception: 445 { 446 // Not a real MH entry, but rather shared code for raising an 447 // exception. Since we use a C2I adapter to set up the 448 // interpreter state, arguments are expected in compiler 449 // argument registers. 450 assert(raise_exception_method(), "must be set"); 451 address c2i_entry = raise_exception_method()->get_c2i_entry(); 452 assert(c2i_entry, "method must be linked"); 453 454 __ mov(O5_savedSP, SP); // Cut the stack back to where the caller started. 455 456 Label L_no_method; 457 // FIXME: fill in _raise_exception_method with a suitable sun.dyn method 458 __ set(AddressLiteral((address) &_raise_exception_method), G5_method); 459 __ ld_ptr(Address(G5_method, 0), G5_method); 460 __ tst(G5_method); 461 __ brx(Assembler::zero, false, Assembler::pn, L_no_method); 462 __ delayed()->nop(); 463 464 const int jobject_oop_offset = 0; 465 __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method); 466 __ tst(G5_method); 467 __ brx(Assembler::zero, false, Assembler::pn, L_no_method); 468 __ delayed()->nop(); 469 470 __ verify_oop(G5_method); 471 __ jump_to(AddressLiteral(c2i_entry), O3_scratch); 472 __ delayed()->nop(); 473 474 // If we get here, the Java runtime did not do its job of creating the exception. 475 // Do something that is at least causes a valid throw from the interpreter. 476 __ bind(L_no_method); 477 __ unimplemented("call throw_WrongMethodType_entry"); 478 } 479 break; 480 481 case _invokestatic_mh: 482 case _invokespecial_mh: 483 { 484 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop 485 __ verify_oop(G5_method); 486 // Same as TemplateTable::invokestatic or invokespecial, 487 // minus the CP setup and profiling: 488 if (ek == _invokespecial_mh) { 489 // Must load & check the first argument before entering the target method. 490 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); 491 __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle); 492 __ null_check(G3_method_handle); 493 __ verify_oop(G3_method_handle); 494 } | 400 // as set up by generate_method_handle_interpreter_entry(): 401 // - G5: garbage temp (was MethodHandle.invoke methodOop, unused) 402 // - G3: receiver method handle 403 // - O5_savedSP: sender SP (must preserve) 404 405 const Register O0_argslot = O0; 406 const Register O1_scratch = O1; 407 const Register O2_scratch = O2; 408 const Register O3_scratch = O3; 409 const Register G5_index = G5; 410 411 // Argument registers for _raise_exception. 412 const Register O0_code = O0; 413 const Register O1_actual = O1; 414 const Register O2_required = O2; 415 416 guarantee(java_dyn_MethodHandle::vmentry_offset_in_bytes() != 0, "must have offsets"); 417 418 // Some handy addresses: 419 Address G5_method_fie( G5_method, in_bytes(methodOopDesc::from_interpreted_offset())); 420 Address G5_method_fce( G5_method, in_bytes(methodOopDesc::from_compiled_offset())); 421 422 Address G3_mh_vmtarget( G3_method_handle, java_dyn_MethodHandle::vmtarget_offset_in_bytes()); 423 424 Address G3_dmh_vmindex( G3_method_handle, sun_dyn_DirectMethodHandle::vmindex_offset_in_bytes()); 425 426 Address G3_bmh_vmargslot( G3_method_handle, sun_dyn_BoundMethodHandle::vmargslot_offset_in_bytes()); 427 Address G3_bmh_argument( G3_method_handle, sun_dyn_BoundMethodHandle::argument_offset_in_bytes()); 428 429 Address G3_amh_vmargslot( G3_method_handle, sun_dyn_AdapterMethodHandle::vmargslot_offset_in_bytes()); 430 Address G3_amh_argument ( G3_method_handle, sun_dyn_AdapterMethodHandle::argument_offset_in_bytes()); 431 Address G3_amh_conversion(G3_method_handle, sun_dyn_AdapterMethodHandle::conversion_offset_in_bytes()); 432 433 const int java_mirror_offset = klassOopDesc::klass_part_offset_in_bytes() + Klass::java_mirror_offset_in_bytes(); 434 435 if (have_entry(ek)) { 436 __ nop(); // empty stubs make SG sick 437 return; 438 } 439 440 address interp_entry = __ pc(); 441 442 trace_method_handle(_masm, entry_name(ek)); 443 444 switch ((int) ek) { 445 case _raise_exception: 446 { 447 // Not a real MH entry, but rather shared code for raising an 448 // exception. Since we use the compiled entry, arguments are 449 // expected in compiler argument registers. 450 assert(raise_exception_method(), "must be set"); 451 assert(raise_exception_method()->from_compiled_entry(), "method must be linked"); 452 453 __ mov(O5_savedSP, SP); // Cut the stack back to where the caller started. 454 455 Label L_no_method; 456 // FIXME: fill in _raise_exception_method with a suitable sun.dyn method 457 __ set(AddressLiteral((address) &_raise_exception_method), G5_method); 458 __ ld_ptr(Address(G5_method, 0), G5_method); 459 __ tst(G5_method); 460 __ brx(Assembler::zero, false, Assembler::pn, L_no_method); 461 __ delayed()->nop(); 462 463 const int jobject_oop_offset = 0; 464 __ ld_ptr(Address(G5_method, jobject_oop_offset), G5_method); 465 __ tst(G5_method); 466 __ brx(Assembler::zero, false, Assembler::pn, L_no_method); 467 __ delayed()->nop(); 468 469 __ verify_oop(G5_method); 470 __ jump_indirect_to(G5_method_fce, O3_scratch); // jump to compiled entry 471 __ delayed()->nop(); 472 473 // Do something that is at least causes a valid throw from the interpreter. 474 __ bind(L_no_method); 475 __ unimplemented("call throw_WrongMethodType_entry"); 476 } 477 break; 478 479 case _invokestatic_mh: 480 case _invokespecial_mh: 481 { 482 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop 483 __ verify_oop(G5_method); 484 // Same as TemplateTable::invokestatic or invokespecial, 485 // minus the CP setup and profiling: 486 if (ek == _invokespecial_mh) { 487 // Must load & check the first argument before entering the target method. 488 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); 489 __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle); 490 __ null_check(G3_method_handle); 491 __ verify_oop(G3_method_handle); 492 } |