Просмотр исходного кода

* document the format of the sections of the wpo feedback file inside the
feedback file itself

git-svn-id: branches/wpo@12316 -

Jonas Maebe 17 лет назад
Родитель
Сommit
773ee61633
2 измененных файлов с 49 добавлено и 0 удалено
  1. 12 0
      compiler/optdead.pas
  2. 37 0
      compiler/optvirt.pas

+ 12 - 0
compiler/optdead.pas

@@ -41,6 +41,7 @@ unit optdead;
         { hashtable of symbols which are live }
         fsymbols     : tfphashlist;
 
+        procedure documentformat(writer: twposectionwriterintf);
        public
         constructor create; override;
         destructor destroy; override;
@@ -153,11 +154,22 @@ unit optdead;
     end;
 
 
+  procedure twpodeadcodeinfo.documentformat(writer: twposectionwriterintf);
+    begin
+      writer.sectionputline('# section format:');
+      writer.sectionputline('# symbol1_that_is_live');
+      writer.sectionputline('# symbol2_that_is_live');
+      writer.sectionputline('# ...');
+      writer.sectionputline('#');
+    end;
+
+
   procedure twpodeadcodeinfo.storewpofilesection(writer: twposectionwriterintf);
     var
       i: longint;
     begin
       writer.startsection(SYMBOL_SECTION_NAME);
+      documentformat(writer);
       for i:=0 to fsymbols.count-1 do
         writer.sectionputline(fsymbols.nameofindex(i));
     end;

+ 37 - 0
compiler/optvirt.pas

@@ -135,6 +135,7 @@ unit optvirt;
         function addunitifnew(const n: shortstring): tunitdevirtinfo;
         function findunit(const n: shortstring): tunitdevirtinfo;
         function getstaticname(forvmtentry: boolean; objdef, procdef: tdef; out staticname: string): boolean;
+        procedure documentformat(writer: twposectionwriterintf);
        public
         constructor create; override;
         destructor destroy; override;
@@ -946,6 +947,41 @@ unit optvirt;
       end;
 
 
+    procedure tprogdevirtinfo.documentformat(writer: twposectionwriterintf);
+      begin
+        writer.sectionputline('# section format:');
+        writer.sectionputline('# unit1^');
+        writer.sectionputline('# class1&                ; classname&');
+        writer.sectionputline('# 1                      ; instantiated or not');
+        writer.sectionputline('# basevmt                ; vmt type (base or some interface)');
+        writer.sectionputline('# # vmt entry nr');
+        writer.sectionputline('# 0                      ; vmt entry nr');
+        writer.sectionputline('# staticvmtentryforslot0 ; name or routine to call instead');
+        writer.sectionputline('# 5');
+        writer.sectionputline('# staticvmtentryforslot5');
+        writer.sectionputline('# intfvmt1');
+        writer.sectionputline('# 0');
+        writer.sectionputline('# staticvmtentryforslot0');
+        writer.sectionputline('#');
+        writer.sectionputline('# class2&');
+        writer.sectionputline('# 0                      ; non-instantiated class (can be variables of this type, e.g. TObject)');
+        writer.sectionputline('# basevmt');
+        writer.sectionputline('# 1');
+        writer.sectionputline('# staticvmtentryforslot1');
+        writer.sectionputline('#');
+        writer.sectionputline('# class3&                ; instantiated class without optimisable virtual methods');
+        writer.sectionputline('# 1');
+        writer.sectionputline('#');
+        writer.sectionputline('# unit2^');
+        writer.sectionputline('# 1');
+        writer.sectionputline('# class3&');
+        writer.sectionputline('# ...');
+        writer.sectionputline('#');
+        writer.sectionputline('# currently, only basevmt is supported (no interfaces yet)');
+        writer.sectionputline('#');
+      end;
+
+
     procedure tprogdevirtinfo.storewpofilesection(writer: twposectionwriterintf);
       var
         unitcount,
@@ -959,6 +995,7 @@ unit optvirt;
         if not assigned(funits) then
           exit;
         writer.startsection(DEVIRT_SECTION_NAME);
+        documentformat(writer);
         for unitcount:=0 to funits.count-1 do
           begin
             unitdevirtinfo:=tunitdevirtinfo(funits[unitcount]);