mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-29 19:41:15 +02:00
* ensure that load nodes only substitute temps in case both references point
to the start of their respective temps git-svn-id: trunk@38859 -
This commit is contained in:
parent
d69ad8fa41
commit
52e7678033
@ -180,11 +180,11 @@ implementation
|
||||
{ still used later on in initialisation/finalisation code }
|
||||
is_managed_type(n.resultdef) or
|
||||
{ source and destination are temps (= not global variables) }
|
||||
not tg.istemp(n.location.reference) or
|
||||
not tg.istemp(newref) or
|
||||
{ and both point to the start of a temp, and the source is a }
|
||||
{ non-persistent temp (otherwise we need some kind of copy- }
|
||||
{ on-write support in case later on both are still used) }
|
||||
not tg.isstartoftemp(newref) or
|
||||
not tg.isstartoftemp(n.location.reference) or
|
||||
(tg.gettypeoftemp(newref) <> tt_normal) or
|
||||
not (tg.gettypeoftemp(n.location.reference) in [tt_normal,tt_persistent]) or
|
||||
{ and both have the same size }
|
||||
|
@ -103,6 +103,7 @@ unit tgobj;
|
||||
function sizeoftemp(list: TAsmList; const ref: treference): asizeint;
|
||||
function changetemptype(list: TAsmList; const ref:treference;temptype:ttemptype):boolean;
|
||||
function gettypeoftemp(const ref:treference): ttemptype;
|
||||
function isstartoftemp(const ref: treference): boolean;
|
||||
{# Returns a reference corresponding to a temp }
|
||||
procedure temp_to_ref(p: ptemprecord; out ref: treference); virtual;
|
||||
|
||||
@ -662,6 +663,31 @@ implementation
|
||||
end;
|
||||
|
||||
|
||||
function ttgobj.isstartoftemp(const ref: treference): boolean;
|
||||
var
|
||||
hp: ptemprecord;
|
||||
tmpref: treference;
|
||||
begin
|
||||
hp:=templist;
|
||||
if ref.temppos.val=ctempposinvalid.val then
|
||||
begin
|
||||
result:=false;
|
||||
exit;
|
||||
end;
|
||||
while assigned(hp) do
|
||||
begin
|
||||
if (hp^.pos=ref.temppos.val) then
|
||||
begin
|
||||
temp_to_ref(hp, tmpref);
|
||||
result:=references_equal(ref, tmpref);
|
||||
exit;
|
||||
end;
|
||||
hp:=hp^.next;
|
||||
end;
|
||||
internalerror(2018042601);
|
||||
end;
|
||||
|
||||
|
||||
procedure ttgobj.temp_to_ref(p: ptemprecord; out ref: treference);
|
||||
var
|
||||
t: treftemppos;
|
||||
|
Loading…
Reference in New Issue
Block a user