< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page

3641 
3642   const Register method = index;  // method must be rbx
3643   assert(method == rbx,
3644          "Method* must be rbx for interpreter calling convention");
3645 
3646   // do the call - the index is actually the method to call
3647   // that is, f2 is a vtable index if !is_vfinal, else f2 is a Method*
3648 
3649   // It's final, need a null check here!
3650   __ null_check(recv);
3651 
3652   // profile this call
3653   __ profile_final_call(rax);
3654   __ profile_arguments_type(rax, method, rbcp, true);
3655 
3656   __ jump_from_interpreted(method, rax);
3657 
3658   __ bind(notFinal);
3659 
3660   // get receiver klass
3661   __ null_check(recv, oopDesc::klass_offset_in_bytes());
3662   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3663   __ load_klass(rax, recv, tmp_load_klass);
3664 
3665   // profile this call
3666   __ profile_virtual_call(rax, rlocals, rdx);
3667   // get target Method* & entry point
3668   __ lookup_virtual_method(rax, index, method);
3669 
3670   __ profile_arguments_type(rdx, method, rbcp, true);
3671   __ jump_from_interpreted(method, rdx);
3672 }
3673 
3674 void TemplateTable::invokevirtual(int byte_no) {
3675   transition(vtos, vtos);
3676   assert(byte_no == f2_byte, "use this argument");
3677   prepare_invoke(byte_no,
3678                  rbx,    // method or vtable index
3679                  noreg,  // unused itable index
3680                  rcx, rdx); // recv, flags
3681 
3682   // rbx: index
3683   // rcx: receiver

3734   // Special case of invokeinterface called for virtual method of
3735   // java.lang.Object.  See cpCache.cpp for details.
3736   Label notObjectMethod;
3737   __ movl(rlocals, rdx);
3738   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift));
3739   __ jcc(Assembler::zero, notObjectMethod);
3740   invokevirtual_helper(rbx, rcx, rdx);
3741   // no return from above
3742   __ bind(notObjectMethod);
3743 
3744   Label no_such_interface; // for receiver subtype check
3745   Register recvKlass; // used for exception processing
3746 
3747   // Check for private method invocation - indicated by vfinal
3748   Label notVFinal;
3749   __ movl(rlocals, rdx);
3750   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift));
3751   __ jcc(Assembler::zero, notVFinal);
3752 
3753   // Get receiver klass into rlocals - also a null check
3754   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3755   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3756   __ load_klass(rlocals, rcx, tmp_load_klass);
3757 
3758   Label subtype;
3759   __ check_klass_subtype(rlocals, rax, rbcp, subtype);
3760   // If we get here the typecheck failed
3761   recvKlass = rdx;
3762   __ mov(recvKlass, rlocals); // shuffle receiver class for exception use
3763   __ jmp(no_such_interface);
3764 
3765   __ bind(subtype);
3766 
3767   // do the call - rbx is actually the method to call
3768 
3769   __ profile_final_call(rdx);
3770   __ profile_arguments_type(rdx, rbx, rbcp, true);
3771 
3772   __ jump_from_interpreted(rbx, rdx);
3773   // no return from above
3774   __ bind(notVFinal);
3775 
3776   // Get receiver klass into rdx - also a null check
3777   __ restore_locals();  // restore r14
3778   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3779   __ load_klass(rdx, rcx, tmp_load_klass);
3780 
3781   Label no_such_method;
3782 
3783   // Preserve method for throw_AbstractMethodErrorVerbose.
3784   __ mov(rcx, rbx);
3785   // Receiver subtype check against REFC.
3786   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3787   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3788                              rdx, rax, noreg,
3789                              // outputs: scan temp. reg, scan temp. reg
3790                              rbcp, rlocals,
3791                              no_such_interface,
3792                              /*return_method=*/false);
3793 
3794   // profile this call
3795   __ restore_bcp(); // rbcp was destroyed by receiver type check
3796   __ profile_virtual_call(rdx, rbcp, rlocals);
3797 
3798   // Get declaring interface class from method, and itable index
3799   __ load_method_holder(rax, rbx);

3981     // make sure rdx was multiple of 8
3982     Label L;
3983     // Ignore partial flag stall after shrl() since it is debug VM
3984     __ jcc(Assembler::carryClear, L);
3985     __ stop("object size is not multiple of 2 - adjust this code");
3986     __ bind(L);
3987     // rdx must be > 0, no extra check needed here
3988 #endif
3989 
3990     // initialize remaining object fields: rdx was a multiple of 8
3991     { Label loop;
3992     __ bind(loop);
3993     __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
3994     NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
3995     __ decrement(rdx);
3996     __ jcc(Assembler::notZero, loop);
3997     }
3998 
3999     // initialize object header only.
4000     __ bind(initialize_header);
4001     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes()),
4002               (intptr_t)markWord::prototype().value()); // header
4003     __ pop(rcx);   // get saved klass back in the register.
4004 #ifdef _LP64
4005     __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
4006     __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops

4007 #endif
4008     Register tmp_store_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4009     __ store_klass(rax, rcx, tmp_store_klass);  // klass
4010 
4011     {
4012       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4013       // Trigger dtrace event for fastpath
4014       __ push(atos);
4015       __ call_VM_leaf(
4016            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4017       __ pop(atos);
4018     }
4019 
4020     __ jmp(done);
4021   }
4022 
4023   // slow case
4024   __ bind(slow_case);
4025   __ pop(rcx);   // restore stack pointer to what it was when we came in.
4026   __ bind(slow_case_no_pop);
4027 
4028   Register rarg1 = LP64_ONLY(c_rarg1) NOT_LP64(rax);
4029   Register rarg2 = LP64_ONLY(c_rarg2) NOT_LP64(rdx);

4143           JVM_CONSTANT_Class);
4144   __ jcc(Assembler::equal, quicked);
4145 
4146   __ push(atos); // save receiver for result, and for GC
4147   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc));
4148   // vm_result_2 has metadata result
4149 
4150 #ifndef _LP64
4151   // borrow rdi from locals
4152   __ get_thread(rdi);
4153   __ get_vm_result_2(rax, rdi);
4154   __ restore_locals();
4155 #else
4156   __ get_vm_result_2(rax, r15_thread);
4157 #endif
4158 
4159   __ pop_ptr(rdx); // restore receiver
4160   __ verify_oop(rdx);
4161   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4162   __ load_klass(rdx, rdx, tmp_load_klass);
4163   __ jmpb(resolved);
4164 
4165   // Get superklass in rax and subklass in rdx
4166   __ bind(quicked);
4167   __ load_klass(rdx, rax, tmp_load_klass);
4168   __ load_resolved_klass_at_index(rax, rcx, rbx);
4169 
4170   __ bind(resolved);
4171 
4172   // Generate subtype check.  Blows rcx, rdi
4173   // Superklass in rax.  Subklass in rdx.
4174   __ gen_subtype_check(rdx, ok_is_subtype);
4175 
4176   // Come here on failure
4177   __ xorl(rax, rax);
4178   __ jmpb(done);
4179   // Come here on success
4180   __ bind(ok_is_subtype);
4181   __ movl(rax, 1);
4182 
4183   // Collect counts on whether this test sees NULLs a lot or not.

3641 
3642   const Register method = index;  // method must be rbx
3643   assert(method == rbx,
3644          "Method* must be rbx for interpreter calling convention");
3645 
3646   // do the call - the index is actually the method to call
3647   // that is, f2 is a vtable index if !is_vfinal, else f2 is a Method*
3648 
3649   // It's final, need a null check here!
3650   __ null_check(recv);
3651 
3652   // profile this call
3653   __ profile_final_call(rax);
3654   __ profile_arguments_type(rax, method, rbcp, true);
3655 
3656   __ jump_from_interpreted(method, rax);
3657 
3658   __ bind(notFinal);
3659 
3660   // get receiver klass

3661   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3662   __ load_klass(rax, recv, tmp_load_klass, true);
3663 
3664   // profile this call
3665   __ profile_virtual_call(rax, rlocals, rdx);
3666   // get target Method* & entry point
3667   __ lookup_virtual_method(rax, index, method);
3668 
3669   __ profile_arguments_type(rdx, method, rbcp, true);
3670   __ jump_from_interpreted(method, rdx);
3671 }
3672 
3673 void TemplateTable::invokevirtual(int byte_no) {
3674   transition(vtos, vtos);
3675   assert(byte_no == f2_byte, "use this argument");
3676   prepare_invoke(byte_no,
3677                  rbx,    // method or vtable index
3678                  noreg,  // unused itable index
3679                  rcx, rdx); // recv, flags
3680 
3681   // rbx: index
3682   // rcx: receiver

3733   // Special case of invokeinterface called for virtual method of
3734   // java.lang.Object.  See cpCache.cpp for details.
3735   Label notObjectMethod;
3736   __ movl(rlocals, rdx);
3737   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift));
3738   __ jcc(Assembler::zero, notObjectMethod);
3739   invokevirtual_helper(rbx, rcx, rdx);
3740   // no return from above
3741   __ bind(notObjectMethod);
3742 
3743   Label no_such_interface; // for receiver subtype check
3744   Register recvKlass; // used for exception processing
3745 
3746   // Check for private method invocation - indicated by vfinal
3747   Label notVFinal;
3748   __ movl(rlocals, rdx);
3749   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift));
3750   __ jcc(Assembler::zero, notVFinal);
3751 
3752   // Get receiver klass into rlocals - also a null check

3753   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3754   __ load_klass(rlocals, rcx, tmp_load_klass, true);
3755 
3756   Label subtype;
3757   __ check_klass_subtype(rlocals, rax, rbcp, subtype);
3758   // If we get here the typecheck failed
3759   recvKlass = rdx;
3760   __ mov(recvKlass, rlocals); // shuffle receiver class for exception use
3761   __ jmp(no_such_interface);
3762 
3763   __ bind(subtype);
3764 
3765   // do the call - rbx is actually the method to call
3766 
3767   __ profile_final_call(rdx);
3768   __ profile_arguments_type(rdx, rbx, rbcp, true);
3769 
3770   __ jump_from_interpreted(rbx, rdx);
3771   // no return from above
3772   __ bind(notVFinal);
3773 
3774   // Get receiver klass into rdx - also a null check
3775   __ restore_locals();  // restore r14
3776   __ load_klass(rdx, rcx, tmp_load_klass, true);

3777 
3778   Label no_such_method;
3779 
3780   // Preserve method for throw_AbstractMethodErrorVerbose.
3781   __ mov(rcx, rbx);
3782   // Receiver subtype check against REFC.
3783   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3784   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3785                              rdx, rax, noreg,
3786                              // outputs: scan temp. reg, scan temp. reg
3787                              rbcp, rlocals,
3788                              no_such_interface,
3789                              /*return_method=*/false);
3790 
3791   // profile this call
3792   __ restore_bcp(); // rbcp was destroyed by receiver type check
3793   __ profile_virtual_call(rdx, rbcp, rlocals);
3794 
3795   // Get declaring interface class from method, and itable index
3796   __ load_method_holder(rax, rbx);

3978     // make sure rdx was multiple of 8
3979     Label L;
3980     // Ignore partial flag stall after shrl() since it is debug VM
3981     __ jcc(Assembler::carryClear, L);
3982     __ stop("object size is not multiple of 2 - adjust this code");
3983     __ bind(L);
3984     // rdx must be > 0, no extra check needed here
3985 #endif
3986 
3987     // initialize remaining object fields: rdx was a multiple of 8
3988     { Label loop;
3989     __ bind(loop);
3990     __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
3991     NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
3992     __ decrement(rdx);
3993     __ jcc(Assembler::notZero, loop);
3994     }
3995 
3996     // initialize object header only.
3997     __ bind(initialize_header);


3998     __ pop(rcx);   // get saved klass back in the register.
3999     __ movptr(rbx, Address(rcx, Klass::prototype_header_offset()));
4000     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes ()), rbx);
4001 #ifndef _LP64
4002     __ store_klass(rax, rcx);  // klass
4003 #endif


4004 
4005     {
4006       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4007       // Trigger dtrace event for fastpath
4008       __ push(atos);
4009       __ call_VM_leaf(
4010            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4011       __ pop(atos);
4012     }
4013 
4014     __ jmp(done);
4015   }
4016 
4017   // slow case
4018   __ bind(slow_case);
4019   __ pop(rcx);   // restore stack pointer to what it was when we came in.
4020   __ bind(slow_case_no_pop);
4021 
4022   Register rarg1 = LP64_ONLY(c_rarg1) NOT_LP64(rax);
4023   Register rarg2 = LP64_ONLY(c_rarg2) NOT_LP64(rdx);

4137           JVM_CONSTANT_Class);
4138   __ jcc(Assembler::equal, quicked);
4139 
4140   __ push(atos); // save receiver for result, and for GC
4141   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc));
4142   // vm_result_2 has metadata result
4143 
4144 #ifndef _LP64
4145   // borrow rdi from locals
4146   __ get_thread(rdi);
4147   __ get_vm_result_2(rax, rdi);
4148   __ restore_locals();
4149 #else
4150   __ get_vm_result_2(rax, r15_thread);
4151 #endif
4152 
4153   __ pop_ptr(rdx); // restore receiver
4154   __ verify_oop(rdx);
4155   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4156   __ load_klass(rdx, rdx, tmp_load_klass);
4157   __ jmp(resolved);
4158 
4159   // Get superklass in rax and subklass in rdx
4160   __ bind(quicked);
4161   __ load_klass(rdx, rax, tmp_load_klass);
4162   __ load_resolved_klass_at_index(rax, rcx, rbx);
4163 
4164   __ bind(resolved);
4165 
4166   // Generate subtype check.  Blows rcx, rdi
4167   // Superklass in rax.  Subklass in rdx.
4168   __ gen_subtype_check(rdx, ok_is_subtype);
4169 
4170   // Come here on failure
4171   __ xorl(rax, rax);
4172   __ jmpb(done);
4173   // Come here on success
4174   __ bind(ok_is_subtype);
4175   __ movl(rax, 1);
4176 
4177   // Collect counts on whether this test sees NULLs a lot or not.
< prev index next >