From 0ac12f0eaf01571d336b405d809de6fff7927ee2 Mon Sep 17 00:00:00 2001 From: svenbarth Date: Fri, 20 Nov 2015 11:15:30 +0000 Subject: [PATCH] Extend tstaticvarsym (and by extension tabstractnormalvarsym) with the capability to create it as unregistered if needed. git-svn-id: trunk@32373 - --- compiler/blockutl.pas | 4 ++-- compiler/jvm/njvmutil.pas | 2 +- compiler/jvm/pjvm.pas | 6 +++--- compiler/pdecl.pas | 4 ++-- compiler/pdecvar.pas | 4 ++-- compiler/pmodules.pas | 2 +- compiler/symsym.pas | 22 +++++++++++----------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/compiler/blockutl.pas b/compiler/blockutl.pas index 94aede1a2a..9dbfb7d8e2 100644 --- a/compiler/blockutl.pas +++ b/compiler/blockutl.pas @@ -174,7 +174,7 @@ implementation { find the type of the descriptor structure } descriptordef:=search_named_unit_globaltype('BLOCKRTL','FPC_BLOCK_DESCRIPTOR_SIMPLE',true).typedef; { create new static variable } - descriptor:=cstaticvarsym.create(name,vs_value,descriptordef,[]); + descriptor:=cstaticvarsym.create(name,vs_value,descriptordef,[],true); symtablestack.top.insert(descriptor); include(descriptor.symoptions,sp_internal); { create typed constant for the descriptor } @@ -253,7 +253,7 @@ implementation result:=cstaticvarsym.create( '$'+literalname, vs_value, - blockliteraldef,[]); + blockliteraldef,[],true); include(result.symoptions,sp_internal); symtablestack.top.insert(result); { initialise it } diff --git a/compiler/jvm/njvmutil.pas b/compiler/jvm/njvmutil.pas index c40a2ba97a..0e663f2cbd 100644 --- a/compiler/jvm/njvmutil.pas +++ b/compiler/jvm/njvmutil.pas @@ -204,7 +204,7 @@ implementation begin vs:=cstaticvarsym.create(sym.realname+'$threadvar',sym.varspez, jvmgetthreadvardef(sym.vardef), - sym.varoptions - [vo_is_thread_var]); + sym.varoptions - [vo_is_thread_var],true); sym.owner.insert(vs); { make sure that the new sym does not get allocated (we will allocate it when encountering the original sym, because only then we know diff --git a/compiler/jvm/pjvm.pas b/compiler/jvm/pjvm.pas index 98cc86d1dd..ba3395683f 100644 --- a/compiler/jvm/pjvm.pas +++ b/compiler/jvm/pjvm.pas @@ -350,7 +350,7 @@ implementation initialization code } if tenumsym(tenumdef(def).symtable.symlist[i]).value=0 then begin - aliassym:=cstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external]); + aliassym:=cstaticvarsym.create('__FPC_Zero_Initializer',vs_final,enumclass,[vo_is_external],true); enumclass.symtable.insert(aliassym); aliassym.set_raw_mangledname(sym.mangledname); end; @@ -737,7 +737,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:=cstaticvarsym.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],true); csym.owner.insert(ssym); { alias storage to the constsym } ssym.set_mangledname(csym.realname); @@ -775,7 +775,7 @@ implementation has been compiler -> insert a copy in the unit's staticsymtable } symtablestack.push(current_module.localsymtable); - ssym:=cstaticvarsym.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],true); symtablestack.top.insert(ssym); symtablestack.pop(current_module.localsymtable); { alias storage to the constsym } diff --git a/compiler/pdecl.pas b/compiler/pdecl.pas index 643c7ef364..09f711efd7 100644 --- a/compiler/pdecl.pas +++ b/compiler/pdecl.pas @@ -272,7 +272,7 @@ implementation end else begin - sym:=cstaticvarsym.create(orgname,varspez,hdef,[]); + sym:=cstaticvarsym.create(orgname,varspez,hdef,[],true); sym.visibility:=symtablestack.top.currentvisibility; symtablestack.top.insert(sym); end; @@ -352,7 +352,7 @@ implementation end else begin - labelsym.jumpbuf:=cstaticvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[]); + labelsym.jumpbuf:=cstaticvarsym.create('LABEL$_'+labelsym.name,vs_value,rec_jmp_buf,[],true); symtablestack.top.insert(labelsym.jumpbuf); cnodeutils.insertbssdata(tstaticvarsym(labelsym.jumpbuf)); end; diff --git a/compiler/pdecvar.pas b/compiler/pdecvar.pas index 2e5c9676d4..ff03b6dbbb 100644 --- a/compiler/pdecvar.pas +++ b/compiler/pdecvar.pas @@ -1066,7 +1066,7 @@ implementation case vs.typ of localvarsym : begin - tcsym:=cstaticvarsym.create('$default'+vs.realname,vs_const,vs.vardef,[]); + tcsym:=cstaticvarsym.create('$default'+vs.realname,vs_const,vs.vardef,[],true); include(tcsym.symoptions,sp_internal); vs.defaultconstsym:=tcsym; symtablestack.top.insert(tcsym); @@ -1296,7 +1296,7 @@ implementation staticsymtable, globalsymtable : begin - vs:=cstaticvarsym.create(orgpattern,vs_value,generrordef,[]); + vs:=cstaticvarsym.create(orgpattern,vs_value,generrordef,[],true); if vd_threadvar in options then include(vs.varoptions,vo_is_thread_var); end; diff --git a/compiler/pmodules.pas b/compiler/pmodules.pas index 2ca30cb866..974ccfbead 100644 --- a/compiler/pmodules.pas +++ b/compiler/pmodules.pas @@ -650,7 +650,7 @@ implementation begin { insert symbol for got access in assembler code} gotvarsym:=cstaticvarsym.create('_GLOBAL_OFFSET_TABLE_', - vs_value,voidpointertype,[vo_is_external]); + vs_value,voidpointertype,[vo_is_external],true); gotvarsym.set_mangledname('_GLOBAL_OFFSET_TABLE_'); current_module.localsymtable.insert(gotvarsym); { avoid unnecessary warnings } diff --git a/compiler/symsym.pas b/compiler/symsym.pas index 411b78ea95..886bd28c4e 100644 --- a/compiler/symsym.pas +++ b/compiler/symsym.pas @@ -240,7 +240,7 @@ interface { the variable is not living at entry of the scope, so it does not need to be initialized if it is a reg. var (not written to ppu, because not important and would change interface crc) } noregvarinitneeded : boolean; - constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); + constructor create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean); constructor ppuload(st:tsymtyp;ppufile:tcompilerppufile); function globalasmsym: boolean; procedure ppuwrite(ppufile:tcompilerppufile);override; @@ -296,7 +296,7 @@ interface to the symbol of the corresponding class field } fieldvarsym : tfieldvarsym; fieldvarsymderef : tderef; - constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions);virtual; + constructor create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean);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 create_from_fieldvar(const n:string;fieldvar:tfieldvarsym);virtual; @@ -1827,9 +1827,9 @@ implementation TABSTRACTNORMALVARSYM ****************************************************************************} - constructor tabstractnormalvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); + constructor tabstractnormalvarsym.create(st:tsymtyp;const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean); begin - inherited create(st,n,vsp,def,vopts,true); + inherited create(st,n,vsp,def,vopts,doregister); fillchar(localloc,sizeof(localloc),0); fillchar(currentregloc,sizeof(localloc),0); fillchar(initialloc,sizeof(initialloc),0); @@ -1889,9 +1889,9 @@ implementation Tstaticvarsym ****************************************************************************} - constructor tstaticvarsym.create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); + constructor tstaticvarsym.create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions;doregister:boolean); begin - inherited create(staticvarsym,n,vsp,def,vopts); + inherited create(staticvarsym,n,vsp,def,vopts,doregister); {$ifdef symansistr} _mangledname:=''; {$else symansistr} @@ -1902,20 +1902,20 @@ implementation constructor tstaticvarsym.create_dll(const n : string;vsp:tvarspez;def:tdef); begin - tstaticvarsym(self).create(n,vsp,def,[vo_is_dll_var]); + tstaticvarsym(self).create(n,vsp,def,[vo_is_dll_var],true); end; constructor tstaticvarsym.create_C(const n: string; const mangled : TSymStr;vsp:tvarspez;def:tdef); begin - tstaticvarsym(self).create(n,vsp,def,[]); + tstaticvarsym(self).create(n,vsp,def,[],true); set_mangledname(mangled); end; constructor tstaticvarsym.create_from_fieldvar(const n: string;fieldvar:tfieldvarsym); begin - create(internal_static_field_name(n),vs_value,fieldvar.vardef,[]); + create(internal_static_field_name(n),vs_value,fieldvar.vardef,[],true); fieldvarsym:=fieldvar; end; @@ -2086,7 +2086,7 @@ implementation constructor tlocalvarsym.create(const n : string;vsp:tvarspez;def:tdef;vopts:tvaroptions); begin - inherited create(localvarsym,n,vsp,def,vopts); + inherited create(localvarsym,n,vsp,def,vopts,true); end; @@ -2110,7 +2110,7 @@ implementation constructor tparavarsym.create(const n : string;nr:word;vsp:tvarspez;def:tdef;vopts:tvaroptions); begin - inherited create(paravarsym,n,vsp,def,vopts); + inherited create(paravarsym,n,vsp,def,vopts,true); if (vsp in [vs_var,vs_value,vs_const,vs_constref]) and not(vo_is_funcret in vopts) then varstate := vs_initialised;