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
* 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
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.
An interesting feature of the AArch64 ABI simplifies this code relative to other platforms. AArch64 reserves an extra register (x8) for the address of struct returns, giving the
clang trunk if -fobjc-runtime-1.7 is specified and provides significantly
better interoperability with foreign exceptions.
Note: Most of the exception tests will not pass with gcc or clang < 3.3. They
test things that are impossible to implement quite correctly with the
GCC-compatible exception ABI.
Also updated the release notes to reflect recent improvements.
Store the refcount structures inside the hash table, rather than in a chained structure. This uses less space and should be easier for the GC to scan (less cache used).
Added a really ugly hack so that the ABI versions of the three .m files are not checked. This will (hopefully!) prevent the GC being enabled when libobjc is loaded after being compiled with -fobjc-gc.