* converted emitting the class name to the typed constant builder class

git-svn-id: branches/hlcgllvm@28767 -
This commit is contained in:
Jonas Maebe 2014-10-06 20:53:57 +00:00
parent 2ed100666d
commit f8d4d20f5a

View File

@ -26,7 +26,7 @@ unit ncgvmt;
interface interface
uses uses
aasmdata,aasmbase, aasmdata,aasmbase,aasmcnst,
symbase,symdef; symbase,symdef;
type type
@ -98,7 +98,7 @@ implementation
uses uses
cutils,cclasses, cutils,cclasses,
globtype,globals,verbose,constexp, globtype,globals,verbose,constexp,
systems, systems,fmodule,
symconst,symtype,symsym,symtable,defutil, symconst,symtype,symsym,symtable,defutil,
aasmtai, aasmtai,
wpobase, wpobase,
@ -808,10 +808,16 @@ implementation
{$endif WITHDMT} {$endif WITHDMT}
interfacetable : tasmlabel; interfacetable : tasmlabel;
templist : TAsmList; templist : TAsmList;
tcb: ttai_typedconstbuilder;
classnamedef: tdef;
begin begin
{$ifdef WITHDMT} {$ifdef WITHDMT}
dmtlabel:=gendmt; dmtlabel:=gendmt;
{$endif WITHDMT} {$endif WITHDMT}
{ this code gets executed after the current module's symtable has
already been removed from the symtablestack -> add it again, so that
newly created defs here end up in the right unit }
symtablestack.push(current_module.localsymtable);
templist:=TAsmList.Create; templist:=TAsmList.Create;
strmessagetable:=nil; strmessagetable:=nil;
interfacetable:=nil; interfacetable:=nil;
@ -826,11 +832,15 @@ implementation
begin begin
{ write class name } { write class name }
current_asmdata.getlabel(classnamelabel,alt_data); current_asmdata.getlabel(classnamelabel,alt_data);
templist.concat(cai_align.create(const_align(sizeof(pint)))); tcb:=ctai_typedconstbuilder.create;
templist.concat(Tai_label.Create(classnamelabel));
hs:=_class.RttiName; hs:=_class.RttiName;
templist.concat(Tai_const.Create_8bit(length(hs))); classnamedef:=cstringdef.createshort(length(hs));
templist.concat(Tai_string.Create(hs)); tcb.maybe_begin_aggregate(classnamedef);
tcb.emit_tai(Tai_const.Create_8bit(length(hs)),u8inttype);
tcb.emit_tai(Tai_string.Create(hs),getarraydef(cansichartype,length(hs)));
tcb.maybe_end_aggregate(classnamedef);
templist.concatlist(tcb.get_final_asmlist(classnamelabel,classnamedef,sec_rodata_norel,'',sizeof(pint),[tcalo_is_lab]));
tcb.free;
{ interface table } { interface table }
if _class.ImplementedInterfaces.count>0 then if _class.ImplementedInterfaces.count>0 then
@ -933,6 +943,7 @@ implementation
if is_class(_class) then if is_class(_class) then
current_asmdata.asmlists[al_globals].concatlist(templist); current_asmdata.asmlists[al_globals].concatlist(templist);
templist.Free; templist.Free;
symtablestack.pop(current_module.localsymtable);
end; end;