[MLton-commit] r6981
Wesley Terpstra
wesley at mlton.org
Mon Nov 10 04:20:42 PST 2008
Correct the definition of CFunction.size from r6978 by referring to
atoms/c-function.fun:136. The previous patch tried to ensure that the GC
invariants were setup before calling GC_size (which runs the collector).
Otherwise, the marking trace of the heap could fail (specifically by tracing
the stack of the current thrad).
Unfortunately, that patch mistakenly set maySwitchThreads=true rather than
mayGC=true. Furthermore, according to c-function.fun, mayGC must also imply
modifiesFrontier and writesStackTop, even though in this case they will never
be modified.
----------------------------------------------------------------------
U mlton/trunk/mlton/backend/ssa-to-rssa.fun
----------------------------------------------------------------------
Modified: mlton/trunk/mlton/backend/ssa-to-rssa.fun
===================================================================
--- mlton/trunk/mlton/backend/ssa-to-rssa.fun 2008-11-06 19:23:13 UTC (rev 6980)
+++ mlton/trunk/mlton/backend/ssa-to-rssa.fun 2008-11-10 12:20:42 UTC (rev 6981)
@@ -249,19 +249,19 @@
bytesNeeded = NONE,
convention = Cdecl,
ensuresBytesFree = false,
- mayGC = false,
- maySwitchThreads = true, (* Ensure the stack has a return address
- * this guards against the GC possibly
- * tracing the current thread's stack.
- *)
- modifiesFrontier = false,
+ mayGC = true, (* MLton.size works by running the garbage
+ * collector to trace the heap. Make sure all
+ * invariants needed to do this safely are true.
+ *)
+ maySwitchThreads = false,
+ modifiesFrontier = true,
prototype = (Vector.new2 (CType.gcState, CType.cpointer),
SOME (CType.csize ())),
readsStackTop = true,
return = Type.csize (),
symbolScope = Private,
target = Direct "GC_size",
- writesStackTop = false}
+ writesStackTop = true}
end
structure Name =
More information about the MLton-commit
mailing list