src/cpu/x86/vm/methodHandles_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File 6893081 Sdiff src/cpu/x86/vm

src/cpu/x86/vm/methodHandles_x86.cpp

Print this page




 518       } else {
 519         assert(ek == _bound_ref_mh || ek == _bound_ref_direct_mh, "must be ref");
 520         arg_type = T_OBJECT;
 521       }
 522       int arg_slots = type2size[arg_type];
 523       int arg_mask  = (arg_type == T_OBJECT ? _INSERT_REF_MASK :
 524                        arg_slots == 1       ? _INSERT_INT_MASK :  _INSERT_LONG_MASK);
 525 
 526       // make room for the new argument:
 527       __ movl(rax_argslot, rcx_bmh_vmargslot);
 528       __ lea(rax_argslot, __ argument_address(rax_argslot));
 529       insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask,
 530                        rax_argslot, rbx_temp, rdx_temp);
 531 
 532       // store bound argument into the new stack slot:
 533       __ movptr(rbx_temp, rcx_bmh_argument);
 534       Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type));
 535       if (arg_type == T_OBJECT) {
 536         __ movptr(Address(rax_argslot, 0), rbx_temp);
 537       } else {
 538         __ load_sized_value(rbx_temp, prim_value_addr,
 539                             type2aelembytes(arg_type), is_signed_subword_type(arg_type));
 540         __ movptr(Address(rax_argslot, 0), rbx_temp);
 541 #ifndef _LP64
 542         if (arg_slots == 2) {
 543           __ movl(rbx_temp, prim_value_addr.plus_disp(wordSize));
 544           __ movl(Address(rax_argslot, Interpreter::stackElementSize()), rbx_temp);
 545         }
 546 #endif //_LP64
 547         break;
 548       }
 549 
 550       if (direct_to_method) {
 551         Register rbx_method = rbx_temp;
 552         __ movptr(rbx_method, rcx_mh_vmtarget);
 553         __ verify_oop(rbx_method);
 554         __ jmp(rbx_method_fie);
 555       } else {
 556         __ movptr(rcx_recv, rcx_mh_vmtarget);
 557         __ verify_oop(rcx_recv);
 558         __ jump_to_method_handle_entry(rcx_recv, rdx_temp);
 559       }
 560     }
 561     break;
 562 
 563   case _adapter_retype_only:
 564   case _adapter_retype_raw:
 565     // immediately jump to the next MH layer:
 566     __ movptr(rcx_recv, rcx_mh_vmtarget);
 567     __ verify_oop(rcx_recv);


 661         }
 662         break;
 663       default:
 664         assert(false, "");
 665       }
 666       goto finish_int_conversion;
 667     }
 668 
 669   finish_int_conversion:
 670     {
 671       Register rbx_vminfo = rbx_temp;
 672       __ movl(rbx_vminfo, rcx_amh_conversion);
 673       assert(CONV_VMINFO_SHIFT == 0, "preshifted");
 674 
 675       // get the new MH:
 676       __ movptr(rcx_recv, rcx_mh_vmtarget);
 677       // (now we are done with the old MH)
 678 
 679       // original 32-bit vmdata word must be of this form:
 680       //    | MBZ:16 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 |
 681       __ xchgl(rcx, rbx_vminfo);                // free rcx for shifts
 682       __ shll(rdx_temp /*, rcx*/);
 683       Label zero_extend, done;
 684       __ testl(rcx, CONV_VMINFO_SIGN_FLAG);
 685       __ jcc(Assembler::zero, zero_extend);
 686 
 687       // this path is taken for int->byte, int->short
 688       __ sarl(rdx_temp /*, rcx*/);
 689       __ jmp(done);
 690 
 691       __ bind(zero_extend);
 692       // this is taken for int->char
 693       __ shrl(rdx_temp /*, rcx*/);
 694 
 695       __ bind(done);
 696       __ movptr(vmarg, rdx_temp);
 697       __ xchgl(rcx, rbx_vminfo);                // restore rcx_recv
 698 
 699       __ jump_to_method_handle_entry(rcx_recv, rdx_temp);
 700     }
 701     break;
 702 
 703   case _adapter_opt_i2l:        // optimized subcase of adapt_prim_to_prim
 704   case _adapter_opt_unboxl:     // optimized subcase of adapt_ref_to_prim
 705     {
 706       // perform an in-place int-to-long or ref-to-long conversion
 707       __ movl(rax_argslot, rcx_amh_vmargslot);
 708 
 709       // on a little-endian machine we keep the first slot and add another after
 710       __ lea(rax_argslot, __ argument_address(rax_argslot, 1));
 711       insert_arg_slots(_masm, stack_move_unit(), _INSERT_INT_MASK,
 712                        rax_argslot, rbx_temp, rdx_temp);
 713       Address vmarg1(rax_argslot, -Interpreter::stackElementSize());
 714       Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize());
 715 
 716       switch (ek) {
 717       case _adapter_opt_i2l:




 518       } else {
 519         assert(ek == _bound_ref_mh || ek == _bound_ref_direct_mh, "must be ref");
 520         arg_type = T_OBJECT;
 521       }
 522       int arg_slots = type2size[arg_type];
 523       int arg_mask  = (arg_type == T_OBJECT ? _INSERT_REF_MASK :
 524                        arg_slots == 1       ? _INSERT_INT_MASK :  _INSERT_LONG_MASK);
 525 
 526       // make room for the new argument:
 527       __ movl(rax_argslot, rcx_bmh_vmargslot);
 528       __ lea(rax_argslot, __ argument_address(rax_argslot));
 529       insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask,
 530                        rax_argslot, rbx_temp, rdx_temp);
 531 
 532       // store bound argument into the new stack slot:
 533       __ movptr(rbx_temp, rcx_bmh_argument);
 534       Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type));
 535       if (arg_type == T_OBJECT) {
 536         __ movptr(Address(rax_argslot, 0), rbx_temp);
 537       } else {
 538         __ load_sized_value(rdx_temp, prim_value_addr,
 539                             type2aelembytes(arg_type), is_signed_subword_type(arg_type));
 540         __ movptr(Address(rax_argslot, 0), rdx_temp);
 541 #ifndef _LP64
 542         if (arg_slots == 2) {
 543           __ movl(rdx_temp, prim_value_addr.plus_disp(wordSize));
 544           __ movl(Address(rax_argslot, Interpreter::stackElementSize()), rdx_temp);
 545         }
 546 #endif //_LP64

 547       }
 548 
 549       if (direct_to_method) {
 550         Register rbx_method = rbx_temp;
 551         __ movptr(rbx_method, rcx_mh_vmtarget);
 552         __ verify_oop(rbx_method);
 553         __ jmp(rbx_method_fie);
 554       } else {
 555         __ movptr(rcx_recv, rcx_mh_vmtarget);
 556         __ verify_oop(rcx_recv);
 557         __ jump_to_method_handle_entry(rcx_recv, rdx_temp);
 558       }
 559     }
 560     break;
 561 
 562   case _adapter_retype_only:
 563   case _adapter_retype_raw:
 564     // immediately jump to the next MH layer:
 565     __ movptr(rcx_recv, rcx_mh_vmtarget);
 566     __ verify_oop(rcx_recv);


 660         }
 661         break;
 662       default:
 663         assert(false, "");
 664       }
 665       goto finish_int_conversion;
 666     }
 667 
 668   finish_int_conversion:
 669     {
 670       Register rbx_vminfo = rbx_temp;
 671       __ movl(rbx_vminfo, rcx_amh_conversion);
 672       assert(CONV_VMINFO_SHIFT == 0, "preshifted");
 673 
 674       // get the new MH:
 675       __ movptr(rcx_recv, rcx_mh_vmtarget);
 676       // (now we are done with the old MH)
 677 
 678       // original 32-bit vmdata word must be of this form:
 679       //    | MBZ:16 | signBitCount:8 | srcDstTypes:8 | conversionOp:8 |
 680       __ xchgptr(rcx, rbx_vminfo);                // free rcx for shifts
 681       __ shll(rdx_temp /*, rcx*/);
 682       Label zero_extend, done;
 683       __ testl(rcx, CONV_VMINFO_SIGN_FLAG);
 684       __ jcc(Assembler::zero, zero_extend);
 685 
 686       // this path is taken for int->byte, int->short
 687       __ sarl(rdx_temp /*, rcx*/);
 688       __ jmp(done);
 689 
 690       __ bind(zero_extend);
 691       // this is taken for int->char
 692       __ shrl(rdx_temp /*, rcx*/);
 693 
 694       __ bind(done);
 695       __ movl(vmarg, rdx_temp);
 696       __ xchgptr(rcx, rbx_vminfo);                // restore rcx_recv
 697 
 698       __ jump_to_method_handle_entry(rcx_recv, rdx_temp);
 699     }
 700     break;
 701 
 702   case _adapter_opt_i2l:        // optimized subcase of adapt_prim_to_prim
 703   case _adapter_opt_unboxl:     // optimized subcase of adapt_ref_to_prim
 704     {
 705       // perform an in-place int-to-long or ref-to-long conversion
 706       __ movl(rax_argslot, rcx_amh_vmargslot);
 707 
 708       // on a little-endian machine we keep the first slot and add another after
 709       __ lea(rax_argslot, __ argument_address(rax_argslot, 1));
 710       insert_arg_slots(_masm, stack_move_unit(), _INSERT_INT_MASK,
 711                        rax_argslot, rbx_temp, rdx_temp);
 712       Address vmarg1(rax_argslot, -Interpreter::stackElementSize());
 713       Address vmarg2 = vmarg1.plus_disp(Interpreter::stackElementSize());
 714 
 715       switch (ek) {
 716       case _adapter_opt_i2l:


src/cpu/x86/vm/methodHandles_x86.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File