< prev index next >

src/hotspot/cpu/x86/templateTable_x86.cpp

Print this page




3769   // do the call
3770   __ profile_call(rax);
3771   __ profile_arguments_type(rax, rbx, rbcp, false);
3772   __ jump_from_interpreted(rbx, rax);
3773 }
3774 
3775 
3776 void TemplateTable::fast_invokevfinal(int byte_no) {
3777   transition(vtos, vtos);
3778   assert(byte_no == f2_byte, "use this argument");
3779   __ stop("fast_invokevfinal not used on x86");
3780 }
3781 
3782 
3783 void TemplateTable::invokeinterface(int byte_no) {
3784   transition(vtos, vtos);
3785   assert(byte_no == f1_byte, "use this argument");
3786   prepare_invoke(byte_no, rax, rbx,  // get f1 Klass*, f2 Method*
3787                  rcx, rdx); // recv, flags
3788 
3789   // rax: reference klass (from f1)
3790   // rbx: method (from f2)
3791   // rcx: receiver
3792   // rdx: flags
3793 



3794   // Special case of invokeinterface called for virtual method of
3795   // java.lang.Object.  See cpCacheOop.cpp for details.
3796   // This code isn't produced by javac, but could be produced by
3797   // another compliant java compiler.
3798   Label notMethod;
3799   __ movl(rlocals, rdx);
3800   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift));




3801 
3802   __ jcc(Assembler::zero, notMethod);

3803 
3804   invokevirtual_helper(rbx, rcx, rdx);
3805   __ bind(notMethod);

























3806 
3807   // Get receiver klass into rdx - also a null check
3808   __ restore_locals();  // restore r14
3809   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3810   __ load_klass(rdx, rcx);
3811 
3812   Label no_such_interface, no_such_method;
3813 
3814   // Preserve method for throw_AbstractMethodErrorVerbose.
3815   __ mov(rcx, rbx);
3816   // Receiver subtype check against REFC.
3817   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3818   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3819                              rdx, rax, noreg,
3820                              // outputs: scan temp. reg, scan temp. reg
3821                              rbcp, rlocals,
3822                              no_such_interface,
3823                              /*return_method=*/false);
3824 
3825   // profile this call
3826   __ restore_bcp(); // rbcp was destroyed by receiver type check
3827   __ profile_virtual_call(rdx, rbcp, rlocals);
3828 
3829   // Get declaring interface class from method, and itable index
3830   __ movptr(rax, Address(rbx, Method::const_offset()));
3831   __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
3832   __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));


3854   __ profile_called_method(rbx, rbcp, rdx);
3855   __ profile_arguments_type(rdx, rbx, rbcp, true);
3856 
3857   // do the call
3858   // rcx: receiver
3859   // rbx,: Method*
3860   __ jump_from_interpreted(rbx, rdx);
3861   __ should_not_reach_here();
3862 
3863   // exception handling code follows...
3864   // note: must restore interpreter registers to canonical
3865   //       state for exception handling to work correctly!
3866 
3867   __ bind(no_such_method);
3868   // throw exception
3869   __ pop(rbx);           // pop return address (pushed by prepare_invoke)
3870   __ restore_bcp();      // rbcp must be correct for exception handler   (was destroyed)
3871   __ restore_locals();   // make sure locals pointer is correct as well (was destroyed)
3872   // Pass arguments for generating a verbose error message.
3873 #ifdef _LP64
3874   Register recvKlass = c_rarg1;
3875   Register method    = c_rarg2;
3876   if (recvKlass != rdx) { __ movq(recvKlass, rdx); }
3877   if (method != rcx)    { __ movq(method, rcx);    }
3878 #else
3879   Register recvKlass = rdx;
3880   Register method    = rcx;
3881 #endif
3882   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3883              recvKlass, method);
3884   // The call_VM checks for exception, so we should never return here.
3885   __ should_not_reach_here();
3886 
3887   __ bind(no_such_interface);
3888   // throw exception
3889   __ pop(rbx);           // pop return address (pushed by prepare_invoke)
3890   __ restore_bcp();      // rbcp must be correct for exception handler   (was destroyed)
3891   __ restore_locals();   // make sure locals pointer is correct as well (was destroyed)
3892   // Pass arguments for generating a verbose error message.
3893   LP64_ONLY( if (recvKlass != rdx) { __ movq(recvKlass, rdx); } )
3894   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3895              recvKlass, rax);
3896   // the call_VM checks for exception, so we should never return here.
3897   __ should_not_reach_here();
3898 }
3899 




3769   // do the call
3770   __ profile_call(rax);
3771   __ profile_arguments_type(rax, rbx, rbcp, false);
3772   __ jump_from_interpreted(rbx, rax);
3773 }
3774 
3775 
3776 void TemplateTable::fast_invokevfinal(int byte_no) {
3777   transition(vtos, vtos);
3778   assert(byte_no == f2_byte, "use this argument");
3779   __ stop("fast_invokevfinal not used on x86");
3780 }
3781 
3782 
3783 void TemplateTable::invokeinterface(int byte_no) {
3784   transition(vtos, vtos);
3785   assert(byte_no == f1_byte, "use this argument");
3786   prepare_invoke(byte_no, rax, rbx,  // get f1 Klass*, f2 Method*
3787                  rcx, rdx); // recv, flags
3788 
3789   // rax: reference klass (from f1) if interface method
3790   // rbx: method (from f2)
3791   // rcx: receiver
3792   // rdx: flags
3793 
3794   // First check for Object case, then private interface method,
3795   // then regular interface method.
3796 
3797   // Special case of invokeinterface called for virtual method of
3798   // java.lang.Object.  See cpCache.cpp for details.
3799   Label notObjectMethod;


3800   __ movl(rlocals, rdx);
3801   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_forced_virtual_shift));
3802   __ jcc(Assembler::zero, notObjectMethod);
3803   invokevirtual_helper(rbx, rcx, rdx);
3804   // no return from above
3805   __ bind(notObjectMethod);
3806 
3807   Label no_such_interface; // for receiver subtype check
3808   Register recvKlass; // used for exception processing
3809 
3810   // Check for private method invocation - indicated by vfinal
3811   Label notVFinal;
3812   __ movl(rlocals, rdx);
3813   __ andl(rlocals, (1 << ConstantPoolCacheEntry::is_vfinal_shift));
3814   __ jcc(Assembler::zero, notVFinal);
3815 
3816   // Get receiver klass into rlocals - also a null check
3817   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3818   __ load_klass(rlocals, rcx);
3819 
3820   Label subtype;
3821   __ check_klass_subtype(rlocals, rax, rbcp, subtype);
3822   // If we get here the typecheck failed
3823   recvKlass = rdx;
3824   __ mov(recvKlass, rlocals); // shuffle receiver class for exception use
3825   __ jmp(no_such_interface);
3826 
3827   __ bind(subtype);
3828 
3829   // do the call - rbx is actually the method to call
3830 
3831   __ profile_final_call(rdx);
3832   __ profile_arguments_type(rdx, rbx, rbcp, true);
3833 
3834   __ jump_from_interpreted(rbx, rdx);
3835   // no return from above
3836   __ bind(notVFinal);
3837 
3838   // Get receiver klass into rdx - also a null check
3839   __ restore_locals();  // restore r14
3840   __ null_check(rcx, oopDesc::klass_offset_in_bytes());
3841   __ load_klass(rdx, rcx);
3842 
3843   Label no_such_method;
3844 
3845   // Preserve method for throw_AbstractMethodErrorVerbose.
3846   __ mov(rcx, rbx);
3847   // Receiver subtype check against REFC.
3848   // Superklass in rax. Subklass in rdx. Blows rcx, rdi.
3849   __ lookup_interface_method(// inputs: rec. class, interface, itable index
3850                              rdx, rax, noreg,
3851                              // outputs: scan temp. reg, scan temp. reg
3852                              rbcp, rlocals,
3853                              no_such_interface,
3854                              /*return_method=*/false);
3855 
3856   // profile this call
3857   __ restore_bcp(); // rbcp was destroyed by receiver type check
3858   __ profile_virtual_call(rdx, rbcp, rlocals);
3859 
3860   // Get declaring interface class from method, and itable index
3861   __ movptr(rax, Address(rbx, Method::const_offset()));
3862   __ movptr(rax, Address(rax, ConstMethod::constants_offset()));
3863   __ movptr(rax, Address(rax, ConstantPool::pool_holder_offset_in_bytes()));


3885   __ profile_called_method(rbx, rbcp, rdx);
3886   __ profile_arguments_type(rdx, rbx, rbcp, true);
3887 
3888   // do the call
3889   // rcx: receiver
3890   // rbx,: Method*
3891   __ jump_from_interpreted(rbx, rdx);
3892   __ should_not_reach_here();
3893 
3894   // exception handling code follows...
3895   // note: must restore interpreter registers to canonical
3896   //       state for exception handling to work correctly!
3897 
3898   __ bind(no_such_method);
3899   // throw exception
3900   __ pop(rbx);           // pop return address (pushed by prepare_invoke)
3901   __ restore_bcp();      // rbcp must be correct for exception handler   (was destroyed)
3902   __ restore_locals();   // make sure locals pointer is correct as well (was destroyed)
3903   // Pass arguments for generating a verbose error message.
3904 #ifdef _LP64
3905   recvKlass = c_rarg1;
3906   Register method    = c_rarg2;
3907   if (recvKlass != rdx) { __ movq(recvKlass, rdx); }
3908   if (method != rcx)    { __ movq(method, rcx);    }
3909 #else
3910   recvKlass = rdx;
3911   Register method    = rcx;
3912 #endif
3913   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodErrorVerbose),
3914              recvKlass, method);
3915   // The call_VM checks for exception, so we should never return here.
3916   __ should_not_reach_here();
3917 
3918   __ bind(no_such_interface);
3919   // throw exception
3920   __ pop(rbx);           // pop return address (pushed by prepare_invoke)
3921   __ restore_bcp();      // rbcp must be correct for exception handler   (was destroyed)
3922   __ restore_locals();   // make sure locals pointer is correct as well (was destroyed)
3923   // Pass arguments for generating a verbose error message.
3924   LP64_ONLY( if (recvKlass != rdx) { __ movq(recvKlass, rdx); } )
3925   __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose),
3926              recvKlass, rax);
3927   // the call_VM checks for exception, so we should never return here.
3928   __ should_not_reach_here();
3929 }
3930 


< prev index next >