Question on TemplateTable::prepare_invoke

Peng Du imdupeng at gmail.com
Wed Mar 3 12:33:51 PST 2010


Hi, Tom and Christian

You're right. The call indeed trashs some regs because pusha+popa solved
the problem. This seems a little brute-force though. Do you have a good
way to trace down which regs are trashed? 

Thanks a lot!




On Wed, 2010-03-03 at 12:11 -0800, Tom Rodriguez wrote: 
> While call_VM generally takes care of saving off any needed state it's 
> not implicitly safe to use every context. In particular I'd be suspicious 
> of calling it after load_invoke_cp_cache_entry since that sets up state 
> for use by later parts of the invoke path.
> 
> tom
> 

On Wed, 2010-03-03 at 21:09 +0100, Christian Thalinger wrote:
> On Tue, 2010-03-02 at 23:24 -0600, Peng Du wrote:
> > void TemplateTable::prepare_invoke(Register, Register, int) {
> >   const Register recv   = rcx;
> >   ...
> >   // load receiver if needed (note: no return address pushed yet)
> >   if (load_receiver) {
> >     __ movl(recv, flags);
> >     __ andl(recv, 0xFF);
> >     if (TaggedStackInterpreter) __ shll(recv, 1);  // index*2
> >     Address recv_addr(rsp, recv, Address::times_8,
> > -Interpreter::expr_offset_in_bytes(1));
> >     if (is_invokedynamic) {
> >       __ lea(recv, recv_addr);
> >     } else {
> >       __ movptr(recv, recv_addr);
> >       __ verify_oop(recv);
> >     }        
> >         
> >     // !!! cache receiver object !!!
> >     __ call_VM(noreg, CAST_FROM_FN_PTR(address, 
> >         InterpreterRuntime::cache_object), recv);    
> >   }
> > ...
> 
> > Is it because I somehow clobber the recv (rcx) register?
> 
> It's very likely that you trash some registers during the call.  Try to
> put pusha/popa around your call.
> 
> -- Christian
> 




More information about the hotspot-dev mailing list