55 Commits (08bad37c3245490e0bb31fb70ce1063cc934c18d)

Author SHA1 Message Date
Hugo Melder e882423e5a
PowerPC {32, 64}-bit Block Trampolines (#272)
* 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>
2 years ago
Frederik Carlier 4d9d930940 Mark legacy API with OBJC_PUBLIC
Fixes compilation errors on MINGW when using the legacy API (-fobjc-runtime=gnustep-1.7 or -fobjc-runtime=gcc)
2 years ago
David Chisnall e23882fb23 Rewrite the selector table in C++.
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.
3 years ago
David Chisnall 78ff24516c Fix invoking missing superclass methods.
The lookup functions for the superclass paths were silently ignoring
missing methods, rather than calling the forwarding hook.

Fixes #153
6 years ago
Frederik Seiffert ae6a777742 Add support for atomic type qualifiers.
Fixes #101.
7 years ago
David Chisnall 4e9fd2ec8a Rename objc_slot and objc_slot_v1.
The objc_slot type was exposed via public interfaces and the renaming
broke things (including the GNUstep build).
8 years ago
David Chisnall 2e32888296 Remove profiling support.
This was used with an old LLVM pass to perform speculative inlining.  It
is no longer maintained and this code hasn't been tested at all for
years or with nontrivial examples ever.
8 years ago
David Chisnall a8752cd842 Clean up method / slot lookup interfaces. 8 years ago
David Chisnall a9a2ed6b10 Refactor to use `objc_method` as the slot.
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.
8 years ago
David Chisnall ccb8627765 Don't leak extended type encodings in slot access. 8 years ago
David Chisnall c3c81796ca Rework slot handling so that the fields that are used for dispatch are
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`.
10 years ago
theraven f059be5337 Add better handling of messages returning floating point values sent to nil. 14 years ago
theraven d8192c3a64 Always return 64-bit 0 in response to a message to nil on x86. 14 years ago
theraven 6950cb8e55 A couple of small bug fixes. 14 years ago
theraven 4c9acdf153 ARM stuff. 14 years ago
theraven 2e73765ffa Added some experimental stuff. 14 years ago
theraven 8af52846b7 Small object (hidden in a pointer) support. 15 years ago
theraven 2d493697a6 Work around PyObjC's stupid abuse of the message-send-to-super mechanism. 15 years ago
theraven 6412c7a4e7 And another one... 15 years ago
theraven ad16172625 First pass at implementing Apple-compatible GC using Boehm. Still needs some tidying, but the following work:
- __strong pointers, preventing objects from being freed

_ __weak pointers are automatically freed when the last remaining __strong pointer goes away

- objc_gc_{retain,release}_np() functions, which can be used to implement CFRetain() and CFRelease() (adds an reference count - the object will not be collected until after its last retain is gone.
15 years ago
theraven 535ba87a8e Store the selector, not the type encoding, in slots. 15 years ago
theraven d7056f6de2 Simplify @synchronize() and improve efficiency (space and time). 15 years ago
theraven 987ab88a94 Don't do hidden-class transforms for classes, just dangle the look-aside data off the class structure.
Individually lock classes so that +initialize can be sent concurrently to two different classes in two different threads.
15 years ago
theraven 24de067017 Default to building without the legacy APIs, now GNUstep doesn't require them. 15 years ago
theraven d51500184c More cleanups. Stop using __ identifiers for internal stuff now that it's properly marked private and we don't have to worry about conflicts. 15 years ago
theraven 23b26820f5 Make it easier to suppress mismatched selector warnings. It's useful for the runtime to tell you when your code is bad. Not so useful for it to tell you when someone else's code is bad... 15 years ago
theraven f330ba0f36 Remove thread-local variable that isn't actually used... 15 years ago
theraven a2db6f58be Made the selector name field into a union of the name (unregistered selectors) and the selector id / index (registered selectors), to more accurately reflect how it is used in the code. 15 years ago
theraven 2e3b19b735 Ugh, made the same mistake I spent an entire lecture telling my students not to make. Feeling stupid. 15 years ago
theraven 4a3326f2fd Fix class_getMethodImplementation() semantics for Apple compatibility (returns forwarding selector IMP, doesn't actually do the forwarding). 15 years ago
theraven 8c966c461b Return the forwarding IMP from get_imp if required. 15 years ago
theraven 63c2c0ce73 Added NULL checks to class_respondsToSelector() 15 years ago
ericwa 9e64fb7828 undo accidentally commited stuff 16 years ago
ericwa dbb8ea2090 add deprecated sel_eq function for compatibility 16 years ago
theraven 0284155f2d Added a hook that defines the behaviour when you call a method with the wrong signature. 16 years ago
theraven 42a545fc7c In some irritating circumstances, the load order can cause a +load message to trigger other code, which sends messages with selectors that have not been mapped yet.
The runtime was handling the message lookup correctly in this case, but only as a side-effect of the fallback code from when type-dependent dispatch is not possible.  This resulted in a confusing warning message, telling you that you were calling a method with an incorrect signature, when the two signatures that it printed were the same.

This case is now handled correctly, so the warning disappears (unless you really are calling a method with the wrong signature and have TDD enabled).
16 years ago
theraven 943ed5e714 Some source tidies. 16 years ago
theraven 2cc96a6f7e Fix message forwarding by, for example, actually calling the public forwarding hook, instead of one that isn't exposed to GNUstep... 16 years ago
theraven 378c7d3a6c Crash in the caller, instead of in the message lookup, when the method does not exist and there is no forwarding hook. 16 years ago
theraven 0e374db1db Added support for type-dependent dispatch to libobjc2. 16 years ago
theraven b1b9baf382 Finished rewrite of message sending. Deleted lots of legacy stuff. 16 years ago
theraven 1a60fabf96 More 64-bit fixes. 16 years ago
theraven b04cccf46b Fixed some issues in runtime.c when looking up methods. This fixes some issues with DO.
Removed GNU dtable and sparse array implementations, replaced entirely now with versions based on the Étoilé runtime.  Performance is roughly equivalent in microbenchmarks, memory usage is significantly lower (Gorm goes from 95MB to 50MB on my machine - this will be even more pronounced on 64-bit systems), which should improve cache usage considerably.  Still room for some performance tuning, however.
16 years ago
theraven 0d78186238 Some bug fixes and tidies.
I now have an out-of-tree replacement for the dtable stuff, so sarray.{h,c} will be going away soon.  The replacement offers similar (slightly worse currently) performance in microbenchmarks, but uses half as much memory (Gorm goes from 95MB to 48MB on my machine).  This will be committed once it's been tweaked a little bit.
16 years ago
theraven ede942cdd8 Simplified profiling even more. Now should allow inlining of manually-cached IMPs. 16 years ago
theraven 160d1ce829 Added cachable version of the message-to-super lookup function. Clang now calls this in preference to the other one when -fobjc-nonfragile-abi is specified. 16 years ago
theraven 6459292a40 Simplified profiling system and enabled it by default. This should be safe, because it no longer depends on dladdr() and friends (which don't work reliably anywhere), and instead expects the profiling modules to register their own symbol table. 16 years ago
theraven fb26e9a9ef Disable sender-aware dispatch - it breaks some code. 16 years ago
rfm 301c01b2ae slightly more rigorous dtable handling. 16 years ago
theraven eee7956bce Cleaner version of the last fix. 16 years ago