Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created October 11, 2013 10:16
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/1240be3b37b8678bd6fd to your computer and use it in GitHub Desktop.
Save FROGGS/1240be3b37b8678bd6fd to your computer and use it in GitHub Desktop.
diff --git a/3rdparty/dyncall b/3rdparty/dyncall
--- a/3rdparty/dyncall
+++ b/3rdparty/dyncall
@@ -1 +1 @@
-Subproject commit a9e6eec70785f43f63ef17189fc2733d4ceb8446
+Subproject commit a9e6eec70785f43f63ef17189fc2733d4ceb8446-dirty
diff --git a/src/6model/bootstrap.c b/src/6model/bootstrap.c
index def8272..a811f00 100644
--- a/src/6model/bootstrap.c
+++ b/src/6model/bootstrap.c
@@ -495,6 +495,9 @@ static MVMObject * boot_typed_array(MVMThreadContext *tc, char *name, MVMObject
MVM_repr_bind_key_boxed(tc, arr_info, str_type, type);
MVM_repr_bind_key_boxed(tc, repr_info, str_array, arr_info);
MVM_repr_compose(tc, array, repr_info);
+ MVMStorageSpec spec = REPR(type)->get_storage_spec(tc, STABLE(type));
+ if (spec.boxed_primitive == MVM_STORAGE_SPEC_BP_INT)
+ printf("src/6model/bootstrap.c:500 boxed_primitive == MVM_STORAGE_SPEC_BP_INT\n");
});
/* Also give it a boolification spec. */
diff --git a/src/6model/reprs/MVMArray.c b/src/6model/reprs/MVMArray.c
index 88fa65a..00eeb50 100644
--- a/src/6model/reprs/MVMArray.c
+++ b/src/6model/reprs/MVMArray.c
@@ -706,10 +706,32 @@ static void splice(MVMThreadContext *tc, MVMSTable *st, MVMObject *root, void *d
}
static MVMStorageSpec get_elem_storage_spec(MVMThreadContext *tc, MVMSTable *st) {
+ MVMArrayREPRData *repr_data = (MVMArrayREPRData *)st->REPR_data;
MVMStorageSpec spec;
- spec.inlineable = MVM_STORAGE_SPEC_REFERENCE;
- spec.boxed_primitive = MVM_STORAGE_SPEC_BP_NONE;
- spec.can_box = 0;
+ spec.inlineable = MVM_STORAGE_SPEC_REFERENCE;
+ spec.can_box = 0;
+ switch (repr_data->slot_type) {
+ case MVM_ARRAY_STR:
+ spec.boxed_primitive = MVM_STORAGE_SPEC_BP_STR;
+ spec.can_box = MVM_STORAGE_SPEC_CAN_BOX_STR;
+ break;
+ case MVM_ARRAY_I64:
+ case MVM_ARRAY_I32:
+ case MVM_ARRAY_I16:
+ case MVM_ARRAY_I8:
+ spec.boxed_primitive = MVM_STORAGE_SPEC_BP_INT;
+ spec.can_box = MVM_STORAGE_SPEC_CAN_BOX_INT;
+ printf("src/6model/reprs/MVMArray.c:724 boxed_primitive = MVM_STORAGE_SPEC_BP_INT\n");
+ break;
+ case MVM_ARRAY_N64:
+ case MVM_ARRAY_N32:
+ spec.boxed_primitive = MVM_STORAGE_SPEC_BP_NUM;
+ spec.can_box = MVM_STORAGE_SPEC_CAN_BOX_NUM;
+ break;
+ default:
+ spec.boxed_primitive = MVM_STORAGE_SPEC_BP_NONE;
+ break;
+ }
return spec;
}
diff --git a/src/core/args.c b/src/core/args.c
index e70ab87..5d949ea 100644
--- a/src/core/args.c
+++ b/src/core/args.c
@@ -540,6 +540,7 @@ static void flatten_args(MVMThreadContext *tc, MVMArgProcContext *ctx) {
}
for (i = 0; i < count; i++) {
+ MVMObject *o = MVM_repr_at_pos_o(tc, list, i);
if (new_arg_pos == new_args_size) {
new_args = realloc(new_args, (new_args_size *= 2) * sizeof(MVMRegister));
}
@@ -547,8 +548,19 @@ static void flatten_args(MVMThreadContext *tc, MVMArgProcContext *ctx) {
new_arg_flags = realloc(new_arg_flags, (new_arg_flags_size *= 2) * sizeof(MVMCallsiteEntry));
}
- (new_args + new_arg_pos++)->o = MVM_repr_at_pos_o(tc, list, i);
- new_arg_flags[new_flag_pos++] = MVM_CALLSITE_ARG_OBJ;
+ if (REPR(list)->ID == MVM_REPR_ID_MVMArray) {
+ printf("src/core/args.c:552 boxed_primitive = %d\n", REPR(list)->pos_funcs.get_elem_storage_spec(tc, STABLE(list)).boxed_primitive);
+ }
+ if (REPR(list)->ID == MVM_REPR_ID_MVMArray
+ && REPR(list)->pos_funcs.get_elem_storage_spec(tc, STABLE(list)).boxed_primitive == MVM_STORAGE_SPEC_BP_INT) {
+ printf("src/core/args.c:556 boxed_primitive == MVM_STORAGE_SPEC_BP_INT\n");
+ (new_args + new_arg_pos++)->i64 = MVM_repr_get_int(tc, o);
+ new_arg_flags[new_flag_pos++] = MVM_CALLSITE_ARG_INT;
+ }
+ else {
+ (new_args + new_arg_pos++)->o = o;
+ new_arg_flags[new_flag_pos++] = MVM_CALLSITE_ARG_OBJ;
+ }
}
}
else if (!(arg_info.flags & MVM_CALLSITE_ARG_FLAT_NAMED)) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment