Skip to content

Instantly share code, notes, and snippets.

@FROGGS

FROGGS/root.diff Secret

Created July 20, 2014 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FROGGS/534f320aa548e12f75c4 to your computer and use it in GitHub Desktop.
Save FROGGS/534f320aa548e12f75c4 to your computer and use it in GitHub Desktop.
diff --git a/src/core/interp.c b/src/core/interp.c
index 5760ad1..992ffdc 100644
--- a/src/core/interp.c
+++ b/src/core/interp.c
@@ -2335,13 +2335,11 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
box = MVM_intcache_get(tc, type, GET_REG(cur_op, 2).i64);
if (box == 0) {
box = REPR(type)->allocate(tc, STABLE(type));
- MVMROOT(tc, box, {
- if (REPR(box)->initialize)
- REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box));
- REPR(box)->box_funcs.set_int(tc, STABLE(box), box,
- OBJECT_BODY(box), GET_REG(cur_op, 2).i64);
- GET_REG(cur_op, 0).o = box;
- });
+ if (REPR(box)->initialize)
+ REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box));
+ REPR(box)->box_funcs.set_int(tc, STABLE(box), box,
+ OBJECT_BODY(box), GET_REG(cur_op, 2).i64);
+ GET_REG(cur_op, 0).o = box;
} else {
GET_REG(cur_op, 0).o = box;
}
@@ -2351,24 +2349,23 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex
OP(box_n): {
MVMObject *type = GET_REG(cur_op, 4).o;
MVMObject *box = REPR(type)->allocate(tc, STABLE(type));
- MVMROOT(tc, box, {
- if (REPR(box)->initialize)
- REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box));
- REPR(box)->box_funcs.set_num(tc, STABLE(box), box,
- OBJECT_BODY(box), GET_REG(cur_op, 2).n64);
- GET_REG(cur_op, 0).o = box;
- });
+ if (REPR(box)->initialize)
+ REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box));
+ REPR(box)->box_funcs.set_num(tc, STABLE(box), box,
+ OBJECT_BODY(box), GET_REG(cur_op, 2).n64);
+ GET_REG(cur_op, 0).o = box;
cur_op += 6;
goto NEXT;
}
OP(box_s): {
+ MVMString *str = GET_REG(cur_op, 2).s;
MVMObject *type = GET_REG(cur_op, 4).o;
- MVMObject *box = REPR(type)->allocate(tc, STABLE(type));
- MVMROOT(tc, box, {
+ MVMROOT(tc, str, {
+ MVMObject *box = REPR(type)->allocate(tc, STABLE(type));
if (REPR(box)->initialize)
REPR(box)->initialize(tc, STABLE(box), box, OBJECT_BODY(box));
REPR(box)->box_funcs.set_str(tc, STABLE(box), box,
- OBJECT_BODY(box), GET_REG(cur_op, 2).s);
+ OBJECT_BODY(box), str);
GET_REG(cur_op, 0).o = box;
});
cur_op += 6;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment