Author: theraven
Date: Thu Jun 30 11:24:14 2011
New Revision: 33421
URL: http://svn.gna.org/viewcvs/gnustep?rev=33421&view=rev
Log:
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.
Modified:
libs/libobjc2/trunk/arc.m
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs