Kaffe 0.84/JIT on netbsd-m68k (long)
Hauke Fath
hauke@Espresso.Rhein-Neckar.DE
Tue, 3 Feb 1998 00:50:57 +0100
[ cc'ed to port-m68k -- sorry for the noise, guys. ;) ]
Hi, list!
After some rather unhappy experiments with Kaffe 0.9.x on a NetBSD/mac68k
machine I finally turned to 0.8.4.
This works, albeit s...l...o...w...l...y - the engine runs as interpreter
and is - according to the BYTE benchmark - about a factor of 50 slower than
a P90 with Symantec Café 1.0. Not exactly what you'd call usable.
So I started to crank up the JIT. Ah well...
I pulled over the JIT related files under ./config/m68k from A/UX and
applied some changes from the 0.92 OpenBSD files (the NetBSD gas is a
rather old beast and does not like Motorola syntax).
I then built the JIT with CFLAGS="-m68040 -g" and linked statically to make
debugging easier (the 1.3 gdb has a bug wrt. debugging of dynamically
linked apps).
The build went fine so far, but a "kaffe HelloWorldApp" died early
(apparently) in the attempt of translating the class (which is run fine by
the MacOS MRJ 2.0 and the Kaffe interpreter).
Attached is a trace; the point where it crashes varies from one run to the
next but is always beyond the start_instruction() call in .jit/machine.c
(usually a SIGSEV or illegal instruction fault). The [...] passages contain
single steps.
My question goes mainly to those who have/had their hands in the (MD) guts
of Kaffe: What are things to look for and to customize for a port to an
OS/architecture?
Any helpful comment is appreciated.
hauke
------------------------------------------------------------------------------
(gdb) set args HelloWorldApp
(gdb) b translate
Breakpoint 1 at 0x1764a: file ./jit/machine.c, line 119.
(gdb) run
Starting program: /u/hauke/work/Java/Kaffe/kaffe/kaffe/kaffe HelloWorldApp
Breakpoint 1, translate (meth=0x7c018) at ./jit/machine.c:119
(gdb) bt
#0 translate (meth=0x7c018) at ./jit/machine.c:119
#1 0x2212a in findMethodLocal (class=0x7b298, name=0x4f0d8, signature=0x4f058)
at lookup.c:248
#2 0x2216c in findMethod (class=0x7b298, name=0x4f0d8, signature=0x4f058)
at lookup.c:269
#3 0x8e4c in execute_java_constructor (ee=0x0,
cname=0x526b "java/lang/ThreadGroup", cc=0x7b298, signature=0x4f05a "()V")
at support.c:514
#4 0x5578 in initThreads () at thread.c:151
#5 0x3702 in initialiseKaffe () at baseClasses.c:95
#6 0x2806 in main (argc=2, argv=0xffffc8e4) at main.c:76
(gdb) b 212
Breakpoint 2 at 0x1793a: file ./jit/machine.c, line 212.
[ This is the call of start_instruction() ]
(gdb) cont
Continuing.
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=0) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=0, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=0, s2=0, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:53
[...]
_start_instruction (pc=0) at ./jit/icode.c:270
(gdb) s
translate (meth=0x7c018) at ./jit/machine.c:215
[...]
move_ref (dst=0x1072028, src=0x1072000) at ./jit/icode.c:473
(gdb) s
_slot_slot_slot (dst=0x1072028, s1=0x0, s2=0x1072000, f=0xb65a <mover_RxR>,
type=2) at ./jit/basecode.c:118
[...]
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=1) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=1, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=2, s2=2, f=0x214cc <prepareFunctionCall>,
type=0) at ./jit/basecode.c:53
[...]
_prepare_function_call (stk=2, temp=2) at ./jit/icode.c:293
(gdb) s
softcall_get_method_code_const (dst=0x107203c, method=0x52330)
at ./jit/icode.c:2517
(gdb) s
pusharg_ref_const (val=0x52330, idx=0) at ./jit/icode.c:1630
(gdb) s
_slot_const_const (dst=0x0, s1=17224704, s2=0, f=0x10858 <call_xCC>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=17224704, s2=0, f=0x10858 <call_xCC>, type=0)
at ./jit/basecode.c:53
[...]
call_ref (routine=0x26074) at ./jit/icode.c:1811
(gdb) s
call_soft (routine=0x26074) at ./jit/icode.c:1827
(gdb) s
softcall_get_method_code_const (dst=0x107203c, method=0x52330)
at ./jit/icode.c:2519
(gdb) s
popargs () at ./jit/icode.c:1677
(gdb) s
(gdb) s
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=4) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=4, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=0, s2=4, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:53
[...]
_start_instruction (pc=4) at ./jit/icode.c:270
(gdb) s
translate (meth=0x7c018) at ./jit/machine.c:215
[...]
move_ref (dst=0x1072028, src=0x1072000) at ./jit/icode.c:473
(gdb) s
_slot_slot_slot (dst=0x1072028, s1=0x0, s2=0x1072000, f=0xb65a <mover_RxR>,
type=2) at ./jit/basecode.c:118
[...]
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=5) at ./jit/icode.c:269
(gdb) s
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=7) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=7, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=0, s2=7, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:53
[...]
_start_instruction (pc=7) at ./jit/icode.c:270
(gdb) s
translate (meth=0x7c018) at ./jit/machine.c:215
[...]
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=10) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=10, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38
[...]
_slot_const_const (dst=0x0, s1=0, s2=10, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:53
[...]
_start_instruction (pc=10) at ./jit/icode.c:270
(gdb) s
translate (meth=0x7c018) at ./jit/machine.c:215
[...]
move_ref (dst=0x1072028, src=0x1072000) at ./jit/icode.c:473
(gdb) s
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=13) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=0x0, s1=0, s2=13, f=0x20fee <startInsn>, type=0)
at ./jit/basecode.c:51
(gdb) s
Breakpoint 2, translate (meth=0x7c018) at ./jit/machine.c:212
(gdb) s
Breakpoint 1, translate (meth=0x52330) at ./jit/machine.c:119
(gdb) s
internalLockMutex (mux=0x4a984) at locks.c:34
(gdb) finish
Run till exit from #0 internalLockMutex (mux=0x4a984) at locks.c:34
Breakpoint 2, translate (meth=0x52330) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=0) at ./jit/icode.c:269
(gdb) s
Program received signal SIGILL, Illegal instruction.
0x83bbc in ?? ()
(gdb) bt
#0 0x83bbc in ?? ()
#1 0x81c42 in ?? ()
#2 0x8f20 in execute_java_constructor (ee=0x0,
cname=0x526b "java/lang/ThreadGroup", cc=0x7b298, signature=0x4f05a "()V")
at support.c:531
#3 0x5578 in initThreads () at thread.c:151
#4 0x3702 in initialiseKaffe () at baseClasses.c:95
#5 0x2806 in main (argc=2, argv=0xffffc8e4) at main.c:76
(gdb)
--
"It's never straight up and down" (DEVO)