* Implement PowerPC block trampoline
* Adjust pagesize on ppc64
* Skip UnexpectedException test for PowerPC
* Move PAGE_SIZE to asmconstants.h
* Use PAGE_SIZE and PAGE_SHIFT macros for PowerPC
* Add ppc64el and powerpc qemu-crossbuild targets
* Add NO_SAFE_CACHING definition and guards
* Do not export objc_method_cache_version on ppc32
---------
Co-authored-by: David Chisnall <davidchisnall@users.noreply.github.com>
The fast paths follow the pattern that we established for fast ARC:
Framework base classes can opt in by implementing a `+_TrivialAllocInit`
method.
This opt-in behaviour is inherited and is removed implicitly in any
subclass that implements alloc or init methods (alloc and init are
treated independently).
Compilers can emit calls to `objc_alloc(cls)` instead of `[cls alloc]`,
`objc_allocWithZone(cls)` instead of `[cls allocWithZone: NULL]`, and
`objc_alloc_init` instead of `[[cls alloc] init]`.
Direct methods don't require very much support in the runtime. Apple
reuses their fast path for `-self` (which is supported only in the Apple
fork of clang, not the upstream version) for a fast init. Given that
the first few fields of the runtime's class structure have been stable
for around 30 years, I'm happy moving the flags word (and the
initialised bit, in particular) into the public ABI. This lets us do a
fast-path check for whether a class is initialised in class methods and
call `objc_send_initialize` if it isn't. This function is now exposed
as part of the public ABI, it was there already and does the relevant
checks without invoking any of the message-sending machinery.
Fixes#165#169
* Add __GNUSTEP_MSGSEND__ definition
* Mark test as skipped if return code is 77
* Skip tests using objc_msgSend if not available
* ManyManySelectors: Skip objc_msgSend if not available
* Skip UnexpectedException test on ARM and AArch64
* Add UnexpectedException.m to list of unit tests
* Call manyArgs with objc_msgSend directly
* RISC-V objc_msgSend implementation
* Use objc_msgSend.riscv64.S if requirements are met
* RISC-V 64-bit block trampoline
* Fix formatting
* Add riscv64 crossbuild in CI
* Exclude llvm 13 and 14 for riscv64 in CI
* Add RISC-V and Windows on ARM to ANNOUNCE
* Add comment to why we exclude architectures in qemu-crossbuild
* Remove duplicated entry in ANNOUNCE
* Conditionally include ntdll.dll
* Use text relocation instead of GOT
* Use FlushInstructionCache instead of clear_cache for arm64
* Load address in two stages (adrp, add)
* objc_msgSend.aarch64.S add comments
* Add seh directives
* Move .seh_proc into slow sloop section
* Comment out cfi directives
* Substitute raw .seh directives with macros
* Add documentation of SEH annotations
* Detect CPU Architecture with preprocessor
* Cleanup CMakeLists.txt
Co-authored-by: David Chisnall <davidchisnall@users.noreply.github.com>
* Remove line in objc_msgSend.aarch64.S
Co-authored-by: David Chisnall <davidchisnall@users.noreply.github.com>
* Change Test CMakeList to use ARCHITECTURE var
* Use existing clear cache macro
* Change _WIN64 to _WIN32 and reorder labels
* Remove macro and replace _WIN64 with _WIN32
* Remove argument from non-win32 macro
---------
Co-authored-by: David Chisnall <davidchisnall@users.noreply.github.com>
This removes all support for GC mode.
This was deprecated by Apple in OS X 10.8 (2012) and never supported in
iOS. Very little code ever tried to use it with this runtime.
It's gone from the build system already.
This replaces a few home-grown datastructures with third-party ones that
get a lot more testing:
- The home-grown hopscotch hash table is moved to using robin map. The
original was designed to be lock free, but we've been using it behind
a lock for ages.
- The selector list is now a std::vector.
- The types list now use std::forward_list.
This also removes a couple of code paths that haven't been used since we
started using the new ABI data structures internally and upgrading at
load time.
The new code tries to differentiate in the static type system between
registered and unregistered selectors. The check for whether a selector
is registered is fragile and depends on no selector being mapped or
allocated in memory below the total number of selectors. This check can
now disappear on most code paths.
On a single test machine (not guaranteed to be representative) the test
suite now completes around 20% faster.
This adds a dependency on a version of CMake with support for Objective-C,
removing a number of hacks to make CMake work and introduces a few
modernisations:
- Options use CMake's `option` mechanism.
- A lot of things now use generator expressions, which should improve the
things like the multi-config Ninja generator.
- We no longer depend on hacks to build in CI.
At the same time, a few other things are simplified:
- There is no longer support for building without C++ support and we depend on
a C++ standard library, not just a runtime. This makes it possible to use
more C++ features inside the runtime.
- We no longer support clang-cl on Windows and instead require clang.exe.
- Support for the Boehm GC has been removed.
The instance size was being reported incorrectly which meant that
associated objects looked for a reference list slightly after the end of
the object.
Fixes#228
CI was failing because a number of our host platforms were no longer
supported. This commit:
- Moves to the latest FreeBSD 12, 13, and 14 branch releases.
- Moves to modern Ubuntu.
- Replaces Windows 2016 with 2022
- Moves from Azure Pipelines to GitHub for the non-FreeBSD tests.
- Fixes some tests that are not reliable in some contexts.
Reorders how locking is handled in `objc_send_initialize()` to prevent a deadlock.
Previously, contention on the low level spinlocks could cause a very intermittent deadlock:
- Thread A : `objc_send_initialize()` holds the runtime lock, then tries to acquire the object lock on the metaclass, which needs to initialize the mutex for the new metaclass inside `referenceListForObject()`, so it tries to lock the `lock_for_pointer()` / `lock_spinlock()`
- Thread B : `referenceListForObject()` holds a spinlock for an unrelated object while running `initHiddenClassForObject()` -> `allocateHiddenClass()`, which tries to acquire the runtime lock
If the metaclass object pointer in Thread A hashes to the same spinlock as the object in thread B, the runtime lock ends up deadlocked forever.
This test used to fail on Windows, because Clang's codegen and transformation haven't been in-line with the requirements of the WinEH backend in LLVM. The following changes implement the missing pieces and let the test to pass in both debug and release mode:
https://reviews.llvm.org/D128190 [WinEH] Apply funclet operand bundles to nounwind intrinsics that lower to function calls in the course of IR transforms
https://reviews.llvm.org/D134441 [ObjC][ARC] Fix target register for call expanded from CALL_RVMARKER on Windows
https://reviews.llvm.org/D137939 [CGObjC] Open cleanup scope before SaveAndRestore CurrentFuncletPad and push CatchRetScope early
https://reviews.llvm.org/D137944 [ObjC][ARC] Teach the OptimizeSequences step of ObjCARCOpts about WinEH funclet tokens
Fixes building for Android arm64-v8a with NDK r25, which no longer supports this flag. Since we were passing this unconditionally we were previously inadvertently disabling NEON support if the flag wasn't set.
This originally came up as an issue with libc++abi support (#152), but is not specific to that ABI.
* Use the C++ runtime to check for uncaught C++ exceptions.
As discussed in #152, use the function defined in the Itanium C++ ABI to
check whether the thrown exception is the current caught C++ exception
and needs rethrowing via `__cxa_rethrow()`.
Co-authored-by: Niels Grewe <grewe@ocean-insights.com>
Co-authored-by: David Chisnall <gnustep@theravensnest.org>
* Add test for emptying autorelease pool
* Fix arc autorelease pool emptying when adding further references
When releasing a reference in the arc autorelease pool, it is
possible and anticipated that new references may added to the pool.
This fix addresses an edge case where releasing a reference in the
same pool page as the stop position can add more references which
cause the insertion of a new page and emptyPool() returns early
after emptying the new page.
This fixes a regression in 73132a6 (#200) where nil was returned
from a retain call after the object begins deallocating. Normal
retains of a deallocating object are still expected to return an
instance pointer inside its dealloc method and code compiled with ARC
will generate calls to objc_storeStrong() when a block captures the
self pointer inside the dealloc method.