-
-
Save timo/dab3afea0b5362d5e6fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OP(sp_get_i64): | |
GET_REG(cur_op, 0).i64 = *((MVMint64 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); | |
cur_op += 6; | |
goto NEXT; | |
OP(sp_get_n): | |
GET_REG(cur_op, 0).n64 = *((MVMnum64 *)((char *)GET_REG(cur_op, 2).o + GET_UI16(cur_op, 4))); | |
cur_op += 6; | |
goto NEXT; | |
OP(sp_bind_i64): { | |
MVMObject *o = GET_REG(cur_op, 0).o; | |
*((MVMint64 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).i64; | |
cur_op += 6; | |
goto NEXT; | |
} | |
OP(sp_bind_n): { | |
MVMObject *o = GET_REG(cur_op, 0).o; | |
*((MVMnum64 *)((char *)o + GET_UI16(cur_op, 2))) = GET_REG(cur_op, 4).n64; | |
cur_op += 6; | |
goto NEXT; | |
} | |
/* ... */ | |
OP(sp_deref_get_i64): { | |
MVMObject *o = GET_REG(cur_op, 2).o; | |
MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); | |
GET_REG(cur_op, 0).i64 = **target; | |
cur_op += 6; | |
goto NEXT; | |
} | |
OP(sp_deref_get_n): { | |
MVMObject *o = GET_REG(cur_op, 2).o; | |
MVMnum64 **target = ((MVMnum64 **)((char *)o + GET_UI16(cur_op, 4))); | |
GET_REG(cur_op, 0).n64 = **target; | |
cur_op += 6; | |
goto NEXT; | |
} | |
OP(sp_deref_bind_i64): { | |
MVMObject *o = GET_REG(cur_op, 0).o; | |
MVMint64 **target = ((MVMint64 **)((char *)o + GET_UI16(cur_op, 4))); | |
target = GET_REG(cur_op, 2).i64; | |
cur_op += 6; | |
goto NEXT; | |
} | |
OP(sp_deref_bind_n): { | |
MVMObject *o = GET_REG(cur_op, 0).o; | |
MVMnum64 **target = ((MVMnum64 *)((char *)o + GET_UI16(cur_op, 4))); | |
target = GET_REG(cur_op, 2).n64; | |
cur_op += 6; | |
goto NEXT; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* An example for sp_deref_bind_i64 is like this: | |
MVMNativeRef *target_obj; | |
sp_deref_bind_n(target_obj, 100, offsetof(MVMNativeRef, body.u.reg_or_lex)); | |
*/ | |
struct MVMNativeRefBody { | |
union { | |
struct { | |
MVMFrame *frame; | |
MVMRegister *var; | |
MVMuint16 type; | |
} reg_or_lex; | |
struct { | |
MVMObject *obj; | |
MVMObject *class_handle; | |
MVMString *name; | |
} attribute; | |
struct { | |
MVMObject *obj; | |
MVMint64 idx; | |
} positional; | |
} u; | |
}; | |
struct MVMNativeRef { | |
MVMObject common; | |
MVMNativeRefBody body; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment