Mercurial > hg > CbC > CbC_gcc
comparison CbC-examples/c-next.c @ 143:76e1cf5455ef
add cbc_gc test
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 23 Dec 2018 19:24:05 +0900 |
parents | c83ff0b5a2ed |
children | 8f4e72ab4e11 |
comparison
equal
deleted
inserted
replaced
142:c83ff0b5a2ed | 143:76e1cf5455ef |
---|---|
22 | 22 |
23 /* The current frame's bytecode start. */ | 23 /* The current frame's bytecode start. */ |
24 MVMuint8 *bytecode_start; | 24 MVMuint8 *bytecode_start; |
25 | 25 |
26 /* Points to the base of the current register set for the frame we | 26 /* Points to the base of the current register set for the frame we |
27 * * are presently in. */ | 27 * are presently in. */ |
28 MVMRegister *reg_base; | 28 MVMRegister *reg_base; |
29 | 29 |
30 /* Points to the current compilation unit. */ | 30 /* Points to the current compilation unit. */ |
31 MVMCompUnit *cu; | 31 MVMCompUnit *cu; |
32 | 32 |
41 } INTER,*INTERP; | 41 } INTER,*INTERP; |
42 | 42 |
43 __code cbc_no_op(INTERP); | 43 __code cbc_no_op(INTERP); |
44 __code cbc_exit(INTERP); | 44 __code cbc_exit(INTERP); |
45 __code cbc_next(INTERP); | 45 __code cbc_next(INTERP); |
46 __code cbc_gc(INTERP); | |
46 | 47 |
47 __code (* CODES[])(INTERP) = { | 48 __code (* CODES[])(INTERP) = { |
48 cbc_no_op, | 49 cbc_no_op, |
49 cbc_no_op, | 50 cbc_no_op, |
51 cbc_gc, | |
50 cbc_exit, | 52 cbc_exit, |
51 }; | 53 }; |
54 | |
55 void gc(int * p, INTERP i){ | |
56 i->reg_base = (MVMRegister *)p; | |
57 return; | |
58 } | |
59 | |
60 __code cbc_gc(INTERP i){ | |
61 int test = 3; | |
62 gc(&test,i); | |
63 goto cbc_next(i); | |
64 } | |
52 | 65 |
53 __code cbc_next(INTERP i){ | 66 __code cbc_next(INTERP i){ |
54 __code (*c)(INTERP); | 67 __code (*c)(INTERP); |
55 c = CODES[NEXT_OP(i)]; | 68 c = CODES[NEXT_OP(i)]; |
69 // c(i); | |
56 goto c(i); | 70 goto c(i); |
57 } | 71 } |
58 | 72 |
59 __code cbc_no_op(INTERP i){ | 73 __code cbc_no_op(INTERP i){ |
60 goto cbc_next(i); | 74 goto cbc_next(i); |