Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add align field to storage_spec.
Also, adds initialisation of align field to all REPRs (and initialises a
couple of bits fields that weren't).
  • Loading branch information
arnsholt committed Aug 12, 2012
1 parent d384d49 commit 2800c6e
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/6model/reprs/CArray.c
Expand Up @@ -191,6 +191,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *) * 8;
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/CPointer.c
Expand Up @@ -64,6 +64,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *) * 8;
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/CStr.c
Expand Up @@ -100,6 +100,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.boxed_primitive = STORAGE_SPEC_BP_STR;
spec.can_box = 0;
spec.bits = sizeof(void *) * 8;;
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/CStruct.c
Expand Up @@ -644,6 +644,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *) * 8;
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
2 changes: 2 additions & 0 deletions src/6model/reprs/HashAttrStore.c
Expand Up @@ -103,6 +103,8 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.inlineable = STORAGE_SPEC_REFERENCE;
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *);
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
2 changes: 2 additions & 0 deletions src/6model/reprs/KnowHOWREPR.c
Expand Up @@ -77,6 +77,8 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.inlineable = STORAGE_SPEC_REFERENCE;
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *);
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/NativeCall.c
Expand Up @@ -105,6 +105,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(NativeCallBody) * 8;
spec.align = ALIGNOF(void *);
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
return spec;
Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/P6bigint.c
Expand Up @@ -139,6 +139,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(mp_int) * 8;
spec.align = ALIGNOF(void *);
spec.boxed_primitive = STORAGE_SPEC_BP_INT;
spec.can_box = STORAGE_SPEC_CAN_BOX_INT;
return spec;
Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/P6num.c
Expand Up @@ -108,6 +108,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(FLOATVAL) * 8;
spec.align = ALIGNOF(void *);
spec.boxed_primitive = STORAGE_SPEC_BP_NUM;
spec.can_box = STORAGE_SPEC_CAN_BOX_NUM;
return spec;
Expand Down
2 changes: 2 additions & 0 deletions src/6model/reprs/P6opaque.c
Expand Up @@ -808,6 +808,8 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.inlineable = STORAGE_SPEC_REFERENCE;
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *);
spec.align = ALIGNOF(void *);
if (repr_data->unbox_int_slot >= 0)
spec.can_box += STORAGE_SPEC_CAN_BOX_INT;
if (repr_data->unbox_num_slot >= 0)
Expand Down
1 change: 1 addition & 0 deletions src/6model/reprs/P6str.c
Expand Up @@ -115,6 +115,7 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
storage_spec spec;
spec.inlineable = STORAGE_SPEC_INLINED;
spec.bits = sizeof(STRING *) * 8;
spec.align = ALIGNOF(void *);
spec.boxed_primitive = STORAGE_SPEC_BP_STR;
spec.can_box = STORAGE_SPEC_CAN_BOX_STR;
return spec;
Expand Down
2 changes: 2 additions & 0 deletions src/6model/reprs/Uninstantiable.c
Expand Up @@ -59,6 +59,8 @@ static storage_spec get_storage_spec(PARROT_INTERP, STable *st) {
spec.inlineable = STORAGE_SPEC_REFERENCE;
spec.boxed_primitive = STORAGE_SPEC_BP_NONE;
spec.can_box = 0;
spec.bits = sizeof(void *);
spec.align = ALIGNOF(void *);
return spec;
}

Expand Down
4 changes: 3 additions & 1 deletion src/6model/storage_spec.h
Expand Up @@ -12,8 +12,10 @@ typedef struct {
INTVAL inlineable;

/* For things that want to be inlined, the number of bits of
* storage they need. Ignored otherwise. */
* storage they need and what kind of byte-boundary they want to
* be aligned to. Ignored otherwise. */
INTVAL bits;
INTVAL align;

/* For things that are inlined, if they are just storage of a
* primitive type and can unbox, this says what primitive type
Expand Down

0 comments on commit 2800c6e

Please sign in to comment.