Kaynağa Gözat

* optimized memory layout of some often used classes

git-svn-id: trunk@18201 -
florian 14 yıl önce
ebeveyn
işleme
bc0def5e01
3 değiştirilmiş dosya ile 16 ekleme ve 14 silme
  1. 3 3
      compiler/rautils.pas
  2. 9 9
      compiler/symdef.pas
  3. 4 2
      compiler/symtype.pas

+ 3 - 3
compiler/rautils.pas

@@ -93,11 +93,11 @@ type
   end;
 
   TOperand = class
-    typesize : aint;
+    opr    : TOprRec;
+    typesize : byte;
     hastype,          { if the operand has typecasted variable }
     hasvar : boolean; { if the operand is loaded with a variable }
     size   : TCGSize;
-    opr    : TOprRec;
     constructor create;virtual;
     destructor  destroy;override;
     Procedure SetSize(_size:longint;force:boolean);virtual;
@@ -112,11 +112,11 @@ type
   TCOperand = class of TOperand;
 
   TInstruction = class
+    operands  : array[1..max_operands] of toperand;
     opcode    : tasmop;
     condition : tasmcond;
     ops       : byte;
     labeled   : boolean;
-    operands  : array[1..max_operands] of toperand;
     constructor create(optype : tcoperand);virtual;
     destructor  destroy;override;
     { converts the instruction to an instruction how it's used by the assembler writer

+ 9 - 9
compiler/symdef.pas

@@ -272,9 +272,10 @@ interface
           vmtentries     : TFPList;
           vmcallstaticinfo : pmvcallstaticinfo;
           vmt_offset     : longint;
-          objecttype     : tobjecttyp;
           iidguid        : pguid;
           iidstr         : pshortstring;
+          { store implemented interfaces defs and name mappings }
+          ImplementedInterfaces : TFPObjectList;
           writing_class_record_dbginfo,
           { a class of this type has been created in this module }
           created_in_current_module,
@@ -288,8 +289,7 @@ interface
             this module
           }
           classref_created_in_current_module : boolean;
-          { store implemented interfaces defs and name mappings }
-          ImplementedInterfaces : TFPObjectList;
+          objecttype     : tobjecttyp;
           constructor create(ot:tobjecttyp;const n:string;c:tobjectdef);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
@@ -423,14 +423,14 @@ interface
           procoptions     : tprocoptions;
           callerargareasize,
           calleeargareasize: pint;
-          { number of user visibile parameters }
-          maxparacount,
-          minparacount    : byte;
 {$ifdef m68k}
           exp_funcretloc : tregister;   { explicit funcretloc for AmigaOS }
 {$endif}
           funcretloc : array[tcallercallee] of TCGPara;
           has_paraloc_info : tcallercallee; { paraloc info is available }
+          { number of user visible parameters }
+          maxparacount,
+          minparacount    : byte;
           constructor create(dt:tdeftyp;level:byte);
           constructor ppuload(dt:tdeftyp;ppufile:tcompilerppufile);
           destructor destroy;override;
@@ -536,6 +536,8 @@ interface
 {$ifdef oldregvars}
           regvarinfo: pregvarinfo;
 {$endif oldregvars}
+          { interrupt vector }
+          interruptvector : longint;
           { First/last assembler symbol/instruction in aasmoutput list.
             Note: initialised after compiling the code for the procdef, but
               not saved to/restored from ppu. Used when inserting debug info }
@@ -554,8 +556,6 @@ interface
           interfacedef : boolean;
           { true if the procedure has a forward declaration }
           hasforward  : boolean;
-          { interrupt vector }
-          interruptvector : longint;
           constructor create(level:byte);
           constructor ppuload(ppufile:tcompilerppufile);
           destructor  destroy;override;
@@ -613,10 +613,10 @@ interface
        tenumdef = class(tstoreddef)
           minval,
           maxval    : asizeint;
-          has_jumps : boolean;
           basedef   : tenumdef;
           basedefderef : tderef;
           symtable  : TSymtable;
+          has_jumps : boolean;
           constructor create;
           constructor create_subrange(_basedef:tenumdef;_min,_max:asizeint);
           constructor ppuload(ppufile:tcompilerppufile);

+ 4 - 2
compiler/symtype.pas

@@ -99,13 +99,15 @@ interface
       protected
       public
          fileinfo   : tfileposinfo;
+         { size of fileinfo is 10 bytes, so if a >word aligned type would follow,
+           two bytes of memory would be wasted, so we put two one byte fields over here }
+         visibility : tvisibility;
+         isdbgwritten : boolean;
          symoptions : tsymoptions;
          refs       : longint;
          reflist    : TLinkedList;
-         visibility : tvisibility;
          { deprecated optionally can have a message }
          deprecatedmsg: pshortstring;
-         isdbgwritten : boolean;
          constructor create(st:tsymtyp;const aname:string);
          destructor  destroy;override;
          function  mangledname:string; virtual;