Index: src/runtime/runtime-private.h ================================================================== --- src/runtime/runtime-private.h +++ src/runtime/runtime-private.h @@ -107,21 +107,18 @@ }; #ifdef OF_SELUID24 struct objc_sparsearray_level2 { struct objc_sparsearray_level3 *buckets[256]; - bool empty; }; struct objc_sparsearray_level3 { const void *buckets[256]; - bool empty; }; #else struct objc_sparsearray_level2 { const void *buckets[256]; - bool empty; }; #endif extern void objc_register_all_categories(struct objc_abi_symtab*); extern struct objc_category** objc_categories_for_class(Class); Index: src/runtime/sparsearray.m ================================================================== --- src/runtime/sparsearray.m +++ src/runtime/sparsearray.m @@ -34,18 +34,14 @@ empty_level2 = malloc(sizeof(struct objc_sparsearray_level2)); if (empty_level2 == NULL) OBJC_ERROR("Not enough memory to allocate sparse array!"); - empty_level2->empty = true; - #ifdef OF_SELUID24 empty_level3 = malloc(sizeof(struct objc_sparsearray_level3)); if (empty_level3 == NULL) OBJC_ERROR("Not enough memory to allocate sparse array!"); - - empty_level3->empty = true; #endif #ifdef OF_SELUID24 for (i = 0; i < 256; i++) { empty_level2->buckets[i] = empty_level3; @@ -89,16 +85,16 @@ uint_fast16_t k; #endif uint32_t idx; for (i = 0; i < 256; i++) { - if (src->buckets[i]->empty) + if (src->buckets[i] == empty_level2) continue; #ifdef OF_SELUID24 for (j = 0; j < 256; j++) { - if (src->buckets[i]->buckets[j]->empty) + if (src->buckets[i]->buckets[j] == empty_level3) continue; for (k = 0; k < 256; k++) { const void *obj; @@ -138,22 +134,20 @@ #else uint8_t i = idx >> 8; uint8_t j = idx; #endif - if (s->buckets[i]->empty) { + if (s->buckets[i] == empty_level2) { struct objc_sparsearray_level2 *t; uint_fast16_t l; t = malloc(sizeof(struct objc_sparsearray_level2)); if (t == NULL) OBJC_ERROR("Not enough memory to insert into sparse " "array!"); - t->empty = false; - for (l = 0; l < 256; l++) #ifdef OF_SELUID24 t->buckets[l] = empty_level3; #else t->buckets[l] = NULL; @@ -161,22 +155,20 @@ s->buckets[i] = t; } #ifdef OF_SELUID24 - if (s->buckets[i]->buckets[j]->empty) { + if (s->buckets[i]->buckets[j] == empty_level3) { struct objc_sparsearray_level3 *t; uint_fast16_t l; t = malloc(sizeof(struct objc_sparsearray_level3)); if (t == NULL) OBJC_ERROR("Not enough memory to insert into sparse " "array!"); - t->empty = false; - for (l = 0; l < 256; l++) t->buckets[l] = NULL; s->buckets[i]->buckets[j] = t; } @@ -194,16 +186,16 @@ #ifdef OF_SELUID24 uint_fast16_t j; #endif for (i = 0; i < 256; i++) { - if (s->buckets[i]->empty) + if (s->buckets[i] == empty_level2) continue; #ifdef OF_SELUID24 for (j = 0; j < 256; j++) - if (!s->buckets[i]->buckets[j]->empty) + if (!s->buckets[i]->buckets[j] == empty_level3) free(s->buckets[i]->buckets[j]); #endif free(s->buckets[i]); }