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
Several of the hooks were being generated with common linkage in hooks.c
and as normal initialised symbols in sendmsg2.c. Recent clang defaults
to -fno-common, which causes the common linkage versions to become
strong symbols and then causes a linkage failure from duplicate
definitions: one zero initialised, one initialised with a real value.
This removes copy in hooks.c, retaining only the initialised version.
Fixes#171
Methods now include a selector and extended type encoding, rather than a
method name and lgacy type encoding. Older ones are auto-upgraded.
Expose the extended type encoding via a function that JavaScriptCore
expects to exist.
This change set incorporates a number of changes that all needed to
happen together:
* The imp is now the first field of the `objc_method` structure. This
makes it possible to extend the structure without breaking anything
that relies on being able to access the IMP.
* There is no owner in the slot, so we must use other mechanisms for
determining the owner of a method (e.g. whether the same method appears
in the superclass)
* Again, because there is no owner in the slot, we can't use this as a
fast path for finding the C++ construct / destruct methods. These are
now cached in the class structure when they are found.
* The version field is gone from the slot and now we provide a global
version. This is based on the observation that method replacements
are relatively infrequent and the overhead of invalidating all method
caches is cheaper than adding extra state for every (class, method)
pair.
* A number of the runtime functions are simplified because replacing
the IMP in a `Method` now implicitly updates the dtable.
Some applications still include the old objc-class.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
Some applications still include the old objc-runtime.h header expecting
to obtain the declarations contained in objc/message.h and
objc/runtime.h nowadays. This commit adds this header to achieve
out-of-the-box compatibility with these applications.
at the start of the structure, making it easier to change the layout in
the future.
Also clean up the growth of various fields and consolidate some of the
metadata into a pointer to the `struct objc_method`.
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