< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page

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

3732   // Special case of invokeinterface called for virtual method of
3733   // java.lang.Object.  See cpCache.cpp for details.
3734   Label notObjectMethod;
3735   __ movl(rlocals, rdx);
3736   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift));
3737   __ jcc(Assembler::zero, notObjectMethod);
3738   invokevirtual_helper(rbx, rcx, rdx);
3739   // no return from above
3740   __ bind(notObjectMethod);
3741 
3742   Label no_such_interface; // for receiver subtype check
3743   Register recvKlass; // used for exception processing
3744 
3745   // Check for private method invocation - indicated by vfinal
3746   Label notVFinal;
3747   __ movl(rlocals, rdx);
3748   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift));
3749   __ jcc(Assembler::zero, notVFinal);
3750 
3751   // Get receiver klass into rlocals - also a null check
3752   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3753   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3754   __ load_klass(rlocals, rcx, tmp_load_klass);
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   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3777   __ load_klass(rdx, rcx, tmp_load_klass);
3778 
3779   Label no_such_method;
3780 
3781   // Preserve method for throw_AbstractMethodErrorVerbose.
3782   __ mov(rcx, rbx);
3783   // Receiver subtype check against REFC.
3784   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3785   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3786                              rdx, rax, noreg,
3787                              // outputs: scan temp. reg, scan temp. reg
3788                              rbcp, rlocals,
3789                              no_such_interface,
3790                              /*return_method=*/false);
3791 
3792   // profile this call
3793   __ restore_bcp(); // rbcp was destroyed by receiver type check
3794   __ profile_virtual_call(rdx, rbcp, rlocals);
3795 
3796   // Get declaring interface class from method, and itable index
3797   __ load_method_holder(rax, rbx);

4005     // make sure rdx was multiple of 8
4006     Label L;
4007     // Ignore partial flag stall after shrl() since it is debug VM
4008     __ jcc(Assembler::carryClear, L);
4009     __ stop("object size is not multiple of 2 - adjust this code");
4010     __ bind(L);
4011     // rdx must be > 0, no extra check needed here
4012 #endif
4013 
4014     // initialize remaining object fields: rdx was a multiple of 8
4015     { Label loop;
4016     __ bind(loop);
4017     __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
4018     NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
4019     __ decrement(rdx);
4020     __ jcc(Assembler::notZero, loop);
4021     }
4022 
4023     // initialize object header only.
4024     __ bind(initialize_header);
4025     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes()),
4026               (intptr_t)markWord::prototype().value()); // header
4027     __ pop(rcx);   // get saved klass back in the register.
4028 #ifdef _LP64
4029     __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
4030     __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops

4031 #endif
4032     Register tmp_store_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4033     __ store_klass(rax, rcx, tmp_store_klass);  // klass
4034 
4035     {
4036       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4037       // Trigger dtrace event for fastpath
4038       __ push(atos);
4039       __ call_VM_leaf(
4040            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4041       __ pop(atos);
4042     }
4043 
4044     __ jmp(done);
4045   }
4046 
4047   // slow case
4048   __ bind(slow_case);
4049   __ pop(rcx);   // restore stack pointer to what it was when we came in.
4050   __ bind(slow_case_no_pop);
4051 
4052   Register rarg1 = LP64_ONLY(c_rarg1) NOT_LP64(rax);
4053   Register rarg2 = LP64_ONLY(c_rarg2) NOT_LP64(rdx);

4167           JVM_CONSTANT_Class);
4168   __ jcc(Assembler::equal, quicked);
4169 
4170   __ push(atos); // save receiver for result, and for GC
4171   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc));
4172   // vm_result_2 has metadata result
4173 
4174 #ifndef _LP64
4175   // borrow rdi from locals
4176   __ get_thread(rdi);
4177   __ get_vm_result_2(rax, rdi);
4178   __ restore_locals();
4179 #else
4180   __ get_vm_result_2(rax, r15_thread);
4181 #endif
4182 
4183   __ pop_ptr(rdx); // restore receiver
4184   __ verify_oop(rdx);
4185   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4186   __ load_klass(rdx, rdx, tmp_load_klass);
4187   __ jmpb(resolved);
4188 
4189   // Get superklass in rax and subklass in rdx
4190   __ bind(quicked);
4191   __ load_klass(rdx, rax, tmp_load_klass);
4192   __ load_resolved_klass_at_index(rax, rcx, rbx);
4193 
4194   __ bind(resolved);
4195 
4196   // Generate subtype check.  Blows rcx, rdi
4197   // Superklass in rax.  Subklass in rdx.
4198   __ gen_subtype_check(rdx, ok_is_subtype);
4199 
4200   // Come here on failure
4201   __ xorl(rax, rax);
4202   __ jmpb(done);
4203   // Come here on success
4204   __ bind(ok_is_subtype);
4205   __ movl(rax, 1);
4206 
4207   // Collect counts on whether this test sees NULLs a lot or not.

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

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

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

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

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

4002     // make sure rdx was multiple of 8
4003     Label L;
4004     // Ignore partial flag stall after shrl() since it is debug VM
4005     __ jcc(Assembler::carryClear, L);
4006     __ stop("object size is not multiple of 2 - adjust this code");
4007     __ bind(L);
4008     // rdx must be > 0, no extra check needed here
4009 #endif
4010 
4011     // initialize remaining object fields: rdx was a multiple of 8
4012     { Label loop;
4013     __ bind(loop);
4014     __ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 1*oopSize), rcx);
4015     NOT_LP64(__ movptr(Address(rax, rdx, Address::times_8, sizeof(oopDesc) - 2*oopSize), rcx));
4016     __ decrement(rdx);
4017     __ jcc(Assembler::notZero, loop);
4018     }
4019 
4020     // initialize object header only.
4021     __ bind(initialize_header);


4022     __ pop(rcx);   // get saved klass back in the register.
4023     __ movptr(rbx, Address(rcx, Klass::prototype_header_offset()));
4024     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes ()), rbx);
4025 #ifndef _LP64
4026     __ store_klass(rax, rcx);  // klass
4027 #endif


4028 
4029     {
4030       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4031       // Trigger dtrace event for fastpath
4032       __ push(atos);
4033       __ call_VM_leaf(
4034            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4035       __ pop(atos);
4036     }
4037 
4038     __ jmp(done);
4039   }
4040 
4041   // slow case
4042   __ bind(slow_case);
4043   __ pop(rcx);   // restore stack pointer to what it was when we came in.
4044   __ bind(slow_case_no_pop);
4045 
4046   Register rarg1 = LP64_ONLY(c_rarg1) NOT_LP64(rax);
4047   Register rarg2 = LP64_ONLY(c_rarg2) NOT_LP64(rdx);

4161           JVM_CONSTANT_Class);
4162   __ jcc(Assembler::equal, quicked);
4163 
4164   __ push(atos); // save receiver for result, and for GC
4165   call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::quicken_io_cc));
4166   // vm_result_2 has metadata result
4167 
4168 #ifndef _LP64
4169   // borrow rdi from locals
4170   __ get_thread(rdi);
4171   __ get_vm_result_2(rax, rdi);
4172   __ restore_locals();
4173 #else
4174   __ get_vm_result_2(rax, r15_thread);
4175 #endif
4176 
4177   __ pop_ptr(rdx); // restore receiver
4178   __ verify_oop(rdx);
4179   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4180   __ load_klass(rdx, rdx, tmp_load_klass);
4181   __ jmp(resolved);
4182 
4183   // Get superklass in rax and subklass in rdx
4184   __ bind(quicked);
4185   __ load_klass(rdx, rax, tmp_load_klass);
4186   __ load_resolved_klass_at_index(rax, rcx, rbx);
4187 
4188   __ bind(resolved);
4189 
4190   // Generate subtype check.  Blows rcx, rdi
4191   // Superklass in rax.  Subklass in rdx.
4192   __ gen_subtype_check(rdx, ok_is_subtype);
4193 
4194   // Come here on failure
4195   __ xorl(rax, rax);
4196   __ jmpb(done);
4197   // Come here on success
4198   __ bind(ok_is_subtype);
4199   __ movl(rax, 1);
4200 
4201   // Collect counts on whether this test sees NULLs a lot or not.
< prev index next >