43 Commits (2d976b61e2bd491cfc8c506b96589f56e7e4188a)

Author SHA1 Message Date
David Chisnall af55c29007 Fix the build on Windows. 7 years ago
David Chisnall 3f38f691af Rework ARC code as C++.
Move the weak references hash table to use a well-tested third-party
implementation instead of the hand-rolled version.
7 years ago
David Chisnall bd5637af6d Fix memory leak in @synchronized.
This was actually a memory leak in the hidden class implementation, but
it was mostly visible in the @synchronized implementation.  Every hidden
class registered a custom .cxx_destruct method, to handle cleanup of all
of the hidden class structures.  Unfortunately, this destructor failed
to delete the reflection metadata structures associated with the class,
specifically the objc_method_list containing the objc_method pointing to
the destructor itself.

Fixes #98
7 years ago
David Chisnall 8eb06a3b15 Improve ARC test and fix bugs it uncovered.
This cleans up handling of objects that are not reference counted and
makes their interactions with ARC more consistent.  We should probably
generalise this somewhat - it currently special cases NSConstantString
and NSGlobalBlock, but it would be nice to have an API for constant
objects.
8 years ago
David Chisnall c865b519b0 Unregister classes when deleting them.
Coverage checking of the test suite showed that objc_disposeClassPair
wasn't tested at all, which then led to discovering that it didn't
unregister the class.
8 years ago
David Chisnall b81df02b91 Merge branch 'master' into newabi
Simplify the setSubclass dtable updating mechanism.
8 years ago
David Chisnall 41f33508aa Whitespace. 8 years ago
David Chisnall ccefff241a Update obsolete comment. 8 years ago
David Chisnall 20b016c47b Reserve some class flag bits.
These are free for the compiler to be able to use in future ABI
versions.
8 years ago
David Chisnall 4036a88936 Remove separate flags for class and metaclass.
Every class is either a class or a metaclass, it doesn't make sense to
use two flags to store one bit of data.

Also remove the newabi flag from classes in the v2 ABI, where it's
redundant.
8 years ago
David Chisnall 64ab2d51f5 Rename legacy types.
For consistency, each now has a `_gcc` or `_gsv1` suffix indicating
whether they were inherited from the GCC or GNUstep v1 ABI.
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 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 44a85a401a Add size to the property list.
It should now be possible to support newer ABIs.
8 years ago
Dustin Howett 9459f53ffa Add a class inheritance helper 8 years ago
David Chisnall 9718ce247d Initial start of documenting the ABI. 8 years ago
David Chisnall 80a02b3b79 Add a size field to the method list. 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 3dc096eb17 Add new ABI ivar metadata structures.
The new structure has extra fields for alignment and flags (e.g.
ownership).
Old structures are auto-upgraded at load time, so the rest of the code
can assume the presence of the new structure type.
10 years ago
David Chisnall 2777fea77a Enable correct behaviour with respect to ARC for objc_{g,s}etIvar(). 10 years ago
theraven 741add2eb1 Fix typo in class header. 14 years ago
theraven 4c9acdf153 ARM stuff. 14 years ago
theraven 6d50cdee99 Return the correct small int class in 32-bit mode 15 years ago
theraven 4e3e71c750 Tweak 64-bit support for small objects. 15 years ago
theraven a7d4cfd640 Make the version of libobjc generated by the makefile the one Etoile expects 15 years ago
theraven 8af52846b7 Small object (hidden in a pointer) support. 15 years ago
theraven 4e7b476aa6 Change [1] to [] for variable length structure elements (C99 - silences array out of bounds errors).
Added fields to the end of the class structure for strong / weak ivar bitmaps (not yet generated by any compiler).

Fixed definition of __sync_swap() so that it works on GCC again.
15 years ago
theraven 34f7baf8d7 Added a fast path for ARC. Now, if a class implements ARC-compatible retain / release / autorelease methods, we don't call them at all. Instead, we inline them in the ARC accessors. This avoids all of the overhead of the message send (lookup and call) and should make ARC quite a bit faster than manual reference counting. 15 years ago
theraven 9015795dde Use explicitly typed memory for instances. 15 years ago
theraven 5ea9367f3d Tweak alignment. 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 e198597bd3 Added support for associative references. Modified sync code to use this. 15 years ago
theraven 28e6960441 Make object_getIndexedIvars() more robust against compiler bugs. 15 years ago
qmathe 10cb4f9b5c Corrected doc in few places to refer to @synchronized() and not @synchronize() 15 years ago
theraven 7be9f34619 Fixed @synchronize() with a class that has had an instance used for @synchronize(). 15 years ago
theraven 85c07b836e Fix some warnings with -Wextra. 16 years ago
theraven d3122bcfa4 Make sure BOOLs in class tests are always YES or NO.
Make self in +load the correct value (the class, not the metaclass).
16 years ago
theraven 779b28abeb Lots of tidying, removing legacy stuff. 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
theraven de71ebb6b1 Rewritten class loading. 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 7b8b3839df More refactoring. 16 years ago
theraven 2d84b96a72 Tidied up some bits by creating private headers for private data structures.
Imported selector table code frm the Étoilé runtime.  We can now make dispatch type dependent with a -D switch.  Not enabled yet, but it will be enabled in a warning mode soon - I consider preferable to the existing GNU and Apple solution of corrupting the stack.
16 years ago