Pārlūkot izejas kodu

Remove need to export FPC_EMPTYINTF variable.

compiler/ncgvmt.pas, TVMTWriter:
  * writevmt: write ordinal 1 instead of address to FPC_EMPTYINTF, because we wouldn't be able to correctly handle the indirect symbol here
rtl/inc/objpas.inc:
  + new constant emptyintfptr which contains either the address of emptyintf (for 2.6.x) or an ordinal 1
  * InitInterfacePointers, TObject.InitInstance, TObject.GetInterfaceEntry & TObject.GetInterfaceEntryByStr: instead of checking for @emptyintf we check for emptyintfptr

git-svn-id: branches/svenbarth/packages@29007 -
svenbarth 10 gadi atpakaļ
vecāks
revīzija
81006f8a11
2 mainītis faili ar 7 papildinājumiem un 5 dzēšanām
  1. 1 1
      compiler/ncgvmt.pas
  2. 6 4
      rtl/inc/objpas.inc

+ 1 - 1
compiler/ncgvmt.pas

@@ -909,7 +909,7 @@ implementation
             else if _class.implements_any_interfaces then
             else if _class.implements_any_interfaces then
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr)
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_nil_dataptr)
             else
             else
-              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF',AT_DATA)));
+              current_asmdata.asmlists[al_globals].concat(Tai_const.Create_aint(1){Tai_const.Create_sym(current_asmdata.RefAsmSymbol('FPC_EMPTYINTF',AT_DATA))});
             { table for string messages }
             { table for string messages }
             if (oo_has_msgstr in _class.objectoptions) then
             if (oo_has_msgstr in _class.objectoptions) then
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable))
               current_asmdata.asmlists[al_globals].concat(Tai_const.Create_sym(strmessagetable))

+ 6 - 4
rtl/inc/objpas.inc

@@ -314,6 +314,8 @@
 
 
       var
       var
         emptyintf: ptruint; public name 'FPC_EMPTYINTF';
         emptyintf: ptruint; public name 'FPC_EMPTYINTF';
+      const
+        emptyintfptr: pinterfacetable = {$ifdef ver2_6}@emptyintf{$else}pinterfacetable(1){$endif};
 
 
       procedure InitInterfacePointers(objclass: tclass;instance : pointer);
       procedure InitInterfacePointers(objclass: tclass;instance : pointer);
 
 
@@ -324,7 +326,7 @@
           Res: pinterfaceentry;
           Res: pinterfaceentry;
         begin
         begin
           ovmt := PVmt(objclass);
           ovmt := PVmt(objclass);
-          while assigned(ovmt) and (ovmt^.vIntfTable <> @emptyintf) do
+          while assigned(ovmt) and (ovmt^.vIntfTable <> emptyintfptr) do
             begin
             begin
               intftable:=ovmt^.vIntfTable;
               intftable:=ovmt^.vIntfTable;
               if assigned(intftable) then
               if assigned(intftable) then
@@ -351,7 +353,7 @@
            { insert VMT pointer into the new created memory area }
            { insert VMT pointer into the new created memory area }
            { (in class methods self contains the VMT!)           }
            { (in class methods self contains the VMT!)           }
            ppointer(instance)^:=pointer(self);
            ppointer(instance)^:=pointer(self);
-           if PVmt(self)^.vIntfTable <> @emptyintf then
+           if PVmt(self)^.vIntfTable <> emptyintfptr then
              InitInterfacePointers(self,instance);
              InitInterfacePointers(self,instance);
            InitInstance:=TObject(Instance);
            InitInstance:=TObject(Instance);
         end;
         end;
@@ -862,7 +864,7 @@
           ovmt: PVmt;
           ovmt: PVmt;
         begin
         begin
           ovmt := PVmt(Self);
           ovmt := PVmt(Self);
-          while Assigned(ovmt) and (ovmt^.vIntfTable <> @emptyintf) do
+          while Assigned(ovmt) and (ovmt^.vIntfTable <> emptyintfptr) do
           begin
           begin
             intftable:=ovmt^.vIntfTable;
             intftable:=ovmt^.vIntfTable;
             if assigned(intftable) then
             if assigned(intftable) then
@@ -886,7 +888,7 @@
           ovmt: PVmt;
           ovmt: PVmt;
         begin
         begin
           ovmt := PVmt(Self);
           ovmt := PVmt(Self);
-          while Assigned(ovmt) and (ovmt^.vIntfTable <> @emptyintf) do
+          while Assigned(ovmt) and (ovmt^.vIntfTable <> emptyintfptr) do
           begin
           begin
             intftable:=ovmt^.vIntfTable;
             intftable:=ovmt^.vIntfTable;
             if assigned(intftable) then
             if assigned(intftable) then