diff options
61 files changed, 3193 insertions, 475 deletions
diff --git a/compiler/aarch64/symcpu.pas b/compiler/aarch64/symcpu.pas new file mode 100644 index 0000000000..a95c77ba6f --- /dev/null +++ b/compiler/aarch64/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for AARCH64 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/alpha/cpunode.pas b/compiler/alpha/cpunode.pas index c62bc9c303..f399c94588 100644 --- a/compiler/alpha/cpunode.pas +++ b/compiler/alpha/cpunode.pas @@ -32,7 +32,7 @@ unit cpunode; uses { generic nodes } - ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl + ncgbas,ncgld,ncgflw,ncgcnv,ncgmem,ncgcon,ncgcal,ncgset,ncginl, { to be able to only parts of the generic code, the processor specific nodes must be included after the generic one (FK) @@ -48,7 +48,9 @@ unit cpunode; { this not really a node } // naxpobj, // naxpmat, -// naxpcnv +// naxpcnv, + { symtable } + symcpu ; end. diff --git a/compiler/alpha/symcpu.pas b/compiler/alpha/symcpu.pas new file mode 100644 index 0000000000..f8a126a1b2 --- /dev/null +++ b/compiler/alpha/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for Alpha + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/arm/cpunode.pas b/compiler/arm/cpunode.pas index dd26776627..b5438e5183 100644 --- a/compiler/arm/cpunode.pas +++ b/compiler/arm/cpunode.pas @@ -41,7 +41,9 @@ unit cpunode; narmcnv, narmcon, narmset, - narmmem + narmmem, + { symtable } + symcpu ; diff --git a/compiler/arm/symcpu.pas b/compiler/arm/symcpu.pas new file mode 100644 index 0000000000..27ac94790b --- /dev/null +++ b/compiler/arm/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for ARM + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/avr/cpunode.pas b/compiler/avr/cpunode.pas index 64090a192b..9a1af52634 100644 --- a/compiler/avr/cpunode.pas +++ b/compiler/avr/cpunode.pas @@ -36,7 +36,9 @@ unit cpunode; } ,navradd ,navrmat - ,navrcnv + ,navrcnv, + { symtable } + symcpu ; diff --git a/compiler/avr/symcpu.pas b/compiler/avr/symcpu.pas new file mode 100644 index 0000000000..dc9f73c938 --- /dev/null +++ b/compiler/avr/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for AVR + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/cg64f32.pas b/compiler/cg64f32.pas index 5925e9bc85..fde37bc256 100644 --- a/compiler/cg64f32.pas +++ b/compiler/cg64f32.pas @@ -863,7 +863,7 @@ unit cg64f32; { if the high dword = 0, the low dword can be considered a } { simple cardinal } cg.a_label(list,poslabel); - hdef:=torddef.create(u32bit,0,$ffffffff); + hdef:=corddef.create(u32bit,0,$ffffffff); location_copy(temploc,l); temploc.size:=OS_32; @@ -903,7 +903,7 @@ unit cg64f32; { if we get here, the 64bit value lies between } { longint($80000000) and -1 (JM) } cg.a_label(list,neglabel); - hdef:=torddef.create(s32bit,int64(longint($80000000)),int64(-1)); + hdef:=corddef.create(s32bit,int64(longint($80000000)),int64(-1)); location_copy(temploc,l); temploc.size:=OS_32; hlcg.g_rangecheck(list,temploc,hdef,todef); diff --git a/compiler/generic/symcpu.pas b/compiler/generic/symcpu.pas new file mode 100644 index 0000000000..2c968295cd --- /dev/null +++ b/compiler/generic/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for <generic> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/i386/cpunode.pas b/compiler/i386/cpunode.pas index 543d66f7fd..8be4686809 100644 --- a/compiler/i386/cpunode.pas +++ b/compiler/i386/cpunode.pas @@ -57,7 +57,9 @@ unit cpunode; {$ifdef TEST_WIN32_SEH} n386flw, {$endif TEST_WIN32_SEH} - n386mat + n386mat, + { symtable } + symcpu ; end. diff --git a/compiler/i386/symcpu.pas b/compiler/i386/symcpu.pas new file mode 100644 index 0000000000..5e8e6f28d2 --- /dev/null +++ b/compiler/i386/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for i386 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/i8086/cpunode.pas b/compiler/i8086/cpunode.pas index 047a211279..eb041343f1 100644 --- a/compiler/i8086/cpunode.pas +++ b/compiler/i8086/cpunode.pas @@ -54,7 +54,9 @@ unit cpunode; n386set}, n8086inl, n8086mat, - n8086con + n8086con, + { symtable } + symcpu ; end. diff --git a/compiler/i8086/symcpu.pas b/compiler/i8086/symcpu.pas new file mode 100644 index 0000000000..b4aefb87b7 --- /dev/null +++ b/compiler/i8086/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for i8086 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/ia64/symcpu.pas b/compiler/ia64/symcpu.pas new file mode 100644 index 0000000000..b31a721e4c --- /dev/null +++ b/compiler/ia64/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for IA64 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/jvm/cpunode.pas b/compiler/jvm/cpunode.pas index 2cdeb03272..e9703aa334 100644 --- a/compiler/jvm/cpunode.pas +++ b/compiler/jvm/cpunode.pas @@ -35,6 +35,8 @@ implementation njvmadd,njvmcal,njvmmat,njvmcnv,njvmcon,njvminl,njvmmem,njvmflw,njvmld, njvmset,njvmvmt { these are not really nodes } - ,rgcpu,tgcpu,njvmutil,njvmtcon; + ,rgcpu,tgcpu,njvmutil,njvmtcon, + { symtable } + symcpu; end. diff --git a/compiler/jvm/njvmcon.pas b/compiler/jvm/njvmcon.pas index 722ccb29e4..44a5b9c7ec 100644 --- a/compiler/jvm/njvmcon.pas +++ b/compiler/jvm/njvmcon.pas @@ -445,7 +445,7 @@ implementation { add a read-only typed constant } new(ps); ps^:=value_set^; - csym:=tconstsym.create_ptr('_$setconst'+tostr(current_module.symlist.count),constset,ps,resultdef); + csym:=cconstsym.create_ptr('_$setconst'+tostr(current_module.symlist.count),constset,ps,resultdef); csym.visibility:=vis_private; include(csym.symoptions,sp_internal); current_module.localsymtable.insert(csym); diff --git a/compiler/jvm/njvmutil.pas b/compiler/jvm/njvmutil.pas index d19537874d..6b09ed4612 100644 --- a/compiler/jvm/njvmutil.pas +++ b/compiler/jvm/njvmutil.pas @@ -197,7 +197,7 @@ implementation java.lang.ThreadLocal class which will wrap the actual variable value } if vo_is_thread_var in sym.varoptions then begin - vs:=tstaticvarsym.create(sym.realname+'$threadvar',sym.varspez, + vs:=cstaticvarsym.create(sym.realname+'$threadvar',sym.varspez, jvmgetthreadvardef(sym.vardef), sym.varoptions - [vo_is_thread_var]); sym.owner.insert(vs); @@ -467,7 +467,7 @@ implementation if (tprocdef(pd).proctypeoption=potype_proginit) then begin { add the args parameter } - pvs:=tparavarsym.create('$args',1,vs_const,search_system_type('TJSTRINGARRAY').typedef,[]); + pvs:=cparavarsym.create('$args',1,vs_const,search_system_type('TJSTRINGARRAY').typedef,[]); tprocdef(pd).parast.insert(pvs); tprocdef(pd).calcparas; end; diff --git a/compiler/jvm/pjvm.pas b/compiler/jvm/pjvm.pas index d05886b6e9..37987c3ccf 100644 --- a/compiler/jvm/pjvm.pas +++ b/compiler/jvm/pjvm.pas @@ -131,7 +131,7 @@ implementation end; if not assigned(sym) then begin - ps:=tprocsym.create('Create'); + ps:=cprocsym.create('Create'); obj.symtable.insert(ps); end; { determine symtable level } @@ -139,7 +139,7 @@ implementation while not(topowner.owner.symtabletype in [staticsymtable,globalsymtable]) do topowner:=topowner.owner.defowner; { create procdef } - pd:=tprocdef.create(topowner.owner.symtablelevel+1); + pd:=cprocdef.create(topowner.owner.symtablelevel+1); if df_generic in obj.defoptions then include(pd.defoptions,df_generic); {Â method of this objectdef } @@ -304,7 +304,7 @@ implementation { create new class (different internal name than enum to prevent name clash; at unit level because we don't want its methods to be nested inside a function in case its a local type) } - enumclass:=tobjectdef.create(odt_javaclass,'$'+current_module.realmodulename^+'$'+name+'$InternEnum$'+tostr(def.defid),java_jlenum); + enumclass:=cobjectdef.create(odt_javaclass,'$'+current_module.realmodulename^+'$'+name+'$InternEnum$'+tostr(def.defid),java_jlenum); tenumdef(def).classdef:=enumclass; include(enumclass.objectoptions,oo_is_enum_class); include(enumclass.objectoptions,oo_is_sealed); @@ -314,11 +314,11 @@ implementation name that can be used in generated Pascal code without risking an identifier conflict (since it is local to this class; the global name is unique because it's an identifier that contains $-signs) } - enumclass.symtable.insert(ttypesym.create('__FPC_TEnumClassAlias',enumclass)); + enumclass.symtable.insert(ctypesym.create('__FPC_TEnumClassAlias',enumclass)); { also create an alias for the enum type so that we can iterate over all enum values when creating the body of the class constructor } - temptypesym:=ttypesym.create('__FPC_TEnumAlias',nil); + temptypesym:=ctypesym.create('__FPC_TEnumAlias',nil); { don't pass def to the ttypesym constructor, because then it will replace the current (real) typesym of that def with the alias } temptypesym.typedef:=def; @@ -350,23 +350,23 @@ implementation { create static fields representing all enums } for i:=0 to tenumdef(def).symtable.symlist.count-1 do begin - fsym:=tfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[]); + fsym:=cfieldvarsym.create(tenumsym(tenumdef(def).symtable.symlist[i]).realname,vs_final,enumclass,[]); enumclass.symtable.insert(fsym); sym:=make_field_static(enumclass.symtable,fsym); { add alias for the field representing ordinal(0), for use in initialization code } if tenumsym(tenumdef(def).symtable.symlist[i]).value=0 then begin - aliassym:=tstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external]); + aliassym:=cstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external]); enumclass.symtable.insert(aliassym); aliassym.set_raw_mangledname(sym.mangledname); end; end; { create local "array of enumtype" type for the "values" functionality (used internally by the JDK) } - arrdef:=tarraydef.create(0,tenumdef(def).symtable.symlist.count-1,s32inttype); + arrdef:=carraydef.create(0,tenumdef(def).symtable.symlist.count-1,s32inttype); arrdef.elementdef:=enumclass; - arrsym:=ttypesym.create('__FPC_TEnumValues',arrdef); + arrsym:=ctypesym.create('__FPC_TEnumValues',arrdef); enumclass.symtable.insert(arrsym); { insert "public static values: array of enumclass" that returns $VALUES.clone() (rather than a dynamic array and using clone --which we don't support yet for arrays-- @@ -380,12 +380,12 @@ implementation if tenumdef(def).has_jumps then begin { add field for the value } - fsym:=tfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[]); + fsym:=cfieldvarsym.create('__fpc_fenumval',vs_final,s32inttype,[]); enumclass.symtable.insert(fsym); tobjectsymtable(enumclass.symtable).addfield(fsym,vis_strictprivate); { add class field with hash table that maps from FPC-declared ordinal value -> enum instance } juhashmap:=search_system_type('JUHASHMAP').typedef; - fsym:=tfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[]); + fsym:=cfieldvarsym.create('__fpc_ord2enum',vs_final,juhashmap,[]); enumclass.symtable.insert(fsym); make_field_static(enumclass.symtable,fsym); { add custom constructor } @@ -442,14 +442,14 @@ implementation "Values" instance method -- that's also the reason why we insert the field only now, because we cannot disable duplicate identifier checking when creating the "Values" method } - fsym:=tfieldvarsym.create('$VALUES',vs_final,arrdef,[]); + fsym:=cfieldvarsym.create('$VALUES',vs_final,arrdef,[]); fsym.visibility:=vis_strictprivate; enumclass.symtable.insert(fsym,false); sym:=make_field_static(enumclass.symtable,fsym); { alias for accessing the field in generated Pascal code } sl:=tpropaccesslist.create; sl.addsym(sl_load,sym); - enumclass.symtable.insert(tabsolutevarsym.create_ref('__fpc_FVALUES',arrdef,sl)); + enumclass.symtable.insert(cabsolutevarsym.create_ref('__fpc_FVALUES',arrdef,sl)); { add initialization of the static class fields created above } if not str_parse_method_dec('constructor fpc_enum_class_constructor;',potype_class_constructor,true,enumclass,pd) then internalerror(2011062303); @@ -489,13 +489,13 @@ implementation { create new class (different internal name than pvar to prevent name clash; at unit level because we don't want its methods to be nested inside a function in case its a local type) } - pvclass:=tobjectdef.create(odt_javaclass,'$'+current_module.realmodulename^+'$'+name+'$InternProcvar$'+tostr(def.defid),java_procvarbase); + pvclass:=cobjectdef.create(odt_javaclass,'$'+current_module.realmodulename^+'$'+name+'$InternProcvar$'+tostr(def.defid),java_procvarbase); tprocvardef(def).classdef:=pvclass; include(pvclass.objectoptions,oo_is_sealed); if df_generic in def.defoptions then include(pvclass.defoptions,df_generic); { associate typesym } - pvclass.symtable.insert(ttypesym.create('__FPC_TProcVarClassAlias',pvclass)); + pvclass.symtable.insert(ctypesym.create('__FPC_TProcVarClassAlias',pvclass)); { set external name to match procvar type name } if not islocal then pvclass.objextname:=stringdup(name) @@ -517,7 +517,7 @@ implementation { add local alias for the procvartype that we can use when implementing the invoke method } - temptypesym:=ttypesym.create('__FPC_ProcVarAlias',nil); + temptypesym:=ctypesym.create('__FPC_ProcVarAlias',nil); { don't pass def to the ttypesym constructor, because then it will replace the current (real) typesym of that def with the alias } temptypesym.typedef:=def; @@ -533,12 +533,12 @@ implementation not islocal and not force_no_callback_intf then begin - pvintf:=tobjectdef.create(odt_interfacejava,'Callback',nil); + pvintf:=cobjectdef.create(odt_interfacejava,'Callback',nil); pvintf.objextname:=stringdup('Callback'); if df_generic in def.defoptions then include(pvintf.defoptions,df_generic); { associate typesym } - pvclass.symtable.insert(ttypesym.create('Callback',pvintf)); + pvclass.symtable.insert(ctypesym.create('Callback',pvintf)); { add a method prototype matching the procvar (like the invoke in the procvarclass itself) } @@ -648,7 +648,7 @@ implementation jvm_create_procvar_class_intern('__fpc_virtualclassmethod_pv_t'+tostr(wrapperpd.defid),wrapperpv,true); { create alias for the procvar type so we can use it in generated Pascal code } - typ:=ttypesym.create('__fpc_virtualclassmethod_pv_t'+tostr(wrapperpd.defid),wrapperpv); + typ:=ctypesym.create('__fpc_virtualclassmethod_pv_t'+tostr(wrapperpd.defid),wrapperpv); wrapperpv.classdef.typesym.visibility:=vis_strictprivate; symtablestack.top.insert(typ); symtablestack.pop(pd.owner); @@ -741,7 +741,7 @@ implementation begin { make sure we don't emit a definition for this field (we'll do that for the constsym already) -> mark as external } - ssym:=tstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,csym.constdef,[vo_is_external]); + ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,csym.constdef,[vo_is_external]); csym.owner.insert(ssym); { alias storage to the constsym } ssym.set_mangledname(csym.realname); @@ -779,7 +779,7 @@ implementation has been compiler -> insert a copy in the unit's staticsymtable } symtablestack.push(current_module.localsymtable); - ssym:=tstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,tsetdef(csym.constdef).getcopy,[vo_is_external,vo_has_local_copy]); + ssym:=cstaticvarsym.create(internal_static_field_name(csym.realname),vs_final,tsetdef(csym.constdef).getcopy,[vo_is_external,vo_has_local_copy]); symtablestack.top.insert(ssym); symtablestack.pop(current_module.localsymtable); { alias storage to the constsym } @@ -998,7 +998,7 @@ implementation { create procdef } if not assigned(orgaccesspd) then begin - pd:=tprocdef.create(normal_function_level); + pd:=cprocdef.create(normal_function_level); if df_generic in obj.defoptions then include(pd.defoptions,df_generic); {Â method of this objectdef } @@ -1030,7 +1030,7 @@ implementation if not assigned(sym) or (sym.owner<>p.owner) then begin - ps:=tprocsym.create(name); + ps:=cprocsym.create(name); obj.symtable.insert(ps); end else @@ -1060,7 +1060,7 @@ implementation if not assigned(orgaccesspd) then begin { parameter with value to set } - pvs:=tparavarsym.create('__fpc_newval__',10,vs_const,p.propdef,[]); + pvs:=cparavarsym.create('__fpc_newval__',10,vs_const,p.propdef,[]); pd.parast.insert(pvs); end; if (ppo_hasparameters in p.propoptions) and @@ -1076,7 +1076,7 @@ implementation callthroughpropname:=callthroughpropname+'__getter_wrapper' else callthroughpropname:=callthroughpropname+'__setter_wrapper'; - callthroughprop:=tpropertysym.create(callthroughpropname); + callthroughprop:=cpropertysym.create(callthroughpropname); callthroughprop.visibility:=p.visibility; if getter then diff --git a/compiler/jvm/symcpu.pas b/compiler/jvm/symcpu.pas new file mode 100644 index 0000000000..0d24168397 --- /dev/null +++ b/compiler/jvm/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for JVM + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/m68k/cpunode.pas b/compiler/m68k/cpunode.pas index 646571859b..e44c4e9829 100644 --- a/compiler/m68k/cpunode.pas +++ b/compiler/m68k/cpunode.pas @@ -46,7 +46,9 @@ unit cpunode; // nppcobj, // nppcmat, n68kmat, - n68kcnv - ; + n68kcnv, + { symtable } + symcpu + ; end. diff --git a/compiler/m68k/symcpu.pas b/compiler/m68k/symcpu.pas new file mode 100644 index 0000000000..4457258508 --- /dev/null +++ b/compiler/m68k/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for m68k + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/mips/cpunode.pas b/compiler/mips/cpunode.pas index f5b968bd1d..4066df4bb8 100644 --- a/compiler/mips/cpunode.pas +++ b/compiler/mips/cpunode.pas @@ -37,6 +37,9 @@ implementation after the generic one (FK) } ncpuadd,ncpucall,ncpumat,ncpuinln, - ncpuld,ncpucnv,ncpuset; + ncpuld,ncpucnv,ncpuset, + { symtable } + symcpu + ; end. diff --git a/compiler/mips/symcpu.pas b/compiler/mips/symcpu.pas new file mode 100644 index 0000000000..4c3ff37bf9 --- /dev/null +++ b/compiler/mips/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for MIPS + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/nadd.pas b/compiler/nadd.pas index fdabc580a1..9ee487d53d 100644 --- a/compiler/nadd.pas +++ b/compiler/nadd.pas @@ -1580,7 +1580,7 @@ implementation llow:=rlow; lhigh:=rhigh; end; - nd:=tsetdef.create(tsetdef(ld).elementdef,min(llow,rlow).svalue,max(lhigh,rhigh).svalue); + nd:=csetdef.create(tsetdef(ld).elementdef,min(llow,rlow).svalue,max(lhigh,rhigh).svalue); inserttypeconv(left,nd); if (rd.typ=setdef) then inserttypeconv(right,nd) diff --git a/compiler/ncal.pas b/compiler/ncal.pas index 262e24efd4..4ff1ac37bb 100644 --- a/compiler/ncal.pas +++ b/compiler/ncal.pas @@ -1344,7 +1344,7 @@ implementation for i:=0 to varargsparas.count-1 do begin hp:=tparavarsym(varargsparas[i]); - hpn:=tparavarsym.create(hp.realname,hp.paranr,hp.varspez,hp.vardef,[]); + hpn:=cparavarsym.create(hp.realname,hp.paranr,hp.varspez,hp.vardef,[]); n.varargsparas.add(hpn); para:=tcallparanode(n.left); while assigned(para) do @@ -1927,7 +1927,7 @@ implementation be marked as instantiatable (only the pointeddef will actually be recorded, so it's no problem that the clasrefdef is only temporary) } - crefdef:=tclassrefdef.create(tcallnode(methodpointer).methodpointer.resultdef); + crefdef:=cclassrefdef.create(tcallnode(methodpointer).methodpointer.resultdef); { and register it } crefdef.register_created_object_type; end @@ -2777,7 +2777,7 @@ implementation begin if cpf_varargs_para in pt.callparaflags then begin - varargspara:=tparavarsym.create('va'+tostr(i),i,vs_value,pt.resultdef,[]); + varargspara:=cparavarsym.create('va'+tostr(i),i,vs_value,pt.resultdef,[]); dec(i); { varargspara is left-right, use insert instead of concat } diff --git a/compiler/ncnv.pas b/compiler/ncnv.pas index 530ce78906..bb70e434ef 100644 --- a/compiler/ncnv.pas +++ b/compiler/ncnv.pas @@ -643,7 +643,7 @@ implementation p.free; end; { set the initial set type } - constp.resultdef:=tsetdef.create(hdef,constsetlo.svalue,constsethi.svalue); + constp.resultdef:=csetdef.create(hdef,constsetlo.svalue,constsethi.svalue); { determine the resultdef for the tree } typecheckpass(buildp); { set the new tree } diff --git a/compiler/ncon.pas b/compiler/ncon.pas index 7f85ef8d3c..3357e7f1e7 100644 --- a/compiler/ncon.pas +++ b/compiler/ncon.pas @@ -966,7 +966,7 @@ implementation l:=len-1 else l:=0; - resultdef:=tarraydef.create(0,l,s32inttype); + resultdef:=carraydef.create(0,l,s32inttype); tarraydef(resultdef).elementdef:=cansichartype; include(tarraydef(resultdef).arrayoptions,ado_IsConstString); end; diff --git a/compiler/nflw.pas b/compiler/nflw.pas index d988282dcd..0f321ade74 100644 --- a/compiler/nflw.pas +++ b/compiler/nflw.pas @@ -351,7 +351,7 @@ implementation typecheckpass(tnode(state)); addstatement(mainstatement,state); { the temporary items array } - itemsarraydef:=tarraydef.create(1,16,u32inttype); + itemsarraydef:=carraydef.create(1,16,u32inttype); itemsarraydef.elementdef:=objc_idtype; items:=ctempcreatenode.create(itemsarraydef,itemsarraydef.size,tt_persistent,false); addstatement(mainstatement,items); @@ -456,7 +456,7 @@ implementation if hp.resultdef.typ<>pointerdef then internalerror(2010061904); inserttypeconv(hp, - tarraydef.create_from_pointer(tpointerdef(hp.resultdef).pointeddef)); + carraydef.create_from_pointer(tpointerdef(hp.resultdef).pointeddef)); hp:=cvecnode.create(hp,ctemprefnode.create(innerloopcounter)); addstatement(innerloopbodystatement, cassignmentnode.create(hloopvar,hp)); @@ -570,7 +570,7 @@ implementation if assigned(tmpdef) and (tmpdef.typ=arraydef) and (tarraydef(tmpdef).arrayoptions = []) then begin elementcount:=elementcount*tarraydef(tmpdef).elecount; - convertdef:=tarraydef.create(0,elementcount-1,s32inttype); + convertdef:=carraydef.create(0,elementcount-1,s32inttype); tarraydef(convertdef).elementdef:=tarraydef(tmpdef).elementdef; expression:=expr.getcopy; expression:=ctypeconvnode.create_internal(expression,convertdef); @@ -2011,7 +2011,7 @@ implementation else begin third:=cinlinenode.create(in_get_frame,false,nil); - current_addr:=clabelnode.create(cnothingnode.create,tlabelsym.create('$raiseaddr')); + current_addr:=clabelnode.create(cnothingnode.create,clabelsym.create('$raiseaddr')); addstatement(statements,current_addr); right:=caddrnode.create(cloadnode.create(current_addr.labsym,current_addr.labsym.owner)); end; @@ -2183,7 +2183,7 @@ implementation destroyed before procsym, leaving invalid pointers). } oldsymtablestack:=symtablestack; symtablestack:=nil; - result:=tprocdef.create(max(normal_function_level,st.symtablelevel)+1); + result:=cprocdef.create(max(normal_function_level,st.symtablelevel)+1); symtablestack:=oldsymtablestack; st.insertdef(result); result.struct:=current_procinfo.procdef.struct; @@ -2192,7 +2192,7 @@ implementation exclude(result.procoptions,po_delphi_nested_cc); result.proctypeoption:=potype_exceptfilter; handle_calling_convention(result); - sym:=tprocsym.create('$fin$'+tostr(seq)); + sym:=cprocsym.create('$fin$'+tostr(seq)); st.insert(sym); inc(seq); diff --git a/compiler/ngenutil.pas b/compiler/ngenutil.pas index 259a9baa9c..f6c61b4d2c 100644 --- a/compiler/ngenutil.pas +++ b/compiler/ngenutil.pas @@ -582,7 +582,7 @@ implementation var pd: tprocdef; begin - pd:=tprocdef.create(main_program_level); + pd:=cprocdef.create(main_program_level); pd.procsym:=ps; ps.ProcdefList.Add(pd); include(pd.procoptions,po_global); diff --git a/compiler/ninl.pas b/compiler/ninl.pas index 02c4ecc0d5..28772dc817 100644 --- a/compiler/ninl.pas +++ b/compiler/ninl.pas @@ -410,7 +410,7 @@ implementation if not assigned(srsym) then begin { no valid default variable found, so create it } - srsym:=tlocalvarsym.create(defaultname,vs_const,def,[]); + srsym:=clocalvarsym.create(defaultname,vs_const,def,[]); srsymtable.insert(srsym); { mark the staticvarsym as typedconst } include(tabstractvarsym(srsym).varoptions,vo_is_typed_const); @@ -3353,7 +3353,7 @@ implementation hp:=caddnode.create(subn,left,hp); { assign result of addition } if not(is_integer(resultdef)) then - inserttypeconv(hp,torddef.create( + inserttypeconv(hp,corddef.create( {$ifdef cpu64bitaddr} s64bit, {$else cpu64bitaddr} @@ -3462,7 +3462,7 @@ implementation hpp := caddnode.create(subn,hp,hpp); { assign result of addition } if not(is_integer(resultnode.resultdef)) then - inserttypeconv(hpp,torddef.create( + inserttypeconv(hpp,corddef.create( {$ifdef cpu64bitaddr} s64bit, {$else cpu64bitaddr} @@ -4177,7 +4177,7 @@ implementation temprangedef:=nil; getrange(unpackednode.resultdef,ulorange,uhirange); getrange(packednode.resultdef,plorange,phirange); - temprangedef:=torddef.create(torddef(sinttype).ordtype,ulorange,uhirange); + temprangedef:=corddef.create(torddef(sinttype).ordtype,ulorange,uhirange); sourcevecindex := ctemprefnode.create(loopvar); targetvecindex := ctypeconvnode.create_internal(index.getcopy,sinttype); targetvecindex := caddnode.create(subn,targetvecindex,cordconstnode.create(plorange,sinttype,true)); diff --git a/compiler/nld.pas b/compiler/nld.pas index ef36504ba1..a72f0bbc6b 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -342,7 +342,7 @@ implementation resultdef:=tobjectdef(resultdef).extendeddef; if (po_classmethod in tprocdef(symtableentry.owner.defowner).procoptions) or (po_staticmethod in tprocdef(symtableentry.owner.defowner).procoptions) then - resultdef:=tclassrefdef.create(resultdef) + resultdef:=cclassrefdef.create(resultdef) else if (is_object(resultdef) or is_record(resultdef)) and (loadnf_load_self_pointer in loadnodeflags) then resultdef:=getpointerdef(resultdef); @@ -350,7 +350,7 @@ implementation else if vo_is_vmt in tabstractvarsym(symtableentry).varoptions then begin resultdef:=tprocdef(symtableentry.owner.defowner).struct; - resultdef:=tclassrefdef.create(resultdef); + resultdef:=cclassrefdef.create(resultdef); end else resultdef:=tabstractvarsym(symtableentry).vardef; @@ -1066,7 +1066,7 @@ implementation is_array_of_const(hdef) or is_open_array(hdef) then hdef:=voidtype; - resultdef:=tarraydef.create(0,len-1,s32inttype); + resultdef:=carraydef.create(0,len-1,s32inttype); tarraydef(resultdef).elementdef:=hdef; include(tarraydef(resultdef).arrayoptions,ado_IsConstructor); if varia then diff --git a/compiler/nmem.pas b/compiler/nmem.pas index 52bc50594f..254ed2ff8b 100644 --- a/compiler/nmem.pas +++ b/compiler/nmem.pas @@ -187,7 +187,7 @@ implementation if assigned(current_structdef.genericdef) then if current_structdef.genericdef=left.resultdef then begin - resultdef:=tclassrefdef.create(current_structdef); + resultdef:=cclassrefdef.create(current_structdef); defaultresultdef:=false; end else @@ -196,10 +196,10 @@ implementation else message(parser_e_cant_create_generics_of_this_type); if defaultresultdef then - resultdef:=tclassrefdef.create(left.resultdef); + resultdef:=cclassrefdef.create(left.resultdef); end else - resultdef:=tclassrefdef.create(left.resultdef); + resultdef:=cclassrefdef.create(left.resultdef); end else CGMessage(parser_e_pointer_to_class_expected); @@ -586,12 +586,12 @@ implementation if not(nf_typedaddr in flags) then resultdef:=voidfarpointertype else - resultdef:=tpointerdef.createx86(left.resultdef,x86pt_far); + resultdef:=cpointerdef.createx86(left.resultdef,x86pt_far); {$elseif defined(i386)} if not(nf_typedaddr in flags) then resultdef:=voidnearfspointertype else - resultdef:=tpointerdef.createx86(left.resultdef,x86pt_near_fs); + resultdef:=cpointerdef.createx86(left.resultdef,x86pt_near_fs); {$endif} end else @@ -914,7 +914,7 @@ implementation ((tarraydef(left.resultdef).lowrange<>tenumdef(htype).min) or (tarraydef(left.resultdef).highrange<>tenumdef(htype).max)) then {Convert array indexes to low_bound..high_bound.} - inserttypeconv(right,tenumdef.create_subrange(tenumdef(right.resultdef), + inserttypeconv(right,cenumdef.create_subrange(tenumdef(right.resultdef), asizeint(Tarraydef(left.resultdef).lowrange), asizeint(Tarraydef(left.resultdef).highrange) )) @@ -944,7 +944,7 @@ implementation newordtyp:=Torddef(right.resultdef).ordtype else newordtyp:=torddef(ptrsinttype).ordtype; - inserttypeconv(right,Torddef.create(newordtyp, + inserttypeconv(right,corddef.create(newordtyp, int64(Tarraydef(left.resultdef).lowrange), int64(Tarraydef(left.resultdef).highrange) )) @@ -957,7 +957,7 @@ implementation inserttypeconv(right,u8inttype) else if is_shortstring(left.resultdef) then {Convert shortstring indexes to 0..length.} - inserttypeconv(right,Torddef.create(u8bit,0,int64(Tstringdef(left.resultdef).len))) + inserttypeconv(right,corddef.create(u8bit,0,int64(Tstringdef(left.resultdef).len))) else {Convert indexes into dynamically allocated strings to aword.} inserttypeconv(right,uinttype); @@ -1024,7 +1024,7 @@ implementation ) then begin { convert pointer to array } - htype:=tarraydef.create_from_pointer(tpointerdef(left.resultdef).pointeddef); + htype:=carraydef.create_from_pointer(tpointerdef(left.resultdef).pointeddef); inserttypeconv(left,htype); if right.nodetype=rangen then resultdef:=htype @@ -1051,7 +1051,7 @@ implementation end; if right.nodetype=rangen then begin - htype:=Tarraydef.create_from_pointer(elementdef); + htype:=carraydef.create_from_pointer(elementdef); resultdef:=htype; end else diff --git a/compiler/nset.pas b/compiler/nset.pas index 44c2730a6d..90c2e7167c 100644 --- a/compiler/nset.pas +++ b/compiler/nset.pas @@ -754,11 +754,11 @@ implementation if (labels^.label_type = ltConstString) then begin - endlabel:=clabelnode.create(cnothingnode.create,tlabelsym.create('$casestrofend')); + endlabel:=clabelnode.create(cnothingnode.create,clabelsym.create('$casestrofend')); stmt_block:=internalstatements(stmt); for i:=0 to blocks.count-1 do begin - pcaseblock(blocks[i])^.statementlabel:=clabelnode.create(cnothingnode.create,tlabelsym.create('$casestrof')); + pcaseblock(blocks[i])^.statementlabel:=clabelnode.create(cnothingnode.create,clabelsym.create('$casestrof')); addstatement(stmt,pcaseblock(blocks[i])^.statementlabel); addstatement(stmt,pcaseblock(blocks[i])^.statement); pcaseblock(blocks[i])^.statement:=nil; diff --git a/compiler/optloop.pas b/compiler/optloop.pas index 1d1f6662f1..9a8ea5acaf 100644 --- a/compiler/optloop.pas +++ b/compiler/optloop.pas @@ -155,7 +155,7 @@ unit optloop; if (counts mod unrolls<>0) and ((counts mod unrolls)=unrolls-i) then begin - tfornode(node).entrylabel:=clabelnode.create(cnothingnode.create,tlabelsym.create('$optunrol')); + tfornode(node).entrylabel:=clabelnode.create(cnothingnode.create,clabelsym.create('$optunrol')); addstatement(unrollstatement,tfornode(node).entrylabel); end; diff --git a/compiler/opttail.pas b/compiler/opttail.pas index a177bd8da3..fc3600ad4a 100644 --- a/compiler/opttail.pas +++ b/compiler/opttail.pas @@ -198,7 +198,7 @@ unit opttail; is_managed_type(vardef)) then exit; - labelsym:=tlabelsym.create('$opttail'); + labelsym:=clabelsym.create('$opttail'); labelnode:=clabelnode.create(cnothingnode.create,labelsym); if find_and_replace_tailcalls(n) then begin diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 6bb3f66297..5bd5a0bb83 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -93,9 +93,9 @@ implementation ordconstn: begin if p.resultdef.typ=pointerdef then - hp:=tconstsym.create_ordptr(orgname,constpointer,tordconstnode(p).value.uvalue,p.resultdef) + hp:=cconstsym.create_ordptr(orgname,constpointer,tordconstnode(p).value.uvalue,p.resultdef) else - hp:=tconstsym.create_ord(orgname,constord,tordconstnode(p).value,p.resultdef); + hp:=cconstsym.create_ord(orgname,constord,tordconstnode(p).value,p.resultdef); end; stringconstn: begin @@ -103,7 +103,7 @@ implementation begin initwidestring(pw); copywidestring(pcompilerwidestring(tstringconstnode(p).value_str),pw); - hp:=tconstsym.create_wstring(orgname,constwstring,pw); + hp:=cconstsym.create_wstring(orgname,constwstring,pw); end else begin @@ -113,30 +113,30 @@ implementation keep it } if is_ansistring(p.resultdef) and (tstringdef(p.resultdef).encoding<>0) then - hp:=tconstsym.create_string(orgname,conststring,sp,tstringconstnode(p).len,p.resultdef) + hp:=cconstsym.create_string(orgname,conststring,sp,tstringconstnode(p).len,p.resultdef) else - hp:=tconstsym.create_string(orgname,conststring,sp,tstringconstnode(p).len,nil); + hp:=cconstsym.create_string(orgname,conststring,sp,tstringconstnode(p).len,nil); end; end; realconstn : begin new(pd); pd^:=trealconstnode(p).value_real; - hp:=tconstsym.create_ptr(orgname,constreal,pd,p.resultdef); + hp:=cconstsym.create_ptr(orgname,constreal,pd,p.resultdef); end; setconstn : begin new(ps); ps^:=tsetconstnode(p).value_set^; - hp:=tconstsym.create_ptr(orgname,constset,ps,p.resultdef); + hp:=cconstsym.create_ptr(orgname,constset,ps,p.resultdef); end; pointerconstn : begin - hp:=tconstsym.create_ordptr(orgname,constpointer,tpointerconstnode(p).value,p.resultdef); + hp:=cconstsym.create_ordptr(orgname,constpointer,tpointerconstnode(p).value,p.resultdef); end; niln : begin - hp:=tconstsym.create_ord(orgname,constnil,0,p.resultdef); + hp:=cconstsym.create_ord(orgname,constnil,0,p.resultdef); end; typen : begin @@ -146,7 +146,7 @@ implementation begin new(pg); pg^:=tobjectdef(p.resultdef).iidguid^; - hp:=tconstsym.create_ptr(orgname,constguid,pg,p.resultdef); + hp:=cconstsym.create_ptr(orgname,constguid,pg,p.resultdef); end else Message1(parser_e_interface_has_no_guid,tobjectdef(p.resultdef).objrealname^); @@ -166,7 +166,7 @@ implementation in_sizeof_x, in_bitsizeof_x: begin - hp:=tconstsym.create_ord(orgname,constord,0,p.resultdef); + hp:=cconstsym.create_ord(orgname,constord,0,p.resultdef); end; { add other cases here if necessary } else @@ -266,13 +266,13 @@ implementation to it from the structure or linking will fail } if symtablestack.top.symtabletype in [recordsymtable,ObjectSymtable] then begin - sym:=tfieldvarsym.create(orgname,varspez,hdef,[]); + sym:=cfieldvarsym.create(orgname,varspez,hdef,[]); symtablestack.top.insert(sym); sym:=make_field_static(symtablestack.top,tfieldvarsym(sym)); end else begin - sym:=tstaticvarsym.create(orgname,varspez,hdef,[]); + sym:=cstaticvarsym.create(orgname,varspez,hdef,[]); sym.visibility:=symtablestack.top.currentvisibility; symtablestack.top.insert(sym); end; @@ -339,20 +339,20 @@ implementation else begin if token=_ID then - labelsym:=tlabelsym.create(orgpattern) + labelsym:=clabelsym.create(orgpattern) else - labelsym:=tlabelsym.create(pattern); + labelsym:=clabelsym.create(pattern); symtablestack.top.insert(labelsym); if m_non_local_goto in current_settings.modeswitches then begin if symtablestack.top.symtabletype=localsymtable then begin - labelsym.jumpbuf:=tlocalvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[]); + labelsym.jumpbuf:=clocalvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[]); symtablestack.top.insert(labelsym.jumpbuf); end else begin - labelsym.jumpbuf:=tstaticvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[]); + labelsym.jumpbuf:=cstaticvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[]); symtablestack.top.insert(labelsym.jumpbuf); cnodeutils.insertbssdata(tstaticvarsym(labelsym.jumpbuf)); end; @@ -592,7 +592,7 @@ implementation sym:=tsym(symtablestack.top.Find(typename)); if not assigned(sym) then begin - sym:=ttypesym.create(orgtypename,tundefineddef.create); + sym:=ctypesym.create(orgtypename,cundefineddef.create); Include(sym.symoptions,sp_generic_dummy); ttypesym(sym).typedef.typesym:=sym; sym.visibility:=symtablestack.top.currentvisibility; @@ -628,7 +628,7 @@ implementation { insert a new type if we don't reuse an existing symbol } if not assigned(newtype) then begin - newtype:=ttypesym.create(genorgtypename,hdef); + newtype:=ctypesym.create(genorgtypename,hdef); newtype.visibility:=symtablestack.top.currentvisibility; symtablestack.top.insert(newtype); end; @@ -952,7 +952,7 @@ implementation getmem(sp,2); sp[0]:=chr(tordconstnode(p).value.svalue); sp[1]:=#0; - sym:=tconstsym.create_string(orgname,constresourcestring,sp,1,nil); + sym:=cconstsym.create_string(orgname,constresourcestring,sp,1,nil); end else Message(parser_e_illegal_expression); @@ -965,7 +965,7 @@ implementation changestringtype(getansistringdef); getmem(sp,len+1); move(value_str^,sp^,len+1); - sym:=tconstsym.create_string(orgname,constresourcestring,sp,len,nil); + sym:=cconstsym.create_string(orgname,constresourcestring,sp,len,nil); end; else Message(parser_e_illegal_expression); diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index 2c85fb3785..f83aba9626 100644 --- a/compiler/pdecobj.pas +++ b/compiler/pdecobj.pas @@ -1327,7 +1327,7 @@ implementation begin Message(parser_e_forward_mismatch); { recover } - current_structdef:=tobjectdef.create(current_objectdef.objecttype,n,nil); + current_structdef:=cobjectdef.create(current_objectdef.objecttype,n,nil); include(current_structdef.objectoptions,oo_is_forward); end else @@ -1340,7 +1340,7 @@ implementation Message(parser_f_no_anonym_objects); { create new class } - current_structdef:=tobjectdef.create(objecttype,n,nil); + current_structdef:=cobjectdef.create(objecttype,n,nil); { include always the forward flag, it'll be removed after the parent class have been added. This is to prevent circular childof loops } @@ -1369,14 +1369,14 @@ implementation psystem, but java_jlobject is not yet available there... } hrecst:=trecordsymtable.create('',1); - fsym:=tfieldvarsym.create('$proc',vs_value,java_jlobject,[]); + fsym:=cfieldvarsym.create('$proc',vs_value,java_jlobject,[]); hrecst.insert(fsym); hrecst.addfield(fsym,vis_hidden); - fsym:=tfieldvarsym.create('$data',vs_value,java_jlobject,[]); + fsym:=cfieldvarsym.create('$data',vs_value,java_jlobject,[]); hrecst.insert(fsym); hrecst.addfield(fsym,vis_hidden); - methodpointertype:=trecorddef.create('',hrecst); - systemunit.insert(ttypesym.create('$methodpointer',methodpointertype)); + methodpointertype:=crecorddef.create('',hrecst); + systemunit.insert(ctypesym.create('$methodpointer',methodpointertype)); end else if (current_objectdef.objname^='JLTHROWABLE') then java_jlthrowable:=current_objectdef diff --git a/compiler/pdecsub.pas b/compiler/pdecsub.pas index e527104130..5d24eeb94e 100644 --- a/compiler/pdecsub.pas +++ b/compiler/pdecsub.pas @@ -339,7 +339,7 @@ implementation sc.clear; repeat inc(paranr); - vs:=tparavarsym.create(orgpattern,paranr*10,varspez,generrordef,[]); + vs:=cparavarsym.create(orgpattern,paranr*10,varspez,generrordef,[]); currparast.insert(vs); if assigned(vs.owner) then sc.add(vs) @@ -352,7 +352,7 @@ implementation if parseprocvar<>pv_none then begin { inline procvar definitions are always nested procvars } - pv:=tprocvardef.create(normal_function_level+1); + pv:=cprocvardef.create(normal_function_level+1); if token=_LKLAMMER then parse_parameter_dec(pv); if parseprocvar=pv_func then @@ -366,7 +366,7 @@ implementation { possible proc directives } if check_proc_directive(true) then begin - dummytype:=ttypesym.create('unnamed',hdef); + dummytype:=ctypesym.create('unnamed',hdef); parse_var_proc_directives(tsym(dummytype)); dummytype.typedef:=nil; hdef.typesym:=nil; @@ -399,7 +399,7 @@ implementation consume(_ARRAY); consume(_OF); { define range and type of range } - hdef:=tarraydef.create(0,-1,s32inttype); + hdef:=carraydef.create(0,-1,s32inttype); { array of const ? } if (token=_CONST) and (m_objpas in current_settings.modeswitches) then begin @@ -946,13 +946,13 @@ implementation begin aprocsym:=Tprocsym(symtablestack.top.Find(sp)); if aprocsym=nil then - aprocsym:=tprocsym.create('$'+sp); + aprocsym:=cprocsym.create('$'+sp); end else if (potype in [potype_class_constructor,potype_class_destructor]) then - aprocsym:=tprocsym.create('$'+lower(sp)) + aprocsym:=cprocsym.create('$'+lower(sp)) else - aprocsym:=tprocsym.create(orgsp); + aprocsym:=cprocsym.create(orgsp); symtablestack.top.insert(aprocsym); end; @@ -966,7 +966,7 @@ implementation break; checkstack:=checkstack^.next; end; - pd:=tprocdef.create(st.symtablelevel+1); + pd:=cprocdef.create(st.symtablelevel+1); pd.struct:=astruct; pd.procsym:=aprocsym; pd.proctypeoption:=potype; @@ -1790,7 +1790,7 @@ begin tprocdef(pd).libsym:=sym; if po_syscall_legacy in tprocdef(pd).procoptions then begin - vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); paramanager.parseparaloc(vs,'A6'); pd.parast.insert(vs); end @@ -1822,7 +1822,7 @@ begin ) then begin tprocdef(pd).libsym:=sym; - vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); pd.parast.insert(vs); end else @@ -1891,7 +1891,7 @@ begin tprocdef(pd).libsym:=sym; if po_syscall_legacy in tprocdef(pd).procoptions then begin - vs:=tparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_legacy,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); paramanager.parseparaloc(vs,'A6'); pd.parast.insert(vs); end @@ -1901,17 +1901,17 @@ begin end else if po_syscall_basesysv in tprocdef(pd).procoptions then begin - vs:=tparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_basesysv,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); pd.parast.insert(vs); end else if po_syscall_sysvbase in tprocdef(pd).procoptions then begin - vs:=tparavarsym.create('$syscalllib',paranr_syscall_sysvbase,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_sysvbase,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para]); pd.parast.insert(vs); end else if po_syscall_r12base in tprocdef(pd).procoptions then begin - vs:=tparavarsym.create('$syscalllib',paranr_syscall_r12base,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); + vs:=cparavarsym.create('$syscalllib',paranr_syscall_r12base,vs_value,tabstractvarsym(sym).vardef,[vo_is_syscall_lib,vo_is_hidden_para,vo_has_explicit_paraloc]); paramanager.parseparaloc(vs,'R12'); pd.parast.insert(vs); end diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 4fa154a675..a417ff24a0 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -254,7 +254,7 @@ implementation sym: tprocsym; begin handle_calling_convention(pd); - sym:=tprocsym.create(prefix+lower(p.realname)); + sym:=cprocsym.create(prefix+lower(p.realname)); symtablestack.top.insert(sym); pd.procsym:=sym; include(pd.procoptions,po_dispid); @@ -315,7 +315,7 @@ implementation begin { add an extra parameter, a placeholder of the value to set } inc(paranr); - hparavs:=tparavarsym.create('$value',10*paranr,vs_value,p.propdef,[]); + hparavs:=cparavarsym.create('$value',10*paranr,vs_value,p.propdef,[]); writepd.parast.insert(hparavs); writepd.proctypeoption:=potype_propsetter; @@ -353,8 +353,8 @@ implementation { Generate temp procdefs to search for matching read/write procedures. the readprocdef will store all definitions } paranr:=0; - readprocdef:=tprocdef.create(normal_function_level); - writeprocdef:=tprocdef.create(normal_function_level); + readprocdef:=cprocdef.create(normal_function_level); + writeprocdef:=cprocdef.create(normal_function_level); readprocdef.struct:=astruct; writeprocdef.struct:=astruct; @@ -372,7 +372,7 @@ implementation exit; end; { Generate propertysym and insert in symtablestack } - p:=tpropertysym.create(orgpattern); + p:=cpropertysym.create(orgpattern); p.visibility:=symtablestack.top.currentvisibility; p.default:=longint($80000000); if is_classproperty then @@ -403,7 +403,7 @@ implementation sc.clear; repeat inc(paranr); - hreadparavs:=tparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]); + hreadparavs:=cparavarsym.create(orgpattern,10*paranr,varspez,generrordef,[]); p.parast.insert(hreadparavs); sc.add(hreadparavs); consume(_ID); @@ -414,7 +414,7 @@ implementation begin consume(_OF); { define range and type of range } - hdef:=tarraydef.create(0,-1,s32inttype); + hdef:=carraydef.create(0,-1,s32inttype); { define field type } single_type(arraytype,[]); tarraydef(hdef).elementdef:=arraytype; @@ -605,7 +605,7 @@ implementation of the of the property } writeprocdef.returndef:=voidtype; inc(paranr); - hparavs:=tparavarsym.create('$value',10*paranr,vs_value,p.propdef,[]); + hparavs:=cparavarsym.create('$value',10*paranr,vs_value,p.propdef,[]); writeprocdef.parast.insert(hparavs); { Insert hidden parameters } handle_calling_convention(writeprocdef); @@ -735,14 +735,14 @@ implementation procsym : begin { Create a temporary procvardef to handle parameters } - storedprocdef:=tprocvardef.create(normal_function_level); + storedprocdef:=cprocvardef.create(normal_function_level); include(storedprocdef.procoptions,po_methodpointer); { Return type must be boolean } storedprocdef.returndef:=pasbool8type; { Add index parameter if needed } if ppo_indexed in p.propoptions then begin - hparavs:=tparavarsym.create('$index',10,vs_value,p.indexdef,[]); + hparavs:=cparavarsym.create('$index',10,vs_value,p.indexdef,[]); storedprocdef.parast.insert(hparavs); end; @@ -956,7 +956,7 @@ implementation (def.typesym=nil) and check_proc_directive(true) then begin - newtype:=ttypesym.create('unnamed',def); + newtype:=ctypesym.create('unnamed',def); parse_var_proc_directives(tsym(newtype)); newtype.typedef:=nil; def.typesym:=nil; @@ -1181,7 +1181,7 @@ implementation case vs.typ of localvarsym : begin - tcsym:=tstaticvarsym.create('$default'+vs.realname,vs_const,vs.vardef,[]); + tcsym:=cstaticvarsym.create('$default'+vs.realname,vs_const,vs.vardef,[]); include(tcsym.symoptions,sp_internal); vs.defaultconstsym:=tcsym; symtablestack.top.insert(tcsym); @@ -1241,7 +1241,7 @@ implementation if (pt.nodetype=stringconstn) or (is_constcharnode(pt)) then begin - abssym:=tabsolutevarsym.create(vs.realname,vs.vardef); + abssym:=cabsolutevarsym.create(vs.realname,vs.vardef); abssym.fileinfo:=vs.fileinfo; if pt.nodetype=stringconstn then abssym.asmname:=stringdup(strpas(tstringconstnode(pt).value_str)) @@ -1253,7 +1253,7 @@ implementation { address } else if is_constintnode(pt) then begin - abssym:=tabsolutevarsym.create(vs.realname,vs.vardef); + abssym:=cabsolutevarsym.create(vs.realname,vs.vardef); abssym.fileinfo:=vs.fileinfo; abssym.abstyp:=toaddr; {$ifndef cpu64bitaddr} @@ -1345,7 +1345,7 @@ implementation { we should check the result type of loadn } if not (tloadnode(hp).symtableentry.typ in [fieldvarsym,staticvarsym,localvarsym,paravarsym]) then Message(parser_e_absolute_only_to_var_or_const); - abssym:=tabsolutevarsym.create(vs.realname,vs.vardef); + abssym:=cabsolutevarsym.create(vs.realname,vs.vardef); abssym.fileinfo:=vs.fileinfo; abssym.abstyp:=tovar; abssym.ref:=node_to_propaccesslist(pt); @@ -1407,11 +1407,11 @@ implementation begin case symtablestack.top.symtabletype of localsymtable : - vs:=tlocalvarsym.create(orgpattern,vs_value,generrordef,[]); + vs:=clocalvarsym.create(orgpattern,vs_value,generrordef,[]); staticsymtable, globalsymtable : begin - vs:=tstaticvarsym.create(orgpattern,vs_value,generrordef,[]); + vs:=cstaticvarsym.create(orgpattern,vs_value,generrordef,[]); if vd_threadvar in options then include(vs.varoptions,vo_is_thread_var); end; @@ -1626,7 +1626,7 @@ implementation sorg:=orgpattern; if token=_ID then begin - vs:=tfieldvarsym.create(sorg,vs_value,generrordef,[]); + vs:=cfieldvarsym.create(sorg,vs_value,generrordef,[]); { normally the visibility is set via addfield, but sometimes we collect symbols so we can add them in a batch of @@ -1849,7 +1849,7 @@ implementation begin consume(_ID); consume(_COLON); - fieldvs:=tfieldvarsym.create(sorg,vs_value,generrordef,[]); + fieldvs:=cfieldvarsym.create(sorg,vs_value,generrordef,[]); variantdesc^^.variantselector:=fieldvs; symtablestack.top.insert(fieldvs); end; @@ -1869,7 +1869,7 @@ implementation consume(_OF); UnionSymtable:=trecordsymtable.create('',current_settings.packrecords); - UnionDef:=trecorddef.create('',unionsymtable); + UnionDef:=crecorddef.create('',unionsymtable); uniondef.isunion:=true; startvarrecsize:=UnionSymtable.datasize; diff --git a/compiler/pexpr.pas b/compiler/pexpr.pas index e9ca1356c5..eb08b00719 100644 --- a/compiler/pexpr.pas +++ b/compiler/pexpr.pas @@ -112,14 +112,14 @@ implementation if tordconstnode(p).value>255 then begin { longstring is currently unsupported (CEC)! } -{ t:=tstringdef.createlong(tordconstnode(p).value))} +{ t:=cstringdef.createlong(tordconstnode(p).value))} Message(parser_e_invalid_string_size); tordconstnode(p).value:=255; - def:=tstringdef.createshort(int64(tordconstnode(p).value)); + def:=cstringdef.createshort(int64(tordconstnode(p).value)); end else if tordconstnode(p).value<>255 then - def:=tstringdef.createshort(int64(tordconstnode(p).value)); + def:=cstringdef.createshort(int64(tordconstnode(p).value)); consume(_RECKKLAMMER); end; p.free; @@ -332,13 +332,13 @@ implementation include(current_procinfo.flags,pi_has_nested_exit); exclude(current_procinfo.procdef.procoptions,po_inline); - exit_procinfo.nestedexitlabel:=tlabelsym.create('$nestedexit'); + exit_procinfo.nestedexitlabel:=clabelsym.create('$nestedexit'); { the compiler is responsible to define this label } exit_procinfo.nestedexitlabel.defined:=true; exit_procinfo.nestedexitlabel.used:=true; - exit_procinfo.nestedexitlabel.jumpbuf:=tlocalvarsym.create('LABEL$_'+exit_procinfo.nestedexitlabel.name,vs_value,rec_jmp_buf,[]); + exit_procinfo.nestedexitlabel.jumpbuf:=clocalvarsym.create('LABEL$_'+exit_procinfo.nestedexitlabel.name,vs_value,rec_jmp_buf,[]); exit_procinfo.procdef.localst.insert(exit_procinfo.nestedexitlabel); exit_procinfo.procdef.localst.insert(exit_procinfo.nestedexitlabel.jumpbuf); end; @@ -2741,7 +2741,7 @@ implementation undefinedsym : begin p1:=cnothingnode.Create; - p1.resultdef:=tundefineddef.create; + p1.resultdef:=cundefineddef.create; { clean up previously created dummy symbol } srsym.free; end; @@ -3004,7 +3004,7 @@ implementation hdef:=hclassdef; if (po_classmethod in current_procinfo.procdef.procoptions) or (po_staticmethod in current_procinfo.procdef.procoptions) then - hdef:=tclassrefdef.create(hdef); + hdef:=cclassrefdef.create(hdef); p1:=ctypenode.create(hdef); { we need to allow helpers here } ttypenode(p1).helperallowed:=true; diff --git a/compiler/pgenutil.pas b/compiler/pgenutil.pas index 4c420c3bc4..b99ee7465e 100644 --- a/compiler/pgenutil.pas +++ b/compiler/pgenutil.pas @@ -631,7 +631,7 @@ uses srsym:=tsym(genericdef.genericparas[i]); if not (sp_generic_para in srsym.symoptions) then internalerror(2013092602); - generictype:=ttypesym.create(srsym.realname,tdef(genericdeflist[i])); + generictype:=ctypesym.create(srsym.realname,tdef(genericdeflist[i])); generictypelist.add(generictype); end; @@ -728,7 +728,7 @@ uses { First a new typesym so we can reuse this specialization and references to this specialization can be handled } - srsym:=ttypesym.create(finalspecializename,generrordef); + srsym:=ctypesym.create(finalspecializename,generrordef); specializest.insert(srsym); { specializations are declarations as such it is the wisest to @@ -877,7 +877,7 @@ uses repeat if token=_ID then begin - generictype:=ttypesym.create(orgpattern,cundefinedtype); + generictype:=ctypesym.create(orgpattern,cundefinedtype); include(generictype.symoptions,sp_generic_para); result.add(generictype); end; @@ -924,7 +924,7 @@ uses else begin srsymtable:=trecordsymtable.create(defname,0); - basedef:=trecorddef.create(defname,srsymtable); + basedef:=crecorddef.create(defname,srsymtable); include(constraintdata.flags,gcf_record); allowconstructor:=false; end; @@ -983,7 +983,7 @@ uses if (basedef.typ<>objectdef) or not (tobjectdef(basedef).objecttype in [odt_javaclass,odt_class]) then internalerror(2012101101); - basedef:=tobjectdef.create(tobjectdef(basedef).objecttype,defname,tobjectdef(basedef)); + basedef:=cobjectdef.create(tobjectdef(basedef).objecttype,defname,tobjectdef(basedef)); for i:=0 to constraintdata.interfaces.count-1 do tobjectdef(basedef).implementedinterfaces.add( timplementedinterface.create(tobjectdef(constraintdata.interfaces[i]))); @@ -994,7 +994,7 @@ uses if basedef.typ<>errordef then internalerror(2013021601); def:=tdef(constraintdata.interfaces[0]); - basedef:=tobjectdef.create(tobjectdef(def).objecttype,defname,tobjectdef(def)); + basedef:=cobjectdef.create(tobjectdef(def).objecttype,defname,tobjectdef(def)); constraintdata.interfaces.delete(0); end; if basedef.typ<>errordef then @@ -1080,7 +1080,7 @@ uses begin { we need to pass nil as def here, because the constructor wants to set the typesym of the def which is not what we want } - gensym:=ttypesym.create(copy(name,1,pos('$',name)-1),nil); + gensym:=ctypesym.create(copy(name,1,pos('$',name)-1),nil); gensym.typedef:=current_structdef; include(gensym.symoptions,sp_internal); { the symbol should be only visible to the generic class diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index a1427eb6cf..1c325822f3 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -184,7 +184,7 @@ implementation assigned(hp.globalmacrosymtable) then macrosymtablestack.push(hp.globalmacrosymtable); { insert unitsym } - unitsym:=tunitsym.create(s,hp); + unitsym:=cunitsym.create(s,hp); inc(unitsym.refs); tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym); { add to used units } @@ -457,7 +457,7 @@ implementation can not use the modulename because that can be different when -Un is used } current_tokenpos:=filepos; - unitsym:=tunitsym.create(sorg,nil); + unitsym:=cunitsym.create(sorg,nil); tabstractunitsymtable(current_module.localsymtable).insertunit(unitsym); { the current module uses the unit hp2 } current_module.addusedunit(hp2,true,unitsym); @@ -561,7 +561,7 @@ implementation if assigned(current_procinfo) then internalerror(200304275); {Generate a procsym for main} - ps:=tprocsym.create('$'+name); + ps:=cprocsym.create('$'+name); { main are allways used } inc(ps.refs); st.insert(ps); @@ -604,7 +604,7 @@ implementation (tf_pic_uses_got in target_info.flags) then begin { insert symbol for got access in assembler code} - gotvarsym:=tstaticvarsym.create('_GLOBAL_OFFSET_TABLE_', + gotvarsym:=cstaticvarsym.create('_GLOBAL_OFFSET_TABLE_', vs_value,voidpointertype,[vo_is_external]); gotvarsym.set_mangledname('_GLOBAL_OFFSET_TABLE_'); current_module.localsymtable.insert(gotvarsym); @@ -712,11 +712,11 @@ implementation { java_jlobject may not have been parsed yet (system unit); in any case, we only use this to refer to the class type, so inheritance does not matter } - def:=tobjectdef.create(odt_javaclass,'__FPC_JVM_Module_Class_Alias$',nil); + def:=cobjectdef.create(odt_javaclass,'__FPC_JVM_Module_Class_Alias$',nil); include(def.objectoptions,oo_is_external); include(def.objectoptions,oo_is_sealed); def.objextname:=stringdup(current_module.realmodulename^); - typesym:=ttypesym.create('__FPC_JVM_Module_Class_Alias$',def); + typesym:=ctypesym.create('__FPC_JVM_Module_Class_Alias$',def); symtablestack.top.insert(typesym); end; {$endif jvm} @@ -834,7 +834,7 @@ type { insert unitsym of this unit to prevent other units having the same name } - tabstractunitsymtable(current_module.localsymtable).insertunit(tunitsym.create(current_module.realmodulename^,current_module)); + tabstractunitsymtable(current_module.localsymtable).insertunit(cunitsym.create(current_module.realmodulename^,current_module)); { load default units, like the system unit } loaddefaultunits; @@ -1708,7 +1708,7 @@ type {Insert the name of the main program into the symbol table.} if current_module.realmodulename^<>'' then - tabstractunitsymtable(current_module.localsymtable).insertunit(tunitsym.create(current_module.realmodulename^,current_module)); + tabstractunitsymtable(current_module.localsymtable).insertunit(cunitsym.create(current_module.realmodulename^,current_module)); Message1(parser_u_parsing_implementation,current_module.mainsource); @@ -2063,7 +2063,7 @@ type internalerror(2013011201); for i:=0 to high(sc) do begin - ps:=tstaticvarsym.create(sc[i].name,vs_value,textsym.typedef,[]); + ps:=cstaticvarsym.create(sc[i].name,vs_value,textsym.typedef,[]); ps.isoindex:=sc[i].nr; current_module.localsymtable.insert(ps,true); cnodeutils.insertbssdata(tstaticvarsym(ps)); @@ -2089,7 +2089,7 @@ type {Insert the name of the main program into the symbol table.} if current_module.realmodulename^<>'' then - tabstractunitsymtable(current_module.localsymtable).insertunit(tunitsym.create(current_module.realmodulename^,current_module)); + tabstractunitsymtable(current_module.localsymtable).insertunit(cunitsym.create(current_module.realmodulename^,current_module)); Message1(parser_u_parsing_implementation,current_module.mainsource); diff --git a/compiler/powerpc/symcpu.pas b/compiler/powerpc/symcpu.pas new file mode 100644 index 0000000000..191cddbb9d --- /dev/null +++ b/compiler/powerpc/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for PowerPC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/powerpc64/cpunode.pas b/compiler/powerpc64/cpunode.pas index 0d4780e8ee..a2939de304 100644 --- a/compiler/powerpc64/cpunode.pas +++ b/compiler/powerpc64/cpunode.pas @@ -45,7 +45,9 @@ uses // nppcopt, nppcmat, nppccnv, - nppcld + nppcld, + { symtable } + symcpu ; end. diff --git a/compiler/powerpc64/symcpu.pas b/compiler/powerpc64/symcpu.pas new file mode 100644 index 0000000000..4680425ac0 --- /dev/null +++ b/compiler/powerpc64/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for PowerPC64 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/pp.lpi b/compiler/pp.lpi index 0feb2f007b..c422ab88f7 100644 --- a/compiler/pp.lpi +++ b/compiler/pp.lpi @@ -27,12 +27,22 @@ <FormatVersion Value="1"/> </local> </RunParams> - <Units Count="1"> + <Units Count="3"> <Unit0> <Filename Value="pp.pas"/> <IsPartOfProject Value="True"/> <UnitName Value="pp"/> </Unit0> + <Unit1> + <Filename Value="x86\symold86.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="symold86"/> + </Unit1> + <Unit2> + <Filename Value="i8086\symcpu.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="symcpu"/> + </Unit2> </Units> </ProjectOptions> <CompilerOptions> diff --git a/compiler/pparautl.pas b/compiler/pparautl.pas index 496d5258fd..3545f61509 100644 --- a/compiler/pparautl.pas +++ b/compiler/pparautl.pas @@ -76,7 +76,7 @@ implementation {$endif} paranr:=paranr_result; { Generate result variable accessing function result } - vs:=tparavarsym.create('$result',paranr,vs_var,pd.returndef,[vo_is_funcret,vo_is_hidden_para]); + vs:=cparavarsym.create('$result',paranr,vs_var,pd.returndef,[vo_is_funcret,vo_is_hidden_para]); pd.parast.insert(vs); { Store this symbol as funcretsym for procedures } if pd.typ=procdef then @@ -118,7 +118,7 @@ implementation { in case of errors, prevent invalid type cast } (pd.owner.defowner.typ<>procdef) then begin - vs:=tparavarsym.create('$parentfp',paranr,vs_value + vs:=cparavarsym.create('$parentfp',paranr,vs_value ,parentfpvoidpointertype,[vo_is_parentfp,vo_is_hidden_para]); vs.varregable:=vr_none; end @@ -126,7 +126,7 @@ implementation begin if not assigned(tprocdef(pd.owner.defowner).parentfpstruct) then build_parentfpstruct(tprocdef(pd.owner.defowner)); - vs:=tparavarsym.create('$parentfp',paranr,vs_value + vs:=cparavarsym.create('$parentfp',paranr,vs_value ,tprocdef(pd.owner.defowner).parentfpstructptrtype,[vo_is_parentfp,vo_is_hidden_para]); end; pd.parast.insert(vs); @@ -151,12 +151,12 @@ implementation (pd.parast.symtablelevel=normal_function_level) then begin { insert Objective-C self and selector parameters } - vs:=tparavarsym.create('$_cmd',paranr_objc_cmd,vs_value,objc_seltype,[vo_is_msgsel,vo_is_hidden_para]); + vs:=cparavarsym.create('$_cmd',paranr_objc_cmd,vs_value,objc_seltype,[vo_is_msgsel,vo_is_hidden_para]); pd.parast.insert(vs); { make accessible to code } sl:=tpropaccesslist.create; sl.addsym(sl_load,vs); - aliasvs:=tabsolutevarsym.create_ref('_CMD',objc_seltype,sl); + aliasvs:=cabsolutevarsym.create_ref('_CMD',objc_seltype,sl); include(aliasvs.varoptions,vo_is_msgsel); tlocalsymtable(tprocdef(pd).localst).insert(aliasvs); @@ -166,14 +166,14 @@ implementation else hdef:=tprocdef(pd).struct; - vs:=tparavarsym.create('$self',paranr_objc_self,vs_value,hdef,[vo_is_self,vo_is_hidden_para]); + vs:=cparavarsym.create('$self',paranr_objc_self,vs_value,hdef,[vo_is_self,vo_is_hidden_para]); pd.parast.insert(vs); end else if (pd.typ=procvardef) and pd.is_methodpointer then begin { Generate self variable } - vs:=tparavarsym.create('$self',paranr_self,vs_value,voidpointertype,[vo_is_self,vo_is_hidden_para]); + vs:=cparavarsym.create('$self',paranr_self,vs_value,voidpointertype,[vo_is_self,vo_is_hidden_para]); pd.parast.insert(vs); end else @@ -202,7 +202,7 @@ implementation begin { can't use classrefdef as type because inheriting will then always file because of a type mismatch } - vs:=tparavarsym.create('$vmt',paranr_vmt,vs_value,voidpointertype,[vo_is_vmt,vo_is_hidden_para]); + vs:=cparavarsym.create('$vmt',paranr_vmt,vs_value,voidpointertype,[vo_is_vmt,vo_is_hidden_para]); pd.parast.insert(vs); end; @@ -218,14 +218,14 @@ implementation vsp:=vs_value; if (po_staticmethod in pd.procoptions) or (po_classmethod in pd.procoptions) then - hdef:=tclassrefdef.create(selfdef) + hdef:=cclassrefdef.create(selfdef) else begin if is_object(selfdef) or (selfdef.typ<>objectdef) then vsp:=vs_var; hdef:=selfdef; end; - vs:=tparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]); + vs:=cparavarsym.create('$self',paranr_self,vsp,hdef,[vo_is_self,vo_is_hidden_para]); pd.parast.insert(vs); current_tokenpos:=storepos; @@ -257,7 +257,7 @@ implementation if (df_generic in pd.defoptions) or not paramanager.ret_in_param(pd.returndef,pd) then begin - vs:=tlocalvarsym.create('$result',vs_value,pd.returndef,[vo_is_funcret]); + vs:=clocalvarsym.create('$result',vs_value,pd.returndef,[vo_is_funcret]); pd.localst.insert(vs); pd.funcretsym:=vs; end; @@ -273,7 +273,7 @@ implementation hs:=pd.procsym.name; sl:=tpropaccesslist.create; sl.addsym(sl_load,pd.funcretsym); - aliasvs:=tabsolutevarsym.create_ref(hs,pd.returndef,sl); + aliasvs:=cabsolutevarsym.create_ref(hs,pd.returndef,sl); include(aliasvs.varoptions,vo_is_funcret); tlocalsymtable(pd.localst).insert(aliasvs); end; @@ -283,7 +283,7 @@ implementation begin sl:=tpropaccesslist.create; sl.addsym(sl_load,pd.funcretsym); - aliasvs:=tabsolutevarsym.create_ref('RESULT',pd.returndef,sl); + aliasvs:=cabsolutevarsym.create_ref('RESULT',pd.returndef,sl); include(aliasvs.varoptions,vo_is_funcret); include(aliasvs.varoptions,vo_is_result); tlocalsymtable(pd.localst).insert(aliasvs); @@ -316,7 +316,7 @@ implementation { needs high parameter ? } if paramanager.push_high_param(varspez,vardef,pd.proccalloption) then begin - hvs:=tparavarsym.create('$high'+name,paranr+1,vs_const,sinttype,[vo_is_high_para,vo_is_hidden_para]); + hvs:=cparavarsym.create('$high'+name,paranr+1,vs_const,sinttype,[vo_is_high_para,vo_is_hidden_para]); hvs.symoptions:=[]; owner.insert(hvs); { don't place to register if it will be accessed from implicit finally block } @@ -344,7 +344,7 @@ implementation end; if (vardef.typ=formaldef) and (Tformaldef(vardef).typed) then begin - hvs:=tparavarsym.create('$typinfo'+name,paranr+1,vs_const,voidpointertype, + hvs:=cparavarsym.create('$typinfo'+name,paranr+1,vs_const,voidpointertype, [vo_is_typinfo_para,vo_is_hidden_para]); owner.insert(hvs); end; diff --git a/compiler/pstatmnt.pas b/compiler/pstatmnt.pas index ba86eec247..b49fdd0908 100644 --- a/compiler/pstatmnt.pas +++ b/compiler/pstatmnt.pas @@ -671,7 +671,7 @@ implementation if hasimplicitderef then hdef:=p.resultdef else - hdef:=tpointerdef.create(p.resultdef); + hdef:=cpointerdef.create(p.resultdef); { load address of the value in a temp } tempnode:=ctempcreatenode.create_withnode(hdef,sizeof(pint),tt_persistent,true,p); typecheckpass(tnode(tempnode)); @@ -940,7 +940,7 @@ implementation begin single_type(ot,[]); check_type_valid(ot); - sym:=tlocalvarsym.create(objrealname,vs_value,ot,[]); + sym:=clocalvarsym.create(objrealname,vs_value,ot,[]); end else begin @@ -973,7 +973,7 @@ implementation { create dummy symbol so we don't need a special case in ncgflw, and so that we always know the type } - sym:=tlocalvarsym.create('$exceptsym',vs_value,ot,[]); + sym:=clocalvarsym.create('$exceptsym',vs_value,ot,[]); end; excepTSymtable:=tstt_excepTSymtable.create; excepTSymtable.insert(sym); diff --git a/compiler/psub.pas b/compiler/psub.pas index b1cb668f2a..078b926630 100644 --- a/compiler/psub.pas +++ b/compiler/psub.pas @@ -464,7 +464,7 @@ implementation load_self_pointer_node, voidpointertype), ccallnode.create(nil,tprocsym(srsym),srsym.owner, - ctypeconvnode.create_internal(load_self_pointer_node,tclassrefdef.create(current_structdef)), + ctypeconvnode.create_internal(load_self_pointer_node,cclassrefdef.create(current_structdef)), [])), nil)); end diff --git a/compiler/psystem.pas b/compiler/psystem.pas index 2c19970f7c..0fd3619ced 100644 --- a/compiler/psystem.pas +++ b/compiler/psystem.pas @@ -54,58 +54,58 @@ implementation all intern procedures for the system unit } begin - systemunit.insert(tsyssym.create('Concat',in_concat_x)); - systemunit.insert(tsyssym.create('Write',in_write_x)); - systemunit.insert(tsyssym.create('WriteLn',in_writeln_x)); - systemunit.insert(tsyssym.create('WriteStr',in_writestr_x)); - systemunit.insert(tsyssym.create('Assigned',in_assigned_x)); - systemunit.insert(tsyssym.create('Read',in_read_x)); - systemunit.insert(tsyssym.create('ReadLn',in_readln_x)); - systemunit.insert(tsyssym.create('ReadStr',in_readstr_x)); - systemunit.insert(tsyssym.create('Ofs',in_ofs_x)); - systemunit.insert(tsyssym.create('SizeOf',in_sizeof_x)); - systemunit.insert(tsyssym.create('BitSizeOf',in_bitsizeof_x)); - systemunit.insert(tsyssym.create('TypeOf',in_typeof_x)); - systemunit.insert(tsyssym.create('Low',in_low_x)); - systemunit.insert(tsyssym.create('High',in_high_x)); - systemunit.insert(tsyssym.create('Slice',in_slice_x)); - systemunit.insert(tsyssym.create('Seg',in_seg_x)); - systemunit.insert(tsyssym.create('Ord',in_ord_x)); - systemunit.insert(tsyssym.create('Pred',in_pred_x)); - systemunit.insert(tsyssym.create('Succ',in_succ_x)); - systemunit.insert(tsyssym.create('Exclude',in_exclude_x_y)); - systemunit.insert(tsyssym.create('Include',in_include_x_y)); - systemunit.insert(tsyssym.create('Pack',in_pack_x_y_z)); - systemunit.insert(tsyssym.create('Unpack',in_unpack_x_y_z)); - systemunit.insert(tsyssym.create('Break',in_break)); - systemunit.insert(tsyssym.create('Exit',in_exit)); - systemunit.insert(tsyssym.create('Continue',in_continue)); - systemunit.insert(tsyssym.create('Leave',in_leave)); {macpas only} - systemunit.insert(tsyssym.create('Cycle',in_cycle)); {macpas only} - systemunit.insert(tsyssym.create('Dec',in_dec_x)); - systemunit.insert(tsyssym.create('Inc',in_inc_x)); - systemunit.insert(tsyssym.create('Str',in_str_x_string)); - systemunit.insert(tsyssym.create('Assert',in_assert_x_y)); - systemunit.insert(tsyssym.create('Val',in_val_x)); - systemunit.insert(tsyssym.create('Addr',in_addr_x)); - systemunit.insert(tsyssym.create('TypeInfo',in_typeinfo_x)); - systemunit.insert(tsyssym.create('SetLength',in_setlength_x)); - systemunit.insert(tsyssym.create('Copy',in_copy_x)); - systemunit.insert(tsyssym.create('Initialize',in_initialize_x)); - systemunit.insert(tsyssym.create('Finalize',in_finalize_x)); - systemunit.insert(tsyssym.create('Length',in_length_x)); - systemunit.insert(tsyssym.create('New',in_new_x)); - systemunit.insert(tsyssym.create('Dispose',in_dispose_x)); + systemunit.insert(csyssym.create('Concat',in_concat_x)); + systemunit.insert(csyssym.create('Write',in_write_x)); + systemunit.insert(csyssym.create('WriteLn',in_writeln_x)); + systemunit.insert(csyssym.create('WriteStr',in_writestr_x)); + systemunit.insert(csyssym.create('Assigned',in_assigned_x)); + systemunit.insert(csyssym.create('Read',in_read_x)); + systemunit.insert(csyssym.create('ReadLn',in_readln_x)); + systemunit.insert(csyssym.create('ReadStr',in_readstr_x)); + systemunit.insert(csyssym.create('Ofs',in_ofs_x)); + systemunit.insert(csyssym.create('SizeOf',in_sizeof_x)); + systemunit.insert(csyssym.create('BitSizeOf',in_bitsizeof_x)); + systemunit.insert(csyssym.create('TypeOf',in_typeof_x)); + systemunit.insert(csyssym.create('Low',in_low_x)); + systemunit.insert(csyssym.create('High',in_high_x)); + systemunit.insert(csyssym.create('Slice',in_slice_x)); + systemunit.insert(csyssym.create('Seg',in_seg_x)); + systemunit.insert(csyssym.create('Ord',in_ord_x)); + systemunit.insert(csyssym.create('Pred',in_pred_x)); + systemunit.insert(csyssym.create('Succ',in_succ_x)); + systemunit.insert(csyssym.create('Exclude',in_exclude_x_y)); + systemunit.insert(csyssym.create('Include',in_include_x_y)); + systemunit.insert(csyssym.create('Pack',in_pack_x_y_z)); + systemunit.insert(csyssym.create('Unpack',in_unpack_x_y_z)); + systemunit.insert(csyssym.create('Break',in_break)); + systemunit.insert(csyssym.create('Exit',in_exit)); + systemunit.insert(csyssym.create('Continue',in_continue)); + systemunit.insert(csyssym.create('Leave',in_leave)); {macpas only} + systemunit.insert(csyssym.create('Cycle',in_cycle)); {macpas only} + systemunit.insert(csyssym.create('Dec',in_dec_x)); + systemunit.insert(csyssym.create('Inc',in_inc_x)); + systemunit.insert(csyssym.create('Str',in_str_x_string)); + systemunit.insert(csyssym.create('Assert',in_assert_x_y)); + systemunit.insert(csyssym.create('Val',in_val_x)); + systemunit.insert(csyssym.create('Addr',in_addr_x)); + systemunit.insert(csyssym.create('TypeInfo',in_typeinfo_x)); + systemunit.insert(csyssym.create('SetLength',in_setlength_x)); + systemunit.insert(csyssym.create('Copy',in_copy_x)); + systemunit.insert(csyssym.create('Initialize',in_initialize_x)); + systemunit.insert(csyssym.create('Finalize',in_finalize_x)); + systemunit.insert(csyssym.create('Length',in_length_x)); + systemunit.insert(csyssym.create('New',in_new_x)); + systemunit.insert(csyssym.create('Dispose',in_dispose_x)); {$ifdef SUPPORT_GET_FRAME} - systemunit.insert(tsyssym.create('Get_Frame',in_get_frame)); + systemunit.insert(csyssym.create('Get_Frame',in_get_frame)); {$endif SUPPORT_GET_FRAME} - systemunit.insert(tsyssym.create('Unaligned',in_unaligned_x)); - systemunit.insert(tsyssym.create('Aligned',in_aligned_x)); - systemunit.insert(tsyssym.create('ObjCSelector',in_objc_selector_x)); { objc only } - systemunit.insert(tsyssym.create('ObjCEncode',in_objc_encode_x)); { objc only } - systemunit.insert(tsyssym.create('Default',in_default_x)); - systemunit.insert(tconstsym.create_ord('False',constord,0,pasbool8type)); - systemunit.insert(tconstsym.create_ord('True',constord,1,pasbool8type)); + systemunit.insert(csyssym.create('Unaligned',in_unaligned_x)); + systemunit.insert(csyssym.create('Aligned',in_aligned_x)); + systemunit.insert(csyssym.create('ObjCSelector',in_objc_selector_x)); { objc only } + systemunit.insert(csyssym.create('ObjCEncode',in_objc_encode_x)); { objc only } + systemunit.insert(csyssym.create('Default',in_default_x)); + systemunit.insert(cconstsym.create_ord('False',constord,0,pasbool8type)); + systemunit.insert(cconstsym.create_ord('True',constord,1,pasbool8type)); end; @@ -166,7 +166,7 @@ implementation function addtype(const s:string;def:tdef):ttypesym; begin - result:=ttypesym.create(s,def); + result:=ctypesym.create(s,def); systemunit.insert(result); end; @@ -180,10 +180,10 @@ implementation begin if init_settings.fputype<>fpu_none then begin - s32floattype:=tfloatdef.create(s32real); - s64floattype:=tfloatdef.create(s64real); - s80floattype:=tfloatdef.create(s80real); - sc80floattype:=tfloatdef.create(sc80real); + s32floattype:=cfloatdef.create(s32real); + s64floattype:=cfloatdef.create(s64real); + s80floattype:=cfloatdef.create(s80real); + sc80floattype:=cfloatdef.create(sc80real); end else begin s32floattype:=nil; s64floattype:=nil; @@ -196,120 +196,120 @@ implementation hrecst : trecordsymtable; begin symtablestack.push(systemunit); - cundefinedtype:=tundefineddef.create; - cformaltype:=tformaldef.create(false); - ctypedformaltype:=tformaldef.create(true); - voidtype:=torddef.create(uvoid,0,0); - voidpointertype:=tpointerdef.create(voidtype); - u8inttype:=torddef.create(u8bit,0,255); - s8inttype:=torddef.create(s8bit,int64(-128),127); - u16inttype:=torddef.create(u16bit,0,65535); - s16inttype:=torddef.create(s16bit,int64(-32768),32767); - u32inttype:=torddef.create(u32bit,0,high(longword)); - s32inttype:=torddef.create(s32bit,int64(low(longint)),int64(high(longint))); - u64inttype:=torddef.create(u64bit,low(qword),high(qword)); - s64inttype:=torddef.create(s64bit,low(int64),high(int64)); - pasbool8type:=torddef.create(pasbool8,0,1); - pasbool16type:=torddef.create(pasbool16,0,1); - pasbool32type:=torddef.create(pasbool32,0,1); - pasbool64type:=torddef.create(pasbool64,0,1); - bool8type:=torddef.create(bool8bit,low(int64),high(int64)); - bool16type:=torddef.create(bool16bit,low(int64),high(int64)); - bool32type:=torddef.create(bool32bit,low(int64),high(int64)); - bool64type:=torddef.create(bool64bit,low(int64),high(int64)); - cansichartype:=torddef.create(uchar,0,255); - cwidechartype:=torddef.create(uwidechar,0,65535); - cshortstringtype:=tstringdef.createshort(255); + cundefinedtype:=cundefineddef.create; + cformaltype:=cformaldef.create(false); + ctypedformaltype:=cformaldef.create(true); + voidtype:=corddef.create(uvoid,0,0); + voidpointertype:=cpointerdef.create(voidtype); + u8inttype:=corddef.create(u8bit,0,255); + s8inttype:=corddef.create(s8bit,int64(-128),127); + u16inttype:=corddef.create(u16bit,0,65535); + s16inttype:=corddef.create(s16bit,int64(-32768),32767); + u32inttype:=corddef.create(u32bit,0,high(longword)); + s32inttype:=corddef.create(s32bit,int64(low(longint)),int64(high(longint))); + u64inttype:=corddef.create(u64bit,low(qword),high(qword)); + s64inttype:=corddef.create(s64bit,low(int64),high(int64)); + pasbool8type:=corddef.create(pasbool8,0,1); + pasbool16type:=corddef.create(pasbool16,0,1); + pasbool32type:=corddef.create(pasbool32,0,1); + pasbool64type:=corddef.create(pasbool64,0,1); + bool8type:=corddef.create(bool8bit,low(int64),high(int64)); + bool16type:=corddef.create(bool16bit,low(int64),high(int64)); + bool32type:=corddef.create(bool32bit,low(int64),high(int64)); + bool64type:=corddef.create(bool64bit,low(int64),high(int64)); + cansichartype:=corddef.create(uchar,0,255); + cwidechartype:=corddef.create(uwidechar,0,65535); + cshortstringtype:=cstringdef.createshort(255); { should we give a length to the default long and ansi string definition ?? } - clongstringtype:=tstringdef.createlong(-1); - cansistringtype:=tstringdef.createansi(0); + clongstringtype:=cstringdef.createlong(-1); + cansistringtype:=cstringdef.createansi(0); if target_info.system in systems_windows then - cwidestringtype:=tstringdef.createwide + cwidestringtype:=cstringdef.createwide else - cwidestringtype:=tstringdef.createunicode; - cunicodestringtype:=tstringdef.createunicode; + cwidestringtype:=cstringdef.createunicode; + cunicodestringtype:=cstringdef.createunicode; { length=0 for shortstring is open string (needed for readln(string) } - openshortstringtype:=tstringdef.createshort(0); - openchararraytype:=tarraydef.create(0,-1,s32inttype); + openshortstringtype:=cstringdef.createshort(0); + openchararraytype:=carraydef.create(0,-1,s32inttype); tarraydef(openchararraytype).elementdef:=cansichartype; {$ifdef x86} create_fpu_types; {$ifndef FPC_SUPPORT_X87_TYPES_ON_WIN64} if target_info.system=system_x86_64_win64 then begin - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); pbestrealtype:=@s64floattype; end else {$endif FPC_SUPPORT_X87_TYPES_ON_WIN64} - s64currencytype:=tfloatdef.create(s64currency); + s64currencytype:=cfloatdef.create(s64currency); {$endif x86} {$ifdef powerpc} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif powerpc} {$ifdef POWERPC64} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif POWERPC64} {$ifdef sparc} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif sparc} {$ifdef m68k} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif} {$ifdef arm} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif arm} {$ifdef avr} - s32floattype:=tfloatdef.create(s32real); - s64floattype:=tfloatdef.create(s64real); - s80floattype:=tfloatdef.create(s80real); - sc80floattype:=tfloatdef.create(sc80real); - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s32floattype:=cfloatdef.create(s32real); + s64floattype:=cfloatdef.create(s64real); + s80floattype:=cfloatdef.create(s80real); + sc80floattype:=cfloatdef.create(sc80real); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif avr} {$ifdef mips} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif mips} {$ifdef jvm} create_fpu_types; - s64currencytype:=torddef.create(scurrency,low(int64),high(int64)); + s64currencytype:=corddef.create(scurrency,low(int64),high(int64)); {$endif jvm} set_default_int_types; { some other definitions } - charpointertype:=tpointerdef.create(cansichartype); - widecharpointertype:=tpointerdef.create(cwidechartype); + charpointertype:=cpointerdef.create(cansichartype); + widecharpointertype:=cpointerdef.create(cwidechartype); {$ifdef i8086} - parentfpvoidpointertype:=tpointerdef.createx86(voidtype,x86pt_near); + parentfpvoidpointertype:=cpointerdef.createx86(voidtype,x86pt_near); {$else i8086} - parentfpvoidpointertype:=tpointerdef.create(voidtype); + parentfpvoidpointertype:=cpointerdef.create(voidtype); {$endif i8086} {$ifdef x86} - voidnearpointertype:=tpointerdef.createx86(voidtype,x86pt_near); - voidnearcspointertype:=tpointerdef.createx86(voidtype,x86pt_near_cs); - voidneardspointertype:=tpointerdef.createx86(voidtype,x86pt_near_ds); - voidnearsspointertype:=tpointerdef.createx86(voidtype,x86pt_near_ss); - voidnearespointertype:=tpointerdef.createx86(voidtype,x86pt_near_es); - voidnearfspointertype:=tpointerdef.createx86(voidtype,x86pt_near_fs); - voidneargspointertype:=tpointerdef.createx86(voidtype,x86pt_near_gs); + voidnearpointertype:=cpointerdef.createx86(voidtype,x86pt_near); + voidnearcspointertype:=cpointerdef.createx86(voidtype,x86pt_near_cs); + voidneardspointertype:=cpointerdef.createx86(voidtype,x86pt_near_ds); + voidnearsspointertype:=cpointerdef.createx86(voidtype,x86pt_near_ss); + voidnearespointertype:=cpointerdef.createx86(voidtype,x86pt_near_es); + voidnearfspointertype:=cpointerdef.createx86(voidtype,x86pt_near_fs); + voidneargspointertype:=cpointerdef.createx86(voidtype,x86pt_near_gs); {$ifdef i8086} - voidfarpointertype:=tpointerdef.createx86(voidtype,x86pt_far); - voidhugepointertype:=tpointerdef.createx86(voidtype,x86pt_huge); - charnearpointertype:=tpointerdef.createx86(cansichartype,x86pt_near); - charfarpointertype:=tpointerdef.createx86(cansichartype,x86pt_far); - bytefarpointertype:=tpointerdef.createx86(u8inttype,x86pt_far); - wordfarpointertype:=tpointerdef.createx86(u16inttype,x86pt_far); - longintfarpointertype:=tpointerdef.createx86(s32inttype,x86pt_far); + voidfarpointertype:=cpointerdef.createx86(voidtype,x86pt_far); + voidhugepointertype:=cpointerdef.createx86(voidtype,x86pt_huge); + charnearpointertype:=cpointerdef.createx86(cansichartype,x86pt_near); + charfarpointertype:=cpointerdef.createx86(cansichartype,x86pt_far); + bytefarpointertype:=cpointerdef.createx86(u8inttype,x86pt_far); + wordfarpointertype:=cpointerdef.createx86(u16inttype,x86pt_far); + longintfarpointertype:=cpointerdef.createx86(s32inttype,x86pt_far); {$endif i8086} {$endif x86} set_default_ptr_types; - cfiletype:=tfiledef.createuntyped; - cvarianttype:=tvariantdef.create(vt_normalvariant); - colevarianttype:=tvariantdef.create(vt_olevariant); + cfiletype:=cfiledef.createuntyped; + cvarianttype:=cvariantdef.create(vt_normalvariant); + colevarianttype:=cvariantdef.create(vt_olevariant); {$ifdef cpufpemu} { Normal types } @@ -348,7 +348,7 @@ implementation {$ifndef FPC_SUPPORT_X87_TYPES_ON_WIN64} if target_info.system<>system_x86_64_win64 then {$endif FPC_SUPPORT_X87_TYPES_ON_WIN64} - addtype('Comp',tfloatdef.create(s64comp)); + addtype('Comp',cfloatdef.create(s64comp)); {$endif x86} addtype('Currency',s64currencytype); addtype('Pointer',voidpointertype); @@ -392,8 +392,8 @@ implementation addtype('Int64',s64inttype); addtype('Char',cansichartype); addtype('WideChar',cwidechartype); - addtype('Text',tfiledef.createtext); - addtype('TypedFile',tfiledef.createtyped(voidtype)); + addtype('Text',cfiledef.createtext); + addtype('TypedFile',cfiledef.createtyped(voidtype)); addtype('Variant',cvarianttype); addtype('OleVariant',colevarianttype); { Internal types } @@ -463,40 +463,40 @@ implementation begin { Add a type for virtual method tables } hrecst:=trecordsymtable.create('',current_settings.packrecords); - vmttype:=trecorddef.create('',hrecst); - pvmttype:=tpointerdef.create(vmttype); + vmttype:=crecorddef.create('',hrecst); + pvmttype:=cpointerdef.create(vmttype); { can't use addtype for pvmt because the rtti of the pointed type is not available. The rtti for pvmt will be written implicitly by thev tblarray below } - systemunit.insert(ttypesym.create('$pvmt',pvmttype)); - addfield(hrecst,tfieldvarsym.create('$length',vs_value,ptrsinttype,[])); - addfield(hrecst,tfieldvarsym.create('$mlength',vs_value,ptrsinttype,[])); - addfield(hrecst,tfieldvarsym.create('$parent',vs_value,pvmttype,[])); + systemunit.insert(ctypesym.create('$pvmt',pvmttype)); + addfield(hrecst,cfieldvarsym.create('$length',vs_value,ptrsinttype,[])); + addfield(hrecst,cfieldvarsym.create('$mlength',vs_value,ptrsinttype,[])); + addfield(hrecst,cfieldvarsym.create('$parent',vs_value,pvmttype,[])); { it seems vmttype is used both for TP objects and Delphi classes, so the next entry could either be the first virtual method (vm1) (object) or the class name (class). We can't easily create separate vtable formats for both, as gdb is hard coded to search for __vtbl_ptr_type in all cases (JM) } - addfield(hrecst,tfieldvarsym.create('$vm1_or_classname',vs_value,tpointerdef.create(cshortstringtype),[])); - vmtarraytype:=tarraydef.create(0,0,s32inttype); + addfield(hrecst,cfieldvarsym.create('$vm1_or_classname',vs_value,cpointerdef.create(cshortstringtype),[])); + vmtarraytype:=carraydef.create(0,0,s32inttype); tarraydef(vmtarraytype).elementdef:=voidpointertype; - addfield(hrecst,tfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[])); + addfield(hrecst,cfieldvarsym.create('$__pfn',vs_value,vmtarraytype,[])); addtype('$__vtbl_ptr_type',vmttype); - vmtarraytype:=tarraydef.create(0,1,s32inttype); + vmtarraytype:=carraydef.create(0,1,s32inttype); tarraydef(vmtarraytype).elementdef:=pvmttype; addtype('$vtblarray',vmtarraytype); { Add a type for methodpointers } hrecst:=trecordsymtable.create('',1); {$ifdef i8086} if current_settings.x86memorymodel in x86_far_code_models then - addfield(hrecst,tfieldvarsym.create('$proc',vs_value,voidfarpointertype,[])) + addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidfarpointertype,[])) else - addfield(hrecst,tfieldvarsym.create('$proc',vs_value,voidnearpointertype,[])); + addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidnearpointertype,[])); {$else i8086} - addfield(hrecst,tfieldvarsym.create('$proc',vs_value,voidpointertype,[])); + addfield(hrecst,cfieldvarsym.create('$proc',vs_value,voidpointertype,[])); {$endif i8086} - addfield(hrecst,tfieldvarsym.create('$self',vs_value,voidpointertype,[])); - methodpointertype:=trecorddef.create('',hrecst); + addfield(hrecst,cfieldvarsym.create('$self',vs_value,voidpointertype,[])); + methodpointertype:=crecorddef.create('',hrecst); addtype('$methodpointer',methodpointertype); end; symtablestack.pop(systemunit); diff --git a/compiler/ptype.pas b/compiler/ptype.pas index fa74138d43..a124992aac 100644 --- a/compiler/ptype.pas +++ b/compiler/ptype.pas @@ -339,7 +339,7 @@ implementation if isforwarddef and not(is_unit_specific) then begin - def:=tforwarddef.create(sorg,pos); + def:=cforwarddef.create(sorg,pos); exit; end; { unknown sym ? } @@ -408,7 +408,7 @@ implementation single_type(t2,[stoAllowTypeDef]); if is_managed_type(t2) then Message(parser_e_no_refcounted_typed_file); - def:=tfiledef.createtyped(t2); + def:=cfiledef.createtyped(t2); end else def:=cfiletype; @@ -820,14 +820,14 @@ implementation recst:=trecordsymtable.create(n,current_settings.packrecords); { can't use recst.realname^ instead of n, because recst.realname is nil in case of an empty name } - current_structdef:=trecorddef.create(n,recst); + current_structdef:=crecorddef.create(n,recst); end else begin { for the JVM target records always need a name, because they are represented by a class } recst:=trecordsymtable.create(current_module.realmodulename^+'__fpc_intern_recname_'+tostr(current_module.deflist.count),current_settings.packrecords); - current_structdef:=trecorddef.create(recst.name^,recst); + current_structdef:=crecorddef.create(recst.name^,recst); end; result:=current_structdef; { insert in symtablestack } @@ -956,18 +956,18 @@ implementation { All checks passed, create the new def } case pt1.resultdef.typ of enumdef : - def:=tenumdef.create_subrange(tenumdef(pt1.resultdef),lv.svalue,hv.svalue); + def:=cenumdef.create_subrange(tenumdef(pt1.resultdef),lv.svalue,hv.svalue); orddef : begin if is_char(pt1.resultdef) then - def:=torddef.create(uchar,lv,hv) + def:=corddef.create(uchar,lv,hv) else if is_boolean(pt1.resultdef) then - def:=torddef.create(pasbool8,lv,hv) + def:=corddef.create(pasbool8,lv,hv) else if is_signed(pt1.resultdef) then - def:=torddef.create(range_to_basetype(lv,hv),lv,hv) + def:=corddef.create(range_to_basetype(lv,hv),lv,hv) else - def:=torddef.create(range_to_basetype(lv,hv),lv,hv); + def:=corddef.create(range_to_basetype(lv,hv),lv,hv); end; end; end; @@ -1109,8 +1109,8 @@ implementation enumdef : if (tenumdef(tt2).min>=0) and (tenumdef(tt2).max<=255) then - // !! def:=tsetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max)) - def:=tsetdef.create(tt2,tenumdef(tt2).min,tenumdef(tt2).max) + // !! def:=csetdef.create(tt2,tenumdef(tt2.def).min,tenumdef(tt2.def).max)) + def:=csetdef.create(tt2,tenumdef(tt2).min,tenumdef(tt2).max) else Message(sym_e_ill_type_decl_set); orddef : @@ -1118,11 +1118,11 @@ implementation if (torddef(tt2).ordtype<>uvoid) and (torddef(tt2).ordtype<>uwidechar) and (torddef(tt2).low>=0) then - // !! def:=tsetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high)) + // !! def:=csetdef.create(tt2,torddef(tt2.def).low,torddef(tt2.def).high)) if Torddef(tt2).high>int64(high(byte)) then message(sym_e_ill_type_decl_set) else - def:=tsetdef.create(tt2,torddef(tt2).low.svalue,torddef(tt2).high.svalue) + def:=csetdef.create(tt2,torddef(tt2).low.svalue,torddef(tt2).high.svalue) else Message(sym_e_ill_type_decl_set); end; @@ -1195,7 +1195,7 @@ implementation current_genericdef:=nil; current_specializedef:=nil; first:=true; - arrdef:=tarraydef.create(0,0,s32inttype); + arrdef:=carraydef.create(0,0,s32inttype); consume(_ARRAY); { usage of specialized type inside its generic template } @@ -1287,7 +1287,7 @@ implementation as element of the existing array, otherwise modify the existing array } if not(first) then begin - arrdef.elementdef:=tarraydef.create(lowval.svalue,highval.svalue,indexdef); + arrdef.elementdef:=carraydef.create(lowval.svalue,highval.svalue,indexdef); { push new symtable } symtablestack.pop(arrdef.symtable); arrdef:=tarraydef(arrdef.elementdef); @@ -1357,7 +1357,7 @@ implementation is_func:=(token=_FUNCTION); consume(token); - pd:=tprocvardef.create(normal_function_level); + pd:=cprocvardef.create(normal_function_level); { usage of specialized type inside its generic template } if assigned(genericdef) then @@ -1406,7 +1406,7 @@ implementation begin if check_proc_directive(true) then begin - newtype:=ttypesym.create('unnamed',result); + newtype:=ctypesym.create('unnamed',result); parse_var_proc_directives(tsym(newtype)); newtype.typedef:=nil; result.typesym:=nil; @@ -1470,7 +1470,7 @@ implementation break; end; if not is_specialize then - aktenumdef:=tenumdef.create + aktenumdef:=cenumdef.create else aktenumdef:=nil; repeat @@ -1532,9 +1532,9 @@ implementation begin storepos:=current_tokenpos; current_tokenpos:=defpos; - tenumsymtable(aktenumdef.symtable).insert(tenumsym.create(s,aktenumdef,longint(l.svalue))); + tenumsymtable(aktenumdef.symtable).insert(cenumsym.create(s,aktenumdef,longint(l.svalue))); if not (cs_scopedenums in current_settings.localswitches) then - tstoredsymtable(aktenumdef.owner).insert(tenumsym.create(s,aktenumdef,longint(l.svalue))); + tstoredsymtable(aktenumdef.owner).insert(cenumsym.create(s,aktenumdef,longint(l.svalue))); current_tokenpos:=storepos; end; until not try_to_consume(_COMMA); @@ -1576,7 +1576,7 @@ implementation end; { don't use getpointerdef() here, since this is a type declaration (-> must create new typedef) } - def:=tpointerdef.create(tt2); + def:=cpointerdef.create(tt2); if tt2.typ=forwarddef then current_module.checkforwarddefs.add(def); end; @@ -1655,11 +1655,11 @@ implementation if is_class(hdef) or is_objcclass(hdef) or is_javaclass(hdef) then - def:=tclassrefdef.create(hdef) + def:=cclassrefdef.create(hdef) else if hdef.typ=forwarddef then begin - def:=tclassrefdef.create(hdef); + def:=cclassrefdef.create(hdef); current_module.checkforwarddefs.add(def); end else @@ -1739,7 +1739,7 @@ implementation begin consume(_KLAMMERAFFE); single_type(tt2,SingleTypeOptionsInTypeBlock[block_type=bt_type]); - def:=tpointerdef.create(tt2); + def:=cpointerdef.create(tt2); if tt2.typ=forwarddef then current_module.checkforwarddefs.add(def); end diff --git a/compiler/scanner.pas b/compiler/scanner.pas index e447df7824..a71889c05a 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -849,6 +849,10 @@ type class constructor texprvalue.createdefs; begin + { do not use corddef etc here: this code is executed before those + variables are initialised. Since these types are only used for + compile-time evaluation of conditional expressions, it doesn't matter + that we use the base types instead of the cpu-specific ones. } sintdef:=torddef.create(s64bit,low(int64),high(int64)); uintdef:=torddef.create(u64bit,low(qword),high(qword)); booldef:=torddef.create(pasbool8,0,1); diff --git a/compiler/sparc/cpunode.pas b/compiler/sparc/cpunode.pas index 63fdb77d6f..e242c80f26 100644 --- a/compiler/sparc/cpunode.pas +++ b/compiler/sparc/cpunode.pas @@ -33,6 +33,8 @@ implementation ncgbas,ncgflw,ncgcnv,ncgld,ncgmem,ncgcon,ncgset, ncpuadd,ncpucall,ncpumat,ncpuinln,ncpucnv,ncpuset, { this not really a node } - rgcpu; + rgcpu, + { symtable } + symcpu; end. diff --git a/compiler/sparc/symcpu.pas b/compiler/sparc/symcpu.pas new file mode 100644 index 0000000000..13e2966739 --- /dev/null +++ b/compiler/sparc/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for SPARC + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + diff --git a/compiler/symcreat.pas b/compiler/symcreat.pas index 06ac751c72..f8ed93738a 100644 --- a/compiler/symcreat.pas +++ b/compiler/symcreat.pas @@ -1053,7 +1053,7 @@ implementation end else begin - ps:=tprocsym.create(realname); + ps:=cprocsym.create(realname); newparentst.insert(ps); end; pd.procsym:=ps; @@ -1071,7 +1071,7 @@ implementation if vo_is_self in parasym.varoptions then begin if parasym.vardef.typ=classrefdef then - parasym.vardef:=tclassrefdef.create(newstruct) + parasym.vardef:=cclassrefdef.create(newstruct) else parasym.vardef:=newstruct; end @@ -1105,7 +1105,7 @@ implementation accessed from within nested routines (start with extra dollar to prevent the JVM from thinking this is a nested class in the unit) } nestedvarsst:=trecordsymtable.create('$'+current_module.realmodulename^+'$$_fpc_nestedvars$'+tostr(pd.defid),current_settings.alignment.localalignmax); - nestedvarsdef:=trecorddef.create(nestedvarsst.name^,nestedvarsst); + nestedvarsdef:=crecorddef.create(nestedvarsst.name^,nestedvarsst); {$ifdef jvm} maybe_guarantee_record_typesym(nestedvarsdef,nestedvarsdef.owner); { don't add clone/FpcDeepCopy, because the field names are not all @@ -1118,7 +1118,7 @@ implementation symtablestack.free; symtablestack:=old_symtablestack.getcopyuntil(pd.localst); pnestedvarsdef:=getpointerdef(nestedvarsdef); - nestedvars:=tlocalvarsym.create('$nestedvars',vs_var,nestedvarsdef,[]); + nestedvars:=clocalvarsym.create('$nestedvars',vs_var,nestedvarsdef,[]); pd.localst.insert(nestedvars); pd.parentfpstruct:=nestedvars; pd.parentfpstructptrtype:=pnestedvarsdef; @@ -1151,7 +1151,7 @@ implementation fieldvardef:=getpointerdef(vardef) else fieldvardef:=vardef; - result:=tfieldvarsym.create(sym.realname,vs_value,fieldvardef,[]); + result:=cfieldvarsym.create(sym.realname,vs_value,fieldvardef,[]); if nestedvarsst.symlist.count=0 then include(tfieldvarsym(result).varoptions,vo_is_first_field); nestedvarsst.insert(result); @@ -1209,7 +1209,7 @@ implementation sl:=tpropaccesslist.create; sl.addsym(sl_load,pd.parentfpstruct); sl.addsym(sl_subscript,tfieldvarsym(fsym)); - aliassym:=tabsolutevarsym.create_ref(lsym.name,tfieldvarsym(fsym).vardef,sl); + aliassym:=cabsolutevarsym.create_ref(lsym.name,tfieldvarsym(fsym).vardef,sl); { hide the original variable (can't delete, because there may be other loadnodes that reference it) -- only for locals; hiding parameters changes the @@ -1250,7 +1250,7 @@ implementation (def.typ=recorddef) and not assigned(def.typesym) then begin - ts:=ttypesym.create(trecorddef(def).symtable.realname^,def); + ts:=ctypesym.create(trecorddef(def).symtable.realname^,def); st.insert(ts); ts.visibility:=vis_strictprivate; { this typesym can't be used by any Pascal code, so make sure we don't @@ -1270,7 +1270,7 @@ implementation include(fieldvs.symoptions,sp_static); { generate the symbol which reserves the space } static_name:=lower(generate_nested_name(recst,'_'))+'_'+fieldvs.name; - hstaticvs:=tstaticvarsym.create(internal_static_field_name(static_name),vs_value,fieldvs.vardef,[]); + hstaticvs:=cstaticvarsym.create(internal_static_field_name(static_name),vs_value,fieldvs.vardef,[]); {$ifdef jvm} { for the JVM, static field accesses are name-based and hence we have to keep the original name of the field. @@ -1304,7 +1304,7 @@ implementation load node (handle_staticfield_access -> searchsym_in_class -> is_visible_for_object), which means that the load will fail if this symbol is e.g. "strict private" while the property is public } - tmp:=tabsolutevarsym.create_ref('$'+static_name,fieldvs.vardef,sl); + tmp:=cabsolutevarsym.create_ref('$'+static_name,fieldvs.vardef,sl); recst.insert(tmp); result:=hstaticvs; end; diff --git a/compiler/symdef.pas b/compiler/symdef.pas index aef0e35ae1..01ad67e719 100644 --- a/compiler/symdef.pas +++ b/compiler/symdef.pas @@ -128,10 +128,10 @@ interface filetyp : tfiletyp; typedfiledef : tdef; typedfiledefderef : tderef; - constructor createtext; - constructor createuntyped; - constructor createtyped(def : tdef); - constructor ppuload(ppufile:tcompilerppufile); + constructor createtext;virtual; + constructor createuntyped;virtual; + constructor createtyped(def : tdef);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; @@ -141,11 +141,12 @@ interface function size:asizeint;override; procedure setsize; end; + tfiledefclass = class of tfiledef; tvariantdef = class(tstoreddef) varianttype : tvarianttype; - constructor create(v : tvarianttype); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(v : tvarianttype);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; function GetTypeName:string;override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -154,37 +155,42 @@ interface function is_publishable : boolean;override; function needs_inittable : boolean;override; end; + tvariantdefclass = class of tvariantdef; tformaldef = class(tstoreddef) typed:boolean; - constructor create(Atyped:boolean); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(Atyped:boolean);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function GetTypeName:string;override; end; + tformaldefclass = class of tformaldef; tforwarddef = class(tstoreddef) tosymname : pshortstring; forwardpos : tfileposinfo; - constructor create(const s:string;const pos:tfileposinfo); + constructor create(const s:string;const pos:tfileposinfo);virtual; destructor destroy;override; function getcopy:tstoreddef;override; function GetTypeName:string;override; end; + tforwarddefclass = class of tforwarddef; tundefineddef = class(tstoreddef) - constructor create; - constructor ppuload(ppufile:tcompilerppufile); + constructor create;virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function GetTypeName:string;override; end; + tundefineddefclass = class of tundefineddef; terrordef = class(tstoreddef) - constructor create; + constructor create;virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function GetTypeName:string;override; function getmangledparaname : TSymStr;override; end; + terrordefclass = class of terrordef; tabstractpointerdef = class(tstoreddef) pointeddef : tdef; @@ -206,16 +212,17 @@ interface x86pointertyp : tx86pointertyp; {$endif x86} has_pointer_math : boolean; - constructor create(def:tdef); + constructor create(def:tdef);virtual; {$ifdef x86} - constructor createx86(def:tdef;x86typ:tx86pointertyp); + constructor createx86(def:tdef;x86typ:tx86pointertyp);virtual; {$endif x86} function size:asizeint;override; function getcopy:tstoreddef;override; - constructor ppuload(ppufile:tcompilerppufile); + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function GetTypeName:string;override; end; + tpointerdefclass = class of tpointerdef; tprocdef = class; @@ -272,8 +279,8 @@ interface public variantrecdesc : pvariantrecdesc; isunion : boolean; - constructor create(const n:string; p:TSymtable); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n:string; p:TSymtable);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -288,6 +295,7 @@ interface function needs_inittable : boolean;override; function needs_separate_initrtti:boolean;override; end; + trecorddefclass = class of trecorddef; tobjectdef = class; @@ -307,8 +315,8 @@ interface ImplementsGetter : tsym; ImplementsGetterDeref : tderef; ImplementsField : tsym; - constructor create(aintf: tobjectdef); - constructor create_deref(intfd,getterd:tderef); + constructor create(aintf: tobjectdef);virtual; + constructor create_deref(intfd,getterd:tderef);virtual; destructor destroy; override; function getcopy:TImplementedInterface; procedure buildderef; @@ -319,6 +327,7 @@ interface function IsImplMergePossible(MergingIntf:TImplementedInterface;out weight: longint): boolean; property IOffset: longint read GetIOffset write fIOffset; end; + timplementedinterfaceclass = class of timplementedinterface; { tvmtentry } tvmtentry = record @@ -373,8 +382,8 @@ interface } classref_created_in_current_module : boolean; objecttype : tobjecttyp; - constructor create(ot:tobjecttyp;const n:string;c:tobjectdef); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(ot:tobjecttyp;const n:string;c:tobjectdef);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -419,10 +428,11 @@ interface { C++ } procedure finish_cpp_data; end; + tobjectdefclass = class of tobjectdef; tclassrefdef = class(tabstractpointerdef) - constructor create(def:tdef); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(def:tdef);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function getcopy:tstoreddef;override; function GetTypeName:string;override; @@ -430,6 +440,7 @@ interface function rtti_mangledname(rt:trttitype):string;override; procedure register_created_object_type;override; end; + tclassrefdefclass = class of tclassrefdef; tarraydef = class(tstoreddef) lowrange, @@ -446,9 +457,9 @@ interface function elesize : asizeint; function elepackedbitsize : asizeint; function elecount : asizeuint; - constructor create_from_pointer(def:tdef); - constructor create(l,h:asizeint;def:tdef); - constructor ppuload(ppufile:tcompilerppufile); + constructor create_from_pointer(def:tdef);virtual; + constructor create(l,h:asizeint;def:tdef);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy; override; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -464,12 +475,13 @@ interface property elementdef : tdef read _elementdef write setelementdef; function is_publishable : boolean;override; end; + tarraydefclass = class of tarraydef; torddef = class(tstoreddef) low,high : TConstExprInt; ordtype : tordtype; - constructor create(t : tordtype;v,b : TConstExprInt); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(t : tordtype;v,b : TConstExprInt);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; function is_publishable : boolean;override; @@ -479,11 +491,12 @@ interface function packedbitsize: asizeint; override; function getvardef : longint;override; end; + torddefclass = class of torddef; tfloatdef = class(tstoreddef) floattype : tfloattype; - constructor create(t : tfloattype); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(t : tfloattype);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; function GetTypeName:string;override; @@ -493,6 +506,7 @@ interface procedure setsize; function getvardef:longint;override; end; + tfloatdefclass = class of tfloatdef; { tabstractprocdef } @@ -553,8 +567,8 @@ interface classdef : tobjectdef; classdefderef : tderef; {$endif} - constructor create(level:byte); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(level:byte);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; {$ifdef jvm} @@ -569,6 +583,7 @@ interface function is_addressonly:boolean;override; function getmangledparaname:TSymStr;override; end; + tprocvardefclass = class of tprocvardef; tmessageinf = record case integer of @@ -710,8 +725,8 @@ interface { set to a value different from tsk_none in case this procdef is for a routine that has to be internally generated by the compiler } synthetickind : tsynthetickind; - constructor create(level:byte); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(level:byte);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; @@ -778,6 +793,7 @@ interface { true if all information required to inline this routine is available } property has_inlininginfo: boolean read GetHasInliningInfo write SetHasInliningInfo; end; + tprocdefclass = class of tprocdef; { single linked list of overloaded procs } pprocdeflist = ^tprocdeflist; @@ -791,16 +807,16 @@ interface encoding : tstringencoding; stringtype : tstringtype; len : asizeint; - constructor createshort(l : byte); - constructor loadshort(ppufile:tcompilerppufile); - constructor createlong(l : asizeint); - constructor loadlong(ppufile:tcompilerppufile); - constructor createansi(aencoding:tstringencoding); - constructor loadansi(ppufile:tcompilerppufile); - constructor createwide; - constructor loadwide(ppufile:tcompilerppufile); - constructor createunicode; - constructor loadunicode(ppufile:tcompilerppufile); + constructor createshort(l : byte);virtual; + constructor loadshort(ppufile:tcompilerppufile);virtual; + constructor createlong(l : asizeint);virtual; + constructor loadlong(ppufile:tcompilerppufile);virtual; + constructor createansi(aencoding:tstringencoding);virtual; + constructor loadansi(ppufile:tcompilerppufile);virtual; + constructor createwide;virtual; + constructor loadwide(ppufile:tcompilerppufile);virtual; + constructor createunicode;virtual; + constructor loadunicode(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; function stringtypname:string; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -812,6 +828,7 @@ interface function needs_inittable : boolean;override; function getvardef:longint;override; end; + tstringdefclass = class of tstringdef; { tenumdef } @@ -827,9 +844,9 @@ interface classdefderef : tderef; {$endif} has_jumps : boolean; - constructor create; - constructor create_subrange(_basedef:tenumdef;_min,_max:asizeint); - constructor ppuload(ppufile:tcompilerppufile); + constructor create;virtual; + constructor create_subrange(_basedef:tenumdef;_min,_max:asizeint);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -848,14 +865,15 @@ interface { returns basedef if assigned, otherwise self } function getbasedef: tenumdef; end; + tenumdefclass = class of tenumdef; tsetdef = class(tstoreddef) elementdef : tdef; elementdefderef : tderef; setbase, setmax : aword; - constructor create(def:tdef;low, high : asizeint); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(def:tdef;low, high : asizeint);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; function getcopy : tstoreddef;override; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; @@ -863,6 +881,7 @@ interface function GetTypeName:string;override; function is_publishable : boolean;override; end; + tsetdefclass = class of tsetdef; tgenericdummyentry = class @@ -890,6 +909,27 @@ interface current_genericdef: tstoreddef; { used to reject declaration of generic class inside generic class } current_specializedef: tstoreddef; { used to implement usage of generic class in itself } + cfiledef: tfiledefclass; + cvariantdef: tvariantdefclass; + cformaldef: tformaldefclass; + cforwarddef: tforwarddefclass; + cundefineddef: tundefineddefclass; + cerrordef: terrordefclass; + cpointerdef: tpointerdefclass; + crecorddef: trecorddefclass; + cimplementedinterface: timplementedinterfaceclass; + cobjectdef: tobjectdefclass; + cclassrefdef: tclassrefdefclass; + carraydef: tarraydefclass; + corddef: torddefclass; + cfloatdef: tfloatdefclass; + cprocvardef: tprocvardefclass; + cprocdef: tprocdefclass; + cstringdef: tstringdefclass; + cenumdef: tenumdefclass; + csetdef: tsetdefclass; + + { default types } generrordef, { error in definition } voidpointertype, { pointer for Void-pointeddef } @@ -1181,7 +1221,7 @@ implementation else symtable:=current_module.localsymtable; symtablestack.push(symtable); - current_module.ansistrdef:=tstringdef.createansi(current_settings.sourcecodepage); + current_module.ansistrdef:=cstringdef.createansi(current_settings.sourcecodepage); symtablestack.pop(symtable); end; result:=tstringdef(current_module.ansistrdef); @@ -1833,7 +1873,7 @@ implementation function tstoreddef.getcopy : tstoreddef; begin Message(sym_e_cant_create_unique_type); - getcopy:=terrordef.create; + getcopy:=cerrordef.create; end; @@ -2133,7 +2173,7 @@ implementation function tstringdef.getcopy : tstoreddef; begin - result:=tstringdef.create(typ); + result:=cstringdef.create(typ); result.typ:=stringdef; tstringdef(result).stringtype:=stringtype; tstringdef(result).encoding:=encoding; @@ -2313,10 +2353,10 @@ implementation function tenumdef.getcopy : tstoreddef; begin if assigned(basedef) then - result:=tenumdef.create_subrange(basedef,minval,maxval) + result:=cenumdef.create_subrange(basedef,minval,maxval) else begin - result:=tenumdef.create; + result:=cenumdef.create; tenumdef(result).minval:=minval; tenumdef(result).maxval:=maxval; tenumdef(result).symtable.free; @@ -2528,7 +2568,7 @@ implementation function torddef.getcopy : tstoreddef; begin - result:=torddef.create(ordtype,low,high); + result:=corddef.create(ordtype,low,high); result.typ:=orddef; torddef(result).low:=low; torddef(result).high:=high; @@ -2664,7 +2704,7 @@ implementation function tfloatdef.getcopy : tstoreddef; begin - result:=tfloatdef.create(floattype); + result:=cfloatdef.create(floattype); result.typ:=floatdef; tfloatdef(result).savesize:=savesize; end; @@ -2804,11 +2844,11 @@ implementation begin case filetyp of ft_typed: - result:=tfiledef.createtyped(typedfiledef); + result:=cfiledef.createtyped(typedfiledef); ft_untyped: - result:=tfiledef.createuntyped; + result:=cfiledef.createuntyped; ft_text: - result:=tfiledef.createtext; + result:=cfiledef.createtext; else internalerror(2004121201); end; @@ -2921,7 +2961,7 @@ implementation function tvariantdef.getcopy : tstoreddef; begin - result:=tvariantdef.create(varianttype); + result:=cvariantdef.create(varianttype); end; @@ -3076,9 +3116,9 @@ implementation one of them will be destroyed on forward type resolve and the second will point to garbage } if pointeddef.typ=forwarddef then - result:=tpointerdef.create(tforwarddef(pointeddef).getcopy) + result:=cpointerdef.create(tforwarddef(pointeddef).getcopy) else - result:=tpointerdef.create(pointeddef); + result:=cpointerdef.create(pointeddef); {$ifdef x86} tpointerdef(result).x86pointertyp:=x86pointertyp; {$endif x86} @@ -3166,9 +3206,9 @@ implementation function tclassrefdef.getcopy:tstoreddef; begin if pointeddef.typ=forwarddef then - result:=tclassrefdef.create(tforwarddef(pointeddef).getcopy) + result:=cclassrefdef.create(tforwarddef(pointeddef).getcopy) else - result:=tclassrefdef.create(pointeddef); + result:=cclassrefdef.create(pointeddef); end; @@ -3252,7 +3292,7 @@ implementation function tsetdef.getcopy : tstoreddef; begin - result:=tsetdef.create(elementdef,setbase,setmax); + result:=csetdef.create(elementdef,setbase,setmax); { the copy might have been created with a different setalloc setting } tsetdef(result).savesize:=savesize; end; @@ -3382,7 +3422,7 @@ implementation function tarraydef.getcopy : tstoreddef; begin - result:=tarraydef.create(lowrange,highrange,rangedef); + result:=carraydef.create(lowrange,highrange,rangedef); tarraydef(result).arrayoptions:=arrayoptions; tarraydef(result)._elementdef:=_elementdef; end; @@ -3930,7 +3970,7 @@ implementation function trecorddef.getcopy : tstoreddef; begin - result:=trecorddef.create(objrealname^,symtable.getcopy); + result:=crecorddef.create(objrealname^,symtable.getcopy); trecorddef(result).isunion:=isunion; include(trecorddef(result).defoptions,df_copied_def); if assigned(tcinitcode) then @@ -4398,14 +4438,14 @@ implementation if newtyp=procdef then begin if (copytyp<>pc_bareproc) then - result:=tprocdef.create(nestinglevel) + result:=cprocdef.create(nestinglevel) else - result:=tprocdef.create(normal_function_level); + result:=cprocdef.create(normal_function_level); tprocdef(result).visibility:=vis_public; end else begin - result:=tprocvardef.create(nestinglevel); + result:=cprocvardef.create(nestinglevel); end; tabstractprocdef(result).returndef:=returndef; tabstractprocdef(result).returndefderef:=returndefderef; @@ -4422,7 +4462,7 @@ implementation if (copytyp=pc_bareproc) and (([vo_is_self,vo_is_vmt,vo_is_parentfp,vo_is_result]*pvs.varoptions)<>[]) then continue; - npvs:=tparavarsym.create(pvs.realname,pvs.paranr,pvs.varspez, + npvs:=cparavarsym.create(pvs.realname,pvs.paranr,pvs.varspez, pvs.vardef,pvs.varoptions); npvs.defaultconstsym:=pvs.defaultconstsym; tabstractprocdef(result).parast.insert(npvs); @@ -5730,7 +5770,7 @@ implementation i : tcallercallee; j : longint; begin - result:=tprocvardef.create(parast.symtablelevel); + result:=cprocvardef.create(parast.symtablelevel); tprocvardef(result).returndef:=returndef; tprocvardef(result).returndefderef:=returndefderef; tprocvardef(result).parast:=parast.getcopy; @@ -6068,7 +6108,7 @@ implementation var i : longint; begin - result:=tobjectdef.create(objecttype,objrealname^,childof); + result:=cobjectdef.create(objecttype,objrealname^,childof); { the constructor allocates a symtable which we release to avoid memory leaks } tobjectdef(result).symtable.free; tobjectdef(result).symtable:=symtable.getcopy; @@ -6264,7 +6304,7 @@ implementation psym:=tsym(st.find(nname)); if not assigned(psym) then begin - psym:=tprocsym.create(nname); + psym:=cprocsym.create(nname); { avoid warning about this symbol being unused } psym.IncRefCount; { don't check for duplicates: @@ -6418,7 +6458,7 @@ implementation tObjectSymtable(symtable).datasize:=align(tObjectSymtable(symtable).datasize,sizeof(pint)); tObjectSymtable(symtable).alignrecord(tObjectSymtable(symtable).datasize,sizeof(pint)); end; - vs:=tfieldvarsym.create('_vptr$'+objname^,vs_value,voidpointertype,[]); + vs:=cfieldvarsym.create('_vptr$'+objname^,vs_value,voidpointertype,[]); hidesym(vs); tObjectSymtable(symtable).insert(vs); tObjectSymtable(symtable).addfield(vs,vis_hidden); @@ -7084,7 +7124,7 @@ implementation function tforwarddef.getcopy:tstoreddef; begin - result:=tforwarddef.create(tosymname^, forwardpos); + result:=cforwarddef.create(tosymname^, forwardpos); end; {**************************************************************************** @@ -7485,7 +7525,7 @@ implementation { do not simply push/pop current_module.localsymtable, because that can have side-effects (e.g., it removes helpers) } symtablestack:=nil; - res^.Data:=tpointerdef.create(def); + res^.Data:=cpointerdef.create(def); if assigned(current_module.localsymtable) then current_module.localsymtable.insertdef(tdef(res^.Data)) else @@ -7522,7 +7562,7 @@ implementation unit, add them to the global/staticsymtable } oldsymtablestack:=symtablestack; symtablestack:=nil; - res^.Data:=tarraydef.create(0,elecount-1,ptrsinttype); + res^.Data:=carraydef.create(0,elecount-1,ptrsinttype); tarraydef(res^.Data).elementdef:=def; if assigned(current_module.localsymtable) then current_module.localsymtable.insertdef(tdef(res^.Data)) diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 4862506b91..cb987b6b54 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -64,29 +64,32 @@ interface { when the label is defined in an asm block, this points to the generated asmlabel } asmblocklabel : tasmlabel; - constructor create(const n : string); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; function mangledname:TSymStr;override; end; + tlabelsymclass = class of tlabelsym; tunitsym = class(Tstoredsym) module : tobject; { tmodule } - constructor create(const n : string;amodule : tobject); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;amodule : tobject);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; + tunitsymclass = class of tunitsym; tnamespacesym = class(Tstoredsym) unitsym:tsym; unitsymderef:tderef; - constructor create(const n : string); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; procedure deref;override; end; + tnamespacesymclass = class of tnamespacesym; terrorsym = class(Tsym) constructor create; @@ -99,8 +102,8 @@ interface FProcdefList : TFPObjectList; FProcdefDerefList : TFPList; public - constructor create(const n : string); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; { writes all declarations except the specified one } procedure write_parameter_lists(skipdef:tprocdef); @@ -120,20 +123,22 @@ interface function find_procdef_enumerator_operator(fromdef,todef:tdef;var besteq:tequaltype):Tprocdef; property ProcdefList:TFPObjectList read FProcdefList; end; + tprocsymclass = class of tprocsym; ttypesym = class(Tstoredsym) public typedef : tdef; typedefderef : tderef; fprettyname : ansistring; - constructor create(const n : string;def:tdef); + constructor create(const n : string;def:tdef);virtual; destructor destroy;override; - constructor ppuload(ppufile:tcompilerppufile); + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; procedure deref;override; function prettyname : string;override; end; + ttypesymclass = class of ttypesym; tabstractvarsym = class(tstoredsym) varoptions : tvaroptions; @@ -178,13 +183,14 @@ interface {$else symansistr} cachedmangledname: pshortstring; { mangled name for ObjC or Java } {$endif symansistr} - constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure set_externalname(const s:string); function mangledname:TSymStr;override; destructor destroy;override; end; + tfieldvarsymclass = class of tfieldvarsym; tabstractnormalvarsym = class(tabstractvarsym) defaultconstsym : tsym; @@ -206,10 +212,11 @@ interface end; tlocalvarsym = class(tabstractnormalvarsym) - constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; end; + tlocalvarsymclass = class of tlocalvarsym; tparavarsym = class(tabstractnormalvarsym) paraloc : array[tcallercallee] of TCGPara; @@ -221,12 +228,13 @@ interface {$ifdef EXTDEBUG} eqval : tequaltype; {$endif EXTDEBUG} - constructor create(const n : string;nr:word;vsp:tvarspez;def:tdef;vopts:tvaroptions); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;nr:word;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure ppuwrite(ppufile:tcompilerppufile);override; function needs_finalization: boolean; end; + tparavarsymclass = class of tparavarsym; tstaticvarsym = class(tabstractnormalvarsym) private @@ -243,10 +251,10 @@ interface parameters as it is done by iso pascal with the program symbols, isoindex contains the parameter number } isoindex : dword; - constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); - constructor create_dll(const n : string;vsp:tvarspez;def:tdef); - constructor create_C(const n: string; const mangled : TSymStr;vsp:tvarspez;def:tdef); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual; + constructor create_dll(const n : string;vsp:tvarspez;def:tdef);virtual; + constructor create_C(const n: string; const mangled : TSymStr;vsp:tvarspez;def:tdef);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure ppuwrite(ppufile:tcompilerppufile);override; function mangledname:TSymStr;override; @@ -255,6 +263,7 @@ interface procedure set_mangledname(const s:TSymStr); procedure set_raw_mangledname(const s:TSymStr); end; + tstaticvarsymclass = class of tstaticvarsym; tabsolutevarsym = class(tabstractvarsym) public @@ -268,15 +277,16 @@ interface addrsegment : aword; {$endif defined(i8086)} ref : tpropaccesslist; - constructor create(const n : string;def:tdef); - constructor create_ref(const n : string;def:tdef;_ref:tpropaccesslist); + constructor create(const n : string;def:tdef);virtual; + constructor create_ref(const n : string;def:tdef;_ref:tpropaccesslist);virtual; destructor destroy;override; - constructor ppuload(ppufile:tcompilerppufile); + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure buildderef;override; procedure deref;override; function mangledname : TSymStr;override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; + tabsolutevarsymclass = class of tabsolutevarsym; tpropaccesslisttypes=(palt_none,palt_read,palt_write,palt_stored); @@ -293,9 +303,9 @@ interface dispid : longint; propaccesslist: array[tpropaccesslisttypes] of tpropaccesslist; parast : tsymtable; - constructor create(const n : string); + constructor create(const n : string);virtual; destructor destroy;override; - constructor ppuload(ppufile:tcompilerppufile); + constructor ppuload(ppufile:tcompilerppufile);virtual; function getsize : asizeint; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; @@ -307,6 +317,7 @@ interface procedure add_accessor_parameters(readprocdef, writeprocdef: tprocdef); procedure add_index_parameter(var paranr: word; readprocdef, writeprocdef: tprocdef); end; + tpropertysymclass = class of tpropertysym; tconstvalue = record case integer of @@ -320,36 +331,39 @@ interface constdefderef : tderef; consttyp : tconsttyp; value : tconstvalue; - constructor create_ord(const n : string;t : tconsttyp;v : tconstexprint;def:tdef); - constructor create_ordptr(const n : string;t : tconsttyp;v : tconstptruint;def:tdef); - constructor create_ptr(const n : string;t : tconsttyp;v : pointer;def:tdef); - constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint;def:tdef); - constructor create_wstring(const n : string;t : tconsttyp;pw:pcompilerwidestring); - constructor ppuload(ppufile:tcompilerppufile); + constructor create_ord(const n : string;t : tconsttyp;v : tconstexprint;def:tdef);virtual; + constructor create_ordptr(const n : string;t : tconsttyp;v : tconstptruint;def:tdef);virtual; + constructor create_ptr(const n : string;t : tconsttyp;v : pointer;def:tdef);virtual; + constructor create_string(const n : string;t : tconsttyp;str:pchar;l:longint;def:tdef);virtual; + constructor create_wstring(const n : string;t : tconsttyp;pw:pcompilerwidestring);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure buildderef;override; procedure deref;override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; + tconstsymclass = class of tconstsym; tenumsym = class(Tstoredsym) value : longint; definition : tenumdef; definitionderef : tderef; - constructor create(const n : string;def : tenumdef;v : longint); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;def : tenumdef;v : longint);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; procedure ppuwrite(ppufile:tcompilerppufile);override; procedure buildderef;override; procedure deref;override; end; + tenumsymclass = class of tenumsym; tsyssym = class(Tstoredsym) number : longint; - constructor create(const n : string;l : longint); - constructor ppuload(ppufile:tcompilerppufile); + constructor create(const n : string;l : longint);virtual; + constructor ppuload(ppufile:tcompilerppufile);virtual; destructor destroy;override; procedure ppuwrite(ppufile:tcompilerppufile);override; end; + tsyssymclass = class of tsyssym; const maxmacrolen=16*1024; @@ -380,6 +394,21 @@ interface var generrorsym : tsym; + clabelsym: tlabelsymclass; + cunitsym: tunitsymclass; + cnamespacesym: tnamespacesymclass; + cprocsym: tprocsymclass; + ctypesym: ttypesymclass; + cfieldvarsym: tfieldvarsymclass; + clocalvarsym: tlocalvarsymclass; + cparavarsym: tparavarsymclass; + cstaticvarsym: tstaticvarsymclass; + cabsolutevarsym: tabsolutevarsymclass; + cpropertysym: tpropertysymclass; + cconstsym: tconstsymclass; + cenumsym: tenumsymclass; + csyssym: tsyssymclass; + { generate internal static field name based on regular field name } function internal_static_field_name(const fieldname: TSymStr): TSymStr; function get_high_value_sym(vs: tparavarsym):tsym; { marking it as inline causes IE 200311075 during loading from ppu file } @@ -1262,12 +1291,12 @@ implementation orig:=tparavarsym(parast.SymList[i]); if assigned(readprocdef) then begin - hparavs:=tparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]); + hparavs:=cparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]); readprocdef.parast.insert(hparavs); end; if assigned(writeprocdef) then begin - hparavs:=tparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]); + hparavs:=cparavarsym.create(orig.RealName,orig.paranr,orig.varspez,orig.vardef,[]); writeprocdef.parast.insert(hparavs); end; end; @@ -1281,12 +1310,12 @@ implementation inc(paranr); if assigned(readprocdef) then begin - hparavs:=tparavarsym.create('$index',10*paranr,vs_value,indexdef,[]); + hparavs:=cparavarsym.create('$index',10*paranr,vs_value,indexdef,[]); readprocdef.parast.insert(hparavs); end; if assigned(writeprocdef) then begin - hparavs:=tparavarsym.create('$index',10*paranr,vs_value,indexdef,[]); + hparavs:=cparavarsym.create('$index',10*paranr,vs_value,indexdef,[]); writeprocdef.parast.insert(hparavs); end; end; diff --git a/compiler/symtable.pas b/compiler/symtable.pas index c43bb161c7..ea4fc323f5 100644 --- a/compiler/symtable.pas +++ b/compiler/symtable.pas @@ -485,7 +485,7 @@ implementation iblocalvarsym : sym:=tlocalvarsym.ppuload(ppufile); ibparavarsym : sym:=tparavarsym.ppuload(ppufile); ibfieldvarsym : sym:=tfieldvarsym.ppuload(ppufile); - ibabsolutevarsym : sym:=tabsolutevarsym.ppuload(ppufile); + ibabsolutevarsym : sym:=cabsolutevarsym.ppuload(ppufile); ibenumsym : sym:=tenumsym.ppuload(ppufile); ibpropertysym : sym:=tpropertysym.ppuload(ppufile); ibunitsym : sym:=tunitsym.ppuload(ppufile); @@ -1738,7 +1738,7 @@ implementation system.delete(n,1,p); oldsym:=findnamespace(upper(ns)); if not assigned(oldsym) then - insert(tnamespacesym.create(ns)); + insert(cnamespacesym.create(ns)); p:=pos('.',n); end; end; @@ -3647,7 +3647,7 @@ implementation systemunit:=nil; { create error syms and def } generrorsym:=terrorsym.create; - generrordef:=terrordef.create; + generrordef:=cerrordef.create; { macros } initialmacrosymtable:=tmacrosymtable.create(false); macrosymtablestack:=TSymtablestack.create; diff --git a/compiler/vis/cpunode.pas b/compiler/vis/cpunode.pas index 010879c0e5..db4bd3cb3c 100644 --- a/compiler/vis/cpunode.pas +++ b/compiler/vis/cpunode.pas @@ -41,7 +41,9 @@ unit cpunode; // nvismem, // nvisinl, // nvismat, -// nviscnv +// nviscnv, + { symtable } + symcpu ; end. diff --git a/compiler/x86_64/cpunode.pas b/compiler/x86_64/cpunode.pas index f9befac47b..f7a50fa4cf 100644 --- a/compiler/x86_64/cpunode.pas +++ b/compiler/x86_64/cpunode.pas @@ -56,7 +56,9 @@ unit cpunode; nx64flw, {$endif DISABLE_WIN64_SEH} nx64inl, - nx64set + nx64set, + { symtable } + symcpu ; end. diff --git a/compiler/x86_64/symcpu.pas b/compiler/x86_64/symcpu.pas new file mode 100644 index 0000000000..d84bb78164 --- /dev/null +++ b/compiler/x86_64/symcpu.pas @@ -0,0 +1,174 @@ +{ + Copyright (c) 2014 by Florian Klaempfl + + Symbol table overrides for x86_64 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + **************************************************************************** +} +unit symcpu; + +{$i fpcdefs.inc} + +interface + +uses + symdef,symsym; + +type + { defs } + tcpufiledef = class(tfiledef) + end; + + tcpuvariantdef = class(tvariantdef) + end; + + tcpuformaldef = class(tformaldef) + end; + + tcpuforwarddef = class(tforwarddef) + end; + + tcpuundefineddef = class(tundefineddef) + end; + + tcpuerrordef = class(terrordef) + end; + + tcpupointerdef = class(tpointerdef) + end; + + tcpurecorddef = class(trecorddef) + end; + + tcpuimplementedinterface = class(timplementedinterface) + end; + + tcpuobjectdef = class(tobjectdef) + end; + + tcpuclassrefdef = class(tclassrefdef) + end; + + tcpuarraydef = class(tarraydef) + end; + + tcpuorddef = class(torddef) + end; + + tcpufloatdef = class(tfloatdef) + end; + + tcpuprocvardef = class(tprocvardef) + end; + + tcpuprocdef = class(tprocdef) + end; + + tcpustringdef = class(tstringdef) + end; + + tcpuenumdef = class(tenumdef) + end; + + tcpusetdef = class(tsetdef) + end; + + { syms } + tcpulabelsym = class(tlabelsym) + end; + + tcpuunitsym = class(tunitsym) + end; + + tcpunamespacesym = class(tnamespacesym) + end; + + tcpuprocsym = class(tprocsym) + end; + + tcpuypesym = class(ttypesym) + end; + + tcpufieldvarsym = class(tfieldvarsym) + end; + + tcpulocalvarsym = class(tlocalvarsym) + end; + + tcpuparavarsym = class(tparavarsym) + end; + + tcpustaticvarsym = class(tstaticvarsym) + end; + + tcpuabsolutevarsym = class(tabsolutevarsym) + end; + + tcpupropertysym = class(tpropertysym) + end; + + tcpuconstsym = class(tconstsym) + end; + + tcpuenumsym = class(tenumsym) + end; + + tcpusyssym = class(tsyssym) + end; + + +implementation + +begin + { used tdef classes } + cfiledef:=tcpufiledef; + cvariantdef:=tcpuvariantdef; + cformaldef:=tcpuformaldef; + cforwarddef:=tcpuforwarddef; + cundefineddef:=tcpuundefineddef; + cerrordef:=tcpuerrordef; + cpointerdef:=tcpupointerdef; + crecorddef:=tcpurecorddef; + cimplementedinterface:=tcpuimplementedinterface; + cobjectdef:=tcpuobjectdef; + cclassrefdef:=tcpuclassrefdef; + carraydef:=tcpuarraydef; + corddef:=tcpuorddef; + cfloatdef:=tcpufloatdef; + cprocvardef:=tcpuprocvardef; + cprocdef:=tcpuprocdef; + cstringdef:=tcpustringdef; + cenumdef:=tcpuenumdef; + csetdef:=tcpusetdef; + + { used tsym classes } + clabelsym:=tcpulabelsym; + cunitsym:=tcpuunitsym; + cnamespacesym:=tcpunamespacesym; + cprocsym:=tcpuprocsym; + ctypesym:=tcpuypesym; + cfieldvarsym:=tcpufieldvarsym; + clocalvarsym:=tcpulocalvarsym; + cparavarsym:=tcpuparavarsym; + cstaticvarsym:=tcpustaticvarsym; + cabsolutevarsym:=tcpuabsolutevarsym; + cpropertysym:=tcpupropertysym; + cconstsym:=tcpuconstsym; + cenumsym:=tcpuenumsym; + csyssym:=tcpusyssym; +end. + |