-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Given this program:
PROC main (CHAN BYTE kyb, scr, err)
SKIP
the TVM segfaults. (I don't know if kroc would segfault, because I'm just trying to get a TVM build going.)
building as follows:
CFLAGS=-DDEBUG_INTERPRETER ./build --prefix=/home/jadudm/local/kroc --with-toolchain=tvm --with-wrapper=posix
and compiling the program with occbuild --program skip.occ, I get a TCE and TBC file.
I get the following debug output from running tvm skip.tbc:
jadudm@lego:~/git/kroc/mcj$ tvm skip.tbc
0x565557768814 55 LDNLP 00000005 00000000 00000000 00000000
0x565557768815 56 LDNLP 00000006 00000014 00000000 00000000
0x565557768816 00 J 00000000 0000002c 00000000 00000000
0x565557768817 00 J 00000000 0000002c 00000000 00000000
0x565557768818 60 NFIX 00000000 0000002c 00000000 00000000
0x565557768819 4e LDC fffffffe 0000002c 00000000 00000000
0x56555776881a 22 PFIX 00000002 fffffffe 0000002c 00000000
0x56555776881b f5 FFICALL 00000025 fffffffe 0000002c 00000000
Dumping the TCE file:
jadudm@lego:~/git/kroc/mcj$ tce-dump.pl skip.tce
.JUMPENTRY main
.ALIGN 3
.L0:
.GLOBAL main
.SETWS 4
.SETVS 0
.MS_USAGE 0
.FILENAME skip.occ
.LINE 1
.PROC main
.LINE 2
RET
.GLOBALEND main
.ALIGN 3
I'm not sure what is going on. The LDNLP (load non-local pointer) instructions... could be loading the top-level channels (KYB, SCR, ERR)... but... Hm.
The entire program compiles down to a RET instruction. However, the actual run looks different... which I think is because the TVM wrapper/runtime for POSIX has to do some additional work (that is, making FFI calls in order to check the external channels, etc.).
I think the segfault has to do with the external channel linkages, but that's a hunch, not something supported by evidence.
This is a start, anyway.