changeset 50:a28c50b4c875

fix compunitmainline read eval loop worked
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 10 Dec 2018 08:59:08 +0900
parents 2d03fdcd8b7f
children 2cba07b40fd1
files src/core/cbc-interp.cbc src/core/interp.c
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/cbc-interp.cbc	Sun Dec 09 16:05:26 2018 +0900
+++ b/src/core/cbc-interp.cbc	Mon Dec 10 08:59:08 2018 +0900
@@ -57,10 +57,11 @@
 
 static int tracing_enabled = 0;
 static int op_count=0;
-static int cbctrace=0;
+static int cbc_trace=0;
 
 // #define ddd(x) printf("count=%d op=%d cur_op=%p reg[0]=%p reg[2]=%p \n", op_count++, *i->cur_op, i->cur_op, GET_REG(i->cur_op, 0,i).o, GET_REG(i->cur_op, 2,i).o)
-#define ddd(x) (op_count++>200?printf("count=%d op=%d\n", op_count, *(MVMuint16 *)i->cur_op):0)
+#define ddd(x) ((op_count++,cbc_trace)?printf("count=%d op=%d\n", op_count, *(MVMuint16 *)i->cur_op):0)
+//#define ddd(x) (op_count++)
 // #define ddd(x) 0
 
 __code cbc_next(INTERP i){
@@ -3449,7 +3450,7 @@
     MVMObject *maybe_cu = GET_REG(i->cur_op, 2,i).o;
     if (REPR(maybe_cu)->ID == MVM_REPR_ID_MVMCompUnit) {
         MVMCompUnit *cu = (MVMCompUnit *)maybe_cu;
-        GET_REG(i->cur_op, 0,i).o =i->cu->body.coderefs[0];
+        GET_REG(i->cur_op, 0,i).o = cu->body.coderefs[0];
     }
     else {
         MVM_exception_throw_adhoc(i->tc, "compunitmainline requires an MVMCompUnit");
--- a/src/core/interp.c	Sun Dec 09 16:05:26 2018 +0900
+++ b/src/core/interp.c	Mon Dec 10 08:59:08 2018 +0900
@@ -42,7 +42,8 @@
 #define GET_UI32(pc, idx)   *((MVMuint32 *)(pc + idx))
 #define GET_N32(pc, idx)    *((MVMnum32 *)(pc + idx))
 
-#define ddd(x) (op_count++>200?printf("count=%d op=%d\n", op_count, *(MVMuint16 *)cur_op):0)
+#define ddd(x) ((op_count++,cbc_trace)?printf("count=%d op=%d\n", op_count, *(MVMuint16 *)cur_op):0)
+// #define ddd(x) (op_count++)
 
 #define NEXT_OP (ddd(0), op = *(MVMuint16 *)(cur_op), cur_op += 2, op)
 
@@ -60,6 +61,7 @@
 
 int use_cbc = 0;
 int op_count = 0;
+int cbc_trace = 0;
 extern void MVM_interp_run_cbc(MVMThreadContext *tc);
 typedef struct interp {
      MVMuint16 op;