瀏覽代碼

+ extra sanity checks in TCGPara.ppuwrite()

git-svn-id: trunk@15358 -
Jonas Maebe 15 年之前
父節點
當前提交
c8d75245a9
共有 1 個文件被更改,包括 20 次插入11 次删除
  1. 20 11
      compiler/parabase.pas

+ 20 - 11
compiler/parabase.pas

@@ -268,19 +268,28 @@ implementation
           begin
           begin
             ppufile.putbyte(byte(hparaloc^.Size));
             ppufile.putbyte(byte(hparaloc^.Size));
             ppufile.putbyte(byte(hparaloc^.loc));
             ppufile.putbyte(byte(hparaloc^.loc));
-            if hparaloc^.loc=LOC_REFERENCE then
-              begin
-                ppufile.putlongint(longint(hparaloc^.reference.index));
-                ppufile.putaint(hparaloc^.reference.offset);
-              end
-            else
-              begin
+            case hparaloc^.loc of
+              LOC_REFERENCE:
+                begin
+                  ppufile.putlongint(longint(hparaloc^.reference.index));
+                  ppufile.putaint(hparaloc^.reference.offset);
+                end;
+              LOC_FPUREGISTER,
+              LOC_CFPUREGISTER,
+              LOC_MMREGISTER,
+              LOC_CMMREGISTER,
+              LOC_REGISTER,
+              LOC_CREGISTER :
+                begin
 {$ifdef powerpc64}
 {$ifdef powerpc64}
-                ppufile.putbyte(hparaloc^.shiftval);
+                  ppufile.putbyte(hparaloc^.shiftval);
 {$endif}
 {$endif}
-                ppufile.putlongint(longint(hparaloc^.register));
-              end;
-            hparaloc:=hparaloc^.Next;
+                  ppufile.putlongint(longint(hparaloc^.register));
+                end;
+              else
+                internalerror(2010053115);
+            end;
+            hparaloc:=hparaloc^.next;
           end;
           end;
       end;
       end;