Skip to content

Commit 08bdce1

Browse files
committed
Update (functional) implementors of get_attribute_ref to return bit-width.
Right now they are hard-coded to just return 8*sizeof(void *). I think that should be a good way to return the number of bits in a machine word, but probably a decision that deserves some more scrutiny.
1 parent 2407c15 commit 08bdce1

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/6model/reprs/CStruct.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,11 @@ static void * get_attribute_ref(PARROT_INTERP, STable *st, void *data, PMC *clas
482482
/* Look up slot, then offset and compute address. */
483483
slot = hint >= 0 ? hint :
484484
try_get_slot(interp, repr_data, class_handle, name);
485-
if (slot >= 0)
485+
if (slot >= 0) {
486+
if(bits)
487+
*bits = 8*sizeof(void *);
486488
return ((char *)body->cstruct) + repr_data->struct_offsets[slot];
489+
}
487490

488491
/* Otherwise, complain that the attribute doesn't exist. */
489492
no_such_attribute(interp, "get", class_handle, name);

src/6model/reprs/P6opaque.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,11 @@ static void * get_attribute_ref(PARROT_INTERP, STable *st, void *data, PMC *clas
527527
/* Look up slot, then offset and compute address. */
528528
slot = hint >= 0 && !(repr_data->mi) ? hint :
529529
try_get_slot(interp, repr_data, class_handle, name);
530-
if (slot >= 0)
530+
if (slot >= 0) {
531+
if (bits)
532+
*bits = 8*sizeof(void *);
531533
return ((char *)data) + repr_data->attribute_offsets[slot];
534+
}
532535

533536
/* Otherwise, complain that the attribute doesn't exist. */
534537
no_such_attribute(interp, "get", class_handle, name);

0 commit comments

Comments
 (0)