Procházet zdrojové kódy

* fixed alignment of variant records
* more alignment problems fixed

florian před 21 roky
rodič
revize
cf25a973f8

+ 5 - 4
compiler/aasmtai.pas

@@ -182,9 +182,6 @@ interface
       { please keep the size of this record <=12 bytes and keep it properly aligned }
       toper = record
         ot : longint;
-{$ifdef FPC_REQUIRES_PROPER_ALIGNMENT}
-        dummy1,dummy2,dummy3 : byte;
-{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
         case typ : toptype of
           top_none   : ();
           top_reg    : (reg:tregister);
@@ -2217,7 +2214,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.87  2004-08-14 14:50:42  florian
+  Revision 1.88  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.87  2004/08/14 14:50:42  florian
     * fixed several sparc alignment issues
     + Jonas' inline node patch; non functional yet
 

+ 9 - 1
compiler/fpcdefs.inc

@@ -81,6 +81,10 @@
   {$define oldset}
 {$endif sparc}
 
+{$ifdef cpusparc}
+  {$undef useinline}
+{$endif cpusparc}
+
 {$ifdef powerpc}
   {$define noopt}
   {$define oldset}
@@ -102,7 +106,11 @@
 
 {
   $Log$
-  Revision 1.38  2004-06-20 08:55:29  florian
+  Revision 1.39  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.38  2004/06/20 08:55:29  florian
     * logs truncated
 
   Revision 1.37  2004/06/16 20:07:07  florian

+ 7 - 3
compiler/ncgld.pas

@@ -410,11 +410,11 @@ implementation
           the most complex code. Exceptions for this are:
 	    - result is in flags, loading left will then destroy the flags
 	    - result need reference count, when left points to a value used in
-	      right then decreasing the refcnt on left can possibly release 
+	      right then decreasing the refcnt on left can possibly release
 	      the memory before right increased the refcnt, result is that an
 	      empty value is assigned
 	    - calln, call destroys most registers and is therefor 'complex'
-	    
+	
 	   But not when the result is in the flags, then
           loading the left node afterwards can destroy the flags.
 
@@ -959,7 +959,11 @@ begin
 end.
 {
   $Log$
-  Revision 1.121  2004-07-15 20:47:53  jonas
+  Revision 1.122  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.121  2004/07/15 20:47:53  jonas
     - disabled temp-to-temp copy optimization, because it can cause errors
       now that the local variables are temps as well (it can cause local
       variables to be "freed" in the middle of a procedure)

+ 12 - 5
compiler/pdecvar.pas

@@ -1209,13 +1209,16 @@ implementation
               symtablestack:=symtablestack.next;
               { Align the offset where the union symtable is added }
               if (trecordsymtable(symtablestack).usefieldalignment=-1) then
-                usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
+                usedalign:=used_align(unionsymtable.recordalignment,aktalignment.recordalignmin,aktalignment.maxCrecordalign)
               else
-                usedalign:=used_align(maxalignment,aktalignment.recordalignmin,aktalignment.recordalignmax);
+                usedalign:=used_align(unionsymtable.recordalignment,aktalignment.recordalignmin,aktalignment.recordalignmax);
+
               offset:=align(trecordsymtable(symtablestack).datasize,usedalign);
               trecordsymtable(symtablestack).datasize:=offset+unionsymtable.datasize;
-              if maxalignment>trecordsymtable(symtablestack).fieldalignment then
-                trecordsymtable(symtablestack).fieldalignment:=maxalignment;
+
+              if unionsymtable.recordalignment>trecordsymtable(symtablestack).fieldalignment then
+                trecordsymtable(symtablestack).fieldalignment:=unionsymtable.recordalignment;
+
               trecordsymtable(symtablestack).insertunionst(Unionsymtable,offset);
               Unionsym.owner:=nil;
               unionsym.free;
@@ -1231,7 +1234,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.77  2004-08-07 19:14:50  florian
+  Revision 1.78  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.77  2004/08/07 19:14:50  florian
     * fixed problem with explicit specified calling conventions for property symbols
 
   Revision 1.76  2004/07/14 23:19:22  olle

+ 8 - 8
compiler/sparc/cpubase.pas

@@ -168,7 +168,7 @@ uses
 
       { reference record }
       preference = ^treference;
-      treference = packed record
+      treference = record
          { base register, R_NO if none }
          base,
          { index register, R_NO if none }
@@ -224,11 +224,7 @@ type
         References are given from the caller's point of view. The usual
         TLocation isn't used, because contains a lot of unnessary fields.
       }
-      tparalocation =
-{$ifndef FPC_REQUIRES_PROPER_ALIGNMENT}
-      packed
-{$endif FPC_REQUIRES_PROPER_ALIGNMENT}
-      record
+      tparalocation = record
          Size : TCGSize;
          { The location type where the parameter is passed, usually
            LOC_REFERENCE,LOC_REGISTER or LOC_FPUREGISTER
@@ -262,7 +258,7 @@ type
        end;
 
 
-      tlocation = packed record
+      tlocation = record
          size : TCGSize;
          loc : tcgloc;
          case tcgloc of
@@ -571,7 +567,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.69  2004-08-14 14:50:42  florian
+  Revision 1.70  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.69  2004/08/14 14:50:42  florian
     * fixed several sparc alignment issues
     + Jonas' inline node patch; non functional yet
 

+ 6 - 2
compiler/symtable.pas

@@ -1107,7 +1107,7 @@ implementation
             varalign:=ps.vartype.def.alignment;
             if varalign=0 then
               varalign:=size_2_align(ps.getvaluesize);
-            varalignrecord:=used_align(varalign,aktalignment.recordalignmin,aktalignment.recordalignmax);
+            varalignrecord:=used_align(varalign,aktalignment.recordalignmin,fieldalignment);
             recordalignment:=max(recordalignment,varalignrecord);
 
             { next }
@@ -2316,7 +2316,11 @@ implementation
 end.
 {
   $Log$
-  Revision 1.152  2004-07-09 22:17:32  peter
+  Revision 1.153  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.152  2004/07/09 22:17:32  peter
     * revert has_localst patch
     * replace aktstaticsymtable/aktglobalsymtable with current_module
 

+ 6 - 2
compiler/systems/i_linux.pas

@@ -344,7 +344,7 @@ unit i_linux;
             use_function_relative_addresses : true
           );
 
-       system_SPARC_linux_info : tsysteminfo =
+       system_sparc_linux_info : tsysteminfo =
           (
             system       : system_SPARC_Linux;
             name         : 'Linux for SPARC';
@@ -514,7 +514,11 @@ initialization
 end.
 {
   $Log$
-  Revision 1.28  2004-06-29 21:00:08  peter
+  Revision 1.29  2004-08-15 13:30:18  florian
+    * fixed alignment of variant records
+    * more alignment problems fixed
+
+  Revision 1.28  2004/06/29 21:00:08  peter
     * only enable dwarf for supported platforms
 
   Revision 1.27  2004/06/20 08:55:32  florian