Commit Graph

97 Commits

Author SHA1 Message Date
theraven
6317b79a10 Implemented the new exception ABI, and a load of tests for it. This is used by
clang trunk if -fobjc-runtime-1.7 is specified and provides significantly
better interoperability with foreign exceptions.

Note: Most of the exception tests will not pass with gcc or clang < 3.3.  They
test things that are impossible to implement quite correctly with the
GCC-compatible exception ABI.

Also updated the release notes to reflect recent improvements.
2013-01-12 13:17:36 +00:00
theraven
6f1589a841 Some bug fixes to ARC autorelease pools. Now provides all of the support required for implementing GNUstep autorelease pools. 2012-04-06 11:58:14 +00:00
thebeing
f845df37c1 Add objc/blocks_private.h header to expose some internals of the blocks runtime
that are accessed by libdispatch. Also rename the relevant structs to be
compatible with the BlocksRuntime from compiler-rt.
2012-03-11 21:45:08 +00:00
theraven
f9f2e4e313 Added a function for getting the type encoding for a block returned by imp_implementationFromBlock(). 2011-10-13 10:28:31 +00:00
theraven
4796a41e4e Finished implementing the new runtime APIs. 2011-10-11 18:42:34 +00:00
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.
2011-10-09 19:51:54 +00:00
theraven
f133fa7eb8 Better ObjC++ support in runtime.h 2011-08-08 17:07:46 +00:00
theraven
1d16930450 Fix missing semicolon.
Make Makefile.clang work

Patch by Charlie Sharpsteen.
2011-08-08 13:19:52 +00:00
theraven
5d3c047fa2 Finished implementing JavaScript-style prototypes. 2011-08-07 19:50:32 +00:00
theraven
b54719abf1 Basic support for prototype-style object orientation (you can now add methods to an individual object). 2011-08-07 17:04:44 +00:00
theraven
908374672d Make OBJC_SMALL_OBJECT_SHIFT / OBJC_SMALL_OBJECT_MASK constants. 2011-07-31 16:25:38 +00:00
theraven
8e34dccda9 Deprecate access to the isa pointer. This will become a hard error in future. 2011-07-27 10:39:48 +00:00
theraven
22e5aaf7b0 Add OBJC_SMALL_OBJECT_SHIFT macro. 2011-07-26 19:13:06 +00:00
theraven
8af52846b7 Small object (hidden in a pointer) support. 2011-07-26 17:39:13 +00:00
theraven
ffc661fe5c Export capabilities for associated references and GC. 2011-07-19 12:34:20 +00:00
theraven
893b9bf958 Add guard if __has_feature is not defined. 2011-07-05 08:53:34 +00:00
theraven
36d21882ec Documented objc-arc.h 2011-06-29 14:36:20 +00:00
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
2011-06-29 13:12:02 +00:00
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. 2011-06-29 10:12:29 +00:00
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.
2011-06-28 16:29:42 +00:00
theraven
85272c48b9 Improve some comments, minor tweaks to GC. 2011-06-23 10:30:10 +00:00
theraven
c9e54c382d Tweak auto-copy code. Now it only copies classes that are explicitly
registered to be copied on heap assignment.  By default, this is just
_NSConcreteStackBlock.  Other classes can be registered (LanguageKit should
register BlockClosure to make sure that Smalltalk works).

Fred: This makes the stuff that we discussed briefly at FOSDEM possible in GC
mode: We can allocate a GSStackEvent subclass of NSEvent on the stack.  If it
implements a -copy method that returns an NSEvent and is registered with the
runtime in this way, then any code that assigns it anywhere on the heap will
end up implicitly creating a heap copy.
2011-05-29 21:59:50 +00:00
theraven
b296b18571 Improvements to GC mode:
- Add objc_gc_collectable_address() to determine whether a pointer is managed
  by the GC

- If LIBOBJC_CANARIES is set (optionally to a random number seed) then store a
  canary value after every allocation returned by
  objc_gc_allocate_collectable() and, when it is finalised, check that the
  canary has not been modified, aborting if it has.  This catches some
  heap-buffer overflows, and currently causes GNUstep to abort.

- If LIBOBJC_LOG_ALLOCATIONS is set to a file name, log all GC-managed
  allocations to that file.  This gives something like malloc_history on OS X.

- objc_memmove_collectable() now guarantees that all copied pointers remain
  visible to the GC at all times (which was the point of the function - the
  original implementation was just a quick stub).
2011-05-29 21:28:27 +00:00
theraven
d73eb8f634 Expose another function in the header. 2011-05-28 13:24:24 +00:00
theraven
898707bf94 Added function for getting reference count. 2011-05-24 13:11:25 +00:00
theraven
368bf3bd1d Add reallocate function. 2011-05-24 13:02:18 +00:00
theraven
88c075893f Call ObjC++ destructors when finalising an object.
Add public APIs required to implement [NSGarbageCollector -enable] and [NSGarbageCollector -disable].
2011-05-24 12:38:40 +00:00
theraven
9015795dde Use explicitly typed memory for instances. 2011-05-23 17:26:44 +00:00
theraven
2329b7a1ec Change spelling to be consistent with Apple. 2011-05-23 12:08:45 +00:00
theraven
929f8f95b4 Improved a few GC functions.
Added objc-auto.h header, providing (documented) public interfaces to this
functionality.
2011-05-23 11:11:51 +00:00
theraven
8ee4d9c38a Added implementation of property_getAttributes(). This is a horrible interface, both to implement and to use. We should add some better interfaces. 2011-04-28 20:36:36 +00:00
theraven
c6f0651609 Implemented objc_copyProtocolList(). 2011-04-28 18:53:11 +00:00
theraven
79b67ad044 Added missing ivar access functions. 2011-04-28 18:39:48 +00:00
theraven
12385fcb1e Tidy up low memory profile to use slots directly. 2011-04-28 11:59:18 +00:00
theraven
535ba87a8e Store the selector, not the type encoding, in slots. 2011-04-22 12:13:28 +00:00
theraven
e198597bd3 Added support for associative references. Modified sync code to use this. 2011-04-15 11:20:37 +00:00
theraven
06ff4be6a9 More build system tidies. 2011-04-04 12:01:58 +00:00
thebeing
ee7817cf57 Implement a hook that allows the compiler to register the aliases used with the
@compatibility_alias directive so that they can be resolved at runtime.
2011-03-25 20:01:43 +00:00
theraven
faa741b133 Added some header documentation for runtime functions. 2011-03-21 23:54:42 +00:00
theraven
ff21fcc43d Added C++ include guards to capabilities.h 2011-03-21 18:32:28 +00:00
theraven
7336df75bc Added some more comments, C++ include guards around runtime.h. 2011-03-21 18:31:25 +00:00
theraven
2c21235cc2 Fix multiple include guard in capabilities.h. 2011-03-21 18:26:23 +00:00
theraven
73e1e2934b It turns out that Apple chose some confusing and non-intuitive semantics for
catching Objective-C objects in C++ catch statements (i.e. they follow
Objective-C semantics, not C++ semantics, irrespective of whether you use C++
or ObjC syntax).  We now default to Apple-compatible behaviour, but provide a
function that allows users to select the sane semantics if they prefer.

Added a capability bit for the unified exception model, so code can require it.
This is not really required, since any code using it will link against the
ObjC++ personality function and will get a linker failure if it isn't supported.

Also enabled Objective-C++ stuff by default.  This adds a dependency on the C++
standard library (actually on libsupc++, but GNUstep Make wants to link against
libstd++ anyway), which is not ideal.  It can be disabled with:

$ gmake objectiver-cxx=no

I suggest that this is only done by people who know that they will never want
Objective-C++ support.
2011-03-21 17:39:06 +00:00
theraven
e0d80861b5 Added some documentation. 2011-02-12 20:01:50 +00:00
theraven
8db63b976f Initial work on developer mode (allows classes to be replaced at run time with new versions, by cooperating IDEs). This support is part of ongoing work to provide fix-and-continue functionality with Clang / Cling and LanguageKit. 2011-01-15 12:37:02 +00:00
theraven
bde6bf0e14 Fix truncated comment in header and 'worse than useless' macro.
Both issues pointed out by Jens Ayton.
2011-01-13 21:29:24 +00:00
ericwa
a7ea477400 libobjc2: put libobjc compatibility functions in runtime.h marked __attribute__((deprecated)) 2010-11-23 20:03:57 +00:00
theraven
e70d00a76d Restore accidentally deleted toydispatch.h. 2010-10-26 15:49:24 +00:00
theraven
7be9f34619 Fixed @synchronize() with a class that has had an instance used for @synchronize(). 2010-10-04 17:44:17 +00:00
theraven
ee32f78b0a Tweaked the GNUmakefile to (more or less) work with gcc.
Fixed block introspection for the new (Apple-compatible) ABI.
2010-10-01 13:11:48 +00:00