[MLton-commit] r6438
spoons at mlton.org
spoons at mlton.org
Mon Mar 3 07:15:18 PST 2008
Move global state to per-processor data structures.
Some global state (e.g. the current FFI operation) must not be shared
across processors. Use GC_state to store these data.
----------------------------------------------------------------------
U mlton/branches/shared-heap-multicore/mlton/atoms/ffi.fun
U mlton/branches/shared-heap-multicore/mlton/atoms/hash-type.fun
U mlton/branches/shared-heap-multicore/mlton/atoms/prim.fun
U mlton/branches/shared-heap-multicore/mlton/atoms/prim.sig
U mlton/branches/shared-heap-multicore/mlton/backend/rep-type.fun
U mlton/branches/shared-heap-multicore/mlton/backend/runtime.fun
U mlton/branches/shared-heap-multicore/mlton/backend/runtime.sig
U mlton/branches/shared-heap-multicore/mlton/backend/ssa-to-rssa.fun
U mlton/branches/shared-heap-multicore/mlton/codegen/c-codegen/c-codegen.fun
U mlton/branches/shared-heap-multicore/mlton/main/compile.fun
U mlton/branches/shared-heap-multicore/mlton/main/lookup-constant.fun
U mlton/branches/shared-heap-multicore/mlton/ssa/ssa-tree2.fun
U mlton/branches/shared-heap-multicore/runtime/gc/gc_state.c
U mlton/branches/shared-heap-multicore/runtime/gc/gc_state.h
U mlton/branches/shared-heap-multicore/runtime/gc/init.c
----------------------------------------------------------------------
Modified: mlton/branches/shared-heap-multicore/mlton/atoms/ffi.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/atoms/ffi.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/atoms/ffi.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -79,7 +79,7 @@
end
else ()
end)
- val _ = print "Int32 MLton_FFI_op;\n"
+ (* val _ = print "Int32 MLton_FFI_op;\n" *)
in
List.foreach
(!symbols, fn {name, ty} =>
@@ -122,9 +122,9 @@
val _ = List.push (headers, header)
in
print (concat [header, " {\n"])
- ; print (concat ["\tMLton_FFI_op = ", Int.toString id, ";\n"])
+ (* ; print (concat ["\tMLton_FFI_op = ", Int.toString id, ";\n"]) *)
; Vector.foreach (args, fn (_, _, set) => print set)
- ; print ("\tMLton_callFromC ();\n")
+ ; print (concat ["\tMLton_callFromC (", Int.toString id, ");\n"])
; (case res of
NONE => ()
| SOME t =>
Modified: mlton/branches/shared-heap-multicore/mlton/atoms/hash-type.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/atoms/hash-type.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/atoms/hash-type.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -276,6 +276,7 @@
| Exn_setExtendExtra => oneTarg (fn t => ([arrow (t, t)], unit))
| Exn_setInitExtra => oneTarg (fn t => ([t], unit))
| FFI f => done (Vector.toList (CFunction.args f), CFunction.return f)
+ | FFI_getOp => done ([], cint)
| FFI_Symbol _ => done ([], cpointer)
| GC_collect => done ([], unit)
| IntInf_add => intInfBinary ()
Modified: mlton/branches/shared-heap-multicore/mlton/atoms/prim.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/atoms/prim.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/atoms/prim.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -61,6 +61,7 @@
| Exn_setExtendExtra (* implement exceptions *)
| Exn_setInitExtra (* implement exceptions *)
| FFI of 'a CFunction.t (* ssa to rssa *)
+ | FFI_getOp (* XXX DOC spoons *)
| FFI_Symbol of {name: string, cty: CType.t option} (* codegen *)
| GC_collect (* ssa to rssa *)
| IntInf_add (* ssa to rssa *)
@@ -245,6 +246,7 @@
| Exn_setExtendExtra => "Exn_setExtendExtra"
| Exn_setInitExtra => "Exn_setInitExtra"
| FFI f => (CFunction.Target.toString o CFunction.target) f
+ | FFI_getOp => "FFI_getOp"
| FFI_Symbol {name, ...} => name
| GC_collect => "GC_collect"
| IntInf_add => "IntInf_add"
@@ -386,6 +388,7 @@
| (Exn_setExtendExtra, Exn_setExtendExtra) => true
| (Exn_setInitExtra, Exn_setInitExtra) => true
| (FFI f, FFI f') => CFunction.equals (f, f')
+ | (FFI_getOp, FFI_getOp) => true
| (FFI_Symbol {name = n, ...}, FFI_Symbol {name = n', ...}) => n = n'
| (GC_collect, GC_collect) => true
| (IntInf_add, IntInf_add) => true
@@ -549,6 +552,7 @@
| Exn_setExtendExtra => Exn_setExtendExtra
| Exn_setInitExtra => Exn_setInitExtra
| FFI func => FFI (CFunction.map (func, f))
+ | FFI_getOp => FFI_getOp
| FFI_Symbol {name, cty} => FFI_Symbol {name = name, cty = cty}
| GC_collect => GC_collect
| IntInf_add => IntInf_add
@@ -791,6 +795,7 @@
| Exn_setExtendExtra => SideEffect
| Exn_setInitExtra => SideEffect
| FFI _ => Kind.SideEffect
+ | FFI_getOp => SideEffect (* PERF spoons perhaps conservative? *)
| FFI_Symbol _ => Functional
| GC_collect => SideEffect
| IntInf_add => Functional
@@ -992,6 +997,7 @@
Exn_name,
Exn_setExtendExtra,
Exn_setInitExtra,
+ FFI_getOp,
GC_collect,
IntInf_add,
IntInf_andb,
Modified: mlton/branches/shared-heap-multicore/mlton/atoms/prim.sig
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/atoms/prim.sig 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/atoms/prim.sig 2008-03-03 15:15:16 UTC (rev 6438)
@@ -51,6 +51,7 @@
| Exn_setExtendExtra (* implement exceptions *)
| Exn_setInitExtra (* implement exceptions *)
| FFI of 'a CFunction.t (* ssa to rssa *)
+ | FFI_getOp (* XXX DOC spoons *)
| FFI_Symbol of {name: string, cty: CType.t option} (* codegen *)
| GC_collect (* ssa to rssa *)
| IntInf_add (* ssa to rssa *)
Modified: mlton/branches/shared-heap-multicore/mlton/backend/rep-type.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/backend/rep-type.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/backend/rep-type.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -491,10 +491,13 @@
| CurrentThread => thread ()
| CurSourceSeqsIndex => word32
| ExnStack => exnStack ()
+ | FFIOp => word32
| Frontier => cpointer ()
+ | GlobalObjptrNonRoot => cpointer ()
| Limit => cpointer ()
| LimitPlusSlop => cpointer ()
| MaxFrameSize => word32
+ | ReturnToC => word32
| SignalIsPending => word32
| StackBottom => cpointer ()
| StackLimit => cpointer ()
Modified: mlton/branches/shared-heap-multicore/mlton/backend/runtime.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/backend/runtime.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/backend/runtime.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -18,10 +18,13 @@
| CurrentThread
| CurSourceSeqsIndex
| ExnStack
+ | FFIOp
| Frontier
+ | GlobalObjptrNonRoot
| Limit
| LimitPlusSlop
| MaxFrameSize
+ | ReturnToC
| SignalIsPending
| StackBottom
| StackLimit
@@ -32,27 +35,33 @@
val currentThreadOffset: Bytes.t ref = ref Bytes.zero
val curSourceSeqsIndexOffset: Bytes.t ref = ref Bytes.zero
val exnStackOffset: Bytes.t ref = ref Bytes.zero
+ val ffiOpOffset: Bytes.t ref = ref Bytes.zero
val frontierOffset: Bytes.t ref = ref Bytes.zero
+ val globalObjptrNonRootOffset: Bytes.t ref = ref Bytes.zero
val limitOffset: Bytes.t ref = ref Bytes.zero
val limitPlusSlopOffset: Bytes.t ref = ref Bytes.zero
val maxFrameSizeOffset: Bytes.t ref = ref Bytes.zero
+ val returnToCOffset: Bytes.t ref = ref Bytes.zero
val signalIsPendingOffset: Bytes.t ref = ref Bytes.zero
val stackBottomOffset: Bytes.t ref = ref Bytes.zero
val stackLimitOffset: Bytes.t ref = ref Bytes.zero
val stackTopOffset: Bytes.t ref = ref Bytes.zero
fun setOffsets {atomicState, cardMapAbsolute, currentThread, curSourceSeqsIndex,
- exnStack, frontier, limit, limitPlusSlop, maxFrameSize,
- signalIsPending, stackBottom, stackLimit, stackTop} =
+ exnStack, ffiOp, frontier, globalObjptrNonRoot, limit, limitPlusSlop, maxFrameSize,
+ returnToC, signalIsPending, stackBottom, stackLimit, stackTop} =
(atomicStateOffset := atomicState
; cardMapAbsoluteOffset := cardMapAbsolute
; currentThreadOffset := currentThread
; curSourceSeqsIndexOffset := curSourceSeqsIndex
; exnStackOffset := exnStack
+ ; ffiOpOffset := ffiOp
; frontierOffset := frontier
+ ; globalObjptrNonRootOffset := globalObjptrNonRoot
; limitOffset := limit
; limitPlusSlopOffset := limitPlusSlop
; maxFrameSizeOffset := maxFrameSize
+ ; returnToCOffset := returnToC
; signalIsPendingOffset := signalIsPending
; stackBottomOffset := stackBottom
; stackLimitOffset := stackLimit
@@ -64,10 +73,13 @@
| CurrentThread => !currentThreadOffset
| CurSourceSeqsIndex => !curSourceSeqsIndexOffset
| ExnStack => !exnStackOffset
+ | FFIOp => !ffiOpOffset
| Frontier => !frontierOffset
+ | GlobalObjptrNonRoot => !globalObjptrNonRootOffset
| Limit => !limitOffset
| LimitPlusSlop => !limitPlusSlopOffset
| MaxFrameSize => !maxFrameSizeOffset
+ | ReturnToC => !returnToCOffset
| SignalIsPending => !signalIsPendingOffset
| StackBottom => !stackBottomOffset
| StackLimit => !stackLimitOffset
@@ -78,27 +90,33 @@
val currentThreadSize: Bytes.t ref = ref Bytes.zero
val curSourceSeqsIndexSize: Bytes.t ref = ref Bytes.zero
val exnStackSize: Bytes.t ref = ref Bytes.zero
+ val ffiOpSize: Bytes.t ref = ref Bytes.zero
val frontierSize: Bytes.t ref = ref Bytes.zero
+ val globalObjptrNonRootSize: Bytes.t ref = ref Bytes.zero
val limitSize: Bytes.t ref = ref Bytes.zero
val limitPlusSlopSize: Bytes.t ref = ref Bytes.zero
val maxFrameSizeSize: Bytes.t ref = ref Bytes.zero
+ val returnToCSize: Bytes.t ref = ref Bytes.zero
val signalIsPendingSize: Bytes.t ref = ref Bytes.zero
val stackBottomSize: Bytes.t ref = ref Bytes.zero
val stackLimitSize: Bytes.t ref = ref Bytes.zero
val stackTopSize: Bytes.t ref = ref Bytes.zero
fun setSizes {atomicState, cardMapAbsolute, currentThread, curSourceSeqsIndex,
- exnStack, frontier, limit, limitPlusSlop, maxFrameSize,
- signalIsPending, stackBottom, stackLimit, stackTop} =
+ exnStack, ffiOp, frontier, globalObjptrNonRoot, limit, limitPlusSlop, maxFrameSize,
+ returnToC, signalIsPending, stackBottom, stackLimit, stackTop} =
(atomicStateSize := atomicState
; cardMapAbsoluteSize := cardMapAbsolute
; currentThreadSize := currentThread
; curSourceSeqsIndexSize := curSourceSeqsIndex
; exnStackSize := exnStack
+ ; ffiOpSize := ffiOp
; frontierSize := frontier
+ ; globalObjptrNonRootSize := globalObjptrNonRoot
; limitSize := limit
; limitPlusSlopSize := limitPlusSlop
; maxFrameSizeSize := maxFrameSize
+ ; returnToCSize := returnToC
; signalIsPendingSize := signalIsPending
; stackBottomSize := stackBottom
; stackLimitSize := stackLimit
@@ -110,10 +128,13 @@
| CurrentThread => !currentThreadSize
| CurSourceSeqsIndex => !curSourceSeqsIndexSize
| ExnStack => !exnStackSize
+ | FFIOp => !ffiOpSize
| Frontier => !frontierSize
+ | GlobalObjptrNonRoot => !globalObjptrNonRootSize
| Limit => !limitSize
| LimitPlusSlop => !limitPlusSlopSize
| MaxFrameSize => !maxFrameSizeSize
+ | ReturnToC => !returnToCSize
| SignalIsPending => !signalIsPendingSize
| StackBottom => !stackBottomSize
| StackLimit => !stackLimitSize
@@ -125,10 +146,13 @@
| CurrentThread => "CurrentThread"
| CurSourceSeqsIndex => "CurSourceSeqsIndex"
| ExnStack => "ExnStack"
+ | FFIOp => "FFIOp"
| Frontier => "Frontier"
+ | GlobalObjptrNonRoot => "GlobalObjptrNonRoot"
| Limit => "Limit"
| LimitPlusSlop => "LimitPlusSlop"
| MaxFrameSize => "MaxFrameSize"
+ | ReturnToC => "ReturnToC"
| SignalIsPending => "SignalIsPending"
| StackBottom => "StackBottom"
| StackLimit => "StackLimit"
Modified: mlton/branches/shared-heap-multicore/mlton/backend/runtime.sig
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/backend/runtime.sig 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/backend/runtime.sig 2008-03-03 15:15:16 UTC (rev 6438)
@@ -25,10 +25,13 @@
| CurrentThread
| CurSourceSeqsIndex
| ExnStack
+ | FFIOp
| Frontier (* The place where the next object is allocated. *)
+ | GlobalObjptrNonRoot
| Limit (* frontier + heapSize - LIMIT_SLOP *)
| LimitPlusSlop (* frontier + heapSize *)
| MaxFrameSize
+ | ReturnToC
| SignalIsPending
| StackBottom
| StackLimit (* Must have StackTop <= StackLimit *)
@@ -41,10 +44,13 @@
currentThread: Bytes.t,
curSourceSeqsIndex: Bytes.t,
exnStack: Bytes.t,
+ ffiOp: Bytes.t,
frontier: Bytes.t,
+ globalObjptrNonRoot: Bytes.t,
limit: Bytes.t,
limitPlusSlop: Bytes.t,
maxFrameSize: Bytes.t,
+ returnToC: Bytes.t,
signalIsPending: Bytes.t,
stackBottom: Bytes.t,
stackLimit: Bytes.t,
@@ -54,10 +60,13 @@
currentThread: Bytes.t,
curSourceSeqsIndex: Bytes.t,
exnStack: Bytes.t,
+ ffiOp: Bytes.t,
frontier: Bytes.t,
+ globalObjptrNonRoot: Bytes.t,
limit: Bytes.t,
limitPlusSlop: Bytes.t,
maxFrameSize: Bytes.t,
+ returnToC: Bytes.t,
signalIsPending: Bytes.t,
stackBottom: Bytes.t,
stackLimit: Bytes.t,
Modified: mlton/branches/shared-heap-multicore/mlton/backend/ssa-to-rssa.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/backend/ssa-to-rssa.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/backend/ssa-to-rssa.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -99,6 +99,20 @@
target = Direct "MLton_exit",
writesStackTop = true}
+ val ffiGetOp = fn () =>
+ T {args = Vector.new1 (Type.gcState ()),
+ bytesNeeded = NONE,
+ convention = Cdecl,
+ ensuresBytesFree = false,
+ mayGC = false,
+ maySwitchThreads = false,
+ modifiesFrontier = false,
+ prototype = (Vector.new1 CType.gcState, SOME CType.Int32),
+ readsStackTop = false,
+ return = Type.word WordSize.word32,
+ target = Direct "FFI_getOp",
+ writesStackTop = false}
+
fun gcArrayAllocate {return} =
T {args = Vector.new4 (Type.gcState (),
Type.csize (),
@@ -1168,6 +1182,11 @@
| CPointer_setReal _ => cpointerSet ()
| CPointer_setWord _ => cpointerSet ()
| FFI f => simpleCCall f
+ (* PERF spoons this not a very efficient way of
+ getting this value (since we know its offset *)
+ | FFI_getOp =>
+ simpleCCallWithGCState
+ (CFunction.ffiGetOp ())
| GC_collect =>
ccall
{args = (Vector.new5
Modified: mlton/branches/shared-heap-multicore/mlton/codegen/c-codegen/c-codegen.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/codegen/c-codegen/c-codegen.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/codegen/c-codegen/c-codegen.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -226,7 +226,6 @@
in
print (concat [prefix, s, " global", s,
" [", C.int (Global.numberOfType t), "];\n"])
- ; print (concat [prefix, s, " CReturn", CType.name t, ";\n"])
end)
val _ =
print (concat [prefix, "Pointer globalObjptrNonRoot [",
@@ -236,6 +235,20 @@
()
end
+fun declareCReturns (print) =
+ let
+ val _ =
+ List.foreach
+ (CType.all, fn t =>
+ let
+ val s = CType.toString t
+ in
+ print (concat ["\t", s, " CReturn", CType.name t, ";\n"])
+ end)
+ in
+ ()
+ end
+
fun outputDeclarations
{additionalMainArgs: string list,
includes: string list,
@@ -1021,7 +1034,7 @@
(fptr::args) => (fptr, args)
| _ => Error.bug "CCodegen.outputTransfer: CCall,Indirect"
val name =
- concat ["(*(",
+ concat ["(*(", (* " *)
CFunction.cPointerType func,
" ", fptr, "))"]
in
@@ -1135,7 +1148,10 @@
fun outputOffsets () =
List.foreach
([("ExnStackOffset", GCField.ExnStack),
+ ("FFIOpOffset", GCField.FFIOp),
("FrontierOffset", GCField.Frontier),
+ ("GlobalObjptrNonRootOffset", GCField.GlobalObjptrNonRoot),
+ ("ReturnToCOffset", GCField.ReturnToC),
("StackBottomOffset", GCField.StackBottom),
("StackTopOffset", GCField.StackTop)],
fn (name, f) =>
@@ -1150,6 +1166,7 @@
; declareProfileLabels ()
; C.callNoSemi ("Chunk", [chunkLabelToString chunkLabel], print)
; print "\n"
+ ; declareCReturns (print)
; declareRegisters ()
; C.callNoSemi ("ChunkSwitch", [chunkLabelToString chunkLabel],
print)
@@ -1165,7 +1182,8 @@
; done ()
end
val additionalMainArgs =
- [chunkLabelToString chunkLabel,
+ [C.int (Global.numberOfNonRoot ()),
+ chunkLabelToString chunkLabel,
labelToStringIndex label]
val {print, done, ...} = outputC ()
fun rest () =
Modified: mlton/branches/shared-heap-multicore/mlton/main/compile.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/main/compile.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/main/compile.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -460,10 +460,13 @@
currentThread = get "currentThread_Offset",
curSourceSeqsIndex = get "sourceMaps.curSourceSeqsIndex_Offset",
exnStack = get "exnStack_Offset",
+ ffiOp = get "ffiOp_Offset",
frontier = get "frontier_Offset",
+ globalObjptrNonRoot = get "globalObjptrNonRoot_Offset",
limit = get "limit_Offset",
limitPlusSlop = get "limitPlusSlop_Offset",
maxFrameSize = get "maxFrameSize_Offset",
+ returnToC = get "returnToC_Offset",
signalIsPending = get "signalsInfo.signalIsPending_Offset",
stackBottom = get "stackBottom_Offset",
stackLimit = get "stackLimit_Offset",
@@ -476,10 +479,13 @@
currentThread = get "currentThread_Size",
curSourceSeqsIndex = get "sourceMaps.curSourceSeqsIndex_Size",
exnStack = get "exnStack_Size",
+ ffiOp = get "ffiOp_Size",
frontier = get "frontier_Size",
+ globalObjptrNonRoot = get "globalObjptrNonRoot_Size",
limit = get "limit_Size",
limitPlusSlop = get "limitPlusSlop_Size",
maxFrameSize = get "maxFrameSize_Size",
+ returnToC = get "returnToC_Size",
signalIsPending = get "signalsInfo.signalIsPending_Size",
stackBottom = get "stackBottom_Size",
stackLimit = get "stackLimit_Size",
Modified: mlton/branches/shared-heap-multicore/mlton/main/lookup-constant.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/main/lookup-constant.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/main/lookup-constant.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -49,11 +49,14 @@
"currentThread",
"sourceMaps.curSourceSeqsIndex",
"exnStack",
+ "ffiOp",
"frontier",
"generationalMaps.cardMapAbsolute",
+ "globalObjptrNonRoot",
"limit",
"limitPlusSlop",
"maxFrameSize",
+ "returnToC",
"signalsInfo.signalIsPending",
"stackBottom",
"stackLimit",
Modified: mlton/branches/shared-heap-multicore/mlton/ssa/ssa-tree2.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/ssa/ssa-tree2.fun 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/mlton/ssa/ssa-tree2.fun 2008-03-03 15:15:16 UTC (rev 6438)
@@ -394,6 +394,7 @@
| CPointer_toWord => done ([cpointer], csize)
| FFI f => done (Vector.toList (CFunction.args f),
CFunction.return f)
+ | FFI_getOp => done ([], cint)
| FFI_Symbol _ => done ([], cpointer)
| GC_collect => done ([], unit)
| IntInf_add => intInfBinary ()
Modified: mlton/branches/shared-heap-multicore/runtime/gc/gc_state.c
===================================================================
--- mlton/branches/shared-heap-multicore/runtime/gc/gc_state.c 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/runtime/gc/gc_state.c 2008-03-03 15:15:16 UTC (rev 6438)
@@ -17,13 +17,19 @@
displayGenerationalMaps (s, &s->generationalMaps,
stream);
fprintf (stream, "\theap\n");
- displayHeap (s, &s->heap,
+ displayHeap (s, s->heap,
stream);
fprintf (stream,
+ "\tstart = "FMTPTR"\n"
+ "\tfrontier = "FMTPTR"\n"
"\tlimit = "FMTPTR"\n"
+ "\tlimitPlusSlop = "FMTPTR"\n"
"\tstackBottom = "FMTPTR"\n"
"\tstackTop = "FMTPTR"\n",
+ (uintptr_t)s->start,
+ (uintptr_t)s->frontier,
(uintptr_t)s->limit,
+ (uintptr_t)s->limitPlusSlop,
(uintptr_t)s->stackBottom,
(uintptr_t)s->stackTop);
}
@@ -80,12 +86,12 @@
/* We must use it for debugging purposes. */
FORCE_GENERATIONAL
/* We just did a mark compact, so it will be advantageous to to use it. */
- or (s->lastMajorStatistics.kind == GC_MARK_COMPACT)
+ or (s->lastMajorStatistics->kind == GC_MARK_COMPACT)
/* The live ratio is low enough to make it worthwhile. */
- or ((float)h->size / (float)s->lastMajorStatistics.bytesLive
+ or ((float)h->size / (float)s->lastMajorStatistics->bytesLive
<= (h->size < s->sysvals.ram
- ? s->controls.ratios.copyGenerational
- : s->controls.ratios.markCompactGenerational))
+ ? s->controls->ratios.copyGenerational
+ : s->controls->ratios.markCompactGenerational))
)) {
s->canMinor = TRUE;
nursery = genNursery;
Modified: mlton/branches/shared-heap-multicore/runtime/gc/gc_state.h
===================================================================
--- mlton/branches/shared-heap-multicore/runtime/gc/gc_state.h 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/runtime/gc/gc_state.h 2008-03-03 15:15:16 UTC (rev 6438)
@@ -13,7 +13,7 @@
* referenced, and having them at smaller offsets may decrease code
* size and improve cache performance.
*/
- pointer frontier; /* heap.start <= frontier < limit */
+ pointer frontier; /* start <= frontier < limit */
pointer limit; /* limit = heap.start + heap.size */
pointer stackTop; /* Top of stack in current thread. */
pointer stackLimit; /* stackBottom + stackSize - maxFrameSize */
@@ -28,13 +28,17 @@
objptr callFromCHandlerThread; /* Handler for exported C calls (in heap). */
struct GC_callStackState callStackState;
bool canMinor; /* TRUE iff there is space for a minor gc. */
- struct GC_controls controls;
- struct GC_cumulativeStatistics cumulativeStatistics;
+ struct GC_controls *controls;
+ struct GC_cumulativeStatistics *cumulativeStatistics;
objptr currentThread; /* Currently executing thread (in heap). */
+ uint32_t ffiOp;
struct GC_forwardState forwardState;
GC_frameLayout frameLayouts; /* Array of frame layouts. */
uint32_t frameLayoutsLength; /* Cardinality of frameLayouts array. */
struct GC_generationalMaps generationalMaps;
+ /* Currently only used to hold raise operands. XXX at least i think so */
+ Pointer *globalObjptrNonRoot;
+ /* Ordinary globals */
objptr *globals;
uint32_t globalsLength;
bool hashConsDuringGC;
@@ -47,11 +51,19 @@
uint32_t magic; /* The magic number for this executable. */
uint32_t maxFrameSize;
bool mutatorMarksCards;
+ /* The maximum amount of concurrency */
+ int32_t numberOfProcs;
GC_objectHashTable objectHashTable;
GC_objectType objectTypes; /* Array of object types. */
uint32_t objectTypesLength; /* Cardinality of objectTypes array. */
+ /* States for each processor */
+ GC_state procStates;
struct GC_profiling profiling;
GC_frameIndex (*returnAddressToFrameIndex) (GC_returnAddress ra);
+ uint32_t returnToC;
+ /* Roots that may be, for example, on the C call stack */
+ objptr *roots;
+ uint32_t rootsLength;
objptr savedThread; /* Result of GC_copyCurrentThread.
* Thread interrupted by arrival of signal.
*/
@@ -62,11 +74,14 @@
struct GC_signalsInfo signalsInfo;
struct GC_sourceMaps sourceMaps;
pointer stackBottom; /* Bottom of stack in current thread. */
+ pointer start; /* Like heap.nursery but per processor. nursery <= start <= frontier */
uintmax_t startTime; /* The time when GC_init or GC_loadWorld was called. */
+ int32_t syncReason;
struct GC_sysvals sysvals;
struct GC_vectorInit *vectorInits;
uint32_t vectorInitsLength;
GC_weak weaks; /* Linked list of (live) weak pointers */
+ char *worldFile;
};
#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
@@ -79,7 +94,8 @@
static inline void setGCStateCurrentThreadAndStack (GC_state s);
static void setGCStateCurrentHeap (GC_state s,
size_t oldGenBytesRequested,
- size_t nurseryBytesRequested);
+ size_t nurseryBytesRequested,
+ bool duringInit);
#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/shared-heap-multicore/runtime/gc/init.c
===================================================================
--- mlton/branches/shared-heap-multicore/runtime/gc/init.c 2008-03-03 15:07:53 UTC (rev 6437)
+++ mlton/branches/shared-heap-multicore/runtime/gc/init.c 2008-03-03 15:15:16 UTC (rev 6438)
@@ -309,6 +309,7 @@
sigemptyset (&s->signalsInfo.signalsHandled);
sigemptyset (&s->signalsInfo.signalsPending);
s->startTime = getCurrentTime ();
+ s->syncReason = SYNC_NONE;
s->sysvals.totalRam = GC_totalRam ();
s->sysvals.pageSize = GC_pageSize ();
s->weaks = NULL;
More information about the MLton-commit
mailing list