changeset 139:ae07388db637

fix c-next.c segfault
author anatofuz
date Mon, 12 Nov 2018 17:01:46 +0900
parents fc828634a951
children c83ff0b5a2ed
files CbC-examples/c-next.c
diffstat 1 files changed, 4 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/CbC-examples/c-next.c	Thu Nov 08 14:17:14 2018 +0900
+++ b/CbC-examples/c-next.c	Mon Nov 12 17:01:46 2018 +0900
@@ -5,7 +5,6 @@
 typedef long* MVMRegister;
 typedef void* MVMCompUnit;
 typedef void* MVMCallsite;
-//typedef void* MVMThreadContext;
 
 typedef struct MVMThreadContext {
 	MVMuint8 **interp_cur_op;
@@ -36,9 +35,6 @@
 
      MVMThreadContext *tc;
     
-    //__code (*ret)();
-    //__code (*main_ret)();
-    __code (*ret)(int, void*);
     __code (*main_ret)(int, void*);
     void *env;
 
@@ -46,6 +42,7 @@
 
 __code cbc_no_op(INTERP);
 __code cbc_exit(INTERP);
+__code cbc_next(INTERP);
 
 __code (* CODES[])(INTERP) = {
    cbc_no_op,
@@ -67,22 +64,14 @@
    goto i->main_ret(0,i->env);
 }
 
-//__code main_return(int i,stack sp) {
-//    if (loop-->0)
-//        goto f(233,sp);
-//    printf("#0103:%d\n",i);
-//    goto (( (struct main_continuation *)sp)->main_ret)(0,
-//           ((struct main_continuation *)sp)->env);
-//}
 
 int interp_run(MVMThreadContext *tc){
-	INTER inter = {0,0,0,0,0,0,0,0,0};
+	INTER inter = {0,0,0,0,0,0,0,0};
 	INTERP i  = &inter;
-	MVMuint8 cur_op[] = {0,1,1,0,1,2};
-//	i->ret =  main_return;
+	MVMuint16 cur_op[] = {0,1,1,0,1,2};
         i->main_ret = _CbC_return;
         i->env = _CbC_environment;
-	i->cur_op = cur_op;
+	i->cur_op = (MVMuint8 *)cur_op;
 
 	tc->interp_cur_op         = &i->cur_op;
 	tc->interp_bytecode_start = &i->bytecode_start;