7 Commits

Author SHA1 Message Date
theraven
6a37a8c3bc More ARC tweaks. 2011-06-30 14:16:52 +00:00
theraven
55191e34ae Fix the fast path. It should fall back to doing what the slow path does if the other half is not using it. 2011-06-30 12:56:59 +00:00
theraven
e3c836b090 Added fast path for objc_autoreleaseReturnValue() and objc_retainAutoreleasedReturnValue().
In a simple example:

- foo { return self; }

void someFunction(void)
{
	id a = foo;
	...
}

In ARC mode, this expands to:

- foo { return objc_retainAutoreleaseReturnValue(self); }

void someFunction(void)
{
	id a = objc_retainAutoreleasedReturnValue(foo);
	...
}

In the slow path, this is equivalent to:

- foo { return [[self retain] autorelease]; }

void someFunction(void)
{
	id a = [foo retain];
	...
	[a release];
}

The fast path skips the autorelease / retain pair.  The return value is stored
in thread-local storage temporarily and then retrieved, the retain balancing
out the autorelease.

This gives a 50% speedup on a single thread.  It also avoids some atomic
operations.
2011-06-30 09:24:14 +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
065531b12e Remove accidentally-committed WIP ARC code. 2011-06-29 12:04:47 +00:00
theraven
b633338a7a Remove indirection from alias table. 2011-06-29 12:03:41 +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