83 Commits (d44bf5655b02491be15e64283175c157c74a6e40)

Author SHA1 Message Date
David Chisnall d44bf5655b Ensure that objects that support ARC will use ARC, even if they are
created without sending a message to the class.

Also ensure that protocols are always valid objects so that ARC doesn't
become confused.
10 years ago
David Chisnall 53bc9f3892 Fix the size of run-time generated root classes.
The size of the new class with should be sizeof(Class), not sizeof(struct objc_class).
10 years ago
rfm 7f007e354e fix bug in small object test on 64bit systems 12 years ago
theraven 1a76a2a021 Handle the case where the alignment of a new ivar is 0.
Reported by: Lubos Dolezel
13 years ago
theraven aad22cb092 Fix method_setImplementation bug. 13 years ago
theraven ffa7dbad8d Cleaner version of the last fix. 13 years ago
theraven fb2e6756f6 Fix (and add test case for) a bug where objc_allocateClassPair() failed if the
superclass had not yet been loaded.
13 years ago
theraven 7a232c68d6 Fix typo in .cxx_construct.
Reported by Luboš Doležel!
13 years ago
thebeing 8cf9b6058b Attempt to fix objcAllocateClassPair() for root classes.
@David: Could you check whether I got this right?
14 years ago
theraven 9fae0d1f48 Silence a warning on SPARC64. 14 years ago
theraven 5d3c047fa2 Finished implementing JavaScript-style prototypes. 15 years ago
theraven b54719abf1 Basic support for prototype-style object orientation (you can now add methods to an individual object). 15 years ago
theraven 6a27408e9e Fix malloc() / free() imbalance. 15 years ago
theraven 8af52846b7 Small object (hidden in a pointer) support. 15 years ago
theraven 83db079968 Fix bug in fast path for class_getInstanceMethod() 15 years ago
theraven 65d6a8dfb5 When changing the size of structures, it's a good idea to make sure that you change everything that depends on those sizes too... 15 years ago
theraven 219f921bc3 Fix some bugs in class_getInstanceMethod() 15 years ago
theraven 7b6ba21ce5 Small bug fixes:
- Don't call C++ constructors if they don't exist.
- Don't check the owner of retain / release methods if they are not implemented.
- Add arc.m as a file to ignore when checking for GC compatibility.
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 9b70b22eee Use __unsafe_unretained instead of const for returning protocol arrays. Let's not break everyone's code, even if we really want to. 15 years ago
theraven b5380d50d3 Added support for ARC.
Weak references are still not supported, but code that doesn't use them (i.e. any code that wants to be compatible with OS X 10.6) will work fine.

The current implementation is VERY inefficient and has a large number of missed optimisation opportunities: this is the 'make it right' phase, and should be almost equivalent to explicit retain / release code.
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 d12de81cd6 Remove opts from default build - they must now be explicitly built.
Don't crash if objc_disposeClassPair() is called on a class that is not get
registered with the runtime.
15 years ago
theraven 535ba87a8e Store the selector, not the type encoding, in slots. 15 years ago
theraven 7b49755964 Dtable cleanup cleanups. 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 4ee1b1f4ac Test first, then commit... 15 years ago
theraven faa741b133 Added some header documentation for runtime functions. 15 years ago
theraven 7336df75bc Added some more comments, C++ include guards around runtime.h. 15 years ago
theraven 28e6960441 Make object_getIndexedIvars() more robust against compiler bugs. 15 years ago
theraven 94e5f7b344 Return "nil" instead of nil from class_getName with a nil argument. This is stupid (what happens if you have a class called nil?) but it is what OS X does. 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 91e9758fda Add lots of checks for NULL-pointer arguments to runtime functions. 15 years ago
ericwa a7ea477400 libobjc2: put libobjc compatibility functions in runtime.h marked __attribute__((deprecated)) 15 years ago
qmathe 9dbf872f33 Fixed crash when resolving user-allocated classes (e.g. KVO) revealed by r31482.
objc_resolve_class() does ((Class)objc_getClass((char*)cls->isa->isa))->isa;
but cls->isa->isa was a metaclass object and not a C string if the class was 
user-created. objc_allocateClassPair() has been changed to set the 
meta-metaclass as a C string and not an object, so that objc_getClass() does 
not return Nil.
15 years ago
theraven 76bb7762ff Properly resolve the metaclass's isa pointer. 15 years ago
theraven 7be9f34619 Fixed @synchronize() with a class that has had an instance used for @synchronize(). 15 years ago
ericwa d56930241e Stylistic fixes 16 years ago
ericwa ed1c9d41eb libobjc2: Add a pile of NULL checks. In general, any public function should be able to handle NULL for any object/class/selector/pointer to opaque structure without blowing up. 16 years ago
theraven 84fd691944 Make adding more than one ivar with class_addIvar() work... 16 years ago
theraven e1562b28d4 Correctly calculate the offset when adding ivars. 16 years ago
theraven 108247eb5d Fix dead store (the only bug found by the clang static analyser). 16 years ago
theraven fe566cbc2f Fix introspection with type-dependent dispatch enabled. Looking up a method with an untyped selector was failing because the UID for the selector was no longer the same for all type variants.
As a side-effect of this change, method lookups for introspection are now much faster.  They use the slot lookup mechanism to find which class has the method declared and then only need to do the linear search on that class, rather than doing the linear search on the entire hierarchy (slow!).  If the method is not present, then they can give up after two memory accesses, rather than after searching a few hundred list entries, but that's a less important case.

I also noticed while tracking down this bug that the implementation of methodSignatureForSelector in GNUstep is very inefficient.  I'll tweak that next.
16 years ago
theraven 779b28abeb Lots of tidying, removing legacy stuff. 16 years ago
theraven 4ee07676cc Added rewritten encoding parser. The functions that function pointers as arguments and parse compound types should be exposed via the public interfaces, or possibly moved to a separate library - they are generally useful. 16 years ago
theraven b1b9baf382 Finished rewrite of message sending. Deleted lots of legacy stuff. 16 years ago
theraven de71ebb6b1 Rewritten class loading. 16 years ago
theraven 7f6f798074 Rewrote some of the class table code to be slightly cleaner. 16 years ago
theraven a692cbd4dd Fix some GCC warnings. Patch by TOM. 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