Parcourir la source

* 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 il y a 6 ans
Parent
commit
7f772683cb
2 fichiers modifiés avec 10 ajouts et 1 suppressions
  1. 6 0
      compiler/nobj.pas
  2. 4 1
      compiler/symdef.pas

+ 6 - 0
compiler/nobj.pas

@@ -835,6 +835,12 @@ implementation
           0,
           0,
           target_info.alignment.recordalignmin,
           target_info.alignment.recordalignmin,
           target_info.alignment.maxCrecordalign);
           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 }
         { standard VMT fields }
         case _Class.objecttype of
         case _Class.objecttype of
           odt_class:
           odt_class:

+ 4 - 1
compiler/symdef.pas

@@ -7440,7 +7440,10 @@ implementation
       var
       var
         vmttypesym: tsym;
         vmttypesym: tsym;
       begin
       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
         if not assigned(vmttypesym) or
            (vmttypesym.typ<>symconst.typesym) or
            (vmttypesym.typ<>symconst.typesym) or
            (ttypesym(vmttypesym).typedef.typ<>recorddef) then
            (ttypesym(vmttypesym).typedef.typ<>recorddef) then