Request for reviews (M): 6930772: JSR 292 needs to support SPARC C1

Christian Thalinger Christian.Thalinger at Sun.COM
Wed Apr 21 02:22:27 PDT 2010


On Tue, 2010-04-20 at 14:49 -0700, John Rose wrote:
> On Apr 19, 2010, at 3:54 AM, Christian Thalinger wrote:
> 
> > L0?  I think you mean L7.  I only use L0 in unwind_exception to store a
> > temporary result.
> 
> Yes, I meant L7.  (I was looking at L0 used as a temp. nearby in
> c1_Runtime1_sparc.cpp.)
> 
> The places where C1 uses L7 to correct the stack need to be clearly
> linked, perhaps by a shared symbolic constant.
> 
> I see these places:
>  - method_handle_invoke_SP_save_opr in c1_FrameMap_sparc.hpp
>  - the tricky restore of L7 to SP in c1_Runtime1_sparc.cpp
>  - the use of L7 to correct sp_adjustment_by_callee in frame_sparc.cpp
> 
> The shared symbolic constant could be method_handle_invoke_SP_save_opr
> itself, if there's a way of digging L7 out of it.

Maybe we should add a register definition like rbp_mh_SP_save and
L7_mh_SP_save for x86 and SPARC respectively and use that one to have a
common shared symbolic constant across all compilers.
method_handle_invoke_SP_save_opr would be C1 only.

Looking at the C2 changes this wouldn't cover all uses, e.g.:

!   return L7_REGP_mask;

+ instruct CallStaticJavaHandle(method meth, l7RegP l7) %{
+   effect(USE meth, KILL l7);

At least the register definition could be used in the frame code and in
the preserve_SP/restore_SP code.

> 
> The basic rule here is the each type of frame that makes method handle
> invokes must preserve SP across those invokes.
> 
> The interpreter already does so, stashing SP in the last_sp stack
> frame variable on all platforms.
> 
> On Intel, both compilers (C1 and C2) stash SP in RBP.  On SPARC they
> both use L7.
> 
> When walking the stack, the preserved SP has to be taken into account.
> For the interpreter this is based on the last_sp variable, which is
> accessed via the frame pointer.  For compiled code, which doesn't
> necessarily have frame pointers, the stack walker has to (a) determine
> if the call was a MH invoke, and (b) if so pull the corrected stack
> pointer out of a preserved register.
> 
> Is that all correct?  If so, the story (and what charming one it
> is :-) should be put into comments somewhere, perhaps near the shared
> symbolic constant for the preserved register.

Yes that's all correct and a nice story indeed :-)

-- Christian



More information about the hotspot-compiler-dev mailing list