Skip to content

Commit 065622f

Browse files
committed
Eliminte defined from the REPR API; now it's all done through the IS_CONCRETE macro.
1 parent 4035569 commit 065622f

File tree

12 files changed

+10
-68
lines changed

12 files changed

+10
-68
lines changed

src/6model/multi_dispatch.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ PMC *nqp_multi_dispatch(PARROT_INTERP, PMC *dispatcher, PMC *capture) {
314314
if (definedness) {
315315
/* Have a constraint on the definedness. */
316316
INTVAL defined = param->vtable->base_type == smo_id ?
317-
REPR(param)->defined(interp, param) :
317+
IS_CONCRETE(param) :
318318
VTABLE_defined(interp, param);
319319
if ((!defined && definedness == DEFINED_ONLY) || (defined && definedness == UNDEFINED_ONLY)) {
320320
type_mismatch = 1;

src/6model/reprs/HashAttrStore.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4646
((HashAttrStoreBody *)data)->store = pmc_new(interp, enum_class_Hash);
4747
}
4848

49-
/* Checks if a given object is defined (from the point of view of the
50-
* representation). */
51-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
52-
HashAttrStoreInstance *instance = (HashAttrStoreInstance *)PMC_data(obj);
53-
return instance->body.store != NULL;
54-
}
55-
5649
/* Gets the current value for an attribute. */
5750
static PMC * get_attribute(PARROT_INTERP, PMC *obj, PMC *class_handle, STRING *name, INTVAL hint) {
5851
HashAttrStoreInstance *instance = (HashAttrStoreInstance *)PMC_data(obj);
@@ -198,7 +191,6 @@ REPROps * HashAttrStore_initialize(PARROT_INTERP) {
198191
this_repr->type_object_for = type_object_for;
199192
this_repr->allocate = allocate;
200193
this_repr->initialize = initialize;
201-
this_repr->defined = defined;
202194
this_repr->get_attribute = get_attribute;
203195
this_repr->get_attribute_int = get_attribute_int;
204196
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/KnowHOWREPR.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4646
body->attributes = pmc_new(interp, enum_class_ResizablePMCArray);
4747
}
4848

49-
/* Checks if a given object is defined (from the point of view of the
50-
* representation). */
51-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
52-
return !PMC_IS_NULL(((KnowHOWREPRInstance *)PMC_data(obj))->body.methods);
53-
}
54-
5549
/* Helper to die because this type doesn't support attributes. */
5650
PARROT_DOES_NOT_RETURN
5751
static void die_no_attrs(PARROT_INTERP) {
@@ -189,7 +183,6 @@ REPROps * KnowHOWREPR_initialize(PARROT_INTERP) {
189183
this_repr->type_object_for = type_object_for;
190184
this_repr->allocate = allocate;
191185
this_repr->initialize = initialize;
192-
this_repr->defined = defined;
193186
this_repr->get_attribute = get_attribute;
194187
this_repr->get_attribute_int = get_attribute_int;
195188
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/P6int.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4343
((P6intBody *)data)->value = 0;
4444
}
4545

46-
/* Checks if a given object is defined (from the point of view of the
47-
* representation). */
48-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
49-
/* Native types only ever exist as the type object, which is undefined. */
50-
return 0;
51-
}
52-
5346
/* Helper to die because this type doesn't support attributes. */
5447
PARROT_DOES_NOT_RETURN
5548
static void die_no_attrs(PARROT_INTERP) {
@@ -179,7 +172,6 @@ REPROps * P6int_initialize(PARROT_INTERP) {
179172
this_repr->type_object_for = type_object_for;
180173
this_repr->allocate = allocate;
181174
this_repr->initialize = initialize;
182-
this_repr->defined = defined;
183175
this_repr->get_attribute = get_attribute;
184176
this_repr->get_attribute_int = get_attribute_int;
185177
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/P6num.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4444
((P6numBody *)data)->value = 0.0/x;
4545
}
4646

47-
/* Checks if a given object is defined (from the point of view of the
48-
* representation). */
49-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
50-
/* Native types only ever exist as the type object, which is undefined. */
51-
return 0;
52-
}
53-
5447
/* Helper to die because this type doesn't support attributes. */
5548
PARROT_DOES_NOT_RETURN
5649
static void die_no_attrs(PARROT_INTERP) {
@@ -180,7 +173,6 @@ REPROps * P6num_initialize(PARROT_INTERP) {
180173
this_repr->type_object_for = type_object_for;
181174
this_repr->allocate = allocate;
182175
this_repr->initialize = initialize;
183-
this_repr->defined = defined;
184176
this_repr->get_attribute = get_attribute;
185177
this_repr->get_attribute_int = get_attribute_int;
186178
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/P6opaque.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,12 +388,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
388388
/* XXX Fill this out when we may have nested things to initialize. */
389389
}
390390

391-
/* Checks if a given object is defined (from the point of view of the
392-
* representation). */
393-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
394-
return !PObj_flag_TEST(private0, obj);
395-
}
396-
397391
/* Helper for complaining about attribute access errors. */
398392
PARROT_DOES_NOT_RETURN
399393
static void no_such_attribute(PARROT_INTERP, const char *action, PMC *class_handle, STRING *name) {
@@ -604,7 +598,7 @@ static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) {
604598
P6opaqueInstance *obj;
605599
P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(to_clone)->REPR_data;
606600

607-
if (defined(interp, to_clone)) {
601+
if (IS_CONCRETE(to_clone)) {
608602
obj = (P6opaqueInstance *)Parrot_gc_allocate_fixed_size_storage(interp, repr_data->allocation_size);
609603
memcpy(obj, PMC_data(to_clone), repr_data->allocation_size);
610604
return wrap_object(interp, obj);
@@ -890,7 +884,6 @@ REPROps * P6opaque_initialize(PARROT_INTERP) {
890884
this_repr->type_object_for = type_object_for;
891885
this_repr->allocate = allocate;
892886
this_repr->initialize = initialize;
893-
this_repr->defined = defined;
894887
this_repr->get_attribute = get_attribute;
895888
this_repr->get_attribute_int = get_attribute_int;
896889
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/P6str.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4343
((P6strBody *)data)->value = STRINGNULL;
4444
}
4545

46-
/* Checks if a given object is defined (from the point of view of the
47-
* representation). */
48-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
49-
/* Native types only ever exist as the type object, which is undefined. */
50-
return 0;
51-
}
52-
5346
/* Helper to die because this type doesn't support attributes. */
5447
PARROT_DOES_NOT_RETURN
5548
static void die_no_attrs(PARROT_INTERP) {
@@ -181,7 +174,6 @@ REPROps * P6str_initialize(PARROT_INTERP) {
181174
this_repr->type_object_for = type_object_for;
182175
this_repr->allocate = allocate;
183176
this_repr->initialize = initialize;
184-
this_repr->defined = defined;
185177
this_repr->get_attribute = get_attribute;
186178
this_repr->get_attribute_int = get_attribute_int;
187179
this_repr->get_attribute_num = get_attribute_num;

src/6model/reprs/Uninstantiable.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,6 @@ static void initialize(PARROT_INTERP, STable *st, void *data) {
4242
/* Nothing to do. */
4343
}
4444

45-
/* Checks if a given object is defined (from the point of view of the
46-
* representation). */
47-
static INTVAL defined(PARROT_INTERP, PMC *obj) {
48-
/* Non-instantiable; always undefined. */
49-
return 0;
50-
}
51-
5245
/* Helper to die because this type doesn't support attributes. */
5346
PARROT_DOES_NOT_RETURN
5447
static void die_no_attrs(PARROT_INTERP) {
@@ -178,7 +171,6 @@ REPROps * Uninstantiable_initialize(PARROT_INTERP) {
178171
this_repr->type_object_for = type_object_for;
179172
this_repr->allocate = allocate;
180173
this_repr->initialize = initialize;
181-
this_repr->defined = defined;
182174
this_repr->get_attribute = get_attribute;
183175
this_repr->get_attribute_int = get_attribute_int;
184176
this_repr->get_attribute_num = get_attribute_num;

src/6model/sixmodelobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ PMC * create_stable(PARROT_INTERP, REPROps *REPR, PMC *HOW) {
171171
PMC * decontainerize(PARROT_INTERP, PMC *var) {
172172
if (var->vtable->base_type == smo_id) {
173173
ContainerSpec *spec = STABLE(var)->container_spec;
174-
if (spec && REPR(var)->defined(interp, var)) {
174+
if (spec && IS_CONCRETE(var)) {
175175
if (!PMC_IS_NULL(spec->value_slot.class_handle)) {
176176
/* Just get slot. */
177177
return VTABLE_get_attr_keyed(interp, var, spec->value_slot.class_handle,

src/6model/sixmodelobject.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ struct SixModel_REPROps {
159159
* may recursively call initialize for any flattened objects. */
160160
void (*initialize) (PARROT_INTERP, STable *st, void *data);
161161

162-
/* Checks if a given object is defined (from the point of
163-
* view of the representation). */
164-
INTVAL (*defined) (PARROT_INTERP, PMC *Obj);
165-
166162
/* Gets the current value for an object attribute. */
167163
PMC * (*get_attribute) (PARROT_INTERP, PMC *Object, PMC *ClassHandle, STRING *Name, INTVAL Hint);
168164

0 commit comments

Comments
 (0)