changeset 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
files CbC-examples/c-next.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CbC-examples/c-next.c	Thu Nov 22 19:45:33 2018 +0900
+++ b/CbC-examples/c-next.c	Sun Dec 23 19:24:05 2018 +0900
@@ -24,7 +24,7 @@
      MVMuint8 *bytecode_start;
 
      /* Points to the base of the current register set for the frame we
- *       * are presently in. */
+      * are presently in. */
      MVMRegister *reg_base;
 
      /* Points to the current compilation unit. */
@@ -43,16 +43,30 @@
 __code cbc_no_op(INTERP);
 __code cbc_exit(INTERP);
 __code cbc_next(INTERP);
+__code cbc_gc(INTERP);
 
 __code (* CODES[])(INTERP) = {
    cbc_no_op,
    cbc_no_op,
+   cbc_gc,
    cbc_exit,
 };
 
+void gc(int * p, INTERP i){
+   i->reg_base = (MVMRegister *)p;
+   return;
+}
+
+__code cbc_gc(INTERP i){
+   int test = 3;
+   gc(&test,i);
+   goto cbc_next(i);
+}
+
 __code cbc_next(INTERP i){
     __code (*c)(INTERP);
     c = CODES[NEXT_OP(i)];
+    // c(i);
     goto c(i);
 }