mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-10 07:29:41 +01:00
+ Patch from peter to fix wrong pushing of ansistring function results in open array
This commit is contained in:
parent
dfd469b7a3
commit
cf68b27bb9
@ -337,8 +337,8 @@ unit cgobj;
|
|||||||
}
|
}
|
||||||
procedure g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte;delsource,loadref : boolean);
|
procedure g_copyshortstring(list : taasmoutput;const source,dest : treference;len:byte;delsource,loadref : boolean);
|
||||||
|
|
||||||
procedure g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference);
|
procedure g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference;loadref : boolean);
|
||||||
procedure g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference);
|
procedure g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference;loadref : boolean);
|
||||||
procedure g_initialize(list : taasmoutput;t : tdef;const ref : treference;loadref : boolean);
|
procedure g_initialize(list : taasmoutput;t : tdef;const ref : treference;loadref : boolean);
|
||||||
procedure g_finalize(list : taasmoutput;t : tdef;const ref : treference;loadref : boolean);
|
procedure g_finalize(list : taasmoutput;t : tdef;const ref : treference;loadref : boolean);
|
||||||
|
|
||||||
@ -1296,7 +1296,7 @@ unit cgobj;
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcg.g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference);
|
procedure tcg.g_incrrefcount(list : taasmoutput;t: tdef; const ref: treference;loadref : boolean);
|
||||||
var
|
var
|
||||||
href : treference;
|
href : treference;
|
||||||
incrfunc : string;
|
incrfunc : string;
|
||||||
@ -1316,20 +1316,26 @@ unit cgobj;
|
|||||||
{ call the special incr function or the generic addref }
|
{ call the special incr function or the generic addref }
|
||||||
if incrfunc<>'' then
|
if incrfunc<>'' then
|
||||||
begin
|
begin
|
||||||
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(1));
|
if loadref then
|
||||||
|
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(1))
|
||||||
|
else
|
||||||
|
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
||||||
a_call_name(list,incrfunc);
|
a_call_name(list,incrfunc);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
||||||
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
||||||
|
if loadref then
|
||||||
|
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(1))
|
||||||
|
else
|
||||||
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
||||||
a_call_name(list,'FPC_ADDREF');
|
a_call_name(list,'FPC_ADDREF');
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure tcg.g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference);
|
procedure tcg.g_decrrefcount(list : taasmoutput;t: tdef; const ref: treference; loadref:boolean);
|
||||||
var
|
var
|
||||||
href : treference;
|
href : treference;
|
||||||
decrfunc : string;
|
decrfunc : string;
|
||||||
@ -1357,6 +1363,9 @@ unit cgobj;
|
|||||||
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
||||||
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
||||||
end;
|
end;
|
||||||
|
if loadref then
|
||||||
|
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(1))
|
||||||
|
else
|
||||||
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
||||||
a_call_name(list,decrfunc);
|
a_call_name(list,decrfunc);
|
||||||
end
|
end
|
||||||
@ -1364,6 +1373,9 @@ unit cgobj;
|
|||||||
begin
|
begin
|
||||||
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
||||||
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
a_paramaddr_ref(list,href,paramanager.getintparaloc(2));
|
||||||
|
if loadref then
|
||||||
|
a_param_ref(list,OS_ADDR,ref,paramanager.getintparaloc(1))
|
||||||
|
else
|
||||||
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
a_paramaddr_ref(list,ref,paramanager.getintparaloc(1));
|
||||||
a_call_name(list,'FPC_DECREF');
|
a_call_name(list,'FPC_DECREF');
|
||||||
end;
|
end;
|
||||||
@ -1398,7 +1410,7 @@ unit cgobj;
|
|||||||
if is_ansistring(t) or
|
if is_ansistring(t) or
|
||||||
is_widestring(t) or
|
is_widestring(t) or
|
||||||
is_interfacecom(t) then
|
is_interfacecom(t) then
|
||||||
g_decrrefcount(list,t,ref)
|
g_decrrefcount(list,t,ref,loadref)
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
reference_reset_symbol(href,tstoreddef(t).get_rtti_label(initrtti),0);
|
||||||
@ -1853,7 +1865,10 @@ finalization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.92 2003-04-27 11:21:32 peter
|
Revision 1.93 2003-04-29 07:28:52 michael
|
||||||
|
+ Patch from peter to fix wrong pushing of ansistring function results in open array
|
||||||
|
|
||||||
|
Revision 1.92 2003/04/27 11:21:32 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
|||||||
@ -890,12 +890,12 @@ implementation
|
|||||||
if is_widestring(resulttype.def) then
|
if is_widestring(resulttype.def) then
|
||||||
begin
|
begin
|
||||||
tg.GetTemp(exprasmlist,pointer_size,tt_widestring,refcountedtemp);
|
tg.GetTemp(exprasmlist,pointer_size,tt_widestring,refcountedtemp);
|
||||||
cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
|
cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp,false);
|
||||||
end
|
end
|
||||||
else if is_ansistring(resulttype.def) then
|
else if is_ansistring(resulttype.def) then
|
||||||
begin
|
begin
|
||||||
tg.GetTemp(exprasmlist,pointer_size,tt_ansistring,refcountedtemp);
|
tg.GetTemp(exprasmlist,pointer_size,tt_ansistring,refcountedtemp);
|
||||||
cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp);
|
cg.g_decrrefcount(exprasmlist,resulttype.def,refcountedtemp,false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_stdcall]) then
|
if (procdefinition.proccalloption in [pocall_cdecl,pocall_cppdecl,pocall_stdcall]) then
|
||||||
@ -1438,7 +1438,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.55 2003-04-27 11:21:33 peter
|
Revision 1.56 2003-04-29 07:28:52 michael
|
||||||
|
+ Patch from peter to fix wrong pushing of ansistring function results in open array
|
||||||
|
|
||||||
|
Revision 1.55 2003/04/27 11:21:33 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
|||||||
@ -717,7 +717,7 @@ implementation
|
|||||||
useless for string constants }
|
useless for string constants }
|
||||||
if (left.resulttype.def.needs_inittable) and
|
if (left.resulttype.def.needs_inittable) and
|
||||||
(left.nodetype<>stringconstn) then
|
(left.nodetype<>stringconstn) then
|
||||||
cg.g_incrrefcount(exprasmlist,left.resulttype.def,left.location.reference);
|
cg.g_incrrefcount(exprasmlist,left.resulttype.def,left.location.reference,false);
|
||||||
{ the result of left is not needed anymore after this
|
{ the result of left is not needed anymore after this
|
||||||
node }
|
node }
|
||||||
location_freetemp(exprasmlist,left.location);
|
location_freetemp(exprasmlist,left.location);
|
||||||
@ -1531,7 +1531,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.56 2003-04-27 11:21:33 peter
|
Revision 1.57 2003-04-29 07:29:14 michael
|
||||||
|
+ Patch from peter to fix wrong pushing of ansistring function results in open array
|
||||||
|
|
||||||
|
Revision 1.56 2003/04/27 11:21:33 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
|||||||
@ -445,7 +445,7 @@ implementation
|
|||||||
useless for string constants}
|
useless for string constants}
|
||||||
if (right.resulttype.def.needs_inittable) and
|
if (right.resulttype.def.needs_inittable) and
|
||||||
(right.nodetype<>stringconstn) then
|
(right.nodetype<>stringconstn) then
|
||||||
cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference);
|
cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference,false);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ implementation
|
|||||||
secondpass(left);
|
secondpass(left);
|
||||||
{ decrement destination reference counter }
|
{ decrement destination reference counter }
|
||||||
if (left.resulttype.def.needs_inittable) then
|
if (left.resulttype.def.needs_inittable) then
|
||||||
cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference);
|
cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference,false);
|
||||||
{$ifndef newra}
|
{$ifndef newra}
|
||||||
maybe_restore(exprasmlist,right.location,pushedregs);
|
maybe_restore(exprasmlist,right.location,pushedregs);
|
||||||
{$endif newra}
|
{$endif newra}
|
||||||
@ -479,7 +479,7 @@ implementation
|
|||||||
secondpass(left);
|
secondpass(left);
|
||||||
{ decrement destination reference counter }
|
{ decrement destination reference counter }
|
||||||
if (left.resulttype.def.needs_inittable) then
|
if (left.resulttype.def.needs_inittable) then
|
||||||
cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference);
|
cg.g_decrrefcount(exprasmlist,left.resulttype.def,left.location.reference,false);
|
||||||
if codegenerror then
|
if codegenerror then
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
@ -494,7 +494,7 @@ implementation
|
|||||||
useless for string constants}
|
useless for string constants}
|
||||||
if (right.resulttype.def.needs_inittable) and
|
if (right.resulttype.def.needs_inittable) and
|
||||||
(right.nodetype<>stringconstn) then
|
(right.nodetype<>stringconstn) then
|
||||||
cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference);
|
cg.g_incrrefcount(exprasmlist,right.resulttype.def,right.location.reference,false);
|
||||||
{$ifndef newra}
|
{$ifndef newra}
|
||||||
maybe_restore(exprasmlist,left.location,pushedregs);
|
maybe_restore(exprasmlist,left.location,pushedregs);
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -917,6 +917,10 @@ implementation
|
|||||||
else
|
else
|
||||||
{ normal array constructor of the same type }
|
{ normal array constructor of the same type }
|
||||||
begin
|
begin
|
||||||
|
if is_ansistring(left.resulttype.def) or
|
||||||
|
is_widestring(left.resulttype.def) or
|
||||||
|
(left.resulttype.def.deftype=variantdef) then
|
||||||
|
freetemp:=false;
|
||||||
location_release(exprasmlist,hp.left.location);
|
location_release(exprasmlist,hp.left.location);
|
||||||
case hp.left.location.loc of
|
case hp.left.location.loc of
|
||||||
LOC_FPUREGISTER,
|
LOC_FPUREGISTER,
|
||||||
@ -953,7 +957,10 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.54 2003-04-27 11:21:33 peter
|
Revision 1.55 2003-04-29 07:29:14 michael
|
||||||
|
+ Patch from peter to fix wrong pushing of ansistring function results in open array
|
||||||
|
|
||||||
|
Revision 1.54 2003/04/27 11:21:33 peter
|
||||||
* aktprocdef renamed to current_procdef
|
* aktprocdef renamed to current_procdef
|
||||||
* procinfo renamed to current_procinfo
|
* procinfo renamed to current_procinfo
|
||||||
* procinfo will now be stored in current_module so it can be
|
* procinfo will now be stored in current_module so it can be
|
||||||
|
|||||||
@ -1049,7 +1049,7 @@ implementation
|
|||||||
-tvarsym(p).localvarsym.address+tvarsym(p).localvarsym.owner.address_fixup)
|
-tvarsym(p).localvarsym.address+tvarsym(p).localvarsym.owner.address_fixup)
|
||||||
else
|
else
|
||||||
reference_reset_base(href,current_procinfo.framepointer,tvarsym(p).address+tvarsym(p).owner.address_fixup);
|
reference_reset_base(href,current_procinfo.framepointer,tvarsym(p).address+tvarsym(p).owner.address_fixup);
|
||||||
cg.g_incrrefcount(list,tvarsym(p).vartype.def,href);
|
cg.g_incrrefcount(list,tvarsym(p).vartype.def,href,is_open_array(tvarsym(p).vartype.def));
|
||||||
end;
|
end;
|
||||||
vs_out :
|
vs_out :
|
||||||
begin
|
begin
|
||||||
@ -1090,7 +1090,7 @@ implementation
|
|||||||
-tvarsym(p).localvarsym.address+tvarsym(p).localvarsym.owner.address_fixup)
|
-tvarsym(p).localvarsym.address+tvarsym(p).localvarsym.owner.address_fixup)
|
||||||
else
|
else
|
||||||
reference_reset_base(href,current_procinfo.framepointer,tvarsym(p).address+tvarsym(p).owner.address_fixup);
|
reference_reset_base(href,current_procinfo.framepointer,tvarsym(p).address+tvarsym(p).owner.address_fixup);
|
||||||
cg.g_decrrefcount(list,tvarsym(p).vartype.def,href);
|
cg.g_decrrefcount(list,tvarsym(p).vartype.def,href,is_open_array(tvarsym(p).vartype.def));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2006,7 +2006,10 @@ implementation
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.94 2003-04-28 21:17:38 peter
|
Revision 1.95 2003-04-29 07:28:52 michael
|
||||||
|
+ Patch from peter to fix wrong pushing of ansistring function results in open array
|
||||||
|
|
||||||
|
Revision 1.94 2003/04/28 21:17:38 peter
|
||||||
* do not finalize function results
|
* do not finalize function results
|
||||||
|
|
||||||
Revision 1.93 2003/04/27 16:30:34 jonas
|
Revision 1.93 2003/04/27 16:30:34 jonas
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user