-
-
Save timo/84d595f301354393bdc0 to your computer and use it in GitHub Desktop.
it still says "case MVM_OP_atpos_o", that also needs to be changed!
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
diff --git a/src/6model/reprconv.c b/src/6model/reprconv.c | |
index e94608b..a22bb7e 100644 | |
--- a/src/6model/reprconv.c | |
+++ b/src/6model/reprconv.c | |
@@ -280,3 +280,14 @@ MVMObject * MVM_repr_box_str(MVMThreadContext *tc, MVMObject *type, MVMString *v | |
}); | |
return res; | |
} | |
+ | |
+MVM_PUBLIC MVMString * MVM_repr_get_attr_s(MVMThreadContext *tc, MVMObject *object, MVMObject *type, MVMString *name, | |
+ MVMRegister result_reg; | |
+ if (!IS_CONCRETE(object)) | |
+ MVM_exception_throw_adhoc(tc, "Cannot look up attributes in a type object"); | |
+ REPR(object)->attr_funcs.get_attribute(tc, | |
+ STABLE(object), object, OBJECT_BODY(object), | |
+ type, name, | |
+ hint, &result_reg, MVM_reg_str); | |
+ return result_reg.s; | |
+} | |
diff --git a/src/6model/reprconv.h b/src/6model/reprconv.h | |
index 764f3e3..4205f01 100644 | |
--- a/src/6model/reprconv.h | |
+++ b/src/6model/reprconv.h | |
@@ -51,6 +51,8 @@ MVM_PUBLIC MVMObject * MVM_repr_box_int(MVMThreadContext *tc, MVMObject *type, M | |
MVM_PUBLIC MVMObject * MVM_repr_box_num(MVMThreadContext *tc, MVMObject *type, MVMnum64 val); | |
MVM_PUBLIC MVMObject * MVM_repr_box_str(MVMThreadContext *tc, MVMObject *type, MVMString *val); | |
+MVM_PUBLIC MVMString * MVM_repr_get_attr_s(MVMThreadContext *tc, MVMObject *object, MVMObject *type, MVMString *name, | |
+ | |
#define MVM_repr_at_key_int(tc, obj, key) \ | |
MVM_repr_get_int((tc), MVM_repr_at_key_o((tc), (obj), (key))) | |
#define MVM_repr_at_key_num(tc, obj, key) \ | |
diff --git a/src/jit/graph.c b/src/jit/graph.c | |
index e00f1de..04c57c6 100644 | |
--- a/src/jit/graph.c | |
+++ b/src/jit/graph.c | |
@@ -124,6 +124,8 @@ static void * op_to_func(MVMThreadContext *tc, MVMint16 opcode) { | |
case MVM_OP_unshift_o: return &MVM_repr_unshift_o; | |
case MVM_OP_pop_o: return &MVM_repr_pop_o; | |
case MVM_OP_shift_o: return &MVM_repr_shift_o; | |
+ case MVM_OP_atpos_o: return &MVM_repr_at_pos_o; | |
+ case MVM_OP_getattr_s: return &MVM_repr_get_attr_s; | |
default: | |
MVM_exception_throw_adhoc(tc, "No function for op %d", opcode); | |
} | |
@@ -432,6 +434,16 @@ static MVMint32 jgb_consume_ins(MVMThreadContext *tc, JitGraphBuilder *jgb, | |
jgb_append_call_c(tc, jgb, op_to_func(tc, op), 2, args, MVM_JIT_RV_PTR, dst); | |
break; | |
} | |
+ case MVM_OP_atpos_o: { | |
+ MVMint16 dst = ins->operands[0].reg.orig; | |
+ MVMint32 invocant = ins->operands[1].reg.orig; | |
+ MVMint32 position = ins->operands[2].reg.orig; | |
+ MVMJitCallArg args[] = { { MVM_JIT_INTERP_VAR, MVM_JIT_INTERP_TC }, | |
+ { MVM_JIT_REG_VAL, invocant }, | |
+ { MVM_JIT_REG_VAL, position } }; | |
+ jgb_append_call_c(tc, jgb, op_to_func(tc, op), 3, args, MVM_JIT_RV_PTR, dst); | |
+ break; | |
+ } | |
/* coercion */ | |
case MVM_OP_coerce_sn: | |
case MVM_OP_coerce_ns: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment