changeset 23:005049773e61

to protect reg_base use function call before goto
author anatofuz
date Fri, 02 Nov 2018 18:26:39 +0900
parents ab67945df0f0
children 434c28ad3b80
files src/core/cbc-interp.cbc
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/cbc-interp.cbc	Thu Nov 01 20:30:24 2018 +0900
+++ b/src/core/cbc-interp.cbc	Fri Nov 02 18:26:39 2018 +0900
@@ -1249,7 +1249,9 @@
 }
 __code cbc_takeclosure(INTERP i){
     (i->reg_base[*((MVMuint16 *)(i->cur_op + 0))]).o = MVM_frame_takeclosure(i->tc, GET_REG(i->cur_op, 2,i).o);
+    //MVMObject* tmp_base = MVM_frame_takeclosure(i->tc,GET_REG(i->cur_op,2,i).o);
     //GET_REG(i->cur_op, 0,i).o = MVM_frame_takeclosure(i->tc, GET_REG(i->cur_op, 2,i).o);
+    //GET_REG(i->cur_op,0,i).o = tmp_base;
     i->cur_op += 4;
     goto NEXT(i);
 }
@@ -6443,6 +6445,10 @@
     goto NEXT(i);
 }
 
+void MVM_interp_run1(INTERP i){
+	goto (CODES[(i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op)])(i);
+}
+
 /* This is the interpreter run loop. We have one of these per thread. */
 void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContext *, void *), void *invoke_data) {
 #if MVM_CGOTO
@@ -6485,7 +6491,8 @@
         /* The ops should be in the same order here as in the oplist file, so
          * the compiler can can optimise the switch properly */
         //DISPATCH(NEXT_OP(i))
-	goto (CODES[(i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op)])(i);
+	//goto (CODES[(i->op = *(MVMuint16 *)(i->cur_op), i->cur_op += 2, i->op)])(i);
+	MVM_interp_run1(i);
     }
 
 }