* make the VMT symbol and type def of the corresponding class or object instead of having them be global

* bump PPU version to avoid potential compilation errors due to this

Based on code by Blaise.ru
This commit is contained in:
Sven/Sarah Barth 2022-01-30 17:23:40 +01:00
parent ac4df2b066
commit 30a7199165
5 changed files with 8 additions and 9 deletions

View File

@ -1083,8 +1083,9 @@ implementation
{ reuse the type created in nobj, so we get internal consistency
checking for free }
vmttypesym:=try_search_current_module_type(internaltypeprefixName[itp_vmtdef]+_class.mangledparaname);
vmttypesym:=ttypesym(_class.symtable.find('vmtdef'));
if not assigned(vmttypesym) or
(vmttypesym.typ<>typesym) or
(vmttypesym.typedef.typ<>recorddef) then
internalerror(2015071403);
vmtdef:=trecorddef(vmttypesym.typedef);

View File

@ -831,10 +831,11 @@ implementation
exit;
{ create VMT type definition }
vmtdef:=crecorddef.create_global_internal(
internaltypeprefixName[itp_vmtdef]+_class.mangledparaname,
vmtdef:=crecorddef.create_internal(
'$vmtdef',
0,
target_info.alignment.recordalignmin);
target_info.alignment.recordalignmin,
_class.symtable);
{$ifdef llvm}
{ in case of a class declared in the implementation section of unit
whose method is called from an inline routine -- LLVM needs to be able

View File

@ -48,7 +48,7 @@ const
CurrentPPUVersion = 208;
{ for any other changes to the ppu format, increase this version number
(it's a cardinal) }
CurrentPPULongVersion = 15;
CurrentPPULongVersion = 16;
{ unit flags }
uf_big_endian = $000004;

View File

@ -755,7 +755,6 @@ type
itp_1byte,
itp_emptyrec,
itp_llvmstruct,
itp_vmtdef,
itp_vmt_tstringmesssagetable,
itp_vmt_msgint_table_entries,
itp_vmt_tmethod_name_table,
@ -909,7 +908,6 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
'$1byte$',
'$emptyrec',
'$llvmstruct$',
'$vmtdef$',
'$vmt_TStringMesssageTable$',
'$vmt_msgint_table_entries$',
'$vmt_tmethod_name_table$',

View File

@ -8104,8 +8104,7 @@ implementation
begin
if not is_unique_objpasdef then
begin
where:=get_top_level_symtable(true);
vmttypesym:=where.Find('vmtdef$'+mangledparaname);
vmttypesym:=symtable.Find('vmtdef');
if not assigned(vmttypesym) or
(vmttypesym.typ<>symconst.typesym) or
(ttypesym(vmttypesym).typedef.typ<>recorddef) then