mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 04:09:19 +02:00
* fixed register variable loading from parasymtable, the call by
reference code was moved wrong
This commit is contained in:
parent
8fbb716b82
commit
a73ecec989
@ -68,7 +68,6 @@ implementation
|
|||||||
var
|
var
|
||||||
intreg,
|
intreg,
|
||||||
hregister : tregister;
|
hregister : tregister;
|
||||||
is_cdecl,
|
|
||||||
freereg : boolean;
|
freereg : boolean;
|
||||||
symtabletype : tsymtabletype;
|
symtabletype : tsymtabletype;
|
||||||
i : longint;
|
i : longint;
|
||||||
@ -107,6 +106,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
varsym :
|
varsym :
|
||||||
begin
|
begin
|
||||||
|
symtabletype:=symtable.symtabletype;
|
||||||
hregister:=R_NO;
|
hregister:=R_NO;
|
||||||
{ C variable }
|
{ C variable }
|
||||||
if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
|
if (vo_is_C_var in tvarsym(symtableentry).varoptions) then
|
||||||
@ -164,7 +164,6 @@ implementation
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
symtabletype:=symtable.symtabletype;
|
|
||||||
case symtabletype of
|
case symtabletype of
|
||||||
localsymtable,
|
localsymtable,
|
||||||
parasymtable,
|
parasymtable,
|
||||||
@ -212,26 +211,6 @@ implementation
|
|||||||
end;
|
end;
|
||||||
location.reference.base:=hregister;
|
location.reference.base:=hregister;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (symtabletype in [parasymtable,inlineparasymtable]) then
|
|
||||||
begin
|
|
||||||
{ in case call by reference, then calculate. Open array
|
|
||||||
is always an reference! }
|
|
||||||
if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
|
|
||||||
is_open_array(tvarsym(symtableentry).vartype.def) or
|
|
||||||
is_array_of_const(tvarsym(symtableentry).vartype.def) or
|
|
||||||
paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,
|
|
||||||
(tprocdef(symtable.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl])) then
|
|
||||||
begin
|
|
||||||
if hregister=R_NO then
|
|
||||||
hregister:=rg.getaddressregister(exprasmlist);
|
|
||||||
{ we need to load only an address }
|
|
||||||
location.size:=OS_ADDR;
|
|
||||||
cg.a_load_loc_reg(exprasmlist,location,hregister);
|
|
||||||
location_reset(location,LOC_REFERENCE,newsize);
|
|
||||||
location.reference.base:=hregister;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
globalsymtable,
|
globalsymtable,
|
||||||
staticsymtable :
|
staticsymtable :
|
||||||
@ -270,6 +249,27 @@ implementation
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ handle call by reference variables }
|
||||||
|
if (symtabletype in [parasymtable,inlineparasymtable]) then
|
||||||
|
begin
|
||||||
|
{ in case call by reference, then calculate. Open array
|
||||||
|
is always an reference! }
|
||||||
|
if (tvarsym(symtableentry).varspez in [vs_var,vs_out]) or
|
||||||
|
is_open_array(tvarsym(symtableentry).vartype.def) or
|
||||||
|
is_array_of_const(tvarsym(symtableentry).vartype.def) or
|
||||||
|
paramanager.push_addr_param(tvarsym(symtableentry).vartype.def,
|
||||||
|
(tprocdef(symtable.defowner).proccalloption in [pocall_cdecl,pocall_cppdecl])) then
|
||||||
|
begin
|
||||||
|
if hregister=R_NO then
|
||||||
|
hregister:=rg.getaddressregister(exprasmlist);
|
||||||
|
{ we need to load only an address }
|
||||||
|
location.size:=OS_ADDR;
|
||||||
|
cg.a_load_loc_reg(exprasmlist,location,hregister);
|
||||||
|
location_reset(location,LOC_REFERENCE,newsize);
|
||||||
|
location.reference.base:=hregister;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
procsym:
|
procsym:
|
||||||
begin
|
begin
|
||||||
@ -401,7 +401,6 @@ implementation
|
|||||||
otlabel,hlabel,oflabel : tasmlabel;
|
otlabel,hlabel,oflabel : tasmlabel;
|
||||||
fputyp : tfloattype;
|
fputyp : tfloattype;
|
||||||
href : treference;
|
href : treference;
|
||||||
ai : taicpu;
|
|
||||||
releaseright : boolean;
|
releaseright : boolean;
|
||||||
pushedregs : tmaybesave;
|
pushedregs : tmaybesave;
|
||||||
cgsize : tcgsize;
|
cgsize : tcgsize;
|
||||||
@ -947,7 +946,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.27 2002-09-01 12:15:40 peter
|
Revision 1.28 2002-09-01 19:26:32 peter
|
||||||
|
* fixed register variable loading from parasymtable, the call by
|
||||||
|
reference code was moved wrong
|
||||||
|
|
||||||
|
Revision 1.27 2002/09/01 12:15:40 peter
|
||||||
* fixed loading of procvar of object when the object is initialized
|
* fixed loading of procvar of object when the object is initialized
|
||||||
with 0
|
with 0
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user