mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 02:26:06 +02:00
* refactor tclassheader in tvmtbuilder and tvmtwriter
* fix rtti generation * rtti is now written at the end of a module when all info is available, this prevents some duplicate rtti entries cause by inheritance git-svn-id: trunk@5363 -
This commit is contained in:
parent
129ab85aad
commit
9ae8e9fa21
@ -612,7 +612,7 @@ implementation
|
|||||||
{ Need a new label? }
|
{ Need a new label? }
|
||||||
if not assigned(def.dwarf_lab) then
|
if not assigned(def.dwarf_lab) then
|
||||||
begin
|
begin
|
||||||
if (df_has_dwarf_dbg_info in def.defoptions) then
|
if (ds_dwarf_dbg_info_written in def.defstates) then
|
||||||
begin
|
begin
|
||||||
if not assigned(def.typesym) then
|
if not assigned(def.typesym) then
|
||||||
internalerror(200610011);
|
internalerror(200610011);
|
||||||
@ -628,7 +628,7 @@ implementation
|
|||||||
(def.owner.iscurrentunit) then
|
(def.owner.iscurrentunit) then
|
||||||
begin
|
begin
|
||||||
def.dwarf_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym)),AB_GLOBAL,AT_DATA);
|
def.dwarf_lab:=current_asmdata.DefineAsmSymbol(make_mangledname('DBG',def.owner,symname(def.typesym)),AB_GLOBAL,AT_DATA);
|
||||||
include(def.defoptions,df_has_dwarf_dbg_info);
|
include(def.defstates,ds_dwarf_dbg_info_written);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
{ The pointer typecast is needed to prevent a problem with range checking
|
{ The pointer typecast is needed to prevent a problem with range checking
|
||||||
@ -1388,7 +1388,7 @@ implementation
|
|||||||
|
|
||||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_comment.Create(strpnew('Definition '+def.typename)));
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_comment.Create(strpnew('Definition '+def.typename)));
|
||||||
labsym:=def_dwarf_lab(def);
|
labsym:=def_dwarf_lab(def);
|
||||||
if df_has_dwarf_dbg_info in def.defoptions then
|
if ds_dwarf_dbg_info_written in def.defstates then
|
||||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0))
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create_global(labsym,0))
|
||||||
else
|
else
|
||||||
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0));
|
current_asmdata.asmlists[al_dwarf_info].concat(tai_symbol.create(labsym,0));
|
||||||
|
@ -68,7 +68,7 @@ implementation
|
|||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
rttidefopt : array[trttitype] of tdefoption = (df_has_rttitable,df_has_inittable);
|
rttidefstate : array[trttitype] of tdefstate = (ds_rtti_table_written,ds_init_table_written);
|
||||||
|
|
||||||
type
|
type
|
||||||
TPropNameListItem = class(TFPHashObject)
|
TPropNameListItem = class(TFPHashObject)
|
||||||
@ -831,18 +831,20 @@ implementation
|
|||||||
recorddef :
|
recorddef :
|
||||||
fields_write_rtti(trecorddef(def).symtable,rt);
|
fields_write_rtti(trecorddef(def).symtable,rt);
|
||||||
objectdef :
|
objectdef :
|
||||||
|
begin
|
||||||
|
if assigned(tobjectdef(def).childof) then
|
||||||
|
write_rtti(tobjectdef(def).childof,rt);
|
||||||
if rt=initrtti then
|
if rt=initrtti then
|
||||||
fields_write_rtti(tobjectdef(def).symtable,rt)
|
fields_write_rtti(tobjectdef(def).symtable,rt)
|
||||||
else
|
else
|
||||||
published_write_rtti(tobjectdef(def).symtable,rt);
|
published_write_rtti(tobjectdef(def).symtable,rt);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
function TRTTIWriter.ref_rtti(def:tdef;rt:trttitype):tasmsymbol;
|
function TRTTIWriter.ref_rtti(def:tdef;rt:trttitype):tasmsymbol;
|
||||||
begin
|
begin
|
||||||
if not(rttidefopt[rt] in def.defoptions) then
|
|
||||||
internalerror(200611037);
|
|
||||||
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt));
|
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -851,14 +853,13 @@ implementation
|
|||||||
var
|
var
|
||||||
rttilab : tasmsymbol;
|
rttilab : tasmsymbol;
|
||||||
begin
|
begin
|
||||||
if rttidefopt[rt] in def.defoptions then
|
{ only write rtti of definitions from the current module }
|
||||||
exit;
|
|
||||||
{ only write the rttis of defs defined in the current unit,
|
|
||||||
otherwise we will generate duplicate asmsymbols }
|
|
||||||
if not findunitsymtable(def.owner).iscurrentunit then
|
if not findunitsymtable(def.owner).iscurrentunit then
|
||||||
internalerror(200611035);
|
exit;
|
||||||
{ prevent recursion }
|
{ prevent recursion }
|
||||||
include(def.defoptions,rttidefopt[rt]);
|
if rttidefstate[rt] in def.defstates then
|
||||||
|
exit;
|
||||||
|
include(def.defstates,rttidefstate[rt]);
|
||||||
{ write first all dependencies }
|
{ write first all dependencies }
|
||||||
write_child_rtti_data(def,rt);
|
write_child_rtti_data(def,rt);
|
||||||
{ write rtti data }
|
{ write rtti data }
|
||||||
@ -873,9 +874,7 @@ implementation
|
|||||||
|
|
||||||
function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype):tasmsymbol;
|
function TRTTIWriter.get_rtti_label(def:tdef;rt:trttitype):tasmsymbol;
|
||||||
begin
|
begin
|
||||||
if not(rttidefopt[rt] in def.defoptions) then
|
result:=current_asmdata.RefAsmSymbol(def.rtti_mangledname(rt));
|
||||||
write_rtti(def,rt);
|
|
||||||
result:=ref_rtti(def,rt);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
1669
compiler/nobj.pas
1669
compiler/nobj.pas
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ implementation
|
|||||||
{ symtable }
|
{ symtable }
|
||||||
symconst,symbase,symtype,symdef,symtable,paramgr,defutil,
|
symconst,symbase,symtype,symdef,symtable,paramgr,defutil,
|
||||||
{ pass 1 }
|
{ pass 1 }
|
||||||
nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,
|
nmat,nadd,ncal,nset,ncnv,ninl,ncon,nld,nflw,nobj,
|
||||||
{ codegen }
|
{ codegen }
|
||||||
ncgutil,
|
ncgutil,
|
||||||
{ parser }
|
{ parser }
|
||||||
@ -235,8 +235,6 @@ implementation
|
|||||||
{ add default calling convention }
|
{ add default calling convention }
|
||||||
handle_calling_convention(tabstractprocdef(hdef));
|
handle_calling_convention(tabstractprocdef(hdef));
|
||||||
end;
|
end;
|
||||||
{ write rtti/init tables }
|
|
||||||
write_persistent_type_info(hdef);
|
|
||||||
if not skipequal then
|
if not skipequal then
|
||||||
begin
|
begin
|
||||||
{ get init value }
|
{ get init value }
|
||||||
@ -406,6 +404,7 @@ implementation
|
|||||||
istyperenaming : boolean;
|
istyperenaming : boolean;
|
||||||
generictypelist : TFPObjectList;
|
generictypelist : TFPObjectList;
|
||||||
generictokenbuf : tdynamicarray;
|
generictokenbuf : tdynamicarray;
|
||||||
|
vmtbuilder : TVMTBuilder;
|
||||||
begin
|
begin
|
||||||
old_block_type:=block_type;
|
old_block_type:=block_type;
|
||||||
block_type:=bt_type;
|
block_type:=bt_type;
|
||||||
@ -533,7 +532,19 @@ implementation
|
|||||||
handle_calling_convention(tprocvardef(hdef));
|
handle_calling_convention(tprocvardef(hdef));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
objectdef,
|
objectdef :
|
||||||
|
begin
|
||||||
|
{ Build VMT indexes, skip for type renaming and forward classes }
|
||||||
|
if (hdef.typesym=newtype) and
|
||||||
|
not(oo_is_forward in tobjectdef(hdef).objectoptions) then
|
||||||
|
begin
|
||||||
|
vmtbuilder:=TVMTBuilder.Create(tobjectdef(hdef));
|
||||||
|
vmtbuilder.generate_vmt;
|
||||||
|
vmtbuilder.free;
|
||||||
|
end;
|
||||||
|
try_consume_hintdirective(newtype.symoptions);
|
||||||
|
consume(_SEMICOLON);
|
||||||
|
end;
|
||||||
recorddef :
|
recorddef :
|
||||||
begin
|
begin
|
||||||
try_consume_hintdirective(newtype.symoptions);
|
try_consume_hintdirective(newtype.symoptions);
|
||||||
@ -555,18 +566,6 @@ implementation
|
|||||||
{ Generic is never a type renaming }
|
{ Generic is never a type renaming }
|
||||||
hdef.typesym:=newtype;
|
hdef.typesym:=newtype;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ Write tables if there are no errors and we are the typesym that
|
|
||||||
defines this type, so this will not be done for simple type renamings }
|
|
||||||
if (hdef.typ<>errordef) and
|
|
||||||
(hdef.typesym=newtype) then
|
|
||||||
begin
|
|
||||||
{ file position }
|
|
||||||
oldfilepos:=current_filepos;
|
|
||||||
current_filepos:=newtype.fileinfo;
|
|
||||||
write_persistent_type_info(hdef);
|
|
||||||
current_filepos:=oldfilepos;
|
|
||||||
end;
|
|
||||||
until token<>_ID;
|
until token<>_ID;
|
||||||
typecanbeforward:=false;
|
typecanbeforward:=false;
|
||||||
symtablestack.top.SymList.ForEachCall(@resolve_type_forward,nil);
|
symtablestack.top.SymList.ForEachCall(@resolve_type_forward,nil);
|
||||||
|
@ -179,8 +179,8 @@ implementation
|
|||||||
if assigned(def) and
|
if assigned(def) and
|
||||||
(def.typ=procdef) then
|
(def.typ=procdef) then
|
||||||
begin
|
begin
|
||||||
tprocdef(def).extnumber:=aktobjectdef.lastvtableindex;
|
// tprocdef(def).extnumber:=aktobjectdef.lastvtableindex;
|
||||||
inc(aktobjectdef.lastvtableindex);
|
// inc(aktobjectdef.lastvtableindex);
|
||||||
include(tprocdef(def).procoptions,po_virtualmethod);
|
include(tprocdef(def).procoptions,po_virtualmethod);
|
||||||
tprocdef(def).forwarddef:=false;
|
tprocdef(def).forwarddef:=false;
|
||||||
end;
|
end;
|
||||||
|
@ -43,7 +43,7 @@ implementation
|
|||||||
link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
|
link,assemble,import,export,gendef,ppu,comprsrc,dbgbase,
|
||||||
cresstr,procinfo,
|
cresstr,procinfo,
|
||||||
pexports,
|
pexports,
|
||||||
scanner,pbase,pexpr,psystem,psub,pdecsub;
|
scanner,pbase,pexpr,psystem,psub,pdecsub,ptype;
|
||||||
|
|
||||||
|
|
||||||
procedure create_objectfile;
|
procedure create_objectfile;
|
||||||
@ -1110,10 +1110,6 @@ implementation
|
|||||||
{ do we need to add the variants unit? }
|
{ do we need to add the variants unit? }
|
||||||
maybeloadvariantsunit;
|
maybeloadvariantsunit;
|
||||||
|
|
||||||
{ generate debuginfo }
|
|
||||||
if (cs_debuginfo in current_settings.moduleswitches) then
|
|
||||||
debuginfo.inserttypeinfo;
|
|
||||||
|
|
||||||
{ generate wrappers for interfaces }
|
{ generate wrappers for interfaces }
|
||||||
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.globalsymtable);
|
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.globalsymtable);
|
||||||
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable);
|
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable);
|
||||||
@ -1121,12 +1117,20 @@ implementation
|
|||||||
{ generate pic helpers to load eip if necessary }
|
{ generate pic helpers to load eip if necessary }
|
||||||
gen_pic_helpers(current_asmdata.asmlists[al_procedures]);
|
gen_pic_helpers(current_asmdata.asmlists[al_procedures]);
|
||||||
|
|
||||||
|
{ generate rtti/init tables }
|
||||||
|
write_persistent_type_info(current_module.globalsymtable);
|
||||||
|
write_persistent_type_info(current_module.localsymtable);
|
||||||
|
|
||||||
{ Tables }
|
{ Tables }
|
||||||
insertThreadVars;
|
insertThreadVars;
|
||||||
|
|
||||||
{ Resource strings }
|
{ Resource strings }
|
||||||
GenerateResourceStrings;
|
GenerateResourceStrings;
|
||||||
|
|
||||||
|
{ generate debuginfo }
|
||||||
|
if (cs_debuginfo in current_settings.moduleswitches) then
|
||||||
|
debuginfo.inserttypeinfo;
|
||||||
|
|
||||||
{ generate imports }
|
{ generate imports }
|
||||||
if current_module.ImportLibraryList.Count>0 then
|
if current_module.ImportLibraryList.Count>0 then
|
||||||
importlib.generatelib;
|
importlib.generatelib;
|
||||||
@ -1437,22 +1441,25 @@ implementation
|
|||||||
InsertPData;
|
InsertPData;
|
||||||
{$endif arm}
|
{$endif arm}
|
||||||
|
|
||||||
{ generate debuginfo }
|
|
||||||
if (cs_debuginfo in current_settings.moduleswitches) then
|
|
||||||
debuginfo.inserttypeinfo;
|
|
||||||
|
|
||||||
InsertThreadvars;
|
InsertThreadvars;
|
||||||
|
|
||||||
{ generate wrappers for interfaces }
|
|
||||||
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable);
|
|
||||||
|
|
||||||
{ generate pic helpers to load eip if necessary }
|
{ generate pic helpers to load eip if necessary }
|
||||||
gen_pic_helpers(current_asmdata.asmlists[al_procedures]);
|
gen_pic_helpers(current_asmdata.asmlists[al_procedures]);
|
||||||
|
|
||||||
|
{ generate rtti/init tables }
|
||||||
|
write_persistent_type_info(current_module.localsymtable);
|
||||||
|
|
||||||
|
{ generate wrappers for interfaces }
|
||||||
|
gen_intf_wrappers(current_asmdata.asmlists[al_procedures],current_module.localsymtable);
|
||||||
|
|
||||||
{ generate imports }
|
{ generate imports }
|
||||||
if current_module.ImportLibraryList.Count>0 then
|
if current_module.ImportLibraryList.Count>0 then
|
||||||
importlib.generatelib;
|
importlib.generatelib;
|
||||||
|
|
||||||
|
{ generate debuginfo }
|
||||||
|
if (cs_debuginfo in current_settings.moduleswitches) then
|
||||||
|
debuginfo.inserttypeinfo;
|
||||||
|
|
||||||
if islibrary or (target_info.system in system_unit_program_exports) then
|
if islibrary or (target_info.system in system_unit_program_exports) then
|
||||||
exportlib.generatelib;
|
exportlib.generatelib;
|
||||||
|
|
||||||
|
@ -112,9 +112,6 @@ implementation
|
|||||||
begin
|
begin
|
||||||
result:=ttypesym.create(s,def);
|
result:=ttypesym.create(s,def);
|
||||||
systemunit.insert(result);
|
systemunit.insert(result);
|
||||||
{ write always RTTI to get persistent typeinfo }
|
|
||||||
RTTIWriter.write_rtti(def,initrtti);
|
|
||||||
RTTIWriter.write_rtti(def,fullrtti);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
@ -26,7 +26,8 @@ unit ptype;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
globtype,cclasses,symtype,symdef;
|
globtype,cclasses,
|
||||||
|
symtype,symdef,symbase;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ forward types should only be possible inside a TYPE statement }
|
{ forward types should only be possible inside a TYPE statement }
|
||||||
@ -50,7 +51,7 @@ interface
|
|||||||
procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
|
procedure read_anon_type(var def : tdef;parseprocvardir:boolean);
|
||||||
|
|
||||||
{ generate persistent type information like VMT, RTTI and inittables }
|
{ generate persistent type information like VMT, RTTI and inittables }
|
||||||
procedure write_persistent_type_info(def : tdef);
|
procedure write_persistent_type_info(st:tsymtable);
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -64,7 +65,7 @@ implementation
|
|||||||
{ target }
|
{ target }
|
||||||
paramgr,
|
paramgr,
|
||||||
{ symtable }
|
{ symtable }
|
||||||
symconst,symbase,symsym,symtable,
|
symconst,symsym,symtable,
|
||||||
defutil,defcmp,
|
defutil,defcmp,
|
||||||
{ pass 1 }
|
{ pass 1 }
|
||||||
node,ncgrtti,nobj,
|
node,ncgrtti,nobj,
|
||||||
@ -771,43 +772,61 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure write_persistent_type_info(def : tdef);
|
procedure write_persistent_type_info(st:tsymtable);
|
||||||
var
|
var
|
||||||
ch : tclassheader;
|
i : longint;
|
||||||
|
def : tdef;
|
||||||
|
vmtwriter : TVMTWriter;
|
||||||
begin
|
begin
|
||||||
{ generate persistent init/final tables when it's declared in the interface so it can
|
for i:=0 to st.DefList.Count-1 do
|
||||||
be reused in other used }
|
|
||||||
if def.owner.symtabletype=globalsymtable then
|
|
||||||
RTTIWriter.write_rtti(def,initrtti);
|
|
||||||
|
|
||||||
{ for objects we should write the vmt and interfaces.
|
|
||||||
This need to be done after the rtti has been written, because
|
|
||||||
it can contain a reference to that data (PFV)
|
|
||||||
This is not for forward classes }
|
|
||||||
if (def.typ=objectdef) then
|
|
||||||
begin
|
begin
|
||||||
if not(oo_vmt_written in tobjectdef(def).objectoptions) and
|
def:=tdef(st.DefList[i]);
|
||||||
|
if df_deleted in def.defoptions then
|
||||||
|
continue;
|
||||||
|
case def.typ of
|
||||||
|
recorddef :
|
||||||
|
write_persistent_type_info(trecorddef(def).symtable);
|
||||||
|
objectdef :
|
||||||
|
begin
|
||||||
|
write_persistent_type_info(tobjectdef(def).symtable);
|
||||||
|
{ Write also VMT }
|
||||||
|
if not(ds_vmt_written in def.defstates) and
|
||||||
not(oo_is_forward in tobjectdef(def).objectoptions) then
|
not(oo_is_forward in tobjectdef(def).objectoptions) then
|
||||||
begin
|
begin
|
||||||
ch:=tclassheader.create(tobjectdef(def));
|
vmtwriter:=TVMTWriter.create(tobjectdef(def));
|
||||||
{ generate and check virtual methods, must be done
|
|
||||||
before RTTI is written }
|
|
||||||
ch.genvmt;
|
|
||||||
{ Generate RTTI for class }
|
|
||||||
RTTIWriter.write_rtti(def,fullrtti);
|
|
||||||
if is_interface(tobjectdef(def)) then
|
if is_interface(tobjectdef(def)) then
|
||||||
ch.writeinterfaceids;
|
vmtwriter.writeinterfaceids;
|
||||||
if (oo_has_vmt in tobjectdef(def).objectoptions) then
|
if (oo_has_vmt in tobjectdef(def).objectoptions) then
|
||||||
ch.writevmt;
|
vmtwriter.writevmt;
|
||||||
ch.free;
|
vmtwriter.free;
|
||||||
include(tobjectdef(def).objectoptions,oo_vmt_written);
|
include(def.defstates,ds_vmt_written);
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
else
|
procdef :
|
||||||
begin
|
begin
|
||||||
{ Always generate RTTI info for all types. This is to have typeinfo() return
|
if assigned(tprocdef(def).localst) and
|
||||||
the same pointer }
|
(tprocdef(def).localst.symtabletype=localsymtable) then
|
||||||
if def.owner.symtabletype=globalsymtable then
|
write_persistent_type_info(tprocdef(def).localst);
|
||||||
|
if assigned(tprocdef(def).parast) then
|
||||||
|
write_persistent_type_info(tprocdef(def).parast);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
{ generate always persistent tables for types in the interface so it can
|
||||||
|
be reused in other units and give always the same pointer location. }
|
||||||
|
{ Init }
|
||||||
|
if (
|
||||||
|
assigned(def.typesym) and
|
||||||
|
(st.symtabletype=globalsymtable)
|
||||||
|
) or
|
||||||
|
def.needs_inittable or
|
||||||
|
(ds_init_table_used in def.defstates) then
|
||||||
|
RTTIWriter.write_rtti(def,initrtti);
|
||||||
|
{ RTTI }
|
||||||
|
if (
|
||||||
|
assigned(def.typesym) and
|
||||||
|
(st.symtabletype=globalsymtable)
|
||||||
|
) or
|
||||||
|
(ds_rtti_table_used in def.defstates) then
|
||||||
RTTIWriter.write_rtti(def,fullrtti);
|
RTTIWriter.write_rtti(def,fullrtti);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -142,12 +142,6 @@ type
|
|||||||
|
|
||||||
{ flags for a definition }
|
{ flags for a definition }
|
||||||
tdefoption=(df_none,
|
tdefoption=(df_none,
|
||||||
{ init data has been generated }
|
|
||||||
df_has_inittable,
|
|
||||||
{ rtti data has been generated }
|
|
||||||
df_has_rttitable,
|
|
||||||
{ dwarf debug info has been generated }
|
|
||||||
df_has_dwarf_dbg_info,
|
|
||||||
{ type is unique, i.e. declared with type = type <tdef>; }
|
{ type is unique, i.e. declared with type = type <tdef>; }
|
||||||
df_unique,
|
df_unique,
|
||||||
{ type is a generic }
|
{ type is a generic }
|
||||||
@ -159,6 +153,17 @@ type
|
|||||||
);
|
);
|
||||||
tdefoptions=set of tdefoption;
|
tdefoptions=set of tdefoption;
|
||||||
|
|
||||||
|
tdefstate=(ds_none,
|
||||||
|
ds_vmt_written,
|
||||||
|
ds_rtti_table_used,
|
||||||
|
ds_init_table_used,
|
||||||
|
ds_rtti_table_written,
|
||||||
|
ds_init_table_written,
|
||||||
|
ds_dwarf_dbg_info_used,
|
||||||
|
ds_dwarf_dbg_info_written
|
||||||
|
);
|
||||||
|
tdefstates=set of tdefstate;
|
||||||
|
|
||||||
{ tsymlist entry types }
|
{ tsymlist entry types }
|
||||||
tsltype = (sl_none,
|
tsltype = (sl_none,
|
||||||
sl_load,
|
sl_load,
|
||||||
@ -305,8 +310,7 @@ type
|
|||||||
oo_has_msgstr,
|
oo_has_msgstr,
|
||||||
oo_has_msgint,
|
oo_has_msgint,
|
||||||
oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
|
oo_can_have_published,{ the class has rtti, i.e. you can publish properties }
|
||||||
oo_has_default_property,
|
oo_has_default_property
|
||||||
oo_vmt_written
|
|
||||||
);
|
);
|
||||||
tobjectoptions=set of tobjectoption;
|
tobjectoptions=set of tobjectoption;
|
||||||
|
|
||||||
|
@ -227,6 +227,7 @@ interface
|
|||||||
objectoptions : tobjectoptions;
|
objectoptions : tobjectoptions;
|
||||||
{ to be able to have a variable vmt position }
|
{ to be able to have a variable vmt position }
|
||||||
{ and no vmt field for objects without virtuals }
|
{ and no vmt field for objects without virtuals }
|
||||||
|
vmtentries : TFPObjectList;
|
||||||
vmt_offset : longint;
|
vmt_offset : longint;
|
||||||
writing_class_record_dbginfo : boolean;
|
writing_class_record_dbginfo : boolean;
|
||||||
objecttype : tobjecttyp;
|
objecttype : tobjecttyp;
|
||||||
@ -919,9 +920,15 @@ implementation
|
|||||||
prefix : string[4];
|
prefix : string[4];
|
||||||
begin
|
begin
|
||||||
if rt=fullrtti then
|
if rt=fullrtti then
|
||||||
prefix:='RTTI'
|
begin
|
||||||
|
prefix:='RTTI';
|
||||||
|
include(defstates,ds_rtti_table_used);
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
begin
|
||||||
prefix:='INIT';
|
prefix:='INIT';
|
||||||
|
include(defstates,ds_init_table_used);
|
||||||
|
end;
|
||||||
if assigned(typesym) and
|
if assigned(typesym) and
|
||||||
(owner.symtabletype in [staticsymtable,globalsymtable]) then
|
(owner.symtabletype in [staticsymtable,globalsymtable]) then
|
||||||
result:=make_mangledname(prefix,owner,typesym.name)
|
result:=make_mangledname(prefix,owner,typesym.name)
|
||||||
@ -2151,7 +2158,8 @@ implementation
|
|||||||
|
|
||||||
constructor tarraydef.create_from_pointer(def:tdef);
|
constructor tarraydef.create_from_pointer(def:tdef);
|
||||||
begin
|
begin
|
||||||
self.create(0,$7fffffff,s32inttype);
|
{ use -1 so that the elecount will not overflow }
|
||||||
|
self.create(0,$7fffffff-1,s32inttype);
|
||||||
arrayoptions:=[ado_IsConvertedPointer];
|
arrayoptions:=[ado_IsConvertedPointer];
|
||||||
setelementdef(def);
|
setelementdef(def);
|
||||||
end;
|
end;
|
||||||
@ -3560,6 +3568,7 @@ implementation
|
|||||||
childof:=nil;
|
childof:=nil;
|
||||||
symtable:=tObjectSymtable.create(self,n,current_settings.packrecords);
|
symtable:=tObjectSymtable.create(self,n,current_settings.packrecords);
|
||||||
{ create space for vmt !! }
|
{ create space for vmt !! }
|
||||||
|
vmtentries:=nil;
|
||||||
vmt_offset:=0;
|
vmt_offset:=0;
|
||||||
lastvtableindex:=0;
|
lastvtableindex:=0;
|
||||||
set_parent(c);
|
set_parent(c);
|
||||||
@ -3593,6 +3602,7 @@ implementation
|
|||||||
tObjectSymtable(symtable).fieldalignment:=ppufile.getbyte;
|
tObjectSymtable(symtable).fieldalignment:=ppufile.getbyte;
|
||||||
tObjectSymtable(symtable).recordalignment:=ppufile.getbyte;
|
tObjectSymtable(symtable).recordalignment:=ppufile.getbyte;
|
||||||
vmt_offset:=ppufile.getlongint;
|
vmt_offset:=ppufile.getlongint;
|
||||||
|
vmtentries:=nil;
|
||||||
ppufile.getderef(childofderef);
|
ppufile.getderef(childofderef);
|
||||||
ppufile.getsmallset(objectoptions);
|
ppufile.getsmallset(objectoptions);
|
||||||
|
|
||||||
@ -3658,6 +3668,11 @@ implementation
|
|||||||
dispose(iidguid);
|
dispose(iidguid);
|
||||||
iidguid:=nil;
|
iidguid:=nil;
|
||||||
end;
|
end;
|
||||||
|
if assigned(vmtentries) then
|
||||||
|
begin
|
||||||
|
vmtentries.free;
|
||||||
|
vmtentries:=nil;
|
||||||
|
end;
|
||||||
inherited destroy;
|
inherited destroy;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3687,6 +3702,11 @@ implementation
|
|||||||
for i:=0 to ImplementedInterfaces.count-1 do
|
for i:=0 to ImplementedInterfaces.count-1 do
|
||||||
tobjectdef(result).ImplementedInterfaces.Add(TImplementedInterface(ImplementedInterfaces[i]).Getcopy);
|
tobjectdef(result).ImplementedInterfaces.Add(TImplementedInterface(ImplementedInterfaces[i]).Getcopy);
|
||||||
end;
|
end;
|
||||||
|
if assigned(vmtentries) then
|
||||||
|
begin
|
||||||
|
tobjectdef(result).vmtentries:=TFPobjectList.Create(false);
|
||||||
|
tobjectdef(result).vmtentries.Assign(vmtentries);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
@ -62,6 +62,7 @@ interface
|
|||||||
stab_number : word;
|
stab_number : word;
|
||||||
dbg_state : tdefdbgstatus;
|
dbg_state : tdefdbgstatus;
|
||||||
defoptions : tdefoptions;
|
defoptions : tdefoptions;
|
||||||
|
defstates : tdefstates;
|
||||||
constructor create(dt:tdeftyp);
|
constructor create(dt:tdeftyp);
|
||||||
procedure buildderef;virtual;abstract;
|
procedure buildderef;virtual;abstract;
|
||||||
procedure buildderefimpl;virtual;abstract;
|
procedure buildderefimpl;virtual;abstract;
|
||||||
|
@ -741,35 +741,54 @@ end;
|
|||||||
|
|
||||||
procedure readcommondef(const s:string);
|
procedure readcommondef(const s:string);
|
||||||
type
|
type
|
||||||
|
{ flags for a definition }
|
||||||
tdefoption=(df_none,
|
tdefoption=(df_none,
|
||||||
{ init data has been generated }
|
|
||||||
df_has_inittable,
|
|
||||||
{ rtti data has been generated }
|
|
||||||
df_has_rttitable,
|
|
||||||
{ dwarf debug info has been generated }
|
|
||||||
df_has_dwarf_dbg_info,
|
|
||||||
{ type is unique, i.e. declared with type = type <tdef>; }
|
{ type is unique, i.e. declared with type = type <tdef>; }
|
||||||
df_unique,
|
df_unique,
|
||||||
{ type is a generic }
|
{ type is a generic }
|
||||||
df_generic,
|
df_generic,
|
||||||
{ type is a specialization of a generic type }
|
{ type is a specialization of a generic type }
|
||||||
df_specialization
|
df_specialization,
|
||||||
|
{ type is deleted does not to be stored in ppu }
|
||||||
|
df_deleted
|
||||||
);
|
);
|
||||||
tdefoptions=set of tdefoption;
|
tdefoptions=set of tdefoption;
|
||||||
|
|
||||||
|
tdefstate=(ds_none,
|
||||||
|
ds_vmt_written,
|
||||||
|
ds_rtti_table_used,
|
||||||
|
ds_init_table_used,
|
||||||
|
ds_rtti_table_written,
|
||||||
|
ds_init_table_written,
|
||||||
|
ds_dwarf_dbg_info_used,
|
||||||
|
ds_dwarf_dbg_info_written
|
||||||
|
);
|
||||||
|
tdefstates=set of tdefstate;
|
||||||
tdefopt=record
|
tdefopt=record
|
||||||
mask : tdefoption;
|
mask : tdefoption;
|
||||||
str : string[30];
|
str : string[30];
|
||||||
end;
|
end;
|
||||||
|
tdefstateinfo=record
|
||||||
|
mask : tdefstate;
|
||||||
|
str : string[30];
|
||||||
|
end;
|
||||||
const
|
const
|
||||||
defopts=6;
|
defopts=3;
|
||||||
defopt : array[1..defopts] of tdefopt=(
|
defopt : array[1..defopts] of tdefopt=(
|
||||||
(mask:df_has_inittable; str:'InitTable'),
|
|
||||||
(mask:df_has_rttitable; str:'RTTITable'),
|
|
||||||
(mask:df_has_dwarf_dbg_info; str:'Dwarf DbgInfo'),
|
|
||||||
(mask:df_unique; str:'Unique Type'),
|
(mask:df_unique; str:'Unique Type'),
|
||||||
(mask:df_generic; str:'Generic'),
|
(mask:df_generic; str:'Generic'),
|
||||||
(mask:df_specialization; str:'Specialization')
|
(mask:df_specialization; str:'Specialization')
|
||||||
);
|
);
|
||||||
|
defstateinfos=7;
|
||||||
|
defstate : array[1..defstateinfos] of tdefstateinfo=(
|
||||||
|
(mask:ds_init_table_used; str:'InitTable Used'),
|
||||||
|
(mask:ds_rtti_table_used; str:'RTTITable Used'),
|
||||||
|
(mask:ds_init_table_written; str:'InitTable Written'),
|
||||||
|
(mask:ds_rtti_table_written; str:'RTTITable Written'),
|
||||||
|
(mask:ds_dwarf_dbg_info_used; str:'Dwarf DbgInfo Used'),
|
||||||
|
(mask:ds_dwarf_dbg_info_written;str:'Dwarf DbgInfo Written'),
|
||||||
|
(mask:ds_vmt_written; str:'VMT Written')
|
||||||
|
);
|
||||||
var
|
var
|
||||||
defoptions : tdefoptions;
|
defoptions : tdefoptions;
|
||||||
i : longint;
|
i : longint;
|
||||||
|
Loading…
Reference in New Issue
Block a user