mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-15 14:19:28 +02:00
* changed tt_persistant to tt_persistent :)
* tempcreatenode now doesn't accept a boolean anymore for persistent temps, but a ttemptype, so you can also create ansistring temps etc
This commit is contained in:
parent
900bceb0d9
commit
cb279b2029
@ -30,6 +30,7 @@ interface
|
||||
cpubase,
|
||||
aasmbase,aasmtai,aasmcpu,
|
||||
node,
|
||||
tgobj,
|
||||
symtype,symppu;
|
||||
|
||||
type
|
||||
@ -90,6 +91,7 @@ interface
|
||||
hookoncopy : ptempinfo;
|
||||
ref : treference;
|
||||
restype : ttype;
|
||||
temptype : ttemptype;
|
||||
valid : boolean;
|
||||
nextref_set_hookoncopy_nil : boolean;
|
||||
end;
|
||||
@ -98,8 +100,8 @@ interface
|
||||
{ size (the size is separate to allow creating "void" temps with a custom size) }
|
||||
ttempcreatenode = class(tnode)
|
||||
size: longint;
|
||||
temptype: ttemptype;
|
||||
tempinfo: ptempinfo;
|
||||
persistent: boolean;
|
||||
{ * persistent temps are used in manually written code where the temp }
|
||||
{ be usable among different statements and where you can manually say }
|
||||
{ when the temp has to be freed (using a ttempdeletenode) }
|
||||
@ -107,7 +109,7 @@ interface
|
||||
{ where the node that receives the temp becomes responsible for }
|
||||
{ freeing it. In this last case, you should use only one reference }
|
||||
{ to it and *not* generate a ttempdeletenode }
|
||||
constructor create(const _restype: ttype; _size: longint; _persistent: boolean); virtual;
|
||||
constructor create(const _restype: ttype; _size: longint; _temptype: ttemptype); virtual;
|
||||
function getcopy: tnode; override;
|
||||
function pass_1 : tnode; override;
|
||||
function det_resulttype: tnode; override;
|
||||
@ -569,14 +571,14 @@ implementation
|
||||
TEMPCREATENODE
|
||||
*****************************************************************************}
|
||||
|
||||
constructor ttempcreatenode.create(const _restype: ttype; _size: longint; _persistent: boolean);
|
||||
constructor ttempcreatenode.create(const _restype: ttype; _size: longint; _temptype: ttemptype);
|
||||
begin
|
||||
inherited create(tempcreaten);
|
||||
size := _size;
|
||||
new(tempinfo);
|
||||
fillchar(tempinfo^,sizeof(tempinfo^),0);
|
||||
tempinfo^.restype := _restype;
|
||||
persistent := _persistent;
|
||||
temptype := _temptype;
|
||||
end;
|
||||
|
||||
function ttempcreatenode.getcopy: tnode;
|
||||
@ -585,7 +587,7 @@ implementation
|
||||
begin
|
||||
n := ttempcreatenode(inherited getcopy);
|
||||
n.size := size;
|
||||
n.persistent := persistent;
|
||||
n.temptype := temptype;
|
||||
|
||||
new(n.tempinfo);
|
||||
fillchar(n.tempinfo^,sizeof(n.tempinfo^),0);
|
||||
@ -728,7 +730,7 @@ implementation
|
||||
inherited create(tempdeleten);
|
||||
tempinfo := temp.tempinfo;
|
||||
release_to_normal := true;
|
||||
if not temp.persistent then
|
||||
if temp.temptype <> tt_persistent then
|
||||
internalerror(200204211);
|
||||
end;
|
||||
|
||||
@ -798,7 +800,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.50 2003-05-13 19:14:41 peter
|
||||
Revision 1.51 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.50 2003/05/13 19:14:41 peter
|
||||
* failn removed
|
||||
* inherited result code check moven to pexpr
|
||||
|
||||
|
@ -191,7 +191,7 @@ implementation
|
||||
htypechk,pass_1,cpubase,
|
||||
ncnv,nld,ninl,nadd,ncon,nmem,
|
||||
nutils,
|
||||
rgobj,cginfo,cgbase
|
||||
tgobj,rgobj,cginfo,cgbase
|
||||
;
|
||||
|
||||
type
|
||||
@ -1773,7 +1773,7 @@ type
|
||||
hiddentree:=internalstatements(newstatement,false);
|
||||
{ need to use resulttype instead of procdefinition.rettype,
|
||||
because they can be different }
|
||||
temp:=ctempcreatenode.create(resulttype,resulttype.def.size,true);
|
||||
temp:=ctempcreatenode.create(resulttype,resulttype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
addstatement(newstatement,ctempdeletenode.create_normal_temp(temp));
|
||||
addstatement(newstatement,ctemprefnode.create(temp));
|
||||
@ -2212,10 +2212,10 @@ type
|
||||
take_addr := (curparaitem.paratyp in [vs_var,vs_out]) or
|
||||
((curparaitem.paratype.def.deftype = formaldef));
|
||||
if not(take_addr) then
|
||||
temp := ctempcreatenode.create(curpara.left.resulttype,curpara.left.resulttype.def.size,true)
|
||||
temp := ctempcreatenode.create(curpara.left.resulttype,curpara.left.resulttype.def.size,tt_persistent)
|
||||
else
|
||||
begin
|
||||
temp := ctempcreatenode.create(voidpointertype,pointer_size,true);
|
||||
temp := ctempcreatenode.create(voidpointertype,pointer_size,tt_persistent);
|
||||
orgtype := @curpara.left.resulttype;
|
||||
end;
|
||||
addstatement(newstatement,temp);
|
||||
@ -2712,7 +2712,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.155 2003-05-16 14:33:31 peter
|
||||
Revision 1.156 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.155 2003/05/16 14:33:31 peter
|
||||
* regvar fixes
|
||||
|
||||
Revision 1.154 2003/05/14 19:35:50 jonas
|
||||
|
@ -256,8 +256,6 @@ interface
|
||||
*****************************************************************************}
|
||||
|
||||
procedure tcgtempcreatenode.pass_2;
|
||||
var
|
||||
temptype : ttemptype;
|
||||
begin
|
||||
location_reset(location,LOC_VOID,OS_NO);
|
||||
|
||||
@ -266,10 +264,6 @@ interface
|
||||
internalerror(200108222);
|
||||
|
||||
{ get a (persistent) temp }
|
||||
if persistent then
|
||||
temptype:=tt_persistant
|
||||
else
|
||||
temptype:=tt_normal;
|
||||
tg.GetTemp(exprasmlist,size,temptype,tempinfo^.ref);
|
||||
tempinfo^.valid := true;
|
||||
end;
|
||||
@ -316,7 +310,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.33 2003-04-27 11:21:33 peter
|
||||
Revision 1.34 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.33 2003/04/27 11:21:33 peter
|
||||
* aktprocdef renamed to current_procdef
|
||||
* procinfo renamed to current_procinfo
|
||||
* procinfo will now be stored in current_module so it can be
|
||||
|
@ -597,7 +597,7 @@ implementation
|
||||
if assigned(left) then
|
||||
begin
|
||||
inlinecode.para_size:=tprocdef(procdefinition).para_size(para_alignment);
|
||||
tg.GetTemp(exprasmlist,inlinecode.para_size,tt_persistant,pararef);
|
||||
tg.GetTemp(exprasmlist,inlinecode.para_size,tt_persistent,pararef);
|
||||
inlinecode.para_offset:=pararef.offset;
|
||||
end;
|
||||
store_parast_fixup:=tprocdef(procdefinition).parast.address_fixup;
|
||||
@ -742,7 +742,7 @@ implementation
|
||||
if inlined and
|
||||
(resulttype.def.size>0) then
|
||||
begin
|
||||
tg.GetTemp(exprasmlist,Align(resulttype.def.size,aktalignment.paraalign),tt_persistant,returnref);
|
||||
tg.GetTemp(exprasmlist,Align(resulttype.def.size,aktalignment.paraalign),tt_persistent,returnref);
|
||||
inlinecode.retoffset:=returnref.offset;
|
||||
end;
|
||||
|
||||
@ -1017,7 +1017,7 @@ implementation
|
||||
st.symtablelevel:=oldprocdef.localst.symtablelevel;
|
||||
if st.datasize>0 then
|
||||
begin
|
||||
tg.GetTemp(exprasmlist,st.datasize,tt_persistant,localsref);
|
||||
tg.GetTemp(exprasmlist,st.datasize,tt_persistent,localsref);
|
||||
if tg.direction>0 then
|
||||
st.address_fixup:=localsref.offset
|
||||
else
|
||||
@ -1128,7 +1128,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.66 2003-05-16 14:33:31 peter
|
||||
Revision 1.67 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.66 2003/05/16 14:33:31 peter
|
||||
* regvar fixes
|
||||
|
||||
Revision 1.65 2003/05/15 18:58:53 peter
|
||||
|
@ -986,9 +986,9 @@ implementation
|
||||
procedure try_new_exception(list : taasmoutput;var jmpbuf,envbuf, href : treference;
|
||||
a : aword; exceptlabel : tasmlabel);
|
||||
begin
|
||||
tg.GetTemp(list,EXCEPT_BUF_SIZE,tt_persistant,envbuf);
|
||||
tg.GetTemp(list,JMP_BUF_SIZE,tt_persistant,jmpbuf);
|
||||
tg.GetTemp(list,sizeof(aword),tt_persistant,href);
|
||||
tg.GetTemp(list,EXCEPT_BUF_SIZE,tt_persistent,envbuf);
|
||||
tg.GetTemp(list,JMP_BUF_SIZE,tt_persistent,jmpbuf);
|
||||
tg.GetTemp(list,sizeof(aword),tt_persistent,href);
|
||||
new_exception(list, jmpbuf,envbuf, href, a, exceptlabel);
|
||||
end;
|
||||
|
||||
@ -1554,7 +1554,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.61 2003-05-16 14:33:31 peter
|
||||
Revision 1.62 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.61 2003/05/16 14:33:31 peter
|
||||
* regvar fixes
|
||||
|
||||
Revision 1.60 2003/05/13 19:14:41 peter
|
||||
|
@ -376,7 +376,7 @@ implementation
|
||||
|
||||
{ since the input/output variables are threadvars loading them into
|
||||
a temp once is faster. Create a temp which will hold a pointer to the file }
|
||||
filetemp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,true);
|
||||
filetemp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
|
||||
addstatement(newstatement,filetemp);
|
||||
|
||||
{ make sure the resulttype of the temp (and as such of the }
|
||||
@ -409,7 +409,7 @@ implementation
|
||||
if (filepara.left.nodetype <> loadn) then
|
||||
begin
|
||||
{ create a temp which will hold a pointer to the file }
|
||||
filetemp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,true);
|
||||
filetemp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
|
||||
|
||||
{ add it to the statements }
|
||||
addstatement(newstatement,filetemp);
|
||||
@ -525,7 +525,7 @@ implementation
|
||||
begin
|
||||
{ create temp for result }
|
||||
temp := ctempcreatenode.create(para.left.resulttype,
|
||||
para.left.resulttype.def.size,true);
|
||||
para.left.resulttype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
{ assign result to temp }
|
||||
addstatement(newstatement,
|
||||
@ -753,7 +753,7 @@ implementation
|
||||
restype := @u32bittype;
|
||||
|
||||
{ create the parameter list: the temp ... }
|
||||
temp := ctempcreatenode.create(restype^,restype^.def.size,true);
|
||||
temp := ctempcreatenode.create(restype^,restype^.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
|
||||
{ ... and the file }
|
||||
@ -916,7 +916,7 @@ implementation
|
||||
if not assigned(codepara) or
|
||||
(torddef(codepara.resulttype.def).typ in [u8bit,u16bit,s8bit,s16bit]) then
|
||||
begin
|
||||
tempcode := ctempcreatenode.create(s32bittype,4,true);
|
||||
tempcode := ctempcreatenode.create(s32bittype,4,tt_persistent);
|
||||
addstatement(newstatement,tempcode);
|
||||
{ set the resulttype of the temp (needed to be able to get }
|
||||
{ the resulttype of the tempref used in the new code para) }
|
||||
@ -2351,7 +2351,12 @@ begin
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.111 2003-05-11 21:37:03 peter
|
||||
Revision 1.112 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.111 2003/05/11 21:37:03 peter
|
||||
* moved implicit exception frame from ncgutil to psub
|
||||
* constructor/destructor helpers moved from cobj/ncgutil to psub
|
||||
|
||||
|
@ -60,7 +60,7 @@ implementation
|
||||
scanner,
|
||||
pbase,pexpr,
|
||||
{ codegen }
|
||||
cgbase
|
||||
tgobj,cgbase
|
||||
;
|
||||
|
||||
|
||||
@ -231,7 +231,7 @@ implementation
|
||||
if is_new then
|
||||
begin
|
||||
{ create temp for result }
|
||||
temp := ctempcreatenode.create(p.resulttype,p.resulttype.def.size,true);
|
||||
temp := ctempcreatenode.create(p.resulttype,p.resulttype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
|
||||
{ create call to fpc_getmem }
|
||||
@ -312,7 +312,7 @@ implementation
|
||||
newblock:=internalstatements(newstatement,true);
|
||||
|
||||
{ create temp for result }
|
||||
temp := ctempcreatenode.create(p1.resulttype,p1.resulttype.def.size,true);
|
||||
temp := ctempcreatenode.create(p1.resulttype,p1.resulttype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
|
||||
{ create call to fpc_getmem }
|
||||
@ -475,7 +475,7 @@ implementation
|
||||
newblock:=internalstatements(newstatement,true);
|
||||
|
||||
{ get temp for array of lengths }
|
||||
temp := ctempcreatenode.create(s32bittype,counter*s32bittype.def.size,true);
|
||||
temp := ctempcreatenode.create(s32bittype,counter*s32bittype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
|
||||
{ load array of lengths }
|
||||
@ -646,7 +646,7 @@ implementation
|
||||
{ create temp for result, we've to use a temp because a dynarray
|
||||
type is handled differently from a pointer so we can't
|
||||
use createinternres() and a function }
|
||||
temp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,true);
|
||||
temp := ctempcreatenode.create(voidpointertype,voidpointertype.def.size,tt_persistent);
|
||||
addstatement(newstatement,temp);
|
||||
|
||||
{ create call to fpc_dynarray_copy }
|
||||
@ -682,7 +682,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.14 2003-05-16 14:33:31 peter
|
||||
Revision 1.15 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.14 2003/05/16 14:33:31 peter
|
||||
* regvar fixes
|
||||
|
||||
Revision 1.13 2003/05/09 17:47:03 peter
|
||||
|
@ -434,7 +434,7 @@ implementation
|
||||
htype:=p.resulttype
|
||||
else
|
||||
htype.setdef(tpointerdef.create(p.resulttype));
|
||||
loadp:=ctempcreatenode.create(htype,POINTER_SIZE,true);
|
||||
loadp:=ctempcreatenode.create(htype,POINTER_SIZE,tt_persistent);
|
||||
resulttypepass(loadp);
|
||||
if hasimplicitderef then
|
||||
begin
|
||||
@ -1175,7 +1175,12 @@ implementation
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.99 2003-05-15 18:58:53 peter
|
||||
Revision 1.100 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.99 2003/05/15 18:58:53 peter
|
||||
* removed selfpointer_offset, vmtpointer_offset
|
||||
* tvarsym.adjusted_address
|
||||
* address in localsymtable is now in the real direction
|
||||
|
@ -916,7 +916,7 @@ unit rgobj;
|
||||
not(r in unusedregsint) then
|
||||
begin
|
||||
{ then save it }
|
||||
tg.GetTemp(list,sizeof(aword),tt_persistant,hr);
|
||||
tg.GetTemp(list,sizeof(aword),tt_persistent,hr);
|
||||
saved[r].ofs:=hr.offset;
|
||||
r2.enum:=R_INTREGISTER;
|
||||
r2.number:=r shl 8 or R_SUBWHOLE;
|
||||
@ -957,7 +957,7 @@ unit rgobj;
|
||||
not(r.enum in unusedregsfpu) then
|
||||
begin
|
||||
{ then save it }
|
||||
tg.GetTemp(list,extended_size,tt_persistant,hr);
|
||||
tg.GetTemp(list,extended_size,tt_persistent,hr);
|
||||
saved[r.enum].ofs:=hr.offset;
|
||||
cg.a_loadfpu_reg_ref(list,OS_FLOAT,r,hr);
|
||||
cg.a_reg_dealloc(list,r);
|
||||
@ -979,7 +979,7 @@ unit rgobj;
|
||||
not(r.enum in unusedregsmm) then
|
||||
begin
|
||||
{ then save it }
|
||||
tg.GetTemp(list,mmreg_size,tt_persistant,hr);
|
||||
tg.GetTemp(list,mmreg_size,tt_persistent,hr);
|
||||
saved[r.enum].ofs:=hr.offset;
|
||||
cg.a_loadmm_reg_ref(list,r,hr);
|
||||
cg.a_reg_dealloc(list,r);
|
||||
@ -2027,7 +2027,12 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.43 2003-05-16 14:33:31 peter
|
||||
Revision 1.44 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.43 2003/05/16 14:33:31 peter
|
||||
* regvar fixes
|
||||
|
||||
Revision 1.42 2003/04/26 20:03:49 daniel
|
||||
|
@ -40,7 +40,7 @@ unit tgobj;
|
||||
|
||||
type
|
||||
ttemptype = (tt_none,
|
||||
tt_free,tt_normal,tt_persistant,
|
||||
tt_free,tt_normal,tt_persistent,
|
||||
tt_noreuse,tt_freenoreuse,
|
||||
tt_ansistring,tt_freeansistring,
|
||||
tt_widestring,tt_freewidestring,
|
||||
@ -536,7 +536,7 @@ unit tgobj;
|
||||
|
||||
procedure ttgobj.UnGetTemp(list: taasmoutput; const ref : treference);
|
||||
begin
|
||||
FreeTemp(list,ref.offset,[tt_normal,tt_noreuse,tt_persistant,tt_ansistring,tt_widestring,tt_interfacecom]);
|
||||
FreeTemp(list,ref.offset,[tt_normal,tt_noreuse,tt_persistent,tt_ansistring,tt_widestring,tt_interfacecom]);
|
||||
end;
|
||||
|
||||
|
||||
@ -554,7 +554,12 @@ finalization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.33 2003-05-13 20:13:41 florian
|
||||
Revision 1.34 2003-05-17 13:30:08 jonas
|
||||
* changed tt_persistant to tt_persistent :)
|
||||
* tempcreatenode now doesn't accept a boolean anymore for persistent
|
||||
temps, but a ttemptype, so you can also create ansistring temps etc
|
||||
|
||||
Revision 1.33 2003/05/13 20:13:41 florian
|
||||
* fixed temp. management for CPUs were the temp. space grows upwards
|
||||
|
||||
Revision 1.32 2003/05/12 21:29:59 peter
|
||||
|
Loading…
Reference in New Issue
Block a user