Browse Source

* updated for new tvarrec

peter 27 years ago
parent
commit
c2ae04ae25
1 changed files with 16 additions and 16 deletions
  1. 16 16
      compiler/cg386ld.pas

+ 16 - 16
compiler/cg386ld.pas

@@ -634,6 +634,7 @@ implementation
         hp    : ptree;
         hp    : ptree;
         href  : treference;
         href  : treference;
         lt    : pdef;
         lt    : pdef;
+        vaddr : boolean;
         vtype : longint;
         vtype : longint;
       begin
       begin
         clear_reference(p^.location.reference);
         clear_reference(p^.location.reference);
@@ -647,6 +648,7 @@ implementation
             exit;
             exit;
            { find the correct vtype value }
            { find the correct vtype value }
            vtype:=$ff;
            vtype:=$ff;
+           vaddr:=false;
            lt:=hp^.left^.resulttype;
            lt:=hp^.left^.resulttype;
            case lt^.deftype of
            case lt^.deftype of
            enumdef,
            enumdef,
@@ -660,11 +662,10 @@ implementation
                        else
                        else
                         if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then
                         if (lt^.deftype=orddef) and (porddef(lt)^.typ=uchar) then
                          vtype:=vtChar;
                          vtype:=vtChar;
-                       emit_mov_loc_ref(hp^.left^.location,href);
                      end;
                      end;
           floatdef : begin
           floatdef : begin
                        vtype:=vtExtended;
                        vtype:=vtExtended;
-                       emit_lea_loc_ref(hp^.left^.location,href);
+                       vaddr:=true;
                      end;
                      end;
         procvardef,
         procvardef,
         pointerdef : begin
         pointerdef : begin
@@ -672,37 +673,33 @@ implementation
                         vtype:=vtPChar
                         vtype:=vtPChar
                        else
                        else
                         vtype:=vtPointer;
                         vtype:=vtPointer;
-                       emit_mov_loc_ref(hp^.left^.location,href);
-                     end;
-       classrefdef : begin
-                       vtype:=vtClass;
-                       emit_mov_loc_ref(hp^.left^.location,href);
                      end;
                      end;
+       classrefdef : vtype:=vtClass;
          objectdef : begin
          objectdef : begin
                        vtype:=vtObject;
                        vtype:=vtObject;
-                       emit_mov_loc_ref(hp^.left^.location,href);
                      end;
                      end;
          stringdef : begin
          stringdef : begin
                        if is_shortstring(lt) then
                        if is_shortstring(lt) then
                         begin
                         begin
                           vtype:=vtString;
                           vtype:=vtString;
-                          emit_lea_loc_ref(hp^.left^.location,href);
+                          vaddr:=true;
                         end
                         end
                        else
                        else
                         if is_ansistring(lt) then
                         if is_ansistring(lt) then
-                         begin
-                           vtype:=vtAnsiString;
-                           emit_mov_loc_ref(hp^.left^.location,href);
-                         end;
+                         vtype:=vtAnsiString;
                      end;
                      end;
            end;
            end;
            if vtype=$ff then
            if vtype=$ff then
             internalerror(14357);
             internalerror(14357);
            { update href to the vtype field and write it }
            { update href to the vtype field and write it }
-           inc(href.offset,4);
            exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,
            exprasmlist^.concat(new(pai386,op_const_ref(A_MOV,S_L,
              vtype,newreference(href))));
              vtype,newreference(href))));
-           { update href to the next element }
+           inc(href.offset,4);
+           { write changing field update href to the next element }
+           if vaddr then
+            emit_lea_loc_ref(hp^.left^.location,href)
+           else
+            emit_mov_loc_ref(hp^.left^.location,href);
            inc(href.offset,4);
            inc(href.offset,4);
            { load next entry }
            { load next entry }
            hp:=hp^.right;
            hp:=hp^.right;
@@ -713,7 +710,10 @@ implementation
 end.
 end.
 {
 {
   $Log$
   $Log$
-  Revision 1.19  1998-09-23 17:49:59  peter
+  Revision 1.20  1998-09-24 14:26:03  peter
+    * updated for new tvarrec
+
+  Revision 1.19  1998/09/23 17:49:59  peter
     * high(arrayconstructor) is now correct
     * high(arrayconstructor) is now correct
     * procvardef support for variant record
     * procvardef support for variant record