Skip to content

Commit

Permalink
Implement get_elem_storage_spec in VMArray.
Browse files Browse the repository at this point in the history
FROGGS++
  • Loading branch information
jnthn committed Oct 11, 2013
1 parent a1101cd commit 83b416c
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions src/6model/reprs/MVMArray.c
Expand Up @@ -706,10 +706,34 @@ 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;
switch (repr_data->slot_type) {
case MVM_ARRAY_STR:
spec.inlineable = MVM_STORAGE_SPEC_INLINED;
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.inlineable = MVM_STORAGE_SPEC_INLINED;
spec.boxed_primitive = MVM_STORAGE_SPEC_BP_INT;
spec.can_box = MVM_STORAGE_SPEC_CAN_BOX_INT;
break;
case MVM_ARRAY_N64:
case MVM_ARRAY_N32:
spec.inlineable = MVM_STORAGE_SPEC_INLINED;
spec.boxed_primitive = MVM_STORAGE_SPEC_BP_NUM;
spec.can_box = MVM_STORAGE_SPEC_CAN_BOX_NUM;
break;
default:
spec.inlineable = MVM_STORAGE_SPEC_REFERENCE;
spec.boxed_primitive = MVM_STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
break;
}
return spec;
}

Expand Down

0 comments on commit 83b416c

Please sign in to comment.