-
-
Save FROGGS/6a22741986d134ab5011 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
diff --git a/src/core/interp.c b/src/core/interp.c | |
index 069dd55..e2688e1 100644 | |
--- a/src/core/interp.c | |
+++ b/src/core/interp.c | |
@@ -1908,10 +1908,42 @@ void MVM_interp_run(MVMThreadContext *tc, void (*initial_invoke)(MVMThreadContex | |
break; | |
} | |
case MVM_OP_atpos_o: { | |
- MVMObject *obj = GET_REG(cur_op, 2).o; | |
- REPR(obj)->pos_funcs->at_pos(tc, STABLE(obj), obj, | |
- OBJECT_BODY(obj), GET_REG(cur_op, 4).i64, | |
- &GET_REG(cur_op, 0), MVM_reg_obj); | |
+ MVMRegister *out_reg = &GET_REG(cur_op, 0); | |
+ MVMObject *out_obj = out_reg->o; | |
+ MVMRegister *in_reg = &GET_REG(cur_op, 2); | |
+ MVMObject *in_obj = in_reg->o; | |
+ | |
+ MVMObject *type; | |
+ MVMObject *temp_obj; | |
+ | |
+ MVMArrayREPRData *repr_data = (MVMArrayREPRData *)STABLE(in_obj)->REPR_data; | |
+ | |
+ switch (repr_data->slot_type) { | |
+ case MVM_ARRAY_OBJ: | |
+ REPR(in_obj)->pos_funcs->at_pos(tc, STABLE(in_obj), in_obj, | |
+ OBJECT_BODY(in_obj), GET_REG(cur_op, 4).i64, | |
+ out_reg, MVM_reg_obj); | |
+ break; | |
+ case MVM_ARRAY_I64: | |
+ type = tc->instance->boot_types->BOOTInt; | |
+ temp_obj = REPR(type)->allocate(tc, STABLE(type)); | |
+ | |
+ MVMRegister temp_reg; | |
+ | |
+ REPR(in_obj)->pos_funcs->at_pos(tc, STABLE(in_obj), in_obj, | |
+ OBJECT_BODY(in_obj), GET_REG(cur_op, 4).i64, | |
+ &temp_reg, MVM_reg_int64); | |
+ | |
+ MVMROOT(tc, temp_reg, { | |
+ if (REPR(temp_obj)->initialize) | |
+ REPR(temp_obj)->initialize(tc, STABLE(temp_obj), temp_obj, OBJECT_BODY(temp_obj)); | |
+ REPR(temp_obj)->box_funcs->set_int(tc, STABLE(temp_obj), temp_obj, | |
+ OBJECT_BODY(temp_obj), temp_reg.i64); | |
+ GET_REG(cur_op, 0).o = temp_obj; | |
+ }); | |
+ break; | |
+ } | |
+ | |
cur_op += 6; | |
break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment