+ put guids in a constant pool as well

git-svn-id: trunk@24061 -
This commit is contained in:
florian 2013-03-29 18:48:55 +00:00
parent e4949e3044
commit 9375529430
3 changed files with 37 additions and 19 deletions

View File

@ -89,7 +89,8 @@ interface
sp_objcvartypes,
sp_objcprotocolrefs,
sp_varsets,
sp_floats
sp_floats,
sp_guids
);
const

View File

@ -525,21 +525,35 @@ implementation
procedure tcgguidconstnode.pass_generate_code;
var
tmplabel : TAsmLabel;
i : integer;
lastlabel : tasmlabel;
i : longint;
entry : PHashSetItem;
begin
location_reset_ref(location,LOC_CREFERENCE,OS_NO,const_align(16));
{ label for GUID }
current_asmdata.getdatalabel(tmplabel);
maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]);
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,tmplabel.name,const_align(16));
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(tmplabel));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1)));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D2));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D3));
for i:=low(value.D4) to high(value.D4) do
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(value.D4[i]));
location.reference.symbol:=tmplabel;
lastlabel:=nil;
{ const already used ? }
if not assigned(lab_set) then
begin
entry := current_asmdata.ConstPools[sp_guids].FindOrAdd(@value,sizeof(value));
lab_set := TAsmLabel(entry^.Data); // is it needed anymore?
{ :-(, we must generate a new entry }
if not assigned(entry^.Data) then
begin
current_asmdata.getdatalabel(lastlabel);
lab_set:=lastlabel;
entry^.Data:=lastlabel;
maybe_new_object_file(current_asmdata.asmlists[al_typedconsts]);
new_section(current_asmdata.asmlists[al_typedconsts],sec_rodata_norel,lastlabel.name,const_align(16));
current_asmdata.asmlists[al_typedconsts].concat(Tai_label.Create(lastlabel));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_32bit(longint(value.D1)));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D2));
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_16bit(value.D3));
for i:=low(value.D4) to high(value.D4) do
current_asmdata.asmlists[al_typedconsts].concat(Tai_const.Create_8bit(value.D4[i]));
end;
end;
location.reference.symbol:=lab_set;
end;

View File

@ -168,6 +168,7 @@ interface
tguidconstnode = class(tnode)
value : tguid;
lab_set : tasmsymbol;
constructor create(const g:tguid);virtual;
constructor ppuload(t:tnodetype;ppufile:tcompilerppufile);override;
procedure ppuwrite(ppufile:tcompilerppufile);override;
@ -1144,6 +1145,7 @@ implementation
value_set:=nil;
end;
destructor tsetconstnode.destroy;
begin
if assigned(value_set) then
@ -1213,12 +1215,9 @@ implementation
end;
function tsetconstnode.dogetcopy : tnode;
var
n : tsetconstnode;
begin
n:=tsetconstnode(inherited dogetcopy);
if assigned(value_set) then
@ -1233,12 +1232,14 @@ implementation
dogetcopy:=n;
end;
function tsetconstnode.pass_typecheck:tnode;
begin
result:=nil;
resultdef:=typedef;
end;
function tsetconstnode.pass_1 : tnode;
begin
result:=nil;
@ -1307,22 +1308,23 @@ implementation
function tguidconstnode.dogetcopy : tnode;
var
n : tguidconstnode;
begin
n:=tguidconstnode(inherited dogetcopy);
n.value:=value;
n.lab_set:=lab_set;
dogetcopy:=n;
end;
function tguidconstnode.pass_typecheck:tnode;
begin
result:=nil;
resultdef:=rec_tguid;
end;
function tguidconstnode.pass_1 : tnode;
begin
result:=nil;
@ -1332,6 +1334,7 @@ implementation
include(current_procinfo.flags,pi_needs_got);
end;
function tguidconstnode.docompare(p: tnode): boolean;
begin
docompare :=