patch for sparc sysdepCallMethod

Alexandre Oliva oliva at dcc.unicamp.br
Thu Apr 30 17:49:03 PDT 1998


Alexandre Oliva <oliva at dcc.unicamp.br> writes:

> Matthew P Gleeson <gleeson at ERC.MsState.Edu> writes:
>> I think I can see where the problem occurs: the sysdepCallMethod()
>> macro in config/sparc/common.h doesn't do the right thing with the
>> 64-bit jlong argument to Thread.sleep().

> Correct, it seems not to be prepared to handle longs. :-(

Now it does, with the attached patch.  Incidentally, this patch fixed
the problem I described a few days ago: on sparc, with engine intrp,
javac was unable to compile even simple programs; it would print an
error message stating that it couldn't locate the class's base class
file.  I'm pretty sure this had something to do with invoking native
methods that would take as argument or return a long.  This affected
the intrp only, because JIT would produce native method invocation
code inline, instead of relying on callMethodA.

There's still an open issue, however: sparc calling conventions state
that float arguments are promoted to double.  Kaffe's JIT, however,
will happily push floats into the argument list of a method, instead
of converting them to double.  When a JIT-compiled method calls
another, it works.  However, when a native method is invoked, the only 
way to read the float instead of the double is by using
va_arg(,float).  Declaring an argument as float is equivalent to
declaring it as double.  Returning a float is compiled as returning a
double.  This is something that should be fixed, but I still don't
know how to fix this in the JIT, so I'll leave this for someone else,
or at least for later.

Still on calling conventions: on most platforms, bytes and shorts are
automatically promoted to ints when used as function arguments or
return types.  Kaffe already relies on this (see
METHOD_RETURN_VALUE(), in kaffe/kaffe/kaffe.def, for example), and, in 
fact, reading jbytes, jshorts and the like with va_arg produces wrong
results on sparc.  So I modified callMethodV to use jint instead of
types that get promoted to it.  I have tested both intrp and jit on
x86 and sparc, and it all worked.  I hope it doesn't break other
platforms.  If it does, we may have to come up with a solution that
allows platform configuration files to override types to be used for
va_args.

> I'll try to fix that (unless it is fixed in the latest snapshot
> already).

It was not fixed in yesterday's snapshot.  I hope it is fixed in the
next one. :-)

-- 
Alexandre Oliva
mailto:oliva at dcc.unicamp.br mailto:aoliva at acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sparc-intrp.diff
Type: application/octet-stream
Size: 4864 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/19980430/95af65f0/attachment-0006.obj 


More information about the kaffe mailing list