[kaffe] Re: kjc on m68k/netbsd works.

Helmer Krämer hkraemer at freenet.de
Fri Aug 27 05:11:52 PDT 2004


On Tue, 24 Aug 2004 22:15:38 +0900 (JST)
Kiyo Inaba <inaba at src.ricoh.co.jp> wrote:

Hey Kiyo,

> In the current implementation, it looks to adjust SP in eprologue.
> In eprologue, it first calculate frame size by 'op_addal_ia', with
> a label associated with this instruction, based on current FP (the
> value for FP is adjusted by caller of eprologue), and then it escapes
> register set save area for NEXT method (the method which calls the
> method where we are now talking about) by using 'op_subaw_ia'.
> 
> As I said, it is too hard to detect how many registers are used,
> and constant SRNR (which is defined as 10 in jit.h) is used to
> keep the area for next method.
> 
> If I commented out this 'op_subaw_ia' and trace the behavior of
> kjc, I noticed 'a2' register value is changed when it was returned
> from 'tryBundle' method of kjc.

IMHO, it is not correct to comment out the op_subaw_ia in eprologue.
AFAIK, the layout of the stack is something like this (inside a method,
but not inside an exception handler):

                     |                    |
	       fp -> |--------------------|
                     |  local variables,  |
                     |   operand stack    |
                     |    and temps       |
                     |--------------------|
                     |  saved registers   |
               sp -> |--------------------|
                     |                    |
                                            

If the op_subaw_ia is commented out, the sp will point above the
register save area and instructions like pusharg_x will overwrite
the values of saved registers, since they're relative to sp.
 
> I am so sure that, at one time, even with this adjustment, kjc does
> not work, and I guess some other fix (maybe done by Helmer) also
> contributes to this problem.

Do you have any idea what might go wrong in that case?

Regards,
Helmer




More information about the kaffe mailing list