Subject: Kaffe 0.84/JIT on netbsd-m68k (long)
To: Kaffe mailing-list <kaffe@rufus.w3.org>
From: Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
List: port-m68k
Date: 02/03/1998 00:50:57
[ 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=E9 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=3D"-m68040 -g" and linked statically to mak=
e
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=3D0x7c018) at ./jit/machine.c:119
(gdb) bt
#0  translate (meth=3D0x7c018) at ./jit/machine.c:119
#1  0x2212a in findMethodLocal (class=3D0x7b298, name=3D0x4f0d8, signature=
=3D0x4f058)
    at lookup.c:248
#2  0x2216c in findMethod (class=3D0x7b298, name=3D0x4f0d8, signature=3D0x4f=
058)
    at lookup.c:269
#3  0x8e4c in execute_java_constructor (ee=3D0x0,
    cname=3D0x526b "java/lang/ThreadGroup", cc=3D0x7b298, signature=3D0x4f05=
a "()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=3D2, argv=3D0xffffc8e4) 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=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D0) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D0, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D0, s2=3D0, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:53

[...]

_start_instruction (pc=3D0) at ./jit/icode.c:270
(gdb) s
translate (meth=3D0x7c018) at ./jit/machine.c:215

[...]

move_ref (dst=3D0x1072028, src=3D0x1072000) at ./jit/icode.c:473
(gdb) s
_slot_slot_slot (dst=3D0x1072028, s1=3D0x0, s2=3D0x1072000, f=3D0xb65a <move=
r_RxR>,
    type=3D2) at ./jit/basecode.c:118

[...]


Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D1) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D1, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D2, s2=3D2, f=3D0x214cc <prepareFunctionCa=
ll>,
    type=3D0) at ./jit/basecode.c:53

[...]

_prepare_function_call (stk=3D2, temp=3D2) at ./jit/icode.c:293
(gdb) s
softcall_get_method_code_const (dst=3D0x107203c, method=3D0x52330)
    at ./jit/icode.c:2517
(gdb) s
pusharg_ref_const (val=3D0x52330, idx=3D0) at ./jit/icode.c:1630
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D17224704, s2=3D0, f=3D0x10858 <call_xCC>,=
 type=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D17224704, s2=3D0, f=3D0x10858 <call_xCC>,=
 type=3D0)
    at ./jit/basecode.c:53

[...]

call_ref (routine=3D0x26074) at ./jit/icode.c:1811
(gdb) s
call_soft (routine=3D0x26074) at ./jit/icode.c:1827
(gdb) s
softcall_get_method_code_const (dst=3D0x107203c, method=3D0x52330)
    at ./jit/icode.c:2519
(gdb) s
popargs () at ./jit/icode.c:1677
(gdb) s
(gdb) s

Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D4) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D4, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D0, s2=3D4, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:53

[...]

_start_instruction (pc=3D4) at ./jit/icode.c:270
(gdb) s
translate (meth=3D0x7c018) at ./jit/machine.c:215

[...]

move_ref (dst=3D0x1072028, src=3D0x1072000) at ./jit/icode.c:473
(gdb) s
_slot_slot_slot (dst=3D0x1072028, s1=3D0x0, s2=3D0x1072000, f=3D0xb65a <move=
r_RxR>,
    type=3D2) at ./jit/basecode.c:118

[...]


Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D5) at ./jit/icode.c:269
(gdb) s

Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D7) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D7, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D0, s2=3D7, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:53

[...]

_start_instruction (pc=3D7) at ./jit/icode.c:270
(gdb) s
translate (meth=3D0x7c018) at ./jit/machine.c:215

[...]


Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D10) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D10, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s
nextSeq () at ./jit/seq.c:38

[...]

_slot_const_const (dst=3D0x0, s1=3D0, s2=3D10, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:53

[...]

_start_instruction (pc=3D10) at ./jit/icode.c:270
(gdb) s
translate (meth=3D0x7c018) at ./jit/machine.c:215

[...]

move_ref (dst=3D0x1072028, src=3D0x1072000) at ./jit/icode.c:473
(gdb) s

Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s

Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D13) at ./jit/icode.c:269
(gdb) s
_slot_const_const (dst=3D0x0, s1=3D0, s2=3D13, f=3D0x20fee <startInsn>, type=
=3D0)
    at ./jit/basecode.c:51
(gdb) s

Breakpoint 2, translate (meth=3D0x7c018) at ./jit/machine.c:212
(gdb) s

Breakpoint 1, translate (meth=3D0x52330) at ./jit/machine.c:119
(gdb) s
internalLockMutex (mux=3D0x4a984) at locks.c:34
(gdb) finish
Run till exit from #0  internalLockMutex (mux=3D0x4a984) at locks.c:34

Breakpoint 2, translate (meth=3D0x52330) at ./jit/machine.c:212
(gdb) s
_start_instruction (pc=3D0) 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=3D0x0,
    cname=3D0x526b "java/lang/ThreadGroup", cc=3D0x7b298, signature=3D0x4f05=
a "()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=3D2, argv=3D0xffffc8e4) at main.c:76
(gdb)





--
"It's never straight up and down"     (DEVO)