Clarification on my comment w/1.0b3 on the netwinder

Godmar Back gback at
Thu Dec 10 13:19:17 PST 1998

 I copied the dynamic array trick from the Sparc sysdepMethod.
The first four args are always placed in registers.
It is the args after four for which we'll rely on the compiler
laying out thing properly, as we access them through an array.

I have never understood just why this works, and would not at all
be surprised if it broke in egcs.  Maybe they changed the way they
do dynamic arrays?  I believe they're a GNU extension anyway ---
in normal C, you can't write int f[n] with n not a constant.
Kiyo reported at one point that it would work without optimization,
but not when compiled with optimization.  I forgot what architecture
that was for.

	- Godmar

> The problem I'm running into is the same problem I encountered on the
> Alpha when the code for the stack-frame layout was incorrect.
> In particular, both the ARM and Alpha pass arguments in registers. For
> the arm, 4 arguments are passed in register. Additional arguments are
> placed in the call frame.
> When running the interpreter, things fail immediately for me after a
> call is made using 5 arguments. This leads me to believe that the
> arguments are possibly not being set up properly, or that the stack
> management code is incorrect. This was the problem on the Alpha, but
> it only occured there when using optimization (since that caused the
> code to not use an FP, and base everything from an SP).
> However, the problem I'm seeing (see below) occurs even when
> the ARM code is compiled with -O0.
> Before spending a lot of time on this, I'd like to see if anyone else
> has actually gotten 1.0b3 to work on an ARM system -- it might be a
> compiler bug on the system I'm using.
> Call: java/lang/String.getChars(II[CI)V.
> Call: java/lang/System.arraycopy(Ljava/lang/Object;ILjava/lang/Object;II)V.
> Cal with 5 args
> Call: java/lang/NullPointerException.<init>()V.
> Call: java/lang/RuntimeException.<init>()V.
> Call: java/lang/Exception.<init>()V.
> Call: java/lang/Throwable.<init>()V.
> Call: java/lang/Object.<init>()V.
> Call: java/lang/Throwable.fillInStackTrace()Ljava/lang/Throwable;.
> Cal with 1 args

More information about the kaffe mailing list