[MLton] cvs commit: fixed strange
Stephen Weeks
sweeks@mlton.org
Wed, 30 Jun 2004 10:46:48 -0700
sweeks 04/06/30 10:46:46
Modified: mlton/backend backend.fun machine.fun machine.sig
Log:
MAIL fixed "strange Offset" bug
Fixed problem in backend that generated Offsets with an immediate
base, causing the codegen to choke. The problem showed up as
x86Translate.translateChunk::x86Translate.Chunk.toX86Chunk::x86Translate.Block.toX86Blocks::x86Translate.Statement.toX86Blocks::RP(1): Pointers (pt_1178) = OP (Cast (0x1, Pointers (pt_1567)), 0)::x86Translate.Operand.toX86Operand::toX86Operand: strange Offset: base: $0x1
Revision Changes Path
1.76 +9 -3 mlton/mlton/backend/backend.fun
Index: backend.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/backend/backend.fun,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- backend.fun 3 Jun 2004 03:55:24 -0000 1.75
+++ backend.fun 30 Jun 2004 17:46:45 -0000 1.76
@@ -441,9 +441,15 @@
| GCState => M.Operand.GCState
| Line => M.Operand.Line
| Offset {base, offset, ty} =>
- M.Operand.Offset {base = translateOperand base,
- offset = offset,
- ty = ty}
+ let
+ val base = translateOperand base
+ in
+ if M.Operand.isLocation base
+ then M.Operand.Offset {base = base,
+ offset = offset,
+ ty = ty}
+ else M.Operand.bogus ty
+ end
| PointerTycon pt =>
M.Operand.Word
(WordX.fromIntInf
1.73 +6 -0 mlton/mlton/backend/machine.fun
Index: machine.fun
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/backend/machine.fun,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- machine.fun 30 Jun 2004 00:37:14 -0000 1.72
+++ machine.fun 30 Jun 2004 17:46:46 -0000 1.73
@@ -319,6 +319,12 @@
| Register _ => true
| StackOffset _ => true
| _ => false
+
+ val bogus: Type.t -> t =
+ fn t =>
+ case Type.deReal t of
+ NONE => Word (WordX.fromIntInf (0, WordSize.fromBits (Type.width t)))
+ | SOME s => Real (RealX.zero s)
end
structure Switch = Switch (open Atoms
1.50 +2 -0 mlton/mlton/backend/machine.sig
Index: machine.sig
===================================================================
RCS file: /cvsroot/mlton/mlton/mlton/backend/machine.sig,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- machine.sig 3 Jun 2004 03:55:25 -0000 1.49
+++ machine.sig 30 Jun 2004 17:46:46 -0000 1.50
@@ -93,8 +93,10 @@
| StackTop
| Word of WordX.t
+ val bogus: Type.t -> t
val equals: t * t -> bool
val interfere: t * t -> bool
+ val isLocation: t -> bool
val layout: t -> Layout.t
val stackOffset: {offset: Bytes.t, ty: Type.t} -> t
val toString: t -> string