From a7d4cfd64029c155aae0d2857b2d3bc5f11621db Mon Sep 17 00:00:00 2001 From: theraven Date: Sat, 13 Aug 2011 18:54:28 +0000 Subject: [PATCH] Make the version of libobjc generated by the makefile the one Etoile expects --- Makefile | 4 +++- class.h | 15 ++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index bf6edd1..ebe508d 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ .SUFFIXES: .cc .c .m .o -MAJOR_VERSION = 1 +MAJOR_VERSION = 4 MINOR_VERSION = 6 SUBMINOR_VERSION = 0 VERSION = $(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION) @@ -14,6 +14,8 @@ CPPFLAGS += -D__OBJC_RUNTIME_INTERNAL__=1 -D_XOPEN_SOURCE=500 # Suppress warnings about incorrect selectors CPPFLAGS += -DNO_SELECTOR_MISMATCH_WARNINGS +# Some helpful flags for debugging. +#CPPFLAGS += -g -O0 -fno-inline PREFIX?= /usr/local LIB_DIR= ${PREFIX}/lib diff --git a/class.h b/class.h index 2c9a9a4..4d4f812 100644 --- a/class.h +++ b/class.h @@ -261,11 +261,16 @@ void class_table_insert(Class class); */ extern Class SmallObjectClasses[4]; +static BOOL isSmallObject(id obj) +{ + uintptr_t addr = ((uintptr_t)obj); + return (addr & OBJC_SMALL_OBJECT_MASK) != 0; +} + __attribute__((always_inline)) static inline Class classForObject(id obj) { - uintptr_t addr = ((uintptr_t)obj); - if (UNLIKELY((addr & 1) == 1)) + if (UNLIKELY(isSmallObject(obj))) { if (sizeof(Class) == 4) { @@ -273,15 +278,11 @@ static inline Class classForObject(id obj) } else { + uintptr_t addr = ((uintptr_t)obj); return SmallObjectClasses[((addr >> 1) & 3)]; } } return obj->isa; } -static BOOL isSmallObject(id obj) -{ - uintptr_t addr = ((uintptr_t)obj); - return (addr & 1) == 1; -} #endif //__OBJC_CLASS_H_INCLUDED