[kaffe] Kaffe JIT on Alpha

Timothy Stack stack at cs.utah.edu
Tue Apr 22 13:02:01 PDT 2003


I'll butt in and try to offer some advice...

> Hi Dalibor,
> Thanks for your response. I actually managed to compile rt.jar on an x86 
> and use it to proceed in the build. This has atleast allowed me to try 
> and understand the problem.
> There is something I came across during debugging the code generated by 
> the JIT. Here is a sample prolog generated by the jit.
> 0:      lda     gp,0(pv)
> 4:      lda     sp,0(sp)
> 8:      stq     ra,0(sp)
> ...
> 24:     stq     fp,56(sp)
> ...
> 48:     lda     fp,0(sp)

This is actually a template, it will be changed later on.  If you CVS
update and get cross-language debugging (also called xdebugging) working,
it will make things much easier since you can do a 'disas' on the method
in gdb.

> My question is: shouldnt the stack pointer be decremented with the 
> framesize before various registers are saved?

That is what this line does:

> 4:      lda     sp,0(sp)

As I said, this it just a template, it will be changed to something like 
the following when the jitter is finished:

	lda sp, -24(sp)

Which subtracts 24 from the current stack pointer and stores it back in 
the register.

> The relevent piece of code 
> I attach below seems to not update sp at all. I find this to be the case 
> on mips as well. The push instructions on x86 take care of updating the 
> sp there. Or am I missing something here??
>         /* Calling Standard for Alpha Systems
>          *    Entry Code Sequence
>          * 2. If stack space is allocated (PDSC_RPD_FRAME_SIZE is not 
> 0), set
>          *    register SP to SP - PDSC_RPD_FRAME_SIZE.
>          *    After any necessary calculations and stack limit checks, this
>          *    step must be completed in exactly one instruction that 
> modifies
>          *    SP.  This instruction must be the one specified by
>          *    PDSC_RPD_SP_SET.  */
>         alpha_jit_info.sp_set = CODEPC / 4;
>         L->type = Lnegframe|Labsolute|Lgeneral;
>         L->at = (uintp)CODEPC;

These lines and 'L = const_label(1)' are doing the magic.  Once jitting
has completed and the final location of the code has been determined, the
jitter will go back through and fixup these labels (see FAQ/FAQ.jit3).  
So the next line:

>         op_lda(REG_sp, REG_sp, 0);

Will be rewritten by the LABEL_Lframe() macro in jit.h

> Thanks again....
> Kapil

tim stack

More information about the kaffe mailing list