Browse Source

* always keep track of the field about to be emitted in curfield, as we
will need this for LLVM to determine whether the emitted data completely
matches the definition (if not, we have to create a def for the actual
data)
- removed no longer used fieldoffsets property

git-svn-id: trunk@32712 -

Jonas Maebe 9 years ago
parent
commit
5774238887
1 changed files with 7 additions and 15 deletions
  1. 7 15
      compiler/aasmcnst.pas

+ 7 - 15
compiler/aasmcnst.pas

@@ -133,7 +133,6 @@ type
     private
     private
      fnextfieldname: TIDString;
      fnextfieldname: TIDString;
      function getcuroffset: asizeint;
      function getcuroffset: asizeint;
-     function getfieldoffset(l: longint): asizeint;
      procedure setnextfieldname(AValue: TIDString);
      procedure setnextfieldname(AValue: TIDString);
     protected
     protected
      { type of the aggregate }
      { type of the aggregate }
@@ -173,7 +172,6 @@ type
      property curfield: tfieldvarsym read fcurfield write fcurfield;
      property curfield: tfieldvarsym read fcurfield write fcurfield;
      property nextfield: tfieldvarsym read fnextfield write fnextfield;
      property nextfield: tfieldvarsym read fnextfield write fnextfield;
      property nextfieldname: TIDString write setnextfieldname;
      property nextfieldname: TIDString write setnextfieldname;
-     property fieldoffset[l: longint]: asizeint read getfieldoffset;
      property curoffset: asizeint read getcuroffset;
      property curoffset: asizeint read getcuroffset;
      property anonrecord: boolean read fanonrecord write fanonrecord;
      property anonrecord: boolean read fanonrecord write fanonrecord;
    end;
    end;
@@ -489,15 +487,6 @@ implementation
       end;
       end;
 
 
 
 
-    function taggregateinformation.getfieldoffset(l: longint): asizeint;
-      var
-        field: tfieldvarsym;
-      begin
-        field:=tfieldvarsym(tabstractrecorddef(def).symtable.symlist[l]);
-        result:=field.fieldoffset;
-      end;
-
-
     procedure taggregateinformation.setnextfieldname(AValue: TIDString);
     procedure taggregateinformation.setnextfieldname(AValue: TIDString);
       begin
       begin
         if (fnextfieldname<>'') or
         if (fnextfieldname<>'') or
@@ -518,6 +507,7 @@ implementation
 
 
     function taggregateinformation.prepare_next_field(nextfielddef: tdef): asizeint;
     function taggregateinformation.prepare_next_field(nextfielddef: tdef): asizeint;
       var
       var
+        sym: tsym;
         currentoffset,nextoffset: asizeint;
         currentoffset,nextoffset: asizeint;
         i: longint;
         i: longint;
       begin
       begin
@@ -546,14 +536,16 @@ implementation
               end
               end
             else if fnextfieldname<>'' then
             else if fnextfieldname<>'' then
               internalerror(2015071501);
               internalerror(2015071501);
+            currentoffset:=curoffset;
             { find next field }
             { find next field }
             i:=curindex;
             i:=curindex;
             repeat
             repeat
               inc(i);
               inc(i);
-            until (tsym(tabstractrecorddef(def).symtable.symlist[i]).typ=fieldvarsym) and
-              not(sp_static in tsym(tabstractrecorddef(def).symtable.symlist[i]).symoptions);
-            nextoffset:=fieldoffset[i];
-            currentoffset:=curoffset;
+              sym:=tsym(tabstractrecorddef(def).symtable.symlist[i]);
+            until (sym.typ=fieldvarsym) and
+              not(sp_static in sym.symoptions);
+            curfield:=tfieldvarsym(sym);
+            nextoffset:=curfield.fieldoffset;
             curindex:=i;
             curindex:=i;
           end;
           end;
         { need padding? }
         { need padding? }