36 Commits (f983cdbf683925d942dd1d86edcfe4316bf9ed6c)

Author SHA1 Message Date
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 369c84db35 Fix compiler warnings. 7 years ago
David Chisnall 318ae27d8b Allow attempting to load a module twice.
This is necessary because FreeBSD/ARM and possibly other platforms use
.init_array and not .ctors, so never call the init functions.  As a
result, we will need the compiler to move to putting the load function
in .init_array and may end up with it being called by both variants.
7 years ago
David Chisnall 49bf9378fb Force linking the protocol classes.
We use the existence of the `Protocol` class in a set of loaded objects
to determine whether we are mixing ABIs in a safe way (i.e. only mixing
a new ABI runtime with old ABI everything else).  Unfortunately, in
static linking, the Protocol class was not being linked because it is
never directly referenced, which made this check fail.

Fixes #85
7 years ago
David Chisnall 2edfe64739 Fix incorrect strcmp usage. 7 years ago
David Chisnall d015f0160c Rename PUBLIC to OBJC_PUBLIC to avoid some namespace pollution. 7 years ago
David Chisnall cace3a4062 Add some more debug logging. 7 years ago
David Chisnall 6c2a61de9b Improve protocol reference loading.
Now all @protocol references will refer to precisely the same instance,
even across shared libraries.
8 years ago
David Chisnall 934cd13a7a Initial pass at Windows support.
All tests now pass with the new ABI on x86-64, with the new ABI.  Some
of the code is ugly and other platforms are probably broken.
8 years ago
David Chisnall f48403d51c Add commented code for iterating over constant strings. 8 years ago
David Chisnall 2934a98503 Support building without support for old ABIs. 8 years ago
David Chisnall d11a0311e0 Add checks to prevent mixing incompatible ABI versions. 8 years ago
David Chisnall c50db7b1fe Remove debug log message. 8 years ago
David Chisnall 6c9edcb510 Support new NSConstantString format and update tests. 8 years ago
David Chisnall 65b34a196f Add support for improved property structure.
As a side effect, we need to upgrade properties in class and protocols
(but not categories because we didn't have class properties in earlier
ABIs).
8 years ago
David Chisnall 45d0b8e4c9 Add support for registering aliases.
Also add a test.
8 years ago
David Chisnall 6c1fc86f01 Clean up a condition.
Skip adding the null capability.
8 years ago
David Chisnall 12a0d97849 Add protocol references in the loader.
These are currently ignored, because they are only important when the
runtime has upgraded the protocol.  The runtime will upgrade legacy
protocols, but they are not referenced by this indirection layer.
8 years ago
David Chisnall 9718ce247d Initial start of documenting the ABI. 8 years ago
David Chisnall f91fb2e745 Checkpoint more work on new ABI.
We're now using a new class and category structure and auto-upgrading the old ones.  Other changes:

- The Ivar structure now points to the ivar offset variable, so we can more easily find it.
- Categories can now add properties.
8 years ago
David Chisnall f55c158be8 First pass at new Objective-C ABI. 10 years ago
theraven 8d954d1cb8 When linking libdispatch, register to create / destroy autorelease pools at the
correct time.  This fixes the intermittent problems when using libdispatch from
LanguageKit, among other things.
13 years ago
theraven 9e93a413d1 Print some memory usage statistics on exit if LIBOBJC_MEMORY_PROFILE is
defined.
13 years ago
theraven 43ee8b9819 Add initial support for imp_implementationWithBlock() and friends. Currently
only works on x86 and x86-64 and doesn't work with sret functions.
14 years ago
theraven bc87ed22e1 Implemented support for __weak with ARC.
ARC functions are all now exposed in a header, but not yet documented.  See the ARC ABI spec for now:

http://clang.llvm.org/docs/AutomaticReferenceCounting.html#runtime
15 years ago
theraven 4a78269815 Removed debugging line accidentally committed. 15 years ago
theraven 4ffb19230f Make sure that the statics used to store internal tables are marked as roots. 15 years ago
theraven fe5d1b892a Tweak GC check, make sure GC_init() is called even when ObjC code isn't using GC (stuff internal to the runtime may be) 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 e198597bd3 Added support for associative references. Modified sync code to use this. 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 1ecd07d637 Don't use __attribute__((constructor)) for creating things that are called by
other constructors.
15 years ago
theraven ca2c7d1d9d Stop treating NSObject as magic and do what OS X does with regard to root objects and metaclasses. 15 years ago
qmathe 10cb4f9b5c Corrected doc in few places to refer to @synchronized() and not @synchronize() 15 years ago
theraven a75064866a More tweaks to +load. Now defers +load a little bit more. 16 years ago
theraven bb8cafaa15 Finished rewriting the loader. It's now cleanly separated into logically-separate components, so there's a chance it might actually be maintainable... 16 years ago