x86 codegen bug

Matthew Fluet mfluet@intertrust.com
Tue, 19 Jun 2001 16:07:00 -0700 (PDT)


> Matthew, I am getting an Overflow exception from the x86codegen when compiling
> the following program.

In x86-mlton.sml, at the very end in the definition of bug, change the
definition of temp to the following:

	val temp
	  = MemLoc.imm {base = Immediate.const_int 0,
			index = Immediate.const_int 0,
			scale = wordScale,
			size = wordSize,
			commit = MemLoc.Commit.commit {isTemp = false,
						       onFlush = false},
			class = MemLoc.Class.new "Bug"}

The change is to the isTemp flag (and the class, although that's
irrelevant in this incarnation) -- I was tracking the liveness of this
(dummy) memory location as though it were a pseudo-reg, but it is never
def'd.  Essentially, I needed some transfer to put after the halting call
to MLton_bug, so there is an unconditional jump to 0wx0; yes, we'll
segfault, but we'll never get here.  Anyways, without a def, it looked
like the memloc was live in the entire block; so, at any given point,
looking forward for the next use was overflowing, and looking backward for
the last def was returning 0.