< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page

3640 
3641   const Register method = index;  // method must be rbx
3642   assert(method == rbx,
3643          "Method* must be rbx for interpreter calling convention");
3644 
3645   // do the call - the index is actually the method to call
3646   // that is, f2 is a vtable index if !is_vfinal, else f2 is a Method*
3647 
3648   // It's final, need a null check here!
3649   __ null_check(recv);
3650 
3651   // profile this call
3652   __ profile_final_call(rax);
3653   __ profile_arguments_type(rax, method, rbcp, true);
3654 
3655   __ jump_from_interpreted(method, rax);
3656 
3657   __ bind(notFinal);
3658 
3659   // get receiver klass
3660   __ null_check(recv, oopDesc::klass_offset_in_bytes());
3661   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3662   __ load_klass(rax, recv, tmp_load_klass);
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   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3754   Register tmp_load_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
3755   __ load_klass(rlocals, rcx, tmp_load_klass);
3756 
3757   Label subtype;
3758   __ check_klass_subtype(rlocals, rax, rbcp, subtype);
3759   // If we get here the typecheck failed
3760   recvKlass = rdx;
3761   __ mov(recvKlass, rlocals); // shuffle receiver class for exception use
3762   __ jmp(no_such_interface);
3763 
3764   __ bind(subtype);
3765 
3766   // do the call - rbx is actually the method to call
3767 
3768   __ profile_final_call(rdx);
3769   __ profile_arguments_type(rdx, rbx, rbcp, true);
3770 
3771   __ jump_from_interpreted(rbx, rdx);
3772   // no return from above
3773   __ bind(notVFinal);
3774 
3775   // Get receiver klass into rdx - also a null check
3776   __ restore_locals();  // restore r14
3777   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3778   __ load_klass(rdx, rcx, tmp_load_klass);
3779 
3780   Label no_such_method;
3781 
3782   // Preserve method for throw_AbstractMethodErrorVerbose.
3783   __ mov(rcx, rbx);
3784   // Receiver subtype check against REFC.
3785   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3786   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3787                              rdx, rax, noreg,
3788                              // outputs: scan temp. reg, scan temp. reg
3789                              rbcp, rlocals,
3790                              no_such_interface,
3791                              /*return_method=*/false);
3792 
3793   // profile this call
3794   __ restore_bcp(); // rbcp was destroyed by receiver type check
3795   __ profile_virtual_call(rdx, rbcp, rlocals);
3796 
3797   // Get declaring interface class from method, and itable index
3798   __ load_method_holder(rax, rbx);

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


4029 #ifdef _LP64
4030     __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
4031     __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops
4032 #endif
4033     Register tmp_store_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4034     __ store_klass(rax, rcx, tmp_store_klass);  // klass
4035 
4036     {
4037       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4038       // Trigger dtrace event for fastpath
4039       __ push(atos);
4040       __ call_VM_leaf(
4041            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4042       __ pop(atos);
4043     }
4044 
4045     __ jmp(done);
4046   }
4047 
4048   // slow case

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

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

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

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

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


4023     __ pop(rcx);   // get saved klass back in the register.
4024     __ movptr(rbx, Address(rcx, Klass::prototype_header_offset()));
4025     __ movptr(Address(rax, oopDesc::mark_offset_in_bytes ()), rbx);
4026 #ifdef _LP64
4027     __ xorl(rsi, rsi); // use zero reg to clear memory (shorter code)
4028     __ store_klass_gap(rax, rsi);  // zero klass gap for compressed oops
4029 #endif
4030     Register tmp_store_klass = LP64_ONLY(rscratch1) NOT_LP64(noreg);
4031     __ store_klass(rax, rcx, tmp_store_klass);  // klass
4032 
4033     {
4034       SkipIfEqual skip_if(_masm, &DTraceAllocProbes, 0);
4035       // Trigger dtrace event for fastpath
4036       __ push(atos);
4037       __ call_VM_leaf(
4038            CAST_FROM_FN_PTR(address, static_cast<int (*)(oopDesc*)>(SharedRuntime::dtrace_object_alloc)), rax);
4039       __ pop(atos);
4040     }
4041 
4042     __ jmp(done);
4043   }
4044 
4045   // slow case

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