m68k-ecos (Was: Re: [kaffe] WHICH LIBRARIES ARE NECESSARY TO RUN KAFFE?)

Dalibor Topic robilad at kaffe.org
Fri Dec 2 09:01:04 PST 2005


daniel at fh-konstanz.de wrote:
> Hello together.
> 
> I have a big problem since 4 weeks. I have ported kaffe-1.0.7 on my m68k
> platform with eCos as os. I have applied kaffe-1.0.7 because this version of
> kaffe was adapted for eCos.

Hallo daniel,

I've been largely absent from the lists for the last four weeks, I hope
I can still be of help.

> I have build kaffe with following options:
> 
> --with-engine=intrp
> --with-includes=/usr/local/m68k/lib/gcc/m68k-elf/3.4.3/install-tools/include
> --host=m68k-ecos --build=i686-cygwin --with-staticlib --with-staticbin
> --with-staticvm --without-x --with-threads=ecos-native

> But in the next function, kaffe is aborting and saying:
> 
> "INTERNAL ERROR: CHECK CLASSPATH AND INSTALLATION
> NegativeArrayException in ThreadGroup.java at line 84.
> "
> /* Init thread support */
> initThreads();
> 
> The error is when calling the do_execute_java_method and inside this method in
> the method call "callMethodV.
>
> WHATS THE PROBLEM?
>

the line of code looks like this:
... new Thread[threads.length + 1] ...

a NegativearrayException in Java means that the index used to access
elements of an array is negative, and as an array in Java may never have
elements located at a negative index ... the VM reports that as a bug.

Now, why threads.length+1 ends up negative ... I don't know, that's the
part you'll have to debug yourself, using gdb, presumably. Chances are
it overflows (very unlikely), or there is something bad happening wrt to
argument passing. In that case you may want to try building 1.0.7 to use
libffi for argument passing, using --enable-libffi. It may work better
than Kaffe's own sysdepmethodcall code. check out FAQ/FAQ.debugging for
some info on getting started with debugging. I'd suggest compiling
without optimisation, and walking through the do_execute_java_method
code in the debugger to convince yourself that it's passing the right
arguments around.

In your case, I'd also suggest running the sysdepCalltests first, and/or
tweaking the thread groups library code to work around the bug until you
can pin it down. As usual with the less mainstream platforms, gcc
compiler warnings may provide subtle guidance where things are going
horribly wrong.

> DO I NEED TO UPLOAD OTHER NECESSARY LIBRARIES ON MY PLATFORM?

I'd doubt it. The bug you've found seems to be an internal problem in
the VM from over here. But it's hard to tell, you may have more luck
asking the guys who wrote the ecos port first, they may have experienced
the same problems before, and know a fix/workaround.

In particular since you are compiling kaffe for m68k-ecos, I'd suggest
turning gcc's optimisation off (CFLAGS=-O0), as people have reported
various problems with m68k and older gcc version being overeager on
optimisation. I've CC:ed Kiyo, who I recall having worked around some
m68k gcc problems in the past, he may have additional sugegstions as well.

cheers,
dalibor topic




More information about the kaffe mailing list