Przeglądaj źródła

* fix tobjectdef.vmt_def to search in the correct symtable
* always register vmt defs (so they get written to the ppu) in case of llvm,
because it may need this def in case a method from a class defined in the
implementation of unit gets called from an inlined routine that gets
inlined in another unit (normally that vmt def would not get written to
the ppu file, as it can't be referenced from the interface and it's also
not necessarily directly referenced from the inline routine's nodes)
(fixes sdo_dataobject compilation with LLVM after enabling cross-unit
inlining of methods accessing static symbol table symbols)

git-svn-id: trunk@42342 -

Jonas Maebe 6 lat temu
rodzic
commit
7f772683cb
2 zmienionych plików z 10 dodań i 1 usunięć
  1. 6 0
      compiler/nobj.pas
  2. 4 1
      compiler/symdef.pas

+ 6 - 0
compiler/nobj.pas

@@ -835,6 +835,12 @@ implementation
           0,
           target_info.alignment.recordalignmin,
           target_info.alignment.maxCrecordalign);
+{$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
+          to access the vmt def to create signatures }
+        vmtdef.register_def;
+{$endif}
         { standard VMT fields }
         case _Class.objecttype of
           odt_class:

+ 4 - 1
compiler/symdef.pas

@@ -7440,7 +7440,10 @@ implementation
       var
         vmttypesym: tsym;
       begin
-        vmttypesym:=tsym(get_top_level_symtable.Find('vmtdef$'+mangledparaname));
+        if not(typesym.owner.symtabletype in [ObjectSymtable,recordsymtable]) then
+          vmttypesym:=tsym(typesym.owner.Find('vmtdef$'+mangledparaname))
+        else
+          vmttypesym:=tsym(tobjectsymtable(typesym.owner).get_unit_symtable.Find('vmtdef$'+mangledparaname));
         if not assigned(vmttypesym) or
            (vmttypesym.typ<>symconst.typesym) or
            (ttypesym(vmttypesym).typedef.typ<>recorddef) then