Extend tstaticvarsym (and by extension tabstractnormalvarsym) with the capability to create it as unregistered if needed.

git-svn-id: trunk@32373 -
This commit is contained in:
svenbarth 2015-11-20 11:15:30 +00:00
parent 922646d106
commit 0ac12f0eaf
7 changed files with 22 additions and 22 deletions

View File

@ -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 }

View File

@ -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

View File

@ -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 }

View File

@ -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;

View File

@ -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;

View File

@ -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 }

View File

@ -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;