summaryrefslogtreecommitdiff
path: root/packages/objcrtl
diff options
context:
space:
mode:
authordmitry <dmitry@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-06-23 05:52:22 +0000
committerdmitry <dmitry@3ad0048d-3df7-0310-abae-a5850022a9f2>2009-06-23 05:52:22 +0000
commit7eb32527ea6385345ed237d2d56a54f85471ad2c (patch)
tree85487fa05982b404a38523716dff6f9077a3b65b /packages/objcrtl
parent81d3b18a1d741b7fbaf1596b60cf967acd5d6d31 (diff)
downloadfpc-7eb32527ea6385345ed237d2d56a54f85471ad2c.tar.gz
objcrtlutils: added SELectors caching for alloc, init and release methods
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@13318 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/objcrtl')
-rw-r--r--packages/objcrtl/src/objcrtlutils.pas14
1 files changed, 11 insertions, 3 deletions
diff --git a/packages/objcrtl/src/objcrtlutils.pas b/packages/objcrtl/src/objcrtlutils.pas
index 19677370d1..cdf17f549e 100644
--- a/packages/objcrtl/src/objcrtlutils.pas
+++ b/packages/objcrtl/src/objcrtlutils.pas
@@ -28,6 +28,11 @@ function super(obj: id): objc_super;
implementation
+var
+ SEL_alloc : SEL = nil;
+ SEL_init : SEL = nil;
+ SEL_release : SEL = nil;
+
function super(obj: id): objc_super;
begin
Result.reciever := obj;
@@ -57,17 +62,20 @@ end;
procedure release(objc: id); inline;
begin
- objc_msgSend(objc, selector('release'), []);
+ if SEL_release=nil then SEL_release := selector('release');
+ objc_msgSend(objc, SEL_release, []);
end;
function AllocAndInit(classname: PChar): id; inline;
begin
- Result:= objc_msgSend( alloc( classname ), selector('init'), []);
+ if SEL_init=nil then SEL_init := selector('init');
+ Result:= objc_msgSend( alloc( classname ), SEL_init, []);
end;
function AllocAndInitEx(classname: PChar; extraBytes: Integer): id; inline;
begin
- Result := objc_msgSend( allocEx( classname, extraBytes ), selector('init'), []);
+ if SEL_init=nil then SEL_init := selector('init');
+ Result := objc_msgSend( allocEx( classname, extraBytes ), SEL_init, []);
end;