JIT on m68k?

Matthias Hopf (@Home) mshopf at ftpamiga.dialin.rrze.uni-erlangen.de
Sat Feb 22 21:05:26 PST 1997

Hi Richard!

> > I will do it for Amiga of course :) Thanx Richard!

First the good news - I managed to run HelloWorldApp :-)
It took some time to get it working - you assume that a6 is the frame
pointer, but it is a5 on the amiga...

I will change the code accordingly and send the patches to you.
And I found some code portions where you rely on some registers being exactly
one specified register (e.g. return register d0, etc.). I changed some of
these as well :)

On the other hand I guess it is the best documented jit engine available so
far :)

> Be aware that it is definitely not bug free -- e.g. it doesn't
> run javac properly.  I'm trying to find it, but it is subtle.

Now the bad news - you are right.
What happens on your machine? I tried to trace the bug down, but it seems to
be a *very* subtle side-effect.

What happens (and what I quite understand) is the following:

javac throws an uncaught exception (even this is a miracle for me..).
When kaffe tries to call uncaughtException() in ThreadGroup,
do_execute_java_method (support.c) is called with methods *mb ==NULL.
do_execute_java_method will findMethod() and
throwException(NoSuchMethodError) when mb is still NULL.

Now the mistery begins:
mb is *still* NULL and boom, crash on CALL_KAFFE_FUNCTION_VARARGS...

Perhaps something else has altered the code (Amiga has no MMU protection :-(
). Do you have more information?

> Oh, do you have a nice reliable way to identify and catch the
> chk trap on the Amiga?  I want to use it for array bounds checking

It should be no problem. AFAIK ixemul.library generates a SIGSEGV or
something similar for this trap.
The only instructions you should *never ever* use (and need ;)
are TAS and CAS, as in no circumstance I can use them on the Amiga.

> and eliminate about 10 instructions, two of which are conditional
> branches.  A/UX maps it to SIGILL, subcode 6, so it's easy here.

Yep, perhaps it's SIGILL here, too...

But I have another problem, which is related to the interpreter as well:
On the Amiga I have no way to detect NULL-pointer accesses.
Do you have any clue? I guess it is *horrible* work to insert trapeq commands
on every pointer access... And then there's still the question where pointer
accesses happen in the interpreter...
Do you know the important code points or do I have to scan the whole code?

BTW - another two questions :)

I have not found *any* way the softcall_xxx instructions are called (soft.c).
How are calls to them generated?

I don't understand your assembler syntax, and gcc does not understand it as
well, at least when *I* code like you...
I only know the (modern) syntax
   "move.l d0, d1"
but not your
   "move%.l %/d0,%/d1"
What is the meaning of this ambigous '%'??

Thanx again for you patience and your jit engine :)



    //             |   Matthias Hopf - "Hoeppel"   |    _      __
\\ //    Amiga     |  student of computer science  |  _|cience |-iction
 \X/ by conviction |      in Erlangen/Germany      | by belief in Future

 EMail:  mshopf at informatik.uni-erlangen.de
 Aminet: ftpamiga at epix.rrze.uni-erlangen.de
 WWW:    http://wwwcip.informatik.uni-erlangen.de/user/mshopf/

More information about the kaffe mailing list