88 __ ld_ptr(Address(tem, *pchase), G5_method_type); |
88 __ ld_ptr(Address(tem, *pchase), G5_method_type); |
89 } |
89 } |
90 } |
90 } |
91 |
91 |
92 // given the MethodType, find out where the MH argument is buried |
92 // given the MethodType, find out where the MH argument is buried |
93 __ ld_ptr(Address(G5_method_type, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, O1_scratch)), O0_argslot); |
93 __ load_heap_oop(Address(G5_method_type, __ delayed_value(java_dyn_MethodType::form_offset_in_bytes, O1_scratch)), O0_argslot); |
94 __ ldsw( Address(O0_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O0_argslot); |
94 __ ldsw( Address(O0_argslot, __ delayed_value(java_dyn_MethodTypeForm::vmslots_offset_in_bytes, O1_scratch)), O0_argslot); |
95 __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle); |
95 __ ld_ptr(__ argument_address(O0_argslot), G3_method_handle); |
96 |
96 |
97 __ check_method_handle_type(G5_method_type, G3_method_handle, O1_scratch, wrong_method_type); |
97 __ check_method_handle_type(G5_method_type, G3_method_handle, O1_scratch, wrong_method_type); |
98 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
98 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
99 |
99 |
346 __ nop(); // empty stubs make SG sick |
346 __ nop(); // empty stubs make SG sick |
347 return; |
347 return; |
348 } |
348 } |
349 |
349 |
350 address interp_entry = __ pc(); |
350 address interp_entry = __ pc(); |
351 if (UseCompressedOops) __ unimplemented("UseCompressedOops"); |
|
352 |
351 |
353 #ifndef PRODUCT |
352 #ifndef PRODUCT |
354 if (TraceMethodHandles) { |
353 if (TraceMethodHandles) { |
355 // save: Gargs, O5_savedSP |
354 // save: Gargs, O5_savedSP |
356 __ save(SP, -16*wordSize, SP); |
355 __ save(SP, -16*wordSize, SP); |
411 break; |
410 break; |
412 |
411 |
413 case _invokestatic_mh: |
412 case _invokestatic_mh: |
414 case _invokespecial_mh: |
413 case _invokespecial_mh: |
415 { |
414 { |
416 __ ld_ptr(G3_mh_vmtarget, G5_method); // target is a methodOop |
415 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop |
417 __ verify_oop(G5_method); |
416 __ verify_oop(G5_method); |
418 // Same as TemplateTable::invokestatic or invokespecial, |
417 // Same as TemplateTable::invokestatic or invokespecial, |
419 // minus the CP setup and profiling: |
418 // minus the CP setup and profiling: |
420 if (ek == _invokespecial_mh) { |
419 if (ek == _invokespecial_mh) { |
421 // Must load & check the first argument before entering the target method. |
420 // Must load & check the first argument before entering the target method. |
466 { |
465 { |
467 // Same as TemplateTable::invokeinterface, |
466 // Same as TemplateTable::invokeinterface, |
468 // minus the CP setup and profiling: |
467 // minus the CP setup and profiling: |
469 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); |
468 __ load_method_handle_vmslots(O0_argslot, G3_method_handle, O1_scratch); |
470 Register O1_intf = O1_scratch; |
469 Register O1_intf = O1_scratch; |
471 __ ld_ptr(G3_mh_vmtarget, O1_intf); |
470 __ load_heap_oop(G3_mh_vmtarget, O1_intf); |
472 __ ldsw(G3_dmh_vmindex, G5_index); |
471 __ ldsw(G3_dmh_vmindex, G5_index); |
473 __ ld_ptr(__ argument_address(O0_argslot, -1), G3_method_handle); |
472 __ ld_ptr(__ argument_address(O0_argslot, -1), G3_method_handle); |
474 __ null_check(G3_method_handle, oopDesc::klass_offset_in_bytes()); |
473 __ null_check(G3_method_handle, oopDesc::klass_offset_in_bytes()); |
475 |
474 |
476 // Get receiver klass: |
475 // Get receiver klass: |
521 __ add(Gargs, __ argument_offset(O0_argslot), O0_argslot); |
520 __ add(Gargs, __ argument_offset(O0_argslot), O0_argslot); |
522 |
521 |
523 insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask, O0_argslot, O1_scratch, O2_scratch, G5_index); |
522 insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask, O0_argslot, O1_scratch, O2_scratch, G5_index); |
524 |
523 |
525 // Store bound argument into the new stack slot: |
524 // Store bound argument into the new stack slot: |
526 __ ld_ptr(G3_bmh_argument, O1_scratch); |
525 __ load_heap_oop(G3_bmh_argument, O1_scratch); |
527 if (arg_type == T_OBJECT) { |
526 if (arg_type == T_OBJECT) { |
528 __ st_ptr(O1_scratch, Address(O0_argslot, 0)); |
527 __ st_ptr(O1_scratch, Address(O0_argslot, 0)); |
529 } else { |
528 } else { |
530 Address prim_value_addr(O1_scratch, java_lang_boxing_object::value_offset_in_bytes(arg_type)); |
529 Address prim_value_addr(O1_scratch, java_lang_boxing_object::value_offset_in_bytes(arg_type)); |
531 __ load_sized_value(prim_value_addr, O2_scratch, type2aelembytes(arg_type), is_signed_subword_type(arg_type)); |
530 __ load_sized_value(prim_value_addr, O2_scratch, type2aelembytes(arg_type), is_signed_subword_type(arg_type)); |
539 __ st_ptr( O2_scratch, Address(O0_argslot, 0)); |
538 __ st_ptr( O2_scratch, Address(O0_argslot, 0)); |
540 } |
539 } |
541 } |
540 } |
542 |
541 |
543 if (direct_to_method) { |
542 if (direct_to_method) { |
544 __ ld_ptr(G3_mh_vmtarget, G5_method); // target is a methodOop |
543 __ load_heap_oop(G3_mh_vmtarget, G5_method); // target is a methodOop |
545 __ verify_oop(G5_method); |
544 __ verify_oop(G5_method); |
546 __ jump_indirect_to(G5_method_fie, O1_scratch); |
545 __ jump_indirect_to(G5_method_fie, O1_scratch); |
547 __ delayed()->nop(); |
546 __ delayed()->nop(); |
548 } else { |
547 } else { |
549 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); // target is a methodOop |
548 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); // target is a methodOop |
550 __ verify_oop(G3_method_handle); |
549 __ verify_oop(G3_method_handle); |
551 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
550 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
552 } |
551 } |
553 } |
552 } |
554 break; |
553 break; |
555 |
554 |
556 case _adapter_retype_only: |
555 case _adapter_retype_only: |
557 case _adapter_retype_raw: |
556 case _adapter_retype_raw: |
558 // Immediately jump to the next MH layer: |
557 // Immediately jump to the next MH layer: |
559 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
558 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
560 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
559 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
561 // This is OK when all parameter types widen. |
560 // This is OK when all parameter types widen. |
562 // It is also OK when a return type narrows. |
561 // It is also OK when a return type narrows. |
563 break; |
562 break; |
564 |
563 |
570 // Check a reference argument before jumping to the next layer of MH: |
569 // Check a reference argument before jumping to the next layer of MH: |
571 __ ldsw(G3_amh_vmargslot, O0_argslot); |
570 __ ldsw(G3_amh_vmargslot, O0_argslot); |
572 Address vmarg = __ argument_address(O0_argslot); |
571 Address vmarg = __ argument_address(O0_argslot); |
573 |
572 |
574 // What class are we casting to? |
573 // What class are we casting to? |
575 __ ld_ptr(G3_amh_argument, G5_klass); // This is a Class object! |
574 __ load_heap_oop(G3_amh_argument, G5_klass); // This is a Class object! |
576 __ ld_ptr(Address(G5_klass, java_lang_Class::klass_offset_in_bytes()), G5_klass); |
575 __ load_heap_oop(Address(G5_klass, java_lang_Class::klass_offset_in_bytes()), G5_klass); |
577 |
576 |
578 Label done; |
577 Label done; |
579 __ ld_ptr(vmarg, O1_scratch); |
578 __ ld_ptr(vmarg, O1_scratch); |
580 __ tst(O1_scratch); |
579 __ tst(O1_scratch); |
581 __ brx(Assembler::zero, false, Assembler::pn, done); // No cast if null. |
580 __ brx(Assembler::zero, false, Assembler::pn, done); // No cast if null. |
588 // - G3_method_handle: adapter method handle |
587 // - G3_method_handle: adapter method handle |
589 __ check_klass_subtype(O1_scratch, G5_klass, O0_argslot, O2_scratch, done); |
588 __ check_klass_subtype(O1_scratch, G5_klass, O0_argslot, O2_scratch, done); |
590 |
589 |
591 // If we get here, the type check failed! |
590 // If we get here, the type check failed! |
592 __ ldsw(G3_amh_vmargslot, O0_argslot); // reload argslot field |
591 __ ldsw(G3_amh_vmargslot, O0_argslot); // reload argslot field |
593 __ ld_ptr(G3_amh_argument, O3_scratch); // required class |
592 __ load_heap_oop(G3_amh_argument, O3_scratch); // required class |
594 __ ld_ptr(vmarg, O2_scratch); // bad object |
593 __ ld_ptr(vmarg, O2_scratch); // bad object |
595 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot); |
594 __ jump_to(AddressLiteral(from_interpreted_entry(_raise_exception)), O0_argslot); |
596 __ delayed()->mov(Bytecodes::_checkcast, O1_scratch); // who is complaining? |
595 __ delayed()->mov(Bytecodes::_checkcast, O1_scratch); // who is complaining? |
597 |
596 |
598 __ bind(done); |
597 __ bind(done); |
599 // Get the new MH: |
598 // Get the new MH: |
600 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
599 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
601 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
600 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
602 } |
601 } |
603 break; |
602 break; |
604 |
603 |
605 case _adapter_prim_to_prim: |
604 case _adapter_prim_to_prim: |
674 |
673 |
675 __ bind(done); |
674 __ bind(done); |
676 __ st(O1_scratch, vmarg); |
675 __ st(O1_scratch, vmarg); |
677 |
676 |
678 // Get the new MH: |
677 // Get the new MH: |
679 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
678 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
680 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
679 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
681 } |
680 } |
682 break; |
681 break; |
683 |
682 |
684 case _adapter_opt_i2l: // optimized subcase of adapt_prim_to_prim |
683 case _adapter_opt_i2l: // optimized subcase of adapt_prim_to_prim |
719 break; |
718 break; |
720 default: |
719 default: |
721 ShouldNotReachHere(); |
720 ShouldNotReachHere(); |
722 } |
721 } |
723 |
722 |
724 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
723 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
725 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
724 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
726 } |
725 } |
727 break; |
726 break; |
728 |
727 |
729 case _adapter_opt_f2d: // optimized subcase of adapt_prim_to_prim |
728 case _adapter_opt_f2d: // optimized subcase of adapt_prim_to_prim |
849 case 8 : __ stx(O2_scratch, Address(O1_destslot, 0)); break; |
848 case 8 : __ stx(O2_scratch, Address(O1_destslot, 0)); break; |
850 default: ShouldNotReachHere(); |
849 default: ShouldNotReachHere(); |
851 } |
850 } |
852 } |
851 } |
853 |
852 |
854 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
853 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
855 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
854 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
856 } |
855 } |
857 break; |
856 break; |
858 |
857 |
859 case _adapter_dup_args: |
858 case _adapter_dup_args: |
893 __ add(O2_newarg, wordSize, O2_newarg); |
892 __ add(O2_newarg, wordSize, O2_newarg); |
894 __ cmp(O2_newarg, O1_oldarg); |
893 __ cmp(O2_newarg, O1_oldarg); |
895 __ brx(Assembler::less, false, Assembler::pt, loop); |
894 __ brx(Assembler::less, false, Assembler::pt, loop); |
896 __ delayed()->nop(); // FILLME |
895 __ delayed()->nop(); // FILLME |
897 |
896 |
898 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
897 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
899 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
898 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
900 } |
899 } |
901 break; |
900 break; |
902 |
901 |
903 case _adapter_drop_args: |
902 case _adapter_drop_args: |
911 __ ldsw(G3_amh_conversion, G5_stack_move); |
910 __ ldsw(G3_amh_conversion, G5_stack_move); |
912 __ sra(G5_stack_move, CONV_STACK_MOVE_SHIFT, G5_stack_move); |
911 __ sra(G5_stack_move, CONV_STACK_MOVE_SHIFT, G5_stack_move); |
913 |
912 |
914 remove_arg_slots(_masm, G5_stack_move, O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
913 remove_arg_slots(_masm, G5_stack_move, O0_argslot, O1_scratch, O2_scratch, O3_scratch); |
915 |
914 |
916 __ ld_ptr(G3_mh_vmtarget, G3_method_handle); |
915 __ load_heap_oop(G3_mh_vmtarget, G3_method_handle); |
917 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
916 __ jump_to_method_handle_entry(G3_method_handle, O1_scratch); |
918 } |
917 } |
919 break; |
918 break; |
920 |
919 |
921 case _adapter_collect_args: |
920 case _adapter_collect_args: |