Skip to content

Commit

Permalink
objc4-866.9
Browse files Browse the repository at this point in the history
Imported from objc4-866.9.tar.gz
  • Loading branch information
AppleOSSDistributions committed Nov 4, 2022
1 parent 8701d56 commit 689525d
Show file tree
Hide file tree
Showing 135 changed files with 7,835 additions and 14,953 deletions.
1,088 changes: 0 additions & 1,088 deletions objc.vcproj

This file was deleted.

1 change: 1 addition & 0 deletions objc.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

241 changes: 151 additions & 90 deletions objc.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

27 changes: 22 additions & 5 deletions runtime/Messengers.subproj/objc-msg-arm64.s
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#ifdef __arm64__

#include <arm/arch.h>
#include "isa.h"
#include "objc-config.h"
#include "arm64-asm.h"
Expand Down Expand Up @@ -155,6 +154,13 @@ _objc_msgSend_indirect_branch:
$0:
.endmacro

.macro MSG_ENTRY /*name*/
.text
.align 10
.globl $0
$0:
.endmacro

.macro STATIC_ENTRY /*name*/
.text
.align 5
Expand Down Expand Up @@ -503,7 +509,7 @@ LLookupPreopt\Function:
.abort unhandled mode \Mode
.endif

5: ldursw x9, [x10, #-8] // offset -8 is the fallback offset
5: ldur x9, [x10, #-16] // offset -16 is the fallback offset
add x16, x16, x9 // compute the fallback isa
b LLookupStart\Function // lookup again with a new isa
.endif
Expand Down Expand Up @@ -566,7 +572,7 @@ _objc_debug_taggedpointer_classes:
.endmacro
#endif

ENTRY _objc_msgSend
MSG_ENTRY _objc_msgSend
UNWIND _objc_msgSend, NoFrame

cmp p0, #0 // nil check and tagged pointer check
Expand All @@ -575,8 +581,8 @@ _objc_debug_taggedpointer_classes:
#else
b.eq LReturnZero
#endif
ldr p13, [x0] // p13 = isa
GetClassFromIsa_p16 p13, 1, x0 // p16 = class
ldr p14, [x0] // p14 = raw isa
GetClassFromIsa_p16 p14, 1, x0 // p16 = class
LGetIsaDone:
// calls imp or objc_msgSend_uncached
CacheLookup NORMAL, _objc_msgSend, __objc_msgSend_uncached
Expand Down Expand Up @@ -800,9 +806,20 @@ LGetImpMissConstant:
mov w17, #METHOD_SIGNING_DISCRIMINATOR
autdb p1, p17
#endif

// Strip off the kind field in the lower two bits.
and p1, p1, ~0x3

add p16, p1, #METHOD_IMP
ldr p17, [x16]
ldr p1, [x1, #METHOD_NAME]

#if __has_feature(ptrauth_calls)
// Strip the selector for big signed methods. This is unnecessary for
// big non-signed methods, but harmless.
xpacd p1
#endif

TailCallMethodListImp x17, x16

L_method_invoke_small:
Expand Down
2 changes: 1 addition & 1 deletion runtime/NSObjCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <TargetConditionals.h>
#include <objc/objc.h>

#if __LP64__ || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64
#if __LP64__ || NS_BUILD_32_LIKE_64
typedef long NSInteger;
typedef unsigned long NSUInteger;
#else
Expand Down
29 changes: 8 additions & 21 deletions runtime/NSObject-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@
#include <string.h>
#include <assert.h>
#include <objc/objc.h>
#include <pthread.h>


#ifndef C_ASSERT
#if __has_feature(cxx_static_assert)
Expand All @@ -86,6 +84,11 @@
#define OBJC_ASSERT(x) assert(x)
#endif

// Make objc_thread_t work when objc-os.h hasn't been included.
#if !OBJC_THREAD_T_DEFINED
typedef struct objc_thread *objc_thread_t;
#endif

struct magic_t {
static const uint32_t M0 = 0xA1A1A1A1;
# define M1 "AUTORELEASE!"
Expand Down Expand Up @@ -134,41 +137,25 @@ struct AutoreleasePoolPageData

static const uintptr_t maxCount = 65535; // 2^16 - 1
};
static_assert((AutoreleasePoolEntry){ .ptr = MACH_VM_MAX_ADDRESS }.ptr == MACH_VM_MAX_ADDRESS, "MACH_VM_MAX_ADDRESS doesn't fit into AutoreleasePoolEntry::ptr!");
static_assert((AutoreleasePoolEntry){ .ptr = OBJC_VM_MAX_ADDRESS }.ptr == OBJC_VM_MAX_ADDRESS, "OBJC_VM_MAX_ADDRESS doesn't fit into AutoreleasePoolEntry::ptr!");
#endif

magic_t const magic;
__unsafe_unretained id *next;
pthread_t const thread;
objc_thread_t const thread;
AutoreleasePoolPage * const parent;
AutoreleasePoolPage *child;
uint32_t const depth;
uint32_t hiwat;

AutoreleasePoolPageData(__unsafe_unretained id* _next, pthread_t _thread, AutoreleasePoolPage* _parent, uint32_t _depth, uint32_t _hiwat)
AutoreleasePoolPageData(__unsafe_unretained id* _next, objc_thread_t _thread, AutoreleasePoolPage* _parent, uint32_t _depth, uint32_t _hiwat)
: magic(), next(_next), thread(_thread),
parent(_parent), child(nil),
depth(_depth), hiwat(_hiwat)
{
}
};


struct thread_data_t
{
#ifdef __LP64__
pthread_t const thread;
uint32_t const hiwat;
uint32_t const depth;
#else
pthread_t const thread;
uint32_t const hiwat;
uint32_t const depth;
uint32_t padding;
#endif
};
C_ASSERT(sizeof(thread_data_t) == 16);

#undef C_ASSERT

#endif
Expand Down
2 changes: 1 addition & 1 deletion runtime/NSObject-private.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct SideTable {

void lock() { slock.lock(); }
void unlock() { slock.unlock(); }
void forceReset() { slock.forceReset(); }
void reset() { slock.reset(); }

// Address-ordered lock discipline for a pair of side tables.

Expand Down
Loading

0 comments on commit 689525d

Please sign in to comment.