[MLton-commit] r6453

spoons at mlton.org spoons at mlton.org
Mon Mar 3 07:38:59 PST 2008


Mark uses of global state in backend and basis implementation.

Mark (but don't fix) uses of global state that should probably
be fixed in any parallel extension of MLton.

----------------------------------------------------------------------

U   mlton/branches/shared-heap-multicore/basis-library/mlton/exit.sml
U   mlton/branches/shared-heap-multicore/basis-library/mlton/finalizable.sml
U   mlton/branches/shared-heap-multicore/basis-library/mlton/profile.sml
U   mlton/branches/shared-heap-multicore/basis-library/mlton/random.sml
U   mlton/branches/shared-heap-multicore/basis-library/mlton/signal.sml
U   mlton/branches/shared-heap-multicore/mlton/backend/backend.fun

----------------------------------------------------------------------

Modified: mlton/branches/shared-heap-multicore/basis-library/mlton/exit.sml
===================================================================
--- mlton/branches/shared-heap-multicore/basis-library/mlton/exit.sml	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/basis-library/mlton/exit.sml	2008-03-03 15:38:54 UTC (rev 6453)
@@ -16,6 +16,7 @@
             val success = fromInt 0
          end
 
+      (* XX spoons global state seems bad *)
       val exiting = ref false
 
       fun atExit f =

Modified: mlton/branches/shared-heap-multicore/basis-library/mlton/finalizable.sml
===================================================================
--- mlton/branches/shared-heap-multicore/basis-library/mlton/finalizable.sml	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/basis-library/mlton/finalizable.sml	2008-03-03 15:38:54 UTC (rev 6453)
@@ -32,6 +32,7 @@
 
 val finalize =
    let
+ (* XXX spoons finalizers use global shared state *)
       val r: {clean: unit -> unit,
               isAlive: unit -> bool} list ref = ref []
       fun clean l =

Modified: mlton/branches/shared-heap-multicore/basis-library/mlton/profile.sml
===================================================================
--- mlton/branches/shared-heap-multicore/basis-library/mlton/profile.sml	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/basis-library/mlton/profile.sml	2008-03-03 15:38:54 UTC (rev 6453)
@@ -20,6 +20,7 @@
                          isFreed: bool ref,
                          raw: P.Data.t}
 
+      (* XXX spoons profiling uses global shared state *)
       val all: t list ref = ref []
 
       local
@@ -76,6 +77,7 @@
                           (String.nullTerm file))
    end
 
+(* XXX spoons profiling uses global shared state *)
 val r: Data.t ref = ref (Data.make P.Data.dummy)
 
 fun current () = !r

Modified: mlton/branches/shared-heap-multicore/basis-library/mlton/random.sml
===================================================================
--- mlton/branches/shared-heap-multicore/basis-library/mlton/random.sml	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/basis-library/mlton/random.sml	2008-03-03 15:38:54 UTC (rev 6453)
@@ -54,6 +54,7 @@
          open Word
          val seed: word ref = ref 0w13
       in
+      (* XXX spoons random uses global shared state *)
          (* From page 284 of Numerical Recipes in C. *)
          fun rand (): word =
             let
@@ -80,6 +81,7 @@
             in
                loop (IntInf.pow (2, Word.wordSize), 0)
             end
+      (* XXX spoons random uses global shared state *)
          val r: word ref = ref 0w0
          val count: int ref = ref refresh
          val numChars = Word.fromInt numChars

Modified: mlton/branches/shared-heap-multicore/basis-library/mlton/signal.sml
===================================================================
--- mlton/branches/shared-heap-multicore/basis-library/mlton/signal.sml	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/basis-library/mlton/signal.sml	2008-03-03 15:38:54 UTC (rev 6453)
@@ -109,6 +109,7 @@
 datatype handler = datatype Handler.t
 
 local
+  (* XXX spoons signals use global shared state *)
    val r = ref C_Int.zero
 in
    fun initHandler (s: signal): Handler.t =
@@ -134,6 +135,7 @@
        handlers)
    end
 
+(* XXX spoons signal use global shared state *)
 val gcHandler = ref Ignore
 
 fun handled () =

Modified: mlton/branches/shared-heap-multicore/mlton/backend/backend.fun
===================================================================
--- mlton/branches/shared-heap-multicore/mlton/backend/backend.fun	2008-03-03 15:38:28 UTC (rev 6452)
+++ mlton/branches/shared-heap-multicore/mlton/backend/backend.fun	2008-03-03 15:38:54 UTC (rev 6453)
@@ -368,6 +368,7 @@
                   let
                      val gs =
                         Vector.map (ts, fn ty =>
+                                    (* XXX spoons should use per-proc *)
                                     M.Live.Global
                                     (Global.new {isRoot = false,
                                                  ty = ty}))




More information about the MLton-commit mailing list