objcrtlutils: added SELectors caching for alloc, init and release methods

git-svn-id: trunk@13318 -
This commit is contained in:
dmitry 2009-06-23 05:52:22 +00:00
parent 68d937d120
commit 4784948a75

View File

@ -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;