Index: configure.ac ================================================================== --- configure.ac +++ configure.ac @@ -114,13 +114,13 @@ objc_runtime="ObjFW runtime" AC_CHECK_HEADER(objc/objc.h) AC_MSG_CHECKING(which Objective C runtime to use) AC_ARG_ENABLE(runtime, AS_HELP_STRING([--enable-runtime], [use the included runtime])) -AC_ARG_ENABLE(seluid16, - AS_HELP_STRING([--enable-seluid16], - [use only 16 bit for selectors UIDs])) +AC_ARG_ENABLE(seluid24, + AS_HELP_STRING([--enable-seluid24], + [use 24 bit for selectors UIDs])) AS_IF([test x"$enable_runtime" != x"yes"], [ AS_IF([test x"$ac_cv_header_objc_objc_h" = x"yes"], [ dnl TODO: This is ugly. Let's think of a better check. AC_EGREP_CPP(yes, [ #import @@ -254,13 +254,13 @@ AC_SUBST(LOOKUP_S, lookup-arm-elf.S) AC_DEFINE(OF_ASM_LOOKUP, 1, [Whether to use assembly for lookup]) ]) - AS_IF([test x"$enable_seluid16" = x"yes"], [ - AC_DEFINE(OF_SELUID16, 1, - [Whether to use 16 bit selector UIDs]) + AS_IF([test x"$enable_seluid24" = x"yes"], [ + AC_DEFINE(OF_SELUID24, 1, + [Whether to use 24 bit selector UIDs]) ]) AX_CHECK_COMPILER_FLAGS(-Wno-deprecated-objc-isa-usage, [OBJCFLAGS="$OBJCFLAGS -Wno-deprecated-objc-isa-usage"]) ;; Index: src/runtime/lookup-amd64-elf.S ================================================================== --- src/runtime/lookup-amd64-elf.S +++ src/runtime/lookup-amd64-elf.S @@ -29,11 +29,11 @@ lookup: movq (%rsi), %rax movzbl %ah, %ecx movzbl %al, %edx -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 shrl $16, %eax movq (%r8,%rax,8), %r8 #endif movq (%r8,%rcx,8), %r8 Index: src/runtime/lookup-amd64-macho.S ================================================================== --- src/runtime/lookup-amd64-macho.S +++ src/runtime/lookup-amd64-macho.S @@ -29,11 +29,11 @@ lookup: movq (%rsi), %rax movzbl %ah, %ecx movzbl %al, %edx -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 shrl $16, %eax movq (%r8,%rax,8), %r8 #endif movq (%r8,%rcx,8), %r8 Index: src/runtime/lookup-arm-elf.S ================================================================== --- src/runtime/lookup-arm-elf.S +++ src/runtime/lookup-arm-elf.S @@ -26,11 +26,11 @@ ldr r2, [r0, #0] ldr r2, [r2, #32] lookup: -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 ldrb r3, [r1, #2] ldr r2, [r2, r3, lsl #2] #endif ldrb r3, [r1, #1] ldr r2, [r2, r3, lsl #2] Index: src/runtime/lookup-ppc-elf.S ================================================================== --- src/runtime/lookup-ppc-elf.S +++ src/runtime/lookup-ppc-elf.S @@ -26,23 +26,23 @@ lwz %r5, 0(%r3) lwz %r5, 32(%r5) lookup: -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 lbz %r6, 1(%r4) #endif lbz %r7, 2(%r4) lbz %r8, 3(%r4) -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 slwi %r6, %r6, 2 #endif slwi %r7, %r7, 2 slwi %r8, %r8, 2 -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 lwzx %r5, %r5, %r6 #endif lwzx %r5, %r5, %r7 lwzx %r5, %r5, %r8 Index: src/runtime/lookup-x86-elf.S ================================================================== --- src/runtime/lookup-x86-elf.S +++ src/runtime/lookup-x86-elf.S @@ -29,11 +29,11 @@ movl 32(%edx), %edx lookup: movl 8(%esp), %eax -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 movzbl 2(%eax), %ecx movl (%edx,%ecx,4), %edx #endif movzbl 1(%eax), %ecx movl (%edx,%ecx,4), %edx Index: src/runtime/runtime-private.h ================================================================== --- src/runtime/runtime-private.h +++ src/runtime/runtime-private.h @@ -104,11 +104,11 @@ struct objc_sparsearray { struct objc_sparsearray_level2 *buckets[256]; }; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 struct objc_sparsearray_level2 { struct objc_sparsearray_level3 *buckets[256]; BOOL empty; }; @@ -160,11 +160,11 @@ extern void objc_global_mutex_free(void); static inline void* objc_sparsearray_get(const struct objc_sparsearray *s, uint32_t idx) { -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 uint8_t i = idx >> 16; uint8_t j = idx >> 8; uint8_t k = idx; return (void*)s->buckets[i]->buckets[j]->buckets[k]; Index: src/runtime/selector.m ================================================================== --- src/runtime/selector.m +++ src/runtime/selector.m @@ -21,11 +21,11 @@ #include #import "runtime.h" #import "runtime-private.h" -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 # define SEL_MAX 0xFFFFFF #else # define SEL_MAX 0xFFFF #endif Index: src/runtime/sparsearray.m ================================================================== --- src/runtime/sparsearray.m +++ src/runtime/sparsearray.m @@ -21,11 +21,11 @@ #import "runtime.h" #import "runtime-private.h" static struct objc_sparsearray_level2 *empty_level2 = NULL; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 static struct objc_sparsearray_level3 *empty_level3 = NULL; #endif static void init(void) @@ -36,19 +36,19 @@ if (empty_level2 == NULL) OBJC_ERROR("Not enough memory to allocate sparse array!"); empty_level2->empty = YES; -#ifndef OF_SELUID16 +#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 = YES; #endif -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 for (i = 0; i < 256; i++) { empty_level2->buckets[i] = empty_level3; empty_level3->buckets[i] = NULL; } #else @@ -61,11 +61,11 @@ objc_sparsearray_new(void) { struct objc_sparsearray *s; uint_fast16_t i; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 if (empty_level2 == NULL || empty_level3 == NULL) init(); #else if (empty_level2 == NULL) init(); @@ -83,20 +83,20 @@ void objc_sparsearray_copy(struct objc_sparsearray *dst, struct objc_sparsearray *src) { uint_fast16_t i, j; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 uint_fast16_t k; #endif uint32_t idx; for (i = 0; i < 256; i++) { if (src->buckets[i]->empty) continue; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 for (j = 0; j < 256; j++) { if (src->buckets[i]->buckets[j]->empty) continue; for (k = 0; k < 256; k++) { @@ -129,11 +129,11 @@ } void objc_sparsearray_set(struct objc_sparsearray *s, uint32_t idx, const void *obj) { -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 uint8_t i = idx >> 16; uint8_t j = idx >> 8; uint8_t k = idx; #else uint8_t i = idx >> 8; @@ -151,20 +151,20 @@ "array!"); t->empty = NO; for (l = 0; l < 256; l++) -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 t->buckets[l] = empty_level3; #else t->buckets[l] = NULL; #endif s->buckets[i] = t; } -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 if (s->buckets[i]->buckets[j]->empty) { struct objc_sparsearray_level3 *t; uint_fast16_t l; t = malloc(sizeof(struct objc_sparsearray_level3)); @@ -189,16 +189,16 @@ void objc_sparsearray_free(struct objc_sparsearray *s) { uint_fast16_t i; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 uint_fast16_t j; #endif for (i = 0; i < 256; i++) { -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 if (s->buckets[i]->empty) continue; for (j = 0; j < 256; j++) if (!s->buckets[i]->buckets[j]->empty) @@ -214,15 +214,15 @@ void objc_sparsearray_cleanup(void) { if (empty_level2 != NULL) free(empty_level2); -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 if (empty_level3 != NULL) free(empty_level3); #endif empty_level2 = NULL; -#ifndef OF_SELUID16 +#ifdef OF_SELUID24 empty_level3 = NULL; #endif }