From 16c4b59c8ee912ec39d9ac51c029d38223165de8 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 1 Dec 2015 15:47:19 -0800 Subject: [PATCH] OS X 10.11 on 64-bit now supports non-pointer isa. --- ObjectiveC/Library.mm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 8c1528d..87ad547 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1988,11 +1988,6 @@ static JSValueRef Internal_getProperty(JSContextRef context, JSObjectRef object, id self(internal->GetValue()); const char *name(CYPoolCString(pool, context, property)); -#ifdef __arm64__ - if (strcmp(name, "isa") == 0) - return CYCastJSValue(context, object_getClass(self)); -#endif - if (objc_ivar *ivar = object_getInstanceVariable(self, name, NULL)) { ptrdiff_t offset(ivar_getOffset(ivar)); void *data(reinterpret_cast(self) + offset); @@ -2008,6 +2003,12 @@ static JSValueRef Internal_getProperty(JSContextRef context, JSObjectRef object, uintptr_t mask((1 << length) - 1); return CYCastJSValue(context, (field >> shift) & mask); } else { +#if defined(__APPLE__) && defined(__LP64__) + // XXX: maybe do even more verifications here + if (strcmp(name, "isa") == 0) + return CYCastJSValue(context, object_getClass(self)); +#endif + auto type(new(pool) Type_privateData(encoding)); return CYFromFFI(context, type->type_, type->GetFFI(), data); } @@ -2234,7 +2235,7 @@ static void choose_(task_t task, void *baton, unsigned type, vm_range_t *ranges, continue; uintptr_t *pointers(reinterpret_cast(data)); -#ifdef __arm64__ +#if defined(__APPLE__) && defined(__LP64__) Class isa(reinterpret_cast(pointers[0] & 0x1fffffff8)); #else Class isa(reinterpret_cast(pointers[0])); -- 2.45.2