# HG changeset patch # User anatofuz # Date 1542009706 -32400 # Node ID ae07388db63799994dd5f8b21af7411b46b680a8 # Parent fc828634a951acea70278735d8a732f7f49adf0b fix c-next.c segfault diff -r fc828634a951 -r ae07388db637 CbC-examples/c-next.c --- 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;