You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(56) |
Sep
(40) |
Oct
(30) |
Nov
(144) |
Dec
(23) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(41) |
Feb
(29) |
Mar
(31) |
Apr
(39) |
May
(193) |
Jun
(45) |
Jul
(19) |
Aug
(3) |
Sep
(23) |
Oct
(83) |
Nov
(92) |
Dec
(123) |
2007 |
Jan
(90) |
Feb
(267) |
Mar
(120) |
Apr
(51) |
May
(40) |
Jun
(121) |
Jul
(109) |
Aug
(173) |
Sep
(77) |
Oct
(52) |
Nov
(121) |
Dec
(62) |
2008 |
Jan
(76) |
Feb
(53) |
Mar
(98) |
Apr
(87) |
May
(26) |
Jun
(27) |
Jul
(23) |
Aug
(136) |
Sep
(79) |
Oct
(68) |
Nov
(29) |
Dec
(14) |
2009 |
Jan
(7) |
Feb
(2) |
Mar
(11) |
Apr
(75) |
May
(1) |
Jun
(95) |
Jul
(19) |
Aug
(4) |
Sep
(8) |
Oct
(93) |
Nov
(43) |
Dec
(21) |
2010 |
Jan
(20) |
Feb
(23) |
Mar
(18) |
Apr
(6) |
May
(20) |
Jun
(23) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(2) |
Feb
(6) |
Mar
(15) |
Apr
(5) |
May
(9) |
Jun
(14) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(17) |
Jul
(37) |
Aug
|
Sep
(1) |
Oct
(6) |
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(5) |
Apr
(2) |
May
(7) |
Jun
(11) |
Jul
(8) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(1) |
Jul
(7) |
Aug
(2) |
Sep
|
Oct
(5) |
Nov
(2) |
Dec
(4) |
2015 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
(9) |
Jul
(1) |
Aug
|
Sep
|
Oct
(4) |
Nov
(1) |
Dec
|
2016 |
Jan
(2) |
Feb
(1) |
Mar
(1) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
|
Sep
(5) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
(3) |
Mar
(3) |
Apr
(7) |
May
(2) |
Jun
(2) |
Jul
(5) |
Aug
(1) |
Sep
(2) |
Oct
(17) |
Nov
(4) |
Dec
(7) |
2018 |
Jan
(5) |
Feb
(14) |
Mar
(2) |
Apr
(5) |
May
(2) |
Jun
(5) |
Jul
|
Aug
(2) |
Sep
|
Oct
(3) |
Nov
(5) |
Dec
|
2019 |
Jan
(4) |
Feb
(2) |
Mar
(3) |
Apr
(1) |
May
(8) |
Jun
(14) |
Jul
(2) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
(15) |
Dec
(2) |
2020 |
Jan
(10) |
Feb
(3) |
Mar
(1) |
Apr
|
May
(9) |
Jun
(4) |
Jul
(16) |
Aug
(10) |
Sep
(4) |
Oct
(3) |
Nov
|
Dec
|
2021 |
Jan
(11) |
Feb
(2) |
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
(5) |
Sep
|
Oct
(6) |
Nov
(4) |
Dec
(4) |
2022 |
Jan
(4) |
Feb
(2) |
Mar
(2) |
Apr
|
May
(6) |
Jun
(3) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(5) |
Jun
(1) |
Jul
(4) |
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(13) |
Dec
|
2024 |
Jan
(1) |
Feb
|
Mar
(5) |
Apr
|
May
(10) |
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
|
Nov
(1) |
Dec
(14) |
2025 |
Jan
(3) |
Feb
|
Mar
(1) |
Apr
|
May
(2) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Matthew F. <fl...@ml...> - 2005-11-08 19:56:13
|
Added DEBUG_DFS_MARK control ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h 2005-11-09 03:17:04 UTC (rev 4184) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h 2005-11-09 03:56:08 UTC (rev 4185) @@ -15,6 +15,7 @@ DEBUG_CALL_STACK = FALSE, DEBUG_CARD_MARKING = FALSE, DEBUG_DETAILED = FALSE, + DEBUG_DFS_MARK = FALSE, DEBUG_ENTER_LEAVE = FALSE, DEBUG_GENERATIONAL = FALSE, DEBUG_MARK_COMPACT = FALSE, Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c 2005-11-09 03:17:04 UTC (rev 4184) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.c 2005-11-09 03:56:08 UTC (rev 4185) @@ -76,7 +76,7 @@ * nextHeader is the header of next. * todo is a pointer to the pointer inside cur that points to next. */ - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "markNext" " cur = "FMTPTR" next = "FMTPTR @@ -95,7 +95,7 @@ prev = cur; cur = next; mark: - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "mark cur = "FMTPTR" prev = "FMTPTR" mode = %s\n", (uintptr_t)cur, (uintptr_t)prev, (mode == MARK_MODE) ? "mark" : "unmark"); @@ -130,7 +130,7 @@ todo = cur + sizeofNumNonObjptrs (NORMAL_TAG, numNonObjptrs); index = 0; markInNormal: - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "markInNormal index = %"PRIu32"\n", index); assert (index < numObjptrs); // next = *(pointer*)todo; @@ -186,7 +186,7 @@ /* Skip to the first pointer. */ todo += sizeofNumNonObjptrs (ARRAY_TAG, numNonObjptrs); markInArray: - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "markInArray arrayIndex = %"PRIu32" index = %"PRIu32"\n", arrayIndex, index); assert (arrayIndex < getArrayLength (cur)); @@ -234,7 +234,7 @@ * to be marked. */ assert (getStackBottom (s, (GC_stack)cur) <= top); - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "markInStack top = %zu\n", (size_t)(top - getStackBottom (s, (GC_stack)cur))); if (top == getStackBottom (s, (GC_stack)(cur))) @@ -252,7 +252,7 @@ todo = top - frameLayout->size + frameOffsets [index + 1]; // next = *(pointer*)todo; next = fetchObjptrToPointer (todo, s->heap.start); - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, " offset %u todo "FMTPTR" next = "FMTPTR"\n", frameOffsets [index + 1], @@ -278,7 +278,7 @@ * Need to set the pointer in the prev object that pointed to cur * to point back to prev, and restore prev. */ - if (DEBUG_MARK_COMPACT) + if (DEBUG_DFS_MARK) fprintf (stderr, "return cur = "FMTPTR" prev = "FMTPTR"\n", (uintptr_t)cur, (uintptr_t)prev); assert (isPointerMarkedByMode (cur, mode)); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c 2005-11-09 03:17:04 UTC (rev 4184) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c 2005-11-09 03:56:08 UTC (rev 4185) @@ -73,7 +73,7 @@ if (WEAK_TAG == tag and 1 == numObjptrs) { GC_header objptrHeader; - if (DEBUG_WEAK) + if (DEBUG_MARK_COMPACT or DEBUG_WEAK) fprintf (stderr, "clearIfWeakAndUnmarkedForMarkCompact ("FMTPTR") header = "FMTHDR"\n", (uintptr_t)p, header); objptrHeader = getHeader (objptrToPointer(((GC_weak)p)->objptr, s->heap.start)); |
From: Stephen W. <sw...@ml...> - 2005-11-08 19:17:05
|
Cleaned up. ---------------------------------------------------------------------- U mlton/trunk/bin/regression ---------------------------------------------------------------------- Modified: mlton/trunk/bin/regression =================================================================== --- mlton/trunk/bin/regression 2005-11-09 02:41:58 UTC (rev 4183) +++ mlton/trunk/bin/regression 2005-11-09 03:17:04 UTC (rev 4184) @@ -12,14 +12,14 @@ exit 1 } -cross='no' -fail='no' -runOnly='no' -short='no' +cross='false' +fail='false' +runOnly='false' +short='false' while [ "$#" -gt 0 ]; do case "$1" in -cross) - cross='yes' + cross='true' shift if [ "$#" = 0 ]; then usage @@ -28,11 +28,11 @@ shift ;; -fail) - fail='yes' + fail='true' shift ;; -run-only) - runOnly='yes' + runOnly='true' shift if [ "$#" = 0 ]; then usage @@ -41,7 +41,7 @@ shift ;; -short) - short='yes' + short='true' shift ;; *) @@ -57,7 +57,7 @@ lib="$src/build/lib" mlton="$bin/mlton" flags="-type-check true $flags" -if [ $cross = 'yes' ]; then +if $cross; then flags="$flags -target $crossTarget -stop g" fi cont='callcc.sml callcc2.sml callcc3.sml once.sml' @@ -80,7 +80,7 @@ cd $src/regression -if [ "$fail" = 'yes' ]; then +if $fail; then for f in `ls fail/*.sml`; do echo "testing $f" ( $mlton $flags -stop tc $f >/dev/null 2>&1 && @@ -133,8 +133,7 @@ extraFlags="" ;; esac - case "$runOnly" in - no) + if (! $runOnly); then mlb="$f.mlb" echo "\$(SML_LIB)/basis/basis.mlb \$(SML_LIB)/basis/mlton.mlb @@ -149,12 +148,10 @@ cmd="$mlton $flags $extraFlags -output $f $mlb" eval $cmd rm $mlb - if [ "$?" -ne '0' ] || - [ "$cross" = 'no' -a ! -x "$f" ]; then + if [ "$?" -ne '0' ] || ((! $cross) && [ ! -x "$f" ]); then compFail $f fi - ;; - yes) + else case $crossTarget in *mingw) libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32' @@ -180,9 +177,8 @@ -L/usr/pkg/lib \ -L/usr/local/lib \ $files $libs - ;; - esac - if [ ! -r $f.nonterm -a $cross = 'no' -a -x $f ]; then + fi + if [ ! -r $f.nonterm -a $cross = 'false' -a -x $f ]; then nonZeroMsg='Nonzero exit status.' if $forMinGW; then nonZeroMsg="$nonZeroMsg"'\r' @@ -203,7 +199,7 @@ fi fi done -if [ "$cross" = 'yes' -o "$runOnly" = 'yes' -o "$short" = 'yes' ]; then +if $cross || $runOnly || $short; then exit 0 fi mmake clean >/dev/null |
From: Matthew F. <fl...@ml...> - 2005-11-08 18:42:02
|
Format diagnostic message ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.c ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c 2005-11-09 02:10:07 UTC (rev 4182) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c 2005-11-09 02:41:58 UTC (rev 4183) @@ -9,7 +9,7 @@ void displayGCState (GC_state s, FILE *stream) { fprintf (stream, "GC state\n"); - fprintf (stream, "\tcurrentThread"FMTOBJPTR"\n", s->currentThread); + fprintf (stream, "\tcurrentThread = "FMTOBJPTR"\n", s->currentThread); displayThread (s, (GC_thread)(objptrToPointer (s->currentThread, s->heap.start)), stream); fprintf (stream, "\tgenerational\n"); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.c 2005-11-09 02:10:07 UTC (rev 4182) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.c 2005-11-09 02:41:58 UTC (rev 4183) @@ -27,7 +27,7 @@ s->heap.oldGenSize); createCardMapAndCrossMap (s); read_safe (fd, s->heap.start, s->heap.oldGenSize); - (*s->loadGlobals) (fd); + (*(s->loadGlobals)) (fd); // unless (EOF == fgetc (file)) // die ("Invalid world: junk at end of file."); /* translateHeap must occur after loading the heap and globals, @@ -72,7 +72,7 @@ writeObjptr (fd, s->currentThread); writeObjptr (fd, s->signalHandlerThread); write_safe (fd, s->heap.start, s->heap.oldGenSize); - (*s->saveGlobals) (fd); + (*(s->saveGlobals)) (fd); } void GC_saveWorld (GC_state s, int fd) { |
From: Matthew F. <fl...@ml...> - 2005-11-08 18:10:12
|
Cleanup ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun 2005-11-09 02:09:08 UTC (rev 4181) +++ mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun 2005-11-09 02:10:07 UTC (rev 4182) @@ -1352,9 +1352,9 @@ CFunction.weakCanGet {arg = Operand.ty (a 0)} in - ccall {args = (Vector.concat - [Vector.new1 GCState, - vos args]), + ccall {args = (Vector.new2 + (GCState, + Vector.sub (vos args, 0))), func = func} end, fn () => move (Operand.bool false)) @@ -1368,9 +1368,9 @@ {arg = Operand.ty (a 0), return = t} in - ccall {args = (Vector.concat - [Vector.new1 GCState, - vos args]), + ccall {args = (Vector.new2 + (GCState, + Vector.sub (vos args, 0))), func = func} end, none) |
From: Matthew F. <fl...@ml...> - 2005-11-08 18:09:10
|
Bad imports ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-09 02:02:01 UTC (rev 4180) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-09 02:09:08 UTC (rev 4181) @@ -398,10 +398,10 @@ val collect = _prim "GC_collect": unit -> unit; val pack = _import "MLton_GC_pack": unit -> unit; val setHashConsDuringGC = - _import "GC_setHashConsDuringGC": bool -> unit; - val setMessages = _import "GC_setMessages": bool -> unit; - val setRusageMeasureGC = _import "GC_setRusageMeasureGC": bool -> unit; - val setSummary = _import "GC_setSummary": bool -> unit; + _import "MLton_GC_setHashConsDuringGC": bool -> unit; + val setMessages = _import "MLton_GC_setMessages": bool -> unit; + val setRusageMeasureGC = _import "MLton_GC_setRusageMeasureGC": bool -> unit; + val setSummary = _import "MLton_GC_setSummary": bool -> unit; val unpack = _import "MLton_GC_unpack": unit -> unit; end |
From: Stephen W. <sw...@ml...> - 2005-11-08 18:02:04
|
Improved regression script for MinGW. For some reason, MinGW sed doesn't do the right thing with \r, so I hardwired Cygwin sed for now. ---------------------------------------------------------------------- U mlton/trunk/bin/regression ---------------------------------------------------------------------- Modified: mlton/trunk/bin/regression =================================================================== --- mlton/trunk/bin/regression 2005-11-09 02:01:22 UTC (rev 4179) +++ mlton/trunk/bin/regression 2005-11-09 02:02:01 UTC (rev 4180) @@ -90,6 +90,16 @@ exit 0 fi +forMinGW='false' +if [ `host-os` = mingw ]; then + forMinGW='true' +fi +case $crossTarget in +*mingw) + forMinGW='true' +;; +esac + for f in `ls *.sml`; do f=`basename $f .sml` case `host-os` in @@ -174,23 +184,19 @@ esac if [ ! -r $f.nonterm -a $cross = 'no' -a -x $f ]; then nonZeroMsg='Nonzero exit status.' - case $crossTarget in - *mingw) - nonZeroMsg="$nonZeroMsg"'\r' - ;; - esac + if $forMinGW; then + nonZeroMsg="$nonZeroMsg"'\r' + fi ( ./$f || echo -e "$nonZeroMsg" ) >$tmp 2>&1 if [ -r $f.ok ]; then compare="$f.$HOST_ARCH-$HOST_OS.ok" if [ ! -r $compare ]; then compare="$f.ok" fi - case $crossTarget in - *mingw) + if $forMinGW; then compare="$f.sed.ok" - sed 's/$/\r/' <"$f.ok" >"$compare" - ;; - esac + /c/cygwin/bin/sed 's/$/\r/' <"$f.ok" >"$compare" + fi if ! diff $compare $tmp; then echo "difference with $flags" fi |
From: Stephen W. <sw...@ml...> - 2005-11-08 18:01:23
|
Set PREFIX for MinGW. ---------------------------------------------------------------------- U mlton/trunk/Makefile ---------------------------------------------------------------------- Modified: mlton/trunk/Makefile =================================================================== --- mlton/trunk/Makefile 2005-11-08 23:01:51 UTC (rev 4178) +++ mlton/trunk/Makefile 2005-11-09 02:01:22 UTC (rev 4179) @@ -349,6 +349,9 @@ ifeq ($(TARGET_OS), darwin) PREFIX = /usr/local endif +ifeq ($(TARGET_OS), mingw) +PREFIX = /mingw +endif ifeq ($(TARGET_OS), solaris) PREFIX = /usr/local endif |
From: Stephen W. <sw...@ml...> - 2005-11-08 15:01:54
|
With mlton -stop f, always use forward / for path separator. That allows all our Makefiles (which use mlton -stop f) to work without having to do sed hackery. ---------------------------------------------------------------------- U mlton/trunk/mlton/main/main.fun ---------------------------------------------------------------------- Modified: mlton/trunk/mlton/main/main.fun =================================================================== --- mlton/trunk/mlton/main/main.fun 2005-11-08 22:58:45 UTC (rev 4177) +++ mlton/trunk/mlton/main/main.fun 2005-11-08 23:01:51 UTC (rev 4178) @@ -901,6 +901,13 @@ (MLton.GC.pack () ; compileCSO (List.concat [!outputs, csoFiles])) end + fun showFiles (fs: File.t vector) = + Vector.foreach + (fs, fn f => + print (concat [String.translate + (f, fn #"\\" => "/" + | c => str c), + "\n"])) fun compileCM input = let val files = CM.cm {cmfile = input} @@ -916,8 +923,7 @@ in case stop of Place.Files => - List.foreach - (files, fn f => print (concat [f, "\n"])) + showFiles (Vector.fromList files) | Place.SML => saveSML (maybeOut ".sml") | _ => (if !keepSML @@ -970,9 +976,8 @@ val _ = case stop of Place.Files => - Vector.foreach - (Compile.sourceFilesMLB {input = file}, fn f => - print (concat [f, "\n"])) + showFiles + (Compile.sourceFilesMLB {input = file}) | Place.SML => saveSML (maybeOut ".sml") | Place.TypeCheck => trace (Top, "Type Check SML") |
From: Stephen W. <sw...@ml...> - 2005-11-08 14:58:47
|
Use "0" instead of "start" as the first argument to VirtualAlloc because it is more stable on MinGW. ---------------------------------------------------------------------- U mlton/trunk/runtime/platform/windows.c ---------------------------------------------------------------------- Modified: mlton/trunk/runtime/platform/windows.c =================================================================== --- mlton/trunk/runtime/platform/windows.c 2005-11-08 22:48:34 UTC (rev 4176) +++ mlton/trunk/runtime/platform/windows.c 2005-11-08 22:58:45 UTC (rev 4177) @@ -110,7 +110,10 @@ static inline void *Windows_mmapAnon (void *start, size_t length) { void *res; - res = VirtualAlloc ((LPVOID)start, length, MEM_COMMIT, PAGE_READWRITE); + /* Use "0" instead of "start" as the first argument to VirtualAlloc + * because it is more stable on MinGW (at least). + */ + res = VirtualAlloc ((LPVOID)0/*start*/, length, MEM_COMMIT, PAGE_READWRITE); if (NULL == res) res = (void*)-1; return res; |
From: Matthew F. <fl...@ml...> - 2005-11-08 14:48:37
|
Fixed bug in triggering GC signal ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c 2005-11-08 22:05:22 UTC (rev 4175) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c 2005-11-08 22:48:34 UTC (rev 4176) @@ -27,7 +27,7 @@ bool Posix_Signal_isGCPending () { Bool res; - res = GC_getSignalIsPending (&gcState); + res = GC_getGCSignalPending (&gcState); if (DEBUG_SIGNALS) fprintf (stderr, "%s = Posix_Signal_isGCPending ()\n", boolToString (res)); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c 2005-11-08 22:05:22 UTC (rev 4175) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c 2005-11-08 22:48:34 UTC (rev 4176) @@ -37,10 +37,6 @@ return &(s->signalsInfo.signalsHandled); } -bool GC_getSignalIsPending (GC_state s) { - return (s->signalsInfo.signalIsPending); -} - sigset_t* GC_getSignalsPendingAddr (GC_state s) { return &(s->signalsInfo.signalsPending); } @@ -49,6 +45,10 @@ s->signalsInfo.gcSignalHandled = b; } +bool GC_getGCSignalPending (GC_state s) { + return (s->signalsInfo.gcSignalPending); +} + void GC_setGCSignalPending (GC_state s, bool b) { s->signalsInfo.gcSignalPending = b; } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h 2005-11-08 22:05:22 UTC (rev 4175) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h 2005-11-08 22:48:34 UTC (rev 4176) @@ -21,8 +21,8 @@ void GC_setSignalHandlerThread (GC_state s, GC_thread thread); sigset_t* GC_getSignalsHandledAddr (GC_state s); -bool GC_getSignalIsPending (GC_state s); sigset_t* GC_getSignalsPendingAddr (GC_state s); void GC_setGCSignalHandled (GC_state s, bool b); +bool GC_getGCSignalPending (GC_state s); void GC_setGCSignalPending (GC_state s, bool b); |
From: Matthew F. <fl...@ml...> - 2005-11-08 14:05:25
|
Open/Create files with appropriate permission ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile U mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c U mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-08 21:27:52 UTC (rev 4174) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-08 22:05:22 UTC (rev 4175) @@ -165,7 +165,6 @@ rm -f types.h $(CC) $(CFLAGS) $(WARNFLAGS) -o gen-types gen/gen-types.c $(UTILOFILES) ./gen-types - chmod a+r types.h rm -f gen-types gc-gdb.o: gc.c $(GCCFILES) $(HFILES) Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2005-11-08 21:27:52 UTC (rev 4174) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2005-11-08 22:05:22 UTC (rev 4175) @@ -328,12 +328,12 @@ if (s->controls.messages) fprintf (stderr, "Paging heap from "FMTPTR" to %s.\n", (uintptr_t)orig, template); - fd = open_safe (template, O_WRONLY, 0); + fd = open_safe (template, O_WRONLY, S_IRUSR | S_IWUSR); write_safe (fd, orig, size); close_safe (fd); releaseHeap (s, curHeapp); if (createHeap (s, curHeapp, desiredSize, minSize)) { - fd = open_safe (template, O_RDONLY, 0); + fd = open_safe (template, O_RDONLY, S_IRUSR | S_IWUSR); read_safe (fd, curHeapp->start, size); close_safe (fd); unlink_safe (template); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2005-11-08 21:27:52 UTC (rev 4174) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c 2005-11-08 22:05:22 UTC (rev 4175) @@ -82,7 +82,7 @@ int main (int argc, char* argv[]) { int fd; - fd = open_safe ("types.h", O_RDWR | O_CREAT, 0); + fd = open_safe ("types.h", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); for (int i = 0; i < prefixLines; i++) { writeString (fd, prefix[i]); writeNewline (fd); |
From: Stephen W. <sw...@ml...> - 2005-11-08 13:27:56
|
Added some missing EXE's. ---------------------------------------------------------------------- U mlton/trunk/Makefile ---------------------------------------------------------------------- Modified: mlton/trunk/Makefile =================================================================== --- mlton/trunk/Makefile 2005-11-08 20:30:37 UTC (rev 4173) +++ mlton/trunk/Makefile 2005-11-08 21:27:52 UTC (rev 4174) @@ -387,7 +387,8 @@ sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" \ <$(SRC)/bin/mlton-script >$(TBIN)/mlton chmod a+x $(TBIN)/mlton - cd $(BIN) && $(CP) $(LEX) $(NLFFIGEN) $(PROF) $(YACC) $(TBIN)/ + cd $(BIN) && $(CP) $(LEX)$(EXE) $(NLFFIGEN)$(EXE) \ + $(PROF)$(EXE) $(YACC)$(EXE) $(TBIN)/ ( cd $(SRC)/man && tar cf - $(MAN_PAGES)) | \ ( cd $(TMAN)/ && tar xf - ) if $(GZIP_MAN); then \ @@ -397,9 +398,9 @@ cygwin|darwin|solaris) \ ;; \ *) \ - for f in $(TLIB)/$(AOUT) $(TBIN)/$(LEX) \ - $(TBIN)/$(NLFFIGEN) $(TBIN)/$(PROF) \ - $(TBIN)/$(YACC); do \ + for f in $(TLIB)/$(AOUT)$(EXE) $(TBIN)/$(LEX)$(EXE) \ + $(TBIN)/$(NLFFIGEN)$(EXE) $(TBIN)/$(PROF)$(EXE) \ + $(TBIN)/$(YACC)$(EXE); do \ strip --remove-section=.comment \ --remove-section=.note $$f; \ done \ |
From: Stephen W. <sw...@ml...> - 2005-11-08 12:30:40
|
Added .exe suffix on MinGW. ---------------------------------------------------------------------- U mlton/trunk/bin/mlton-script ---------------------------------------------------------------------- Modified: mlton/trunk/bin/mlton-script =================================================================== --- mlton/trunk/bin/mlton-script 2005-11-08 20:22:55 UTC (rev 4172) +++ mlton/trunk/bin/mlton-script 2005-11-08 20:30:37 UTC (rev 4173) @@ -6,11 +6,19 @@ dir=`dirname $0` lib=`cd $dir/../lib && pwd` +eval `$lib/platform` gcc='gcc' -mlton="$lib/mlton-compile" +case "$HOST_OS" in +mingw) + exe='.exe' +;; +*) + exe='' +;; +esac +mlton="$lib/mlton-compile$exe" world="$lib/world.mlton" nj='sml' -eval `$lib/platform` # Try to use the SML/NJ .arch-n-opsys if .arch-n-opsys >/dev/null 2>&1; then eval `.arch-n-opsys` |
From: Stephen W. <sw...@ml...> - 2005-11-08 12:22:57
|
Extended upgrade-basis with an "arch" and "os" argument so it can be used correctly to upgrade the basis when cross compiling. ---------------------------------------------------------------------- U mlton/trunk/bin/upgrade-basis U mlton/trunk/mlton/Makefile ---------------------------------------------------------------------- Modified: mlton/trunk/bin/upgrade-basis =================================================================== --- mlton/trunk/bin/upgrade-basis 2005-11-08 02:59:15 UTC (rev 4171) +++ mlton/trunk/bin/upgrade-basis 2005-11-08 20:22:55 UTC (rev 4172) @@ -11,12 +11,14 @@ name=`basename $0` usage () { - die "usage: $name <PATH>" + die "usage: $name <PATH> <ARCH> <OS>" } case "$#" in -1) +3) PATH="$1" + ARCH="$2" + OS="$3" ;; *) usage @@ -94,7 +96,7 @@ structure LargeWord = Word' eval `$bin/platform` -case $HOST_ARCH in +case "$ARCH" in alpha) arch='Alpha' ;; @@ -132,7 +134,7 @@ die "strange HOST_ARCH: $HOST_ARCH" esac -case $HOST_OS in +case "$OS" in cygwin) os='Cygwin' ;; Modified: mlton/trunk/mlton/Makefile =================================================================== --- mlton/trunk/mlton/Makefile 2005-11-08 02:59:15 UTC (rev 4171) +++ mlton/trunk/mlton/Makefile 2005-11-08 20:22:55 UTC (rev 4172) @@ -9,6 +9,7 @@ SRC = $(shell cd .. && pwd) BUILD = $(SRC)/build BIN = $(BUILD)/bin +HOST_ARCH = $(shell $(SRC)/bin/host-arch) HOST_OS = $(shell $(SRC)/bin/host-os) LIB = $(BUILD)/lib MLTON = mlton @@ -85,7 +86,7 @@ #! Pass $(PATH) to upgrade-basis because it is run via #!/usr/bin/env # bash, which resets the path. $(UP): - $(SRC)/bin/upgrade-basis "$(PATH)" >$(UP) + $(SRC)/bin/upgrade-basis "$(PATH)" "$(HOST_ARCH)" "$(HOST_OS)" >$(UP) mlton.sml: $(SOURCES) rm -f mlton.sml && mlton -stop sml mlton.cm && chmod -w mlton.sml |
From: Matthew F. <fl...@ml...> - 2005-11-07 18:59:44
|
Working towards reintegration of revised GC. Somewhat working. Still seems to be some issues with signals and with pack-real. ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/Makefile U mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/signal.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sig U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sml U mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c U mlton/branches/on-20050822-x86_64-branch/include/bytecode-main.h U mlton/branches/on-20050822-x86_64-branch/include/c-main.h U mlton/branches/on-20050822-x86_64-branch/include/main.h U mlton/branches/on-20050822-x86_64-branch/include/x86-main.h U mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun U mlton/branches/on-20050822-x86_64-branch/mlton/codegen/c-codegen/c-codegen.fun U mlton/branches/on-20050822-x86_64-branch/mlton/main/compile.fun U mlton/branches/on-20050822-x86_64-branch/mlton/main/lookup-constant.fun U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Error.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Stat.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Utimbuf.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/access.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chdir.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chmod.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chown.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/link.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkdir.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkfifo.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/open.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/pathconf.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rename.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rmdir.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/symlink.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/unlink.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/getenv.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setenv.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/SysDB/Group.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawne.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawnp.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/Math.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Real/frexp.c U mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/TODO A mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h A mlton/branches/on-20050822-x86_64-branch/runtime/gc/platform.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/switch-thread.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/virtual-memory.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/virtual-memory.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/weak.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc.h A mlton/branches/on-20050822-x86_64-branch/runtime/gen/ A mlton/branches/on-20050822-x86_64-branch/runtime/gen/gen-types.c A mlton/branches/on-20050822-x86_64-branch/runtime/platform/displayMem.linux.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform/getText.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform/linux.c A mlton/branches/on-20050822-x86_64-branch/runtime/platform/mmap-protect.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform/mmap.c D mlton/branches/on-20050822-x86_64-branch/runtime/platform/ssmmap.c A mlton/branches/on-20050822-x86_64-branch/runtime/platform/sysconf.c D mlton/branches/on-20050822-x86_64-branch/runtime/platform/totalRam.sysconf.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform/use-mmap.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform.h D mlton/branches/on-20050822-x86_64-branch/runtime/types.h U mlton/branches/on-20050822-x86_64-branch/runtime/util.h ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-08 02:59:15 UTC (rev 4171) @@ -276,8 +276,12 @@ $(MAKE) -C runtime $(CP) $(RUN)/*.a $(LIB)/$(TARGET)/ $(CP) runtime/*.h include/*.h $(INC)/ + mkdir -p $(INC)/gc + mkdir -p $(INC)/util mkdir -p $(INC)/platform $(CP) bytecode/interpret.h $(INC) + $(CP) runtime/gc/*.h $(INC)/gc + $(CP) runtime/util/*.h $(INC)/util $(CP) runtime/platform/*.h $(INC)/platform $(MAKE) -C bytecode bytecode/print-opcodes >$(LIB)/opcodes Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-08 02:59:15 UTC (rev 4171) @@ -1705,15 +1705,15 @@ *) val copyCurrent = _prim "Thread_copyCurrent": unit -> unit; val current = _import "Thread_current": unit -> thread; - val finishHandler = _import "Thread_finishHandler": unit -> unit; + val finishSignalHandler = _import "Thread_finishSignalHandler": unit -> unit; val returnToC = _prim "Thread_returnToC": unit -> unit; val saved = _import "Thread_saved": unit -> thread; val savedPre = _import "Thread_saved": unit -> preThread; val setCallFromCHandler = _import "Thread_setCallFromCHandler": thread -> unit; - val setHandler = _import "Thread_setHandler": thread -> unit; + val setSignalHandler = _import "Thread_setSignalHandler": thread -> unit; val setSaved = _import "Thread_setSaved": thread -> unit; - val startHandler = _import "Thread_startHandler": unit -> unit; + val startSignalHandler = _import "Thread_startSignalHandler": unit -> unit; val switchTo = _prim "Thread_switchTo": thread -> unit; end Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/signal.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/signal.sml 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/signal.sml 2005-11-08 02:59:15 UTC (rev 4171) @@ -172,7 +172,7 @@ end) val () = - MLtonThread.setHandler + MLtonThread.setSignalHandler (fn t => let val mask = Mask.getBlocked () @@ -221,7 +221,7 @@ fun suspend m = (Mask.write m ; Prim.suspend () - ; MLtonThread.switchToHandler ()) + ; MLtonThread.switchToSignalHandler ()) fun handleGC f = (Prim.handleGC () Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sig 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sig 2005-11-08 02:59:15 UTC (rev 4171) @@ -63,6 +63,6 @@ val amInSignalHandler: unit -> bool val register: int * (unit -> unit) -> unit - val setHandler: (Runnable.t -> Runnable.t) -> unit - val switchToHandler: unit -> unit + val setSignalHandler: (Runnable.t -> Runnable.t) -> unit + val switchToSignalHandler: unit -> unit end Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sml 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/thread.sml 2005-11-08 02:59:15 UTC (rev 4171) @@ -163,7 +163,7 @@ in fun amInSignalHandler () = InHandler = !state - fun setHandler (f: Runnable.t -> Runnable.t): unit = + fun setSignalHandler (f: Runnable.t -> Runnable.t): unit = let val _ = Primitive.installSignalHandler () fun loop (): unit = @@ -172,7 +172,7 @@ val _ = state := InHandler val t = f (fromPrimitive (Prim.saved ())) val _ = state := Normal - val _ = Prim.finishHandler () + val _ = Prim.finishSignalHandler () val _ = atomicSwitch (fn (T r) => @@ -180,7 +180,7 @@ val _ = case !r of Paused (f, _) => f (fn () => ()) - | _ => raise die "Thread.setHandler saw strange thread" + | _ => raise die "Thread.setSignalHandler saw strange thread" in t end) (* implicit atomicEnd () *) @@ -192,15 +192,15 @@ (new (fn () => loop () handle e => MLtonExn.topLevelHandler e)) val _ = signalHandler := SOME p in - Prim.setHandler p + Prim.setSignalHandler p end - fun switchToHandler () = + fun switchToSignalHandler () = let (* Atomic 0 *) val () = atomicBegin () (* Atomic 1 *) - val () = Prim.startHandler () (* implicit atomicBegin () *) + val () = Prim.startSignalHandler () (* implicit atomicBegin () *) (* Atomic 2 *) in case !signalHandler of Modified: mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -5,14 +5,17 @@ * See the file MLton-LICENSE for details. */ +#define MLTON_GC_INTERNAL #include "platform.h" +#undef MLTON_GC_INTERNAL + #include "interpret.h" #include "c-chunk.h" // c-chunk.h must come before opcode.h because it // redefines some opcode symbols #include "opcode.h" enum { - DEBUG = FALSE, + DEBUG_BYTECODE = FALSE, }; typedef Word32 ArrayIndex; @@ -75,7 +78,7 @@ #define Fetch(t, z) \ do { \ z = *(t*)pc; \ - if (DEBUG or disassemble) { \ + if (DEBUG or DEBUG_BYTECODE or disassemble) { \ if (#z == "label") \ fprintf (stderr, " %s", offsetToLabel[z]); \ else if (#z != "opc") \ @@ -318,10 +321,10 @@ assertRegsEmpty (); \ while (pc < lastCase) { \ Word##size caseWord; \ - if (DEBUG or disassemble) \ + if (DEBUG or DEBUG_BYTECODE or disassemble) \ fprintf (stderr, "\n\t "); \ Fetch (Word##size, caseWord); \ - if (DEBUG or disassemble) \ + if (DEBUG or DEBUG_BYTECODE or disassemble) \ fprintf (stderr, " =>"); \ Fetch (Label, label); \ if (not disassemble and test == caseWord) \ @@ -376,8 +379,9 @@ code = b->code; pcMax = b->code + b->codeSize; - if (DEBUG or disassemble) { - ARRAY (String*, offsetToLabel, b->codeSize); + if (DEBUG or DEBUG_BYTECODE or disassemble) { + offsetToLabel = + (String*)(calloc_safe (b->codeSize, sizeof(*offsetToLabel))); for (i = 0; i < b->nameOffsetsSize; ++i) offsetToLabel [b->nameOffsets[i].codeOffset] = b->addressNames + b->nameOffsets[i].nameOffset; @@ -391,7 +395,7 @@ mainLoop: if (FALSE) displayRegs (); - if (DEBUG or disassemble) { + if (DEBUG or DEBUG_BYTECODE or disassemble) { if (pc == pcMax) goto done; name = offsetToLabel [pc - b->code]; @@ -401,8 +405,8 @@ } assert (code <= pc and pc < pcMax); Fetch (Opcode, opc); - assert (opc < cardof (opcodeStrings)); - if (DEBUG or disassemble) + assert (opc < (cardof (opcodeStrings))); + if (DEBUG or DEBUG_BYTECODE or disassemble) fprintf (stderr, "%s", opcodeStrings[opc]); switch (opc) { prims (); @@ -456,7 +460,7 @@ } assert (FALSE); done: - if (DEBUG or disassemble) + if (DEBUG or DEBUG_BYTECODE or disassemble) free (offsetToLabel); return; } @@ -467,7 +471,7 @@ } void MLton_Bytecode_interpret (Bytecode b, Word32 codeOffset) { - if (DEBUG) { + if (DEBUG or DEBUG_BYTECODE) { fprintf (stderr, "MLton_Bytecode_interpret (0x%08x, %u)\n", (uint)b, (uint)codeOffset); Modified: mlton/branches/on-20050822-x86_64-branch/include/bytecode-main.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/include/bytecode-main.h 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/include/bytecode-main.h 2005-11-08 02:59:15 UTC (rev 4171) @@ -33,7 +33,7 @@ s->canHandle += 3; \ /* Switch to the C Handler thread. */ \ GC_switchToThread (s, s->callFromCHandler, 0); \ - nextFun = *(int*)(s->stackTop - WORD_SIZE); \ + nextFun = *(int*)(s->stackTop - GC_RETURNADDRESS_SIZE); \ MLton_Bytecode_interpret (&MLton_bytecode, nextFun); \ GC_switchToThread (s, s->savedThread, 0); \ s->savedThread = BOGUS_THREAD; \ @@ -48,7 +48,7 @@ nextFun = ml; \ } else { \ /* Return to the saved world */ \ - nextFun = *(int*)(gcState.stackTop - WORD_SIZE); \ + nextFun = *(int*)(gcState.stackTop - GC_RETURNADDRESS_SIZE); \ } \ MLton_Bytecode_interpret (&MLton_bytecode, nextFun); \ } Modified: mlton/branches/on-20050822-x86_64-branch/include/c-main.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/include/c-main.h 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/include/c-main.h 2005-11-08 02:59:15 UTC (rev 4171) @@ -28,29 +28,29 @@ fprintf (stderr, "MLton_callFromC() starting\n"); \ s = &gcState; \ s->savedThread = s->currentThread; \ - s->canHandle += 3; \ + s->atomicState += 3; \ /* Switch to the C Handler thread. */ \ - GC_switchToThread (s, s->callFromCHandler, 0); \ - nextFun = *(int*)(s->stackTop - WORD_SIZE); \ + GC_switchToThread (s, s->callFromCHandlerThread, 0); \ + nextFun = *(int*)(s->stackTop - GC_RETURNADDRESS_SIZE); \ cont.nextChunk = nextChunks[nextFun]; \ returnToC = FALSE; \ do { \ cont=(*(struct cont(*)(void))cont.nextChunk)(); \ } while (not returnToC); \ GC_switchToThread (s, s->savedThread, 0); \ - s->savedThread = BOGUS_THREAD; \ + s->savedThread = BOGUS_OBJPTR; \ if (DEBUG_CCODEGEN) \ fprintf (stderr, "MLton_callFromC done\n"); \ } \ int main (int argc, char **argv) { \ struct cont cont; \ Initialize (al, mg, mfs, mmc, pk, ps); \ - if (gcState.isOriginal) { \ + if (gcState.amOriginal) { \ real_Init(); \ PrepFarJump(mc, ml); \ } else { \ /* Return to the saved world */ \ - nextFun = *(int*)(gcState.stackTop - WORD_SIZE); \ + nextFun = *(int*)(gcState.stackTop - GC_RETURNADDRESS_SIZE); \ cont.nextChunk = nextChunks[nextFun]; \ } \ /* Trampoline */ \ Modified: mlton/branches/on-20050822-x86_64-branch/include/main.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/include/main.h 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/include/main.h 2005-11-08 02:59:15 UTC (rev 4171) @@ -9,7 +9,9 @@ #ifndef _MAIN_H_ #define _MAIN_H_ +#define MLTON_GC_INTERNAL #include "platform.h" +#undef MLTON_GC_INTERNAL /* The label must be declared as weak because gcc's optimizer may prove that * the code that declares the label is dead and hence eliminate the declaration. @@ -25,8 +27,8 @@ #define Vector(a, b, c, d) { a, b, c, d }, #define EndVectors }; -#define LoadArray(a, f) sfread (a, sizeof(*a), cardof(a), f) -#define SaveArray(a, fd) swrite (fd, a, sizeof(*a) * cardof(a)) +#define LoadArray(a, fd) read_safe (fd, a, sizeof(*a) * cardof(a)) +#define SaveArray(a, fd) write_safe (fd, a, sizeof(*a) * cardof(a)) Pointer gcStateAddress; @@ -34,35 +36,35 @@ gcStateAddress = &gcState; \ gcState.alignment = al; \ gcState.atMLtons = atMLtons; \ - gcState.atMLtonsSize = cardof(atMLtons); \ + gcState.atMLtonsLength = cardof(atMLtons); \ gcState.frameLayouts = frameLayouts; \ - gcState.frameLayoutsSize = cardof(frameLayouts); \ - gcState.frameSources = frameSources; \ - gcState.frameSourcesSize = cardof(frameSources); \ + gcState.frameLayoutsLength = cardof(frameLayouts); \ gcState.globals = globalPointer; \ - gcState.globalsSize = cardof(globalPointer); \ + gcState.globalsLength = cardof(globalPointer); \ gcState.intInfInits = intInfInits; \ - gcState.intInfInitsSize = cardof(intInfInits); \ + gcState.intInfInitsLength = cardof(intInfInits); \ gcState.loadGlobals = loadGlobals; \ gcState.magic = mg; \ gcState.maxFrameSize = mfs; \ gcState.mutatorMarksCards = mmc; \ gcState.objectTypes = objectTypes; \ - gcState.objectTypesSize = cardof(objectTypes); \ - gcState.profileKind = pk; \ - gcState.profileStack = ps; \ + gcState.objectTypesLength = cardof(objectTypes); \ gcState.returnAddressToFrameIndex = returnAddressToFrameIndex; \ gcState.saveGlobals = saveGlobals; \ - gcState.sourceLabels = sourceLabels; \ - gcState.sourceLabelsSize = cardof(sourceLabels); \ - gcState.sourceNames = sourceNames; \ - gcState.sourceNamesSize = cardof(sourceNames); \ - gcState.sourceSeqs = sourceSeqs; \ - gcState.sourceSeqsSize = cardof(sourceSeqs); \ - gcState.sources = sources; \ - gcState.sourcesSize = cardof(sources); \ gcState.vectorInits = vectorInits; \ - gcState.vectorInitsSize = cardof(vectorInits); \ + gcState.vectorInitsLength = cardof(vectorInits); \ + gcState.sourceMaps.frameSources = frameSources; \ + gcState.sourceMaps.frameSourcesLength = cardof(frameSources); \ + gcState.sourceMaps.sourceLabels = sourceLabels; \ + gcState.sourceMaps.sourceLabelsLength = cardof(sourceLabels); \ + gcState.sourceMaps.sourceNames = sourceNames; \ + gcState.sourceMaps.sourceNamesLength = cardof(sourceNames); \ + gcState.sourceMaps.sourceSeqs = sourceSeqs; \ + gcState.sourceMaps.sourceSeqsLength = cardof(sourceSeqs); \ + gcState.sourceMaps.sources = sources; \ + gcState.sourceMaps.sourcesLength = cardof(sources); \ + gcState.profiling.kind = pk; \ + gcState.profiling.stack = ps; \ MLton_init (argc, argv, &gcState); \ void MLton_callFromC (); Modified: mlton/branches/on-20050822-x86_64-branch/include/x86-main.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/include/x86-main.h 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/include/x86-main.h 2005-11-08 02:59:15 UTC (rev 4171) @@ -93,13 +93,13 @@ fprintf (stderr, "MLton_callFromC() starting\n"); \ s = &gcState; \ s->savedThread = s->currentThread; \ - s->canHandle += 3; \ + s->atomicState += 3; \ /* Return to the C Handler thread. */ \ - GC_switchToThread (s, s->callFromCHandler, 0); \ - jump = *(pointer*)(s->stackTop - WORD_SIZE); \ + GC_switchToThread (s, s->callFromCHandlerThread, 0); \ + jump = *(pointer*)(s->stackTop - GC_RETURNADDRESS_SIZE); \ MLton_jumpToSML(jump); \ GC_switchToThread (s, s->savedThread, 0); \ - s->savedThread = BOGUS_THREAD; \ + s->savedThread = BOGUS_OBJPTR; \ if (DEBUG_X86CODEGEN) \ fprintf (stderr, "MLton_callFromC() done\n"); \ return; \ @@ -109,11 +109,11 @@ extern pointer ml; \ \ Initialize (al, mg, mfs, mmc, pk, ps); \ - if (gcState.isOriginal) { \ + if (gcState.amOriginal) { \ real_Init(); \ jump = (pointer)&ml; \ } else { \ - jump = *(pointer*)(gcState.stackTop - WORD_SIZE); \ + jump = *(pointer*)(gcState.stackTop - GC_RETURNADDRESS_SIZE); \ } \ MLton_jumpToSML(jump); \ return 1; \ Modified: mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun 2005-11-08 02:59:15 UTC (rev 4171) @@ -163,25 +163,41 @@ target = Direct "Thread_switchTo", writesStackTop = true} - fun weakCanGet t = - vanilla {args = Vector.new1 t, - name = "GC_weakCanGet", - prototype = let - open CType - in - (Vector.new1 Pointer, SOME bool) - end, - return = Type.bool} + fun weakCanGet {arg} = + T {args = Vector.new2 (gcState, arg), + bytesNeeded = NONE, + convention = Cdecl, + ensuresBytesFree = false, + mayGC = false, + maySwitchThreads = false, + modifiesFrontier = false, + prototype = let + open CType + in + (Vector.new2 (Pointer, Pointer), SOME bool) + end, + readsStackTop = false, + return = Type.bool, + target = Direct "GC_weakCanGet", + writesStackTop = false} fun weakGet {arg, return} = - vanilla {args = Vector.new1 arg, - name = "GC_weakGet", - prototype = let - open CType - in - (Vector.new1 Pointer, SOME Pointer) - end, - return = return} + T {args = Vector.new2 (gcState, arg), + bytesNeeded = NONE, + convention = Cdecl, + ensuresBytesFree = false, + mayGC = false, + maySwitchThreads = false, + modifiesFrontier = false, + prototype = let + open CType + in + (Vector.new2 (Pointer, Pointer), SOME Pointer) + end, + readsStackTop = false, + return = return, + target = Direct "GC_weakGet", + writesStackTop = false} fun weakNew {arg, return} = T {args = Vector.new3 (gcState, Word32, arg), @@ -1330,16 +1346,33 @@ | Weak_canGet => ifIsWeakPointer (varType (arg 0), - fn _ => simpleCCall (CFunction.weakCanGet - (Operand.ty (a 0))), + fn _ => + let + val func = + CFunction.weakCanGet + {arg = Operand.ty (a 0)} + in + ccall {args = (Vector.concat + [Vector.new1 GCState, + vos args]), + func = func} + end, fn () => move (Operand.bool false)) | Weak_get => ifIsWeakPointer (varType (arg 0), - fn t => (simpleCCall - (CFunction.weakGet - {arg = Operand.ty (a 0), - return = t})), + fn t => + let + val func = + CFunction.weakGet + {arg = Operand.ty (a 0), + return = t} + in + ccall {args = (Vector.concat + [Vector.new1 GCState, + vos args]), + func = func} + end, none) | Weak_new => ifIsWeakPointer Modified: mlton/branches/on-20050822-x86_64-branch/mlton/codegen/c-codegen/c-codegen.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/mlton/codegen/c-codegen/c-codegen.fun 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/mlton/codegen/c-codegen/c-codegen.fun 2005-11-08 02:59:15 UTC (rev 4171) @@ -253,11 +253,11 @@ CType.toString t, ", fd);\n"]))) ; print "}\n") val _ = - (print "static void loadGlobals (FILE *file) {\n" + (print "static void loadGlobals (int fd) {\n" ; (List.foreach (CType.all, fn t => print (concat ["\tLoadArray (global", - CType.toString t, ", file);\n"]))) + CType.toString t, ", fd);\n"]))) ; print "}\n") in () @@ -296,7 +296,7 @@ fun declareFrameOffsets () = Vector.foreachi (frameOffsets, fn (i, v) => - (print (concat ["static ushort frameOffsets", C.int i, "[] = {"]) + (print (concat ["static uint16_t frameOffsets", C.int i, "[] = {"]) ; print (C.int (Vector.length v)) ; Vector.foreach (v, fn i => (print ","; print (C.bytes i))) ; print "};\n")) @@ -309,18 +309,18 @@ print (concat ["\t", toString (i, x), ",\n"])) ; print "};\n") fun declareFrameLayouts () = - declareArray ("GC_frameLayout", "frameLayouts", frameLayouts, + declareArray ("struct GC_frameLayout", "frameLayouts", frameLayouts, fn (_, {frameOffsetsIndex, isC, size}) => concat ["{", C.bool isC, + ", frameOffsets", C.int frameOffsetsIndex, ", ", C.bytes size, - ", frameOffsets", C.int frameOffsetsIndex, "}"]) fun declareAtMLtons () = - declareArray ("string", "atMLtons", !Control.atMLtons, C.string o #2) + declareArray ("char*", "atMLtons", !Control.atMLtons, C.string o #2) fun declareObjectTypes () = declareArray - ("GC_ObjectType", "objectTypes", objectTypes, + ("struct GC_objectType", "objectTypes", objectTypes, fn (_, ty) => let datatype z = datatype Runtime.RObjectType.t @@ -380,22 +380,22 @@ declareProfileLabel (label, print)) ; (Vector.foreachi (sourceSeqs, fn (i, v) => - (print (concat ["static int sourceSeq", + (print (concat ["static uint32_t sourceSeq", Int.toString i, "[] = {"]) ; print (C.int (Vector.length v)) ; Vector.foreach (v, fn i => (print (concat [",", C.int i]))) ; print "};\n"))) - ; declareArray ("uint", "*sourceSeqs", sourceSeqs, fn (i, _) => + ; declareArray ("uint32_t*", "sourceSeqs", sourceSeqs, fn (i, _) => concat ["sourceSeq", Int.toString i]) - ; declareArray ("uint", "frameSources", frameSources, C.int o #2) + ; declareArray ("GC_sourceSeqIndex", "frameSources", frameSources, C.int o #2) ; (declareArray ("struct GC_sourceLabel", "sourceLabels", labels, fn (_, {label, sourceSeqsIndex}) => concat ["{(pointer)&", ProfileLabel.toString label, ", ", C.int sourceSeqsIndex, "}"])) - ; declareArray ("string", "sourceNames", names, C.string o #2) + ; declareArray ("char*", "sourceNames", names, C.string o #2) ; declareArray ("struct GC_source", "sources", sources, fn (_, {nameIndex, successorsIndex}) => concat ["{ ", Int.toString nameIndex, ", ", Modified: mlton/branches/on-20050822-x86_64-branch/mlton/main/compile.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/mlton/main/compile.fun 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/mlton/main/compile.fun 2005-11-08 02:59:15 UTC (rev 4171) @@ -451,15 +451,15 @@ in Runtime.GCField.setOffsets { - canHandle = get "canHandle", - cardMap = get "cardMapForMutator", + canHandle = get "atomicState", + cardMap = get "generationalMaps.cardMapAbsolute", currentThread = get "currentThread", exnStack = get "exnStack", frontier = get "frontier", limit = get "limit", limitPlusSlop = get "limitPlusSlop", maxFrameSize = get "maxFrameSize", - signalIsPending = get "signalIsPending", + signalIsPending = get "signalsInfo.signalIsPending", stackBottom = get "stackBottom", stackLimit = get "stackLimit", stackTop = get "stackTop" Modified: mlton/branches/on-20050822-x86_64-branch/mlton/main/lookup-constant.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/mlton/main/lookup-constant.fun 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/mlton/main/lookup-constant.fun 2005-11-08 02:59:15 UTC (rev 4171) @@ -42,15 +42,15 @@ val gcFields = [ - "canHandle", + "atomicState", "currentThread", "exnStack", "frontier", - "cardMapForMutator", + "generationalMaps.cardMapAbsolute", "limit", "limitPlusSlop", "maxFrameSize", - "signalIsPending", + "signalsInfo.signalIsPending", "stackBottom", "stackLimit", "stackTop" @@ -73,7 +73,8 @@ in List.foreach (List.concat - [["#include \"platform.h\"", + [["#define MLTON_GC_INTERNAL", + "#include \"platform.h\"", "struct GC_state gcState;", "", "int main (int argc, char **argv) {"], Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-08 02:59:15 UTC (rev 4171) @@ -68,18 +68,29 @@ # -Winline -Wdisabled-optimization DEBUGWARNFLAGS = $(DEBUGFLAGS) $(WARNFLAGS) -Wunused +UTILCFILES = \ + $(shell find util -type f | grep '\.c$$') +UTILHFILES = \ + $(shell find util -type f | grep '\.h$$') +UTILOFILES = $(foreach f, $(UTILCFILES), $(basename $(f)).o) + +GCCFILES = \ + $(shell find gc -type f | grep '\.c$$') +GCHFILES = \ + $(shell find gc -type f | grep '\.h$$') + CFILES = \ - $(shell find util -type f | grep '\.c$$') \ + $(UTILCFILES) \ $(shell find basis -type f | grep '\.c$$' | grep -v Real/) \ $(shell find Posix -type f | grep '\.c$$') \ gc.c \ platform.c HFILES = \ + $(UTILHFILES) \ util.h \ - $(shell find util -type f | grep '\.h$$') \ + $(GCHFILES) \ gc.h \ - $(shell find gc -type f | grep '\.h$$') \ types.h \ platform.h \ platform/$(TARGET_OS).h @@ -143,18 +154,26 @@ runtime.c: $(CFILES) cat $(CFILES) >runtime.c -gc.o: gc.c $(shell find gc -type f | grep '\.c$$') $(HFILES) - $(CC) $(CFLAGS) $(WARNFLAGS) -c -o $@ $< -gc-gdb.o: gc.c $(shell find gc -type f | grep '\.c$$') $(HFILES) +util/%-gdb.o: util/%.c util.h $(UTILHFILES) $(CC) $(DEBUGFLAGS) $(DEBUGWARNFLAGS) -O1 -DASSERT=1 -c -o $@ $< -util/%.o: util/%.c $(HFILES) +util/%.o: util/%.c util.h $(UTILHFILES) $(CC) $(CFLAGS) $(WARNFLAGS) -c -o $@ $< -util/%-gdb.o: util/%.c $(HFILES) +types.h: gen/gen-types.c util.h $(UTILOFILES) + rm -f types.h + $(CC) $(CFLAGS) $(WARNFLAGS) -o gen-types gen/gen-types.c $(UTILOFILES) + ./gen-types + chmod a+r types.h + rm -f gen-types + +gc-gdb.o: gc.c $(GCCFILES) $(HFILES) $(CC) $(DEBUGFLAGS) $(DEBUGWARNFLAGS) -O1 -DASSERT=1 -c -o $@ $< +gc.o: gc.c $(GCCFILES) $(HFILES) + $(CC) $(CFLAGS) $(WARNFLAGS) -c -o $@ $< + # It looks like we don't follow the C spec w.r.t. aliasing. And gcc # -O2 catches us on the code in Real/*.c where we treat a double as a # chunk of two words. Files that have been known to cause problems @@ -162,9 +181,9 @@ # with -fno-strict-aliasing to prevent gcc from taking advantage of # this aspect of the C spec. basis/Real/%-gdb.o: basis/Real/%.c gdtoa/arith.h - $(CC) $(DEBUGFLAGS) -O1 -DASSERT=1 -c -o $@ $< + $(CC) $(DEBUGFLAGS) $(WARNFLAGS) -O1 -DASSERT=1 -c -o $@ $< basis/Real/%.o: basis/Real/%.c gdtoa/arith.h - $(CC) $(CFLAGS) -O1 -fno-strict-aliasing -c -o $@ $< + $(CC) $(CFLAGS) $(DEBUGWARNFLAGS) -O1 -fno-strict-aliasing -c -o $@ $< %-gdb.o: %.c $(HFILES) $(CC) $(DEBUGFLAGS) -O1 -DASSERT=1 -c -o $@ $< Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Error.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Error.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Error.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -8,6 +8,6 @@ return errno; } -Cstring Posix_Error_strerror (Syserror n) { +Cstring Posix_Error_strerror (Int n) { return (Cstring)(strerror (n)); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Stat.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Stat.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Stat.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -50,10 +50,10 @@ return fstat (f, &statbuf); } -Int Posix_FileSys_Stat_lstat (NullString f) { +Int Posix_FileSys_Stat_lstat (Pointer f) { return lstat ((char*)f, &statbuf); } -Int Posix_FileSys_Stat_stat (NullString f) { +Int Posix_FileSys_Stat_stat (Pointer f) { return stat ((char*)f, &statbuf); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Utimbuf.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Utimbuf.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/Utimbuf.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -10,6 +10,6 @@ utimbuf.modtime = i; } -Int Posix_FileSys_Utimbuf_utime (NullString s) { +Int Posix_FileSys_Utimbuf_utime (Pointer s) { return (Int)utime((char *)s, &utimbuf); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/access.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/access.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/access.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_access (NullString f, Word w) { +Int Posix_FileSys_access (Pointer f, Word w) { return access ((char *) f, w); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chdir.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chdir.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chdir.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_chdir(Cpointer p) { +Int Posix_FileSys_chdir(Pointer p) { return chdir((char *) p); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chmod.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chmod.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chmod.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_chmod (NullString p, Mode m) { +Int Posix_FileSys_chmod (Pointer p, Mode m) { return chmod ((char *) p, m); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chown.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chown.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/chown.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_chown (NullString p, Uid u, Gid g) { +Int Posix_FileSys_chown (Pointer p, Uid u, Gid g) { return chown ((char *) p, u, g); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/link.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/link.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/link.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_link (NullString p1, NullString p2) { +Int Posix_FileSys_link (Pointer p1, Pointer p2) { return link ((char *) p1, (char *) p2); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkdir.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkdir.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkdir.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_mkdir (NullString p, Word w) { +Int Posix_FileSys_mkdir (Pointer p, Word w) { return mkdir2 ((char *) p, w); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkfifo.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkfifo.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/mkfifo.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_mkfifo (NullString p, Word w) { +Int Posix_FileSys_mkfifo (Pointer p, Word w) { return mkfifo ((char *) p, w); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/open.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/open.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/open.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -4,7 +4,7 @@ #define DEBUG FALSE #endif -Int Posix_FileSys_open (NullString p, Word w, Mode m) { +Int Posix_FileSys_open (Pointer p, Word w, Mode m) { Int res; res = open ((char *) p, w, m); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/pathconf.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/pathconf.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/pathconf.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_pathconf (NullString p, Int n) { +Int Posix_FileSys_pathconf (Pointer p, Int n) { return pathconf ((char *)p, n); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_readlink (NullString p, Pointer b, Int n) { +Int Posix_FileSys_readlink (Pointer p, Pointer b, Int n) { return readlink ((char*)p, (char*)b, n); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rename.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rename.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rename.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_rename (NullString p1, NullString p2) { +Int Posix_FileSys_rename (Pointer p1, Pointer p2) { return rename ((char *) p1, (char *) p2); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rmdir.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rmdir.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/rmdir.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_rmdir (NullString p) { +Int Posix_FileSys_rmdir (Pointer p) { return rmdir ((char *) p); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/symlink.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/symlink.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/symlink.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_FileSys_symlink (NullString p1, NullString p2) { +Int Posix_FileSys_symlink (Pointer p1, Pointer p2) { return symlink ((char *) p1, (char *) p2); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/unlink.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/unlink.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/unlink.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Word Posix_FileSys_unlink (NullString p) { +Word Posix_FileSys_unlink (Pointer p) { return unlink ((char *) p); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/getenv.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/getenv.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/getenv.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Cstring Posix_ProcEnv_getenv(NullString s) { +Cstring Posix_ProcEnv_getenv(Pointer s) { return (Cstring)getenv((char *)s); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setenv.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setenv.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setenv.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,5 +1,5 @@ #include "platform.h" -Int Posix_ProcEnv_setenv (NullString s, NullString v) { - return setenv ((char *)s, (char *)v, 1); +Int Posix_ProcEnv_setenv (Pointer s, Pointer v) { + return setenv ((char*)s, (char*)v, 1); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -8,7 +8,7 @@ size = GC_getArrayLength (groups); list = (gid_t*)(calloc_safe (size, sizeof(*list))); - assert (size <= (sizeof(list) / sizeof(*list))); + assert (size <= cardof(list)); for (i = 0; i < size; ++i) list[i] = ((Word*)groups)[i]; res = setgroups (size, list); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,6 +1,6 @@ #include "platform.h" -Int Posix_Process_exece (NullString p, Pointer a, Pointer e) { +Int Posix_Process_exece (Pointer p, Pointer a, Pointer e) { char *path; char *asaved; char *esaved; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -1,6 +1,6 @@ #include "platform.h" -Int Posix_Process_execp (NullString f, Pointer a) { +Int Posix_Process_execp (Pointer f, Pointer a) { char *file; char *saved; char **args; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/SysDB/Group.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/SysDB/Group.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/SysDB/Group.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -18,6 +18,6 @@ return NULL != (group = getgrgid ((gid_t)g)); } -Bool Posix_SysDB_getgrnam(NullString s) { +Bool Posix_SysDB_getgrnam(Pointer s) { return NULL != (group = getgrnam ((char*)s)); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Date.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -103,6 +103,6 @@ return mktime(&tm); } -Int Date_strfTime(Pointer buf, Int n, NullString fmt) { +Int Date_strfTime(Pointer buf, Int n, Pointer fmt) { return strftime((char*)(buf), n, (char*)(fmt), &tm); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -8,6 +8,7 @@ #define MLTON_GC_INTERNAL #include "platform.h" +#undef MLTON_GC_INTERNAL enum { DEBUG_INT_INF = FALSE, Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawne.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawne.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawne.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -28,7 +28,7 @@ return result; } #else -Int MLton_Process_spawne (NullString p, Pointer a, Pointer e) { +Int MLton_Process_spawne (Pointer p, Pointer a, Pointer e) { die ("MLton_Process_spawne not implemented"); } #endif Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawnp.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawnp.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/spawnp.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -18,7 +18,7 @@ return result; } #else -Int MLton_Process_spawnp (NullString p, Pointer a) { +Int MLton_Process_spawnp (Pointer p, Pointer a) { die ("MLton_Process_spawnp not implemented"); } #endif Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c 2005-11-07 22:23:36 UTC (rev 4170) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c 2005-11-08 02:59:15 UTC (rev 4171) @@ -6,49 +6,49 @@ DEBUG_THREAD = FALSE, }; -Thread Thread_current () { - Thread t; +Pointer Thread_current () { + Pointer t; - t = (Thread)(GC_getCurrentThread (&gcState)); + t = (Pointer)(GC_getCurrentThread (&gcState)); if (DEBUG_THREAD) fprintf (stderr, "0x%08x = Thread_current ()\n", (uint)t); return t; } -void Thread_finishHandler () { - GC_finishHandler (&gcState); +void Thread_finishSignalHandler () { + GC_finishSignalHandler (&gcState); } -Thread Thread_saved () { - Thread t; +Pointer Thread_saved () { + Pointer t; - t = (Thread)(GC_getSavedThread (&gcState)); + t = (Pointer)(GC_getSavedThread (&gcState)); if (DEBUG_THREAD) fprintf (stderr, "0x%08x = Thread_saved ()\n", (uint)t); return t; } -void Thread_setCallFromCHandler (Thread t) { +void Thread_setCallFromCHandler (Pointer t) { GC_setCallFromCHandlerThread (&gcState, (GC_thread)t); } -void Thread_setSaved (Thread t) { +void Thread_setSaved (Pointer t) { if (DEBUG_THREAD) fprintf (stderr, "Thread_setSaved (0x%08x)\n", (uint)t); GC_setSavedThread (&gcState, (GC_thread)t); } -void Thread_setSignalHandler (Thread t) { +void Thread_setSignalHandler (Pointer t) { GC_setSignalHandlerThread (&gcState, (GC_thread)t); } -void Thread_startHandler () { - GC_startHandler (&gcState); +void Thread_startSignalHandler () { + GC_startSignalHandler (&gc... [truncated message content] |
From: Stephen W. <sw...@ml...> - 2005-11-07 14:23:38
|
Added MLNLFFI MinGW platform memory file. ---------------------------------------------------------------------- A mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-mingw.mlb ---------------------------------------------------------------------- Added: mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-mingw.mlb =================================================================== --- mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-mingw.mlb 2005-11-07 02:43:45 UTC (rev 4169) +++ mlton/trunk/lib/mlnlffi/memory/platform/memory.x86-mingw.mlb 2005-11-07 22:23:36 UTC (rev 4170) @@ -0,0 +1 @@ +../memory.32bit-unix.mlb |
From: Matthew F. <fl...@ml...> - 2005-11-06 18:43:47
|
No more ignore ---------------------------------------------------------------------- _U mlton/branches/on-20050822-x86_64-branch/runtime/gc/ ---------------------------------------------------------------------- Property changes on: mlton/branches/on-20050822-x86_64-branch/runtime/gc ___________________________________________________________________ Name: svn:ignore - gc.h gc.c |
From: Matthew F. <fl...@ml...> - 2005-11-06 18:39:09
|
No more ignore ---------------------------------------------------------------------- D mlton/branches/on-20050822-x86_64-branch/runtime/gc/.ignore ---------------------------------------------------------------------- Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/.ignore =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/.ignore 2005-11-07 02:34:33 UTC (rev 4167) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/.ignore 2005-11-07 02:39:08 UTC (rev 4168) @@ -1,2 +0,0 @@ -gc.h -gc.c |
From: Matthew F. <fl...@ml...> - 2005-11-06 18:34:38
|
Missing files ---------------------------------------------------------------------- A mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/read_write.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/safe.h ---------------------------------------------------------------------- Added: mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h 2005-11-07 02:30:53 UTC (rev 4166) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h 2005-11-07 02:34:33 UTC (rev 4167) @@ -0,0 +1,36 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +uint32_t GC_getArrayLength (pointer a); + +void GC_handler (GC_state s, int signum); + +void GC_pack (GC_state s); +void GC_unpack (GC_state s); + +void GC_share (GC_state s, pointer object); + +size_t GC_size (GC_state s, pointer root); + +void GC_startHandler (GC_state s); +void GC_finishHandler (GC_state s); + +void GC_switchToThread (GC_state s, GC_thread t, size_t ensureBytesFree); + + +GC_profileData GC_getProfileCurrent (GC_state s); +void GC_setProfileCurrent (GC_state s, GC_profileData p); + +void GC_profileFree (GC_state s, GC_profileData p); +GC_profileData GC_profileNew (GC_state s); +void GC_profileWrite (GC_state s, GC_profileData p, int fd); + +void GC_profileDone (GC_state s); + +void GC_done (GC_state s); + Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c 2005-11-07 02:30:53 UTC (rev 4166) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c 2005-11-07 02:34:33 UTC (rev 4167) @@ -1,2 +0,0 @@ -#include "libgc.h" - Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.h 2005-11-07 02:30:53 UTC (rev 4166) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.h 2005-11-07 02:34:33 UTC (rev 4167) @@ -1,5 +0,0 @@ -#ifndef _MLTON_GC_H_ -#define _MLTON_GC_H_ - -struct GC_state; -typedef struct GC_state *GC_state; Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.c =================================================================== Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h =================================================================== Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/read_write.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/read_write.h 2005-11-07 02:30:53 UTC (rev 4166) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/read_write.h 2005-11-07 02:34:33 UTC (rev 4167) @@ -1,26 +0,0 @@ -/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * Copyright (C) 1997-2000 NEC Research Institute. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -char readChar (int fd); -pointer readPointer (int fd); -objptr readObjptr (int fd); -size_t readSize (int fd); -uint32_t readUint32 (int fd); -uintptr_t readUintptr (int fd); -void writeChar (int fd, char c); -void writePointer (int fd, pointer p); -void writeObjptr (int fd, objptr op); -void writeSize (int fd, size_t z); -void writeUint32 (int fd, uint32_t u); -void writeUintptr (int fd, uintptr_t u); -void writeString (int fd, char* s); -void writeUint32U (int fd, uint32_t u); -void writeUintmaxU (int fd, uintmax_t u); -void writeUint32X (int fd, uint32_t u); -void writeUintmaxX (int fd, uintmax_t u); -void writeNewline (int fd); Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/safe.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/safe.h 2005-11-07 02:30:53 UTC (rev 4166) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/safe.h 2005-11-07 02:34:33 UTC (rev 4167) @@ -1,16 +0,0 @@ -/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * Copyright (C) 1997-2000 NEC Research Institute. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -void *calloc_safe (size_t count, size_t size); -void close_safe (int fd); -void *malloc_safe (size_t size); -int mkstemp_safe (char *template); -int open_safe (const char *fileName, int flags, mode_t mode); -void read_safe (int fd, void *buf, size_t size); -void unlink_safe (const char *pathname); -void write_safe (int fd, const void *buf, size_t size); |
From: Matthew F. <fl...@ml...> - 2005-11-06 18:31:38
|
Working on reintegration of gc ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/getcwd.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c U mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c D mlton/branches/on-20050822-x86_64-branch/runtime/assert.h U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Array/numElements.c D mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Array.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Vector.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c A mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/gc.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/profile.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/rusage.c A mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/world.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Net/NetHostDB.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c U mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c D mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c A mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile D mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h A mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/model_predicates.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/object_predicates.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/pack.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer_predicates.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/read_write.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/rusage.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/safe.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/share.h D mlton/branches/on-20050822-x86_64-branch/runtime/gc/size.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c D mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack_predicates.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/statistics.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/switch-thread.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/util.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc.h U mlton/branches/on-20050822-x86_64-branch/runtime/platform.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform.h U mlton/branches/on-20050822-x86_64-branch/runtime/types.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/ A mlton/branches/on-20050822-x86_64-branch/runtime/util/Makefile A mlton/branches/on-20050822-x86_64-branch/runtime/util/align.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.c A mlton/branches/on-20050822-x86_64-branch/runtime/util/assert.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/die.c A mlton/branches/on-20050822-x86_64-branch/runtime/util/die.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/endian.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/pointer.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/read_write.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/safe.h A mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.c A mlton/branches/on-20050822-x86_64-branch/runtime/util/to-string.h A mlton/branches/on-20050822-x86_64-branch/runtime/util.h ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-07 02:30:53 UTC (rev 4166) @@ -11,7 +11,8 @@ TARGET = self TARGET_ARCH = $(shell ../bin/host-arch) TARGET_OS = $(shell ../bin/host-os) -GCC_VERSION = $(shell gcc -v 2>&1 | grep 'gcc version' | sed 's/.*gcc version \(.\).*/\1/') +GCC_VERSION = \ + $(shell gcc -v 2>&1 | grep 'gcc version' | sed 's/.*gcc version \(.\).*/\1/') FLAGS = -fomit-frame-pointer @@ -47,17 +48,40 @@ CC = gcc -std=gnu99 CFLAGS = -O2 -Wall -I. -Iplatform -D_FILE_OFFSET_BITS=64 $(FLAGS) DEBUGFLAGS = $(CFLAGS) -gstabs+ -g2 +WARNFLAGS = -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function \ + -Wformat-nonliteral \ + -Wuninitialized -Winit-self \ + -Wstrict-aliasing=2 \ + -Wfloat-equal \ + -Wpointer-arith \ + -Wbad-function-cast -Wcast-qual -Wcast-align \ + -Waggregate-return \ + -Wstrict-prototypes \ + -Wmissing-noreturn -Wmissing-format-attribute \ + -Wpacked \ + -Wredundant-decls \ + -Wnested-externs +# -Wshadow \ +# -Wconversion \ +# -Wmissing-prototypes \ +# -Wmissing-declarations \ +# -Winline -Wdisabled-optimization +DEBUGWARNFLAGS = $(DEBUGFLAGS) $(WARNFLAGS) -Wunused CFILES = \ + $(shell find util -type f | grep '\.c$$') \ $(shell find basis -type f | grep '\.c$$' | grep -v Real/) \ $(shell find Posix -type f | grep '\.c$$') \ gc.c \ platform.c -HFILES = \ - gc.h \ - types.h \ - platform.h \ +HFILES = \ + util.h \ + $(shell find util -type f | grep '\.h$$') \ + gc.h \ + $(shell find gc -type f | grep '\.h$$') \ + types.h \ + platform.h \ platform/$(TARGET_OS).h FILES = $(basename $(CFILES)) @@ -119,6 +143,18 @@ runtime.c: $(CFILES) cat $(CFILES) >runtime.c +gc.o: gc.c $(shell find gc -type f | grep '\.c$$') $(HFILES) + $(CC) $(CFLAGS) $(WARNFLAGS) -c -o $@ $< + +gc-gdb.o: gc.c $(shell find gc -type f | grep '\.c$$') $(HFILES) + $(CC) $(DEBUGFLAGS) $(DEBUGWARNFLAGS) -O1 -DASSERT=1 -c -o $@ $< + +util/%.o: util/%.c $(HFILES) + $(CC) $(CFLAGS) $(WARNFLAGS) -c -o $@ $< + +util/%-gdb.o: util/%.c $(HFILES) + $(CC) $(DEBUGFLAGS) $(DEBUGWARNFLAGS) -O1 -DASSERT=1 -c -o $@ $< + # It looks like we don't follow the C spec w.r.t. aliasing. And gcc # -O2 catches us on the code in Real/*.c where we treat a double as a # chunk of two words. Files that have been known to cause problems Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/getcwd.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/getcwd.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/getcwd.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,5 +1,5 @@ #include "platform.h" Cstring Posix_FileSys_getcwd (Pointer buf, Size n) { - return (Cstring)(getcwd (buf, n)); + return (Cstring)(getcwd ((char*)buf, n)); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/FileSys/readlink.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,5 +1,5 @@ #include "platform.h" Int Posix_FileSys_readlink (NullString p, Pointer b, Int n) { - return readlink ((char *) p, b, n); + return readlink ((char*)p, (char*)b, n); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/ProcEnv/setgroups.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,9 +6,9 @@ int res; int size; - size = GC_arrayNumElements (groups); - ARRAY (gid_t*, list, size); - assert (size <= cardof (list)); + size = GC_getArrayLength (groups); + list = (gid_t*)(calloc_safe (size, sizeof(*list))); + assert (size <= (sizeof(list) / sizeof(*list))); for (i = 0; i < size; ++i) list[i] = ((Word*)groups)[i]; res = setgroups (size, list); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/exece.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -13,9 +13,9 @@ path = (char *) p; args = (char **) a; env = (char **) e; - an = GC_arrayNumElements (a) - 1; + an = GC_getArrayLength (a) - 1; asaved = args[an]; - en = GC_arrayNumElements (e) - 1; + en = GC_getArrayLength (e) - 1; esaved = env[en]; args[an] = (char *) NULL; env[en] = (char *) NULL; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Process/execp.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -9,7 +9,7 @@ file = (char *) f; args = (char **) a; - n = GC_arrayNumElements (a) - 1; + n = GC_getArrayLength (a) - 1; saved = args[n]; args[n] = (char *) NULL; result = EXECVP (file, args); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -17,7 +17,7 @@ Int Posix_Signal_default (Int signum) { struct sigaction sa; - sigdelset (&gcState.signalsHandled, signum); + sigdelset (GC_getSignalsHandledAddr (&gcState), signum); memset (&sa, 0, sizeof(sa)); sa.sa_handler = SIG_DFL; sa.sa_flags = SA_FLAGS; @@ -27,7 +27,7 @@ bool Posix_Signal_isGCPending () { Bool res; - res = gcState.gcSignalIsPending; + res = GC_getSignalIsPending (&gcState); if (DEBUG_SIGNALS) fprintf (stderr, "%s = Posix_Signal_isGCPending ()\n", boolToString (res)); @@ -35,13 +35,13 @@ } Bool Posix_Signal_isPending (Int signum) { - return sigismember (&gcState.signalsPending, signum); + return sigismember (GC_getSignalsPendingAddr (&gcState), signum); } Int Posix_Signal_handle (Int signum) { static struct sigaction sa; - sigaddset (&gcState.signalsHandled, signum); + sigaddset (GC_getSignalsHandledAddr (&gcState), signum); memset (&sa, 0, sizeof(sa)); /* The mask must be full because GC_handler reads and writes * s->signalsPending (else there is a race condition). @@ -53,13 +53,13 @@ } void Posix_Signal_handleGC () { - gcState.handleGCSignal = TRUE; + GC_setGCSignalHandled (&gcState, TRUE); } Int Posix_Signal_ignore (Int signum) { struct sigaction sa; - sigdelset (&gcState.signalsHandled, signum); + sigdelset (GC_getSignalsHandledAddr (&gcState), signum); memset (&sa, 0, sizeof(sa)); sa.sa_handler = SIG_IGN; sa.sa_flags = SA_FLAGS; @@ -79,8 +79,8 @@ void Posix_Signal_resetPending () { if (DEBUG_SIGNALS) fprintf (stderr, "Posix_Signal_resetPending ()\n"); - sigemptyset (&gcState.signalsPending); - gcState.gcSignalIsPending = FALSE; + sigemptyset (GC_getSignalsPendingAddr (&gcState)); + GC_setGCSignalPending (&gcState, FALSE); } static sigset_t set; Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/assert.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/assert.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/assert.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,20 +0,0 @@ -/* Copyright (C) 2004-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -#ifndef ASSERT -#define ASSERT 0 -#endif - -/* Assertion failure routine */ -extern void asfail (char *file, int line, char *prop); - -/* Assertion verifier */ -#if ASSERT -#define assert(p) ((p) ? (void)0 : asfail(__FILE__, __LINE__, #p)) -#else -#define assert(p) ((void)0) -#endif Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Array/numElements.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Array/numElements.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Array/numElements.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,5 +1,5 @@ #include "platform.h" Int Array_numElements (Pointer p) { - return GC_arrayNumElements (p); + return GC_getArrayLength (p); } Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,29 +0,0 @@ -#define _ISOC99_SOURCE - -#include "platform.h" - -extern struct GC_state gcState; - -void GC_setHashConsDuringGC (Int b) { - gcState.hashConsDuringGC = b; -} - -void GC_setMessages (Int b) { - gcState.messages = b; -} - -void GC_setSummary (Int b) { - gcState.summary = b; -} - -void GC_setRusageMeasureGC (Int b) { - gcState.rusageMeasureGC = b; -} - -void MLton_GC_pack () { - GC_pack (&gcState); -} - -void MLton_GC_unpack () { - GC_unpack (&gcState); -} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Array.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Array.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Array.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -2,11 +2,11 @@ Word32 Word8Array_subWord32Rev (Pointer v, Int offset) { Word32 w; - char *p; - char *s; + pointer p; + pointer s; int i; - p = (char*)&w; + p = (pointer )&w; s = v + (offset * 4); for (i = 0; i < 4; ++i) p[i] = s[3 - i]; @@ -14,11 +14,11 @@ } void Word8Array_updateWord32Rev (Pointer a, Int offset, Word32 w) { - char *p; - char *s; + pointer p; + pointer s; int i; - p = (char*)&w; + p = (pointer)&w; s = a + (offset * 4); for (i = 0; i < 4; ++i) { s[i] = p[3 - i]; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Vector.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Vector.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Int/Word8Vector.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -2,11 +2,11 @@ Word32 Word8Vector_subWord32Rev (Pointer v, Int offset) { Word32 w; - char *p; - char *s; + pointer p; + pointer s; int i; - p = (char*)&w; + p = (pointer)&w; s = v + (offset * 4); for (i = 0; i < 4; ++i) p[i] = s[3 - i]; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,27 +6,17 @@ * See the file MLton-LICENSE for details. */ +#define MLTON_GC_INTERNAL #include "platform.h" enum { - DEBUG_INT_INF = FALSE, + DEBUG_INT_INF = FALSE, }; /* Import the global gcState so we can get and set the frontier. */ extern struct GC_state gcState; /* - * Layout of strings. Note, the value passed around is a pointer to - * the chars member. - */ -typedef struct strng { - uint counter, /* used by GC. */ - card, /* number of chars */ - magic; /* STRMAGIC */ - char chars[0]; /* actual chars */ -} strng; - -/* * Test if a intInf is a fixnum. */ static inline uint isSmall (pointer arg) { @@ -44,14 +34,14 @@ /* * Convert a bignum intInf to a bignum pointer. */ -static inline bignum * toBignum (pointer arg) { - bignum *bp; +static inline GC_intInf toBignum (pointer arg) { + GC_intInf bp; assert(not isSmall(arg)); - bp = (bignum *)((uint)arg - offsetof(struct bignum, isneg)); + bp = (GC_intInf)((uint)arg - offsetof(struct GC_intInf, isneg)); if (DEBUG_INT_INF) - fprintf (stderr, "bp->magic = 0x%08x\n", bp->magic); - assert (bp->magic == BIGMAGIC); + fprintf (stderr, "bp->header = 0x%08x\n", bp->header); + assert (bp->header == GC_INTINF_HEADER); return bp; } @@ -60,7 +50,7 @@ * to contain 2 limbs, fill in the __mpz_struct. */ static inline void fill (pointer arg, __mpz_struct *res, mp_limb_t space[2]) { - bignum *bp; + GC_intInf bp; if (DEBUG_INT_INF) fprintf (stderr, "fill (0x%08x, 0x%08x, 0x%08x)\n", @@ -78,8 +68,8 @@ res->_mp_size = 0; } else { bp = toBignum(arg); - res->_mp_alloc = bp->card - 1; - res->_mp_d = bp->limbs; + res->_mp_alloc = bp->length - 1; + res->_mp_d = (mp_limb_t*)(bp->limbs); res->_mp_size = bp->isneg ? - res->_mp_alloc : res->_mp_alloc; } @@ -89,16 +79,16 @@ * Initialize an __mpz_struct to use the space provided by an ML array. */ static inline void initRes (__mpz_struct *mpzp, uint bytes) { - struct bignum *bp; + GC_intInf bp; assert (bytes <= gcState.limitPlusSlop - gcState.frontier); - bp = (bignum*)gcState.frontier; + bp = (GC_intInf)gcState.frontier; /* We have as much space for the limbs as there is to the end of the * heap. Divide by 4 to get number of words. */ mpzp->_mp_alloc = (gcState.limitPlusSlop - (pointer)bp->limbs) / 4; mpzp->_mp_size = 0; /* is this necessary? */ - mpzp->_mp_d = bp->limbs; + mpzp->_mp_d = (mp_limb_t*)(bp->limbs); } /* @@ -118,7 +108,7 @@ } static inline void setFrontier (pointer p, uint bytes) { - p = GC_alignFrontier (&gcState, p); + p = alignFrontier (&gcState, p); assert (p - gcState.frontier <= bytes); GC_profileAllocInc (&gcState, p - gcState.frontier); gcState.frontier = p; @@ -134,11 +124,11 @@ * the array size and roll the frontier slightly back. */ static pointer answer (__mpz_struct *ans, uint bytes) { - bignum *bp; + GC_intInf bp; int size; - bp = (bignum *)((pointer)ans->_mp_d - offsetof(struct bignum, limbs)); - assert(ans->_mp_d == bp->limbs); + bp = (GC_intInf)((pointer)ans->_mp_d - offsetof(struct GC_intInf, limbs)); + assert(ans->_mp_d == (mp_limb_t*)(bp->limbs)); size = ans->_mp_size; if (size < 0) { bp->isneg = TRUE; @@ -168,10 +158,10 @@ return (pointer)(ans<<1 | 1); } } - setFrontier ((pointer)&bp->limbs[size], bytes); + setFrontier ((pointer)(&bp->limbs[size]), bytes); bp->counter = 0; - bp->card = size + 1; /* +1 for isNeg word */ - bp->magic = BIGMAGIC; + bp->length = size + 1; /* +1 for isNeg word */ + bp->header = GC_INTINF_HEADER; return (pointer)&bp->isneg; } @@ -303,11 +293,11 @@ Word IntInf_smallMul(Word lhs, Word rhs, pointer carry) { - llong prod; + intmax_t prod; - prod = (llong)(int)lhs * (int)rhs; - *(uint *)carry = (ullong)prod >> 32; - return ((uint)(ullong)prod); + prod = (intmax_t)(int)lhs * (int)rhs; + *(uint *)carry = (uintmax_t)prod >> 32; + return ((uint)(uintmax_t)prod); } /* @@ -346,7 +336,7 @@ * string (mutable) which is large enough. */ pointer IntInf_toString (pointer arg, int base, uint bytes) { - strng *sp; + GC_string sp; __mpz_struct argmpz; mp_limb_t argspace[2]; char *str; @@ -359,7 +349,7 @@ (uint)arg, base, bytes); assert (base == 2 || base == 8 || base == 10 || base == 16); fill (arg, &argmpz, argspace); - sp = (strng*)gcState.frontier; + sp = (GC_string)gcState.frontier; str = mpz_get_str(sp->chars, base, &argmpz); assert(str == sp->chars); size = strlen(str); @@ -372,9 +362,9 @@ sp->chars[i] = c + ('A' - 'a'); } sp->counter = 0; - sp->card = size; - sp->magic = STRMAGIC; - setFrontier (&sp->chars[wordAlign(size)], bytes); + sp->length = size; + sp->header = GC_STRING_HEADER; + setFrontier ((pointer)(&sp->chars[align(size, 4)]), bytes); return (pointer)str; } Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/gc.c (from rev 4165, mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/gc.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,29 @@ +#define _ISOC99_SOURCE + +#include "platform.h" + +extern struct GC_state gcState; + +void MLton_GC_setHashConsDuringGC (Int b) { + GC_setHashConsDuringGC (&gcState, b); +} + +void MLton_GC_setMessages (Int b) { + GC_setMessages (&gcState, b); +} + +void MLton_GC_setSummary (Int b) { + GC_setSummary (&gcState, b); +} + +void MLton_GC_setRusageMeasureGC (Int b) { + GC_setRusageMeasureGC (&gcState, b); +} + +void MLton_GC_pack () { + GC_pack (&gcState); +} + +void MLton_GC_unpack () { + GC_unpack (&gcState); +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/profile.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/profile.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/profile.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -7,7 +7,7 @@ extern struct GC_state gcState; void MLton_Profile_Data_free (Pointer p) { - GC_profileFree (&gcState, (GC_profile)p); + GC_profileFree (&gcState, (GC_profileData)p); } Pointer MLton_Profile_Data_malloc (void) { @@ -17,30 +17,25 @@ void MLton_Profile_Data_write (Pointer p, Word fd) { if (DEBUG_PROFILE) fprintf (stderr, "MLton_Profile_Data_write (0x%08x)\n", (uint)p); - GC_profileWrite (&gcState, (GC_profile)p, (int)fd); + GC_profileWrite (&gcState, (GC_profileData)p, (int)fd); } Pointer MLton_Profile_current (void) { - GC_state s; Pointer res; - s = &gcState; - res = (Pointer)s->profile; + res = (Pointer)(GC_getProfileCurrent (&gcState)); if (DEBUG_PROFILE) fprintf (stderr, "0x%08x = MLton_Profile_current ()\n", (uint)res); return res; } -void MLton_Profile_done () { - GC_profileDone (&gcState); -} - void MLton_Profile_setCurrent (Pointer d) { - GC_state s; - - s = &gcState; if (DEBUG_PROFILE) fprintf (stderr, "MLton_Profile_setCurrent (0x%08x)\n", (uint)d); - s->profile = (GC_profile)d; + GC_setProfileCurrent (&gcState, (GC_profileData)d); } + +void MLton_Profile_done () { + GC_profileDone (&gcState); +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/rusage.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/rusage.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/rusage.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -55,7 +55,7 @@ } void MLton_Rusage_ru () { - gc = gcState.ru_gc; - fixedGetrusage (RUSAGE_SELF, &self); - fixedGetrusage (RUSAGE_CHILDREN, &children); + gc = *(GC_getRusageGCAddr (&gcState)); + getrusage (RUSAGE_SELF, &self); + getrusage (RUSAGE_CHILDREN, &children); } Copied: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c (from rev 4164, mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/thread.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,54 @@ +#include "platform.h" + +extern struct GC_state gcState; + +enum { + DEBUG_THREAD = FALSE, +}; + +Thread Thread_current () { + Thread t; + + t = (Thread)(GC_getCurrentThread (&gcState)); + if (DEBUG_THREAD) + fprintf (stderr, "0x%08x = Thread_current ()\n", (uint)t); + return t; +} + +void Thread_finishHandler () { + GC_finishHandler (&gcState); +} + +Thread Thread_saved () { + Thread t; + + t = (Thread)(GC_getSavedThread (&gcState)); + if (DEBUG_THREAD) + fprintf (stderr, "0x%08x = Thread_saved ()\n", (uint)t); + return t; +} + +void Thread_setCallFromCHandler (Thread t) { + GC_setCallFromCHandlerThread (&gcState, (GC_thread)t); +} + +void Thread_setSaved (Thread t) { + if (DEBUG_THREAD) + fprintf (stderr, "Thread_setSaved (0x%08x)\n", (uint)t); + GC_setSavedThread (&gcState, (GC_thread)t); +} + +void Thread_setSignalHandler (Thread t) { + GC_setSignalHandlerThread (&gcState, (GC_thread)t); +} + +void Thread_startHandler () { + GC_startHandler (&gcState); +} + +void Thread_switchTo (Thread thread, Word ensureBytesFree) { + if (DEBUG_THREAD) + fprintf (stderr, "Thread_switchTo (0x%08x, %u)\n", + (uint)thread, (uint)ensureBytesFree); + GC_switchToThread (&gcState, (GC_thread)thread, ensureBytesFree); +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/world.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/world.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/MLton/world.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -3,10 +3,9 @@ extern struct GC_state gcState; Bool World_isOriginal() { - return gcState.isOriginal; + return (Bool)(GC_getAmOriginal (&gcState)); } - void World_makeOriginal() { - gcState.isOriginal = TRUE; + GC_setAmOriginal (&gcState, TRUE); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Net/NetHostDB.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Net/NetHostDB.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Net/NetHostDB.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -49,5 +49,5 @@ } Int NetHostDB_getHostName(Pointer buf, Int len) { - return (gethostname (buf, len)); + return (gethostname ((char*) buf, len)); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/PackReal.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -2,8 +2,8 @@ Real32 PackReal32_subVec (Pointer v, Int offset) { Real32 r; - char *p = (char*)&r; - char *s = v + offset; + pointer p = (pointer)&r; + pointer s = v + offset; int i; for (i = 0; i < 4; ++i) @@ -13,8 +13,8 @@ Real32 PackReal32_subVecRev (Pointer v, Int offset) { Real32 r; - char *p = (char*)&r; - char *s = v + offset; + pointer p = (pointer)&r; + pointer s = v + offset; int i; for (i = 0; i < 4; ++i) @@ -24,8 +24,8 @@ Real64 PackReal64_subVec (Pointer v, Int offset) { Real64 r; - char *p = (char*)&r; - char *s = v + offset; + pointer p = (pointer)&r; + pointer s = v + offset; int i; for (i = 0; i < 8; ++i) @@ -35,8 +35,8 @@ Real64 PackReal64_subVecRev (Pointer v, Int offset) { Real64 r; - char *p = (char*)&r; - char *s = v + offset; + pointer p = (pointer)&r; + pointer s = v + offset; int i; for (i = 0; i < 8; ++i) @@ -45,8 +45,8 @@ } void PackReal32_update (Pointer a, Int offset, Real32 r) { - char *p = (char*)&r; - char *s = a + offset; + pointer p = (pointer)&r; + pointer s = a + offset; int i; for (i = 0; i < 4; ++i) { @@ -55,8 +55,8 @@ } void PackReal32_updateRev (Pointer a, Int offset, Real32 r) { - char *p = (char*)&r; - char *s = a + offset; + pointer p = (pointer)&r; + pointer s = a + offset; int i; for (i = 0; i < 4; ++i) { @@ -65,8 +65,8 @@ } void PackReal64_update (Pointer a, Int offset, Real64 r) { - char *p = (char*)&r; - char *s = a + offset; + pointer p = (pointer)&r; + pointer s = a + offset; int i; for (i = 0; i < 8; ++i) { @@ -75,8 +75,8 @@ } void PackReal64_updateRev (Pointer a, Int offset, Real64 r) { - char *p = (char*)&r; - char *s = a + offset; + pointer p = (pointer)&r; + pointer s = a + offset; int i; for (i = 0; i < 8; ++i) { Modified: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Stdio.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -8,5 +8,5 @@ } Int Stdio_sprintf (Pointer buf, Pointer fmt, Real x) { - return sprintf (buf, (char*) fmt, x); + return sprintf ((char*) buf, (char*) fmt, x); } Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/Thread.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,55 +0,0 @@ -#include "platform.h" - -extern struct GC_state gcState; - -enum { - DEBUG_THREAD = FALSE, -}; - -Thread Thread_current () { - Thread t; - - t = (Thread)gcState.currentThread; - if (DEBUG_THREAD) - fprintf (stderr, "0x%08x = Thread_current ()\n", (uint)t); - return t; -} - -void Thread_finishHandler () { - GC_finishHandler (&gcState); -} - -Thread Thread_saved () { - Thread t; - - t = (Thread)gcState.savedThread; - gcState.savedThread = (GC_thread)0x1; - if (DEBUG_THREAD) - fprintf (stderr, "0x%08x = Thread_saved ()\n", (uint)t); - return t; -} - -void Thread_setCallFromCHandler (Thread t) { - gcState.callFromCHandler = (GC_thread)t; -} - -void Thread_setSaved (Thread t) { - if (DEBUG_THREAD) - fprintf (stderr, "Thread_setSaved (0x%08x)\n", (uint)t); - gcState.savedThread = (GC_thread)t; -} - -void Thread_setHandler (Thread t) { - gcState.signalHandler = (GC_thread)t; -} - -void Thread_startHandler () { - GC_startHandler (&gcState); -} - -void Thread_switchTo (Thread thread, Word ensureBytesFree) { - if (DEBUG_THREAD) - fprintf (stderr, "Thread_switchTo (0x%08x, %u)\n", - (uint)thread, (uint)ensureBytesFree); - GC_switchToThread (&gcState, (GC_thread)thread, ensureBytesFree); -} Copied: mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h (from rev 4165, mlton/branches/on-20050822-x86_64-branch/runtime/platform.h) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/platform.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/cenv.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,50 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +#ifndef _MLTON_CENV_H_ +#define _MLTON_CENV_H_ + +#define _ISOC99_SOURCE +#define _BSD_SOURCE + +/* Only enable _POSIX_C_SOURCE on platforms that don't have broken system + * headers. + */ +#if (defined (__linux__)) +#define _POSIX_C_SOURCE 200112L +#endif + +/* C99-specific headers */ +#include <stddef.h> +#include <stdarg.h> +#include <stdlib.h> +#include <stdbool.h> +#include <iso646.h> +#include <stdint.h> +#include <inttypes.h> +#include <limits.h> +#include <string.h> +#include <stdio.h> +#include <math.h> + +#include <errno.h> +#include <fcntl.h> +#include <unistd.h> + +#include <dirent.h> +#include <signal.h> +#include <time.h> +#include <utime.h> +#include <sys/resource.h> +#include <sys/stat.h> +#include <sys/time.h> + + +#include "gmp.h" + +#endif /* _MLTON_CENV_H_ */ Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,219 +6,8 @@ # See the file MLton-LICENSE for details. ## -PATH = ../../bin:$(shell echo $$PATH) +all: -TARGET = self -TARGET_ARCH = $(shell ../../bin/host-arch) -TARGET_OS = $(shell ../../bin/host-os) -GCC_VERSION = $(shell gcc -v 2>&1 | grep 'gcc version' | sed 's/.*gcc version \(.\).*/\1/') - -FLAGS = -fomit-frame-pointer - -ifeq ($(TARGET_ARCH), x86) -ifneq ($(findstring $(GCC_VERSION), 3 4),) -FLAGS += -falign-loops=2 -falign-jumps=2 -falign-functions=5 -else -FLAGS += -malign-loops=2 -malign-jumps=2 -malign-functions=5 -endif -DEFAULT_MODEL = A -ALL_MODELS = A -endif - -ifeq ($(TARGET_ARCH), amd64) -FLAGS += -mtune=opteron -DEFAULT_MODEL = BX -ALL_MODELS = A AX B BX C CX G -endif - -ifeq ($(TARGET_ARCH), sparc) -FLAGS += -mv8 -m32 -endif - -ifeq ($(TARGET_OS), solaris) -FLAGS += -Wa,-xarch=v8plusa -fcall-used-g5 -fcall-used-g7 -funroll-all-loops -mcpu=ultrasparc -endif - -ifeq ($(TARGET), self) -AR = ar rc -RANLIB = ranlib -else -AR = $(TARGET)-ar rc -RANLIB = $(TARGET)-ranlib -FLAGS += -b $(TARGET) -endif - -CC = gcc -std=gnu99 -CWFLAGS = -pedantic -Wall -Wextra -Wno-unused-parameter -Wno-unused-function \ - -Wformat-nonliteral \ - -Wuninitialized -Winit-self \ - -Wstrict-aliasing=2 \ - -Wfloat-equal \ - -Wpointer-arith \ - -Wbad-function-cast -Wcast-qual -Wcast-align \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wmissing-noreturn -Wmissing-format-attribute \ - -Wpacked \ - -Wredundant-decls \ - -Wnested-externs -# -Wshadow \ -# -Wconversion \ -# -Wmissing-prototypes \ -# -Wmissing-declarations \ -# -Winline -Wdisabled-optimization -CFLAGS = -O2 $(CWFLAGS) -I. -D_FILE_OFFSET_BITS=64 $(FLAGS) -DEBUGFLAGS = $(CFLAGS) -Wunused -gstabs+ -g2 - -## Order matters, as these are concatenated together to form "libgc.c". -CFILES = \ - gc_prefix.c \ - util.c \ - safe.c \ - read_write.c \ - rusage.c \ - debug.c \ - align.c \ - virtual-memory.c \ - array-allocate.c \ - array.c \ - atomic.c \ - call-stack.c \ - cheney-copy.c \ - controls.c \ - copy-thread.c \ - current.c \ - dfs-mark.c \ - done.c \ - enter_leave.c \ - foreach.c \ - forward.c \ - frame.c \ - garbage-collection.c \ - gc_state.c \ - generational.c \ - handler.c \ - hash-cons.c \ - heap.c \ - heap_predicates.c \ - init-world.c \ - init.c \ - invariant.c \ - mark-compact.c \ - model.c \ - model_predicates.c \ - new-object.c \ - object-size.c \ - object.c \ - object_predicates.c \ - pack.c \ - pointer.c \ - pointer_predicates.c \ - profiling.c \ - share.c \ - signals.c \ - size.c \ - sources.c \ - stack.c \ - stack_predicates.c \ - switch-thread.c \ - thread.c \ - translate.c \ - weak.c \ - world.c \ - assumptions.c \ - gc_suffix.c - -## Order matters, as these are concatenated together to form "libgc.h". -HFILES = \ - gc_prefix.h \ - util.h \ - safe.h \ - rusage.h \ - virtual-memory.h \ - model.h \ - pointer.h \ - objptr.h \ - object.h \ - array.h \ - frame.h \ - stack.h \ - thread.h \ - weak.h \ - int-inf.h \ - object-size.h \ - generational.h \ - heap.h \ - current.h \ - foreach.h \ - translate.h \ - sysvals.h \ - controls.h \ - major.h \ - statistics.h \ - forward.h \ - cheney-copy.h \ - hash-cons.h \ - dfs-mark.h \ - mark-compact.h \ - invariant.h \ - atomic.h \ - enter_leave.h \ - signals.h \ - handler.h \ - switch-thread.h \ - garbage-collection.h \ - new-object.h \ - array-allocate.h \ - sources.h \ - call-stack.h \ - profiling.h \ - init-world.h \ - world.h \ - init.h \ - done.h \ - copy-thread.h \ - pack.h \ - share.h \ - size.h \ - gc_state.h \ - gc_suffix.h - -all: libgc.o libgc-gdb.o - -libgc-gdb.o: libgc.c libgc.h - $(CC) $(DEBUGFLAGS) -DGC_MODEL_$(DEFAULT_MODEL) -O1 -DASSERT=1 -c -o $@ libgc.c - -libgc.o: libgc.c libgc.h - $(CC) $(CFLAGS) -DGC_MODEL_$(DEFAULT_MODEL) -c -o $@ libgc.c - -libgc.c: $(CFILES) - rm -f libgc.c - ( \ - for f in $(CFILES); do \ - echo "#line 1 \"$$f\""; \ - cat $$f; \ - done; \ - ) > libgc.c - -libgc.h: $(HFILES) - rm -f libgc.h - ( \ - for f in $(HFILES); do \ - echo "#line 1 \"$$f\""; \ - cat $$f; \ - done; \ - ) > libgc.h - -.PHONY: models -models: libgc.c libgc.h - ( \ - for m in $(ALL_MODELS); do \ - $(CC) $(CFLAGS) -DGC_MODEL_$$m -c -o libgc.$$m.o libgc.c; \ - $(CC) $(DEBUGFLAGS) -O1 -DASSERT=1 -DGC_MODEL_$$m -c -o libgc-gdb.$$m.o libgc.c; \ - done; \ - ) - -.PHONY: clean +.PHONY: clean: ../../bin/clean Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,49 +0,0 @@ -/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * Copyright (C) 1997-2000 NEC Research Institute. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -static inline bool isAligned (size_t a, size_t b) { - return 0 == a % b; -} - -static inline bool isAlignedMax (uintmax_t a, uintmax_t b) { - return 0 == a % b; -} - -static inline size_t alignDown (size_t a, size_t b) { - assert (b >= 1); - a -= a % b; - assert (isAligned (a, b)); - return a; -} - -static inline uintmax_t alignMaxDown (uintmax_t a, uintmax_t b) { - assert (b >= 1); - a -= a % b; - assert (isAlignedMax (a, b)); - return a; -} - -static inline size_t align (size_t a, size_t b) { - assert (b >= 1); - a += b - 1; - a -= a % b; - assert (isAligned (a, b)); - return a; -} - -static inline uintmax_t alignMax (uintmax_t a, uintmax_t b) { - assert (b >= 1); - a += b - 1; - a -= a % b; - assert (isAligned (a, b)); - return a; -} - -static inline size_t pad (GC_state s, size_t bytes, size_t extra) { - return align (bytes + extra, s->alignment) - extra; -} Added: mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,27 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +static inline size_t pad (GC_state s, size_t bytes, size_t extra) { + return align (bytes + extra, s->alignment) - extra; +} + + +#if ASSERT +bool isFrontierAligned (GC_state s, pointer p) { + return isAligned ((size_t)p + GC_NORMAL_HEADER_SIZE, + s->alignment); +} +#endif + +pointer alignFrontier (GC_state s, pointer p) { + size_t res; + + res = pad (s, (size_t)p, GC_NORMAL_HEADER_SIZE); + assert (isFrontierAligned (s, (pointer)res)); + return (pointer)res; +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -66,3 +66,8 @@ + nonObjptrBytesPerElement + pointerIndex * OBJPTR_SIZE; } + + +GC_arrayLength GC_getArrayLength (pointer a) { + return getArrayLength (a); +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -64,7 +64,7 @@ &s->cumulativeStatistics.ru_gcMinor, s->cumulativeStatistics.numMinorGCs, s->cumulativeStatistics.bytesCopiedMinor); - time = currentTime () - s->startTime; + time = getCurrentTime () - s->startTime; fprintf (out, "total GC time: %s ms (%.1f%%)\n", uintmaxToCommaString (gcTime), (0 == time) Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/done.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,9 +0,0 @@ -/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * Copyright (C) 1997-2000 NEC Research Institute. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -void GC_done (GC_state s); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_prefix.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,5 +1,2 @@ #include "libgc.h" -static inline size_t meg (size_t n) { - return n / (1024ul * 1024ul); -} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,6 +6,7 @@ * See the file MLton-LICENSE for details. */ +#ifdef MLTON_GC_INTERNAL struct GC_state { size_t alignment; /* */ bool amInGC; @@ -60,6 +61,7 @@ uint32_t vectorInitsLength; GC_weak weaks; /* Linked list of (live) weak pointers */ }; +#endif void displayGCState (GC_state s, FILE *stream); Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c (from rev 4164, mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,80 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +bool GC_getAmOriginal (GC_state s) { + return s->amOriginal; +} +void GC_setAmOriginal (GC_state s, bool b) { + s->amOriginal = b; +} + +void GC_setMessages (GC_state s, bool b) { + s->controls.messages = b; +} + +void GC_setSummary (GC_state s, bool b) { + s->controls.summary = b; +} + +void GC_setRusageMeasureGC (GC_state s, bool b) { + s->controls.rusageMeasureGC = b; +} + +void GC_setHashConsDuringGC (GC_state s, bool b) { + s->hashConsDuringGC = b; +} + +struct rusage* GC_getRusageGCAddr (GC_state s) { + return &(s->cumulativeStatistics.ru_gc); +} + +sigset_t* GC_getSignalsHandledAddr (GC_state s) { + return &(s->signalsInfo.signalsHandled); +} + +bool GC_getSignalIsPending (GC_state s) { + return (s->signalsInfo.signalIsPending); +} + +sigset_t* GC_getSignalsPendingAddr (GC_state s) { + return &(s->signalsInfo.signalsPending); +} + +void GC_setGCSignalHandled (GC_state s, bool b) { + s->signalsInfo.gcSignalHandled = b; +} + +void GC_setGCSignalPending (GC_state s, bool b) { + s->signalsInfo.gcSignalPending = b; +} + +void GC_setCallFromCHandlerThread (GC_state s, GC_thread t) { + objptr op = pointerToObjptr ((pointer)t, s->heap.start); + s->callFromCHandlerThread = op; +} + +GC_thread GC_getCurrentThread (GC_state s) { + pointer p = objptrToPointer (s->currentThread, s->heap.start); + return (GC_thread)p; +} + +GC_thread GC_getSavedThread (GC_state s) { + pointer p = objptrToPointer (s->savedThread, s->heap.start); + s->savedThread = BOGUS_OBJPTR; + return (GC_thread)p; +} + +void GC_setSavedThread (GC_state s, GC_thread t) { + objptr op = pointerToObjptr ((pointer)t, s->heap.start); + s->savedThread = op; +} + +void GC_setSignalHandlerThread (GC_state s, GC_thread t) { + objptr op = pointerToObjptr ((pointer)t, s->heap.start); + s->signalHandlerThread = op; +} Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h (from rev 4164, mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state_exports.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -0,0 +1,28 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +bool GC_getAmOriginal (GC_state s); +void GC_setAmOriginal (GC_state s, bool b); +void GC_setMessages (GC_state s, bool b); +void GC_setSummary (GC_state s, bool b); +void GC_setRusageMeasureGC (GC_state s, bool b); +void GC_setHashConsDuringGC (GC_state s, bool b); +struct rusage* GC_getRusageGCAddr (GC_state s); + +GC_thread GC_getCurrentThread (GC_state s); +GC_thread GC_getSavedThread (GC_state s); +void GC_setCallFromCHandlerThread (GC_state s, GC_thread thread); +void GC_setSavedThread (GC_state s, GC_thread thread); +void GC_setSignalHandlerThread (GC_state s, GC_thread thread); + +sigset_t* GC_getSignalsHandledAddr (GC_state s); +bool GC_getSignalIsPending (GC_state s); +sigset_t* GC_getSignalsPendingAddr (GC_state s); +void GC_setGCSignalHandled (GC_state s, bool b); +void GC_setGCSignalPending (GC_state s, bool b); + Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_suffix.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -1 +0,0 @@ -#endif /* _MLTON_GC_H_ */ Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,7 +6,4 @@ * See the file MLton-LICENSE for details. */ -void GC_startHandler (GC_state s); -void GC_finishHandler (GC_state s); void switchToHandlerThreadIfNonAtomicAndSignalPending (GC_state s); -void GC_handler (GC_state s, int signum); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -198,9 +198,11 @@ } if (s->controls.messages) fprintf(stderr, - "[Requested %zuM cannot be satisfied, " - "backing off by %zuM (min size = %zuM).\n", - meg (h->size), meg (backoff), meg (minSize)); + "[Requested %s cannot be satisfied, " + "backing off by %s (min size = %s).\n", + sizeToBytesApproxString (h->size), + sizeToBytesApproxString (backoff), + sizeToBytesApproxString (minSize)); } h->size = 0; return FALSE; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -6,6 +6,9 @@ * See the file MLton-LICENSE for details. */ +/* Layout of intInfs. + * Note, the value passed around is a pointer to the isneg member. + */ typedef struct GC_intInf { GC_arrayCounter counter; GC_arrayLength length; @@ -13,3 +16,5 @@ uint32_t isneg; uint32_t *limbs; } *GC_intInf; + +#define GC_INTINF_HEADER GC_WORD32_VECTOR_HEADER Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -65,7 +65,7 @@ foreachObjptrInRange (s, s->heap.nursery, &s->frontier, assertIsObjptrInFromSpace, FALSE); /* Current thread. */ - GC_stack stack = getStackCurrent(s); + __attribute__ ((unused)) GC_stack stack = getStackCurrent(s); assert (isStackReservedAligned (s, stack->reserved)); assert (s->stackBottom == getStackBottom (s, stack)); assert (s->stackTop == getStackTop (s, stack)); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -10,19 +10,35 @@ /* Jonkers Mark-compact Collection */ /* ---------------------------------------------------------------- */ -/* An object pointer might be larger than a header. - */ void copyForThreadInternal (pointer dst, pointer src) { - size_t count; - assert (0 == (OBJPTR_SIZE % GC_HEADER_SIZE)); - count = (OBJPTR_SIZE - GC_HEADER_SIZE) / GC_HEADER_SIZE; - src = src + GC_HEADER_SIZE * count; + if (OBJPTR_SIZE > GC_HEADER_SIZE) { + size_t count; - for (size_t i = 0; i <= count; i++) { + assert (0 == (OBJPTR_SIZE % GC_HEADER_SIZE)); + count = (OBJPTR_SIZE - GC_HEADER_SIZE) / GC_HEADER_SIZE; + src = src + GC_HEADER_SIZE * count; + + for (size_t i = 0; i <= count; i++) { + *((GC_header*)dst) = *((GC_header*)src); + dst += GC_HEADER_SIZE; + src -= GC_HEADER_SIZE; + } + } else if (GC_HEADER_SIZE > OBJPTR_SIZE) { + size_t count; + + assert (0 == (GC_HEADER_SIZE % OBJPTR_SIZE)); + count = (GC_HEADER_SIZE - OBJPTR_SIZE) / OBJPTR_SIZE; + dst = dst + OBJPTR_SIZE * count; + + for (size_t i = 0; i <= count; i++) { + *((objptr*)dst) = *((objptr*)src); + dst -= OBJPTR_SIZE; + src += OBJPTR_SIZE; + } + + } else /* (GC_HEADER_SIZE == OBJPTR_SIZE) */ { *((GC_header*)dst) = *((GC_header*)src); - dst += GC_HEADER_SIZE; - src -= GC_HEADER_SIZE; } } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -135,7 +135,9 @@ manageable set for users. */ -#if (defined (GC_MODEL_A)) +#if (defined (MLTON_GC_INTERNAL)) + +#if (defined (GC_MODEL_A) || defined (GC_MODEL_NATIVE32)) #define GC_MODEL_BITSIZE 32 #define GC_MODEL_SHIFT 0 #define GC_MODEL_USEBASE FALSE @@ -195,7 +197,7 @@ #define GC_MODEL_SHIFT 0 #define GC_MODEL_USEBASE TRUE #define GC_MODEL_MINALIGN_SHIFT 2 -#elif (defined (GC_MODEL_G)) +#elif (defined (GC_MODEL_G) || defined (GC_MODEL_NATIVE64)) #define GC_MODEL_BITSIZE 64 #define GC_MODEL_SHIFT 0 #define GC_MODEL_USEBASE FALSE @@ -205,3 +207,5 @@ #endif #define GC_MODEL_NONOBJPTR ((GC_MODEL_MINALIGN_SHIFT - GC_MODEL_SHIFT) > 0) #define GC_MODEL_MINALIGN TWOPOWER(GC_MODEL_MINALIGN_SHIFT) + +#endif /* (defined (MLTON_GC_INTERNAL)) */ Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/model_predicates.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/model_predicates.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/model_predicates.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -1,18 +0,0 @@ -/* Copyright (C) 2005-2005 Henry Cejtin, Matthew Fluet, Suresh - * Jagannathan, and Stephen Weeks. - * - * MLton is released under a BSD-style license. - * See the file MLton-LICENSE for details. - */ - -/* isObjptr returns true if p looks like an object pointer. */ -bool isObjptr (objptr p) { - if GC_MODEL_NONOBJPTR { - unsigned int shift = GC_MODEL_MINALIGN_SHIFT - GC_MODEL_SHIFT; - objptr mask = ~((~((objptr)0)) << shift); - return (0 == (p & mask)); - } else { - return TRUE; - } -} - Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2005-11-07 02:30:53 UTC (rev 4166) @@ -86,17 +86,6 @@ *numObjptrsRet = numObjptrs; } -pointer alignFrontier (GC_state s, pointer p) { - size_t res; - - res = pad (s, (size_t)p, GC_NORMAL_HEADER_SIZE); - if (DEBUG_STACKS) - fprintf (stderr, FMTPTR" = alignFrontier ("FMTPTR")\n", - (uintptr_t)p, (uintptr_t)res); - assert (isFrontierAligned (s, (pointer)res)); - return (pointer)res; -} - /* advanceToObjectData (s, p) * * If p points at the beginning of an object, then advanceToObjectData Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h 2005-11-06 21:26:45 UTC (rev 4165) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h 2005-11-07 02:30:53 UTC (rev 4166) @@ -122,7 +122,6 @@ uint16_t *numNonObjptrsRet, uint16_t *numObjptrsRet); bool isFr... [truncated message content] |
From: Matthew F. <fl...@ml...> - 2005-11-06 13:27:33
|
Merge trunk revisions 4025:4164 into x86_64 branch ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/Makefile U mlton/branches/on-20050822-x86_64-branch/basis-library/libs/basis-extra/basis-extra.mlb U mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/exn.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/gc.sig U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sig U mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/posix/stub-mingw.sml U mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.fun U mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.sig U mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile U mlton/branches/on-20050822-x86_64-branch/bin/add-cross U mlton/branches/on-20050822-x86_64-branch/bin/clean A mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki A mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide U mlton/branches/on-20050822-x86_64-branch/bin/mlton-script U mlton/branches/on-20050822-x86_64-branch/bin/regression U mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c U mlton/branches/on-20050822-x86_64-branch/doc/README U mlton/branches/on-20050822-x86_64-branch/doc/changelog A mlton/branches/on-20050822-x86_64-branch/doc/guide/ U mlton/branches/on-20050822-x86_64-branch/ide/emacs/esml-gen.el U mlton/branches/on-20050822-x86_64-branch/ide/emacs/mlton.el U mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/c.mlb A mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.mlb D mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.x86-unix.mlb A mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.32bit-unix.mlb A mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.mlb D mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.x86-unix.mlb A mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/platform/ U mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sml U mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/string1.sml U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/gc.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/itimer.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/mlton.sml U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/random.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rlimit.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rusage.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/signal.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/socket.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/syslog.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/word.sig U mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs-in-smlnj/sources.cm U mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT_c.c U mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLU_c.c U mlton/branches/on-20050822-x86_64-branch/lib/opengl/GL_c.c U mlton/branches/on-20050822-x86_64-branch/lib/opengl/Makefile U mlton/branches/on-20050822-x86_64-branch/lib/opengl/atom.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/hello.sml A mlton/branches/on-20050822-x86_64-branch/lib/opengl/platform.h U mlton/branches/on-20050822-x86_64-branch/lib/opengl/points.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/shortest.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/solar.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/spin_cube.sml U mlton/branches/on-20050822-x86_64-branch/lib/opengl/triangle.sml A mlton/branches/on-20050822-x86_64-branch/man/mlnlffigen.1 U mlton/branches/on-20050822-x86_64-branch/man/mlton.1 U mlton/branches/on-20050822-x86_64-branch/mllex/Makefile U mlton/branches/on-20050822-x86_64-branch/mlnlffigen/Makefile U mlton/branches/on-20050822-x86_64-branch/mlnlffigen/gen.sml U mlton/branches/on-20050822-x86_64-branch/mlprof/Makefile U mlton/branches/on-20050822-x86_64-branch/mlton/Makefile U mlton/branches/on-20050822-x86_64-branch/mlton/backend/allocate-registers.fun U mlton/branches/on-20050822-x86_64-branch/mlton/backend/backend.fun U mlton/branches/on-20050822-x86_64-branch/mlton/backend/machine.fun U mlton/branches/on-20050822-x86_64-branch/mlton/backend/ssa-to-rssa.fun U mlton/branches/on-20050822-x86_64-branch/mlton/codegen/c-codegen/c-codegen.fun U mlton/branches/on-20050822-x86_64-branch/mlton/control/control-flags.sig U mlton/branches/on-20050822-x86_64-branch/mlton/control/control-flags.sml U mlton/branches/on-20050822-x86_64-branch/mlton/control/source.sml U mlton/branches/on-20050822-x86_64-branch/mlton/elaborate/elaborate-env.fun U mlton/branches/on-20050822-x86_64-branch/mlton/elaborate/elaborate-sigexp.fun U mlton/branches/on-20050822-x86_64-branch/mlton/elaborate/type-env.fun U mlton/branches/on-20050822-x86_64-branch/mlton/front-end/mlb-front-end.fun U mlton/branches/on-20050822-x86_64-branch/mlton/main/main.fun U mlton/branches/on-20050822-x86_64-branch/mlyacc/Makefile U mlton/branches/on-20050822-x86_64-branch/mlyacc/doc/Makefile U mlton/branches/on-20050822-x86_64-branch/package/debian/changelog U mlton/branches/on-20050822-x86_64-branch/package/debian/control A mlton/branches/on-20050822-x86_64-branch/package/debian/mlton.doc-base U mlton/branches/on-20050822-x86_64-branch/package/debian/rules A mlton/branches/on-20050822-x86_64-branch/package/mingw/ A mlton/branches/on-20050822-x86_64-branch/regression/filesys.x86-cygwin.ok A mlton/branches/on-20050822-x86_64-branch/regression/finalize.3.ok A mlton/branches/on-20050822-x86_64-branch/regression/finalize.3.sml A mlton/branches/on-20050822-x86_64-branch/regression/finalize.4.ok A mlton/branches/on-20050822-x86_64-branch/regression/finalize.4.sml A mlton/branches/on-20050822-x86_64-branch/regression/finalize.5.ok A mlton/branches/on-20050822-x86_64-branch/regression/finalize.5.sml U mlton/branches/on-20050822-x86_64-branch/regression/flexrecord.sml A mlton/branches/on-20050822-x86_64-branch/regression/unixpath.x86-cygwin.ok U mlton/branches/on-20050822-x86_64-branch/runtime/Makefile U mlton/branches/on-20050822-x86_64-branch/runtime/basis/GC.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc.h U mlton/branches/on-20050822-x86_64-branch/runtime/platform/mingw.c U mlton/branches/on-20050822-x86_64-branch/runtime/platform/mingw.h U mlton/branches/on-20050822-x86_64-branch/runtime/platform.h ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-06 21:26:45 UTC (rev 4165) @@ -19,9 +19,14 @@ RUN = $(SRC)/runtime MLTON = $(BIN)/mlton AOUT = mlton-compile +ifeq (mingw, $(TARGET_OS)) +EXE = .exe +else +EXE = +endif MLBPATHMAP = $(LIB)/mlb-path-map TARGETMAP = $(LIB)/target-map -SPEC = $(SRC)/package/rpm/mlton.spec +SPEC = package/rpm/mlton.spec LEX = mllex PROF = mlprof YACC = mlyacc @@ -46,7 +51,7 @@ # stubs. Remove $(AOUT) so that the $(MAKE) compiler below will # remake MLton. ifeq (other, $(shell if [ ! -x $(BIN)/mlton ]; then echo other; fi)) - rm -f $(COMP)/$(AOUT) + rm -f $(COMP)/$(AOUT)$(EXE) endif $(MAKE) script mlbpathmap targetmap constants compiler world libraries tools @echo 'Build of MLton succeeded.' @@ -92,7 +97,7 @@ .PHONY: compiler compiler: $(MAKE) -C $(COMP) - $(CP) $(COMP)/$(AOUT) $(LIB)/ + $(CP) $(COMP)/$(AOUT)$(EXE) $(LIB)/ .PHONY: constants constants: @@ -105,7 +110,7 @@ DEBSRC = mlton-$(VERSION).orig .PHONY: deb deb: - $(MAKE) clean clean-svn version deb-change + $(MAKE) clean clean-svn version mv package/debian . tar -cpf - . | \ ( cd .. && mkdir $(DEBSRC) && cd $(DEBSRC) && tar -xpf - ) @@ -159,33 +164,26 @@ # vvvv do not change make to $(MAKE) cd $(BSDSRC)/freebsd && make build-package +LIBRARIES = ckit-lib cml mlnlffi-lib mlyacc-lib smlnj-lib + .PHONY: libraries-no-check libraries-no-check: mkdir -p $(LIB)/sml - cd $(LIB)/sml && rm -rf mlyacc-lib - $(CP) $(SRC)/lib/mlyacc/. $(LIB)/sml/mlyacc-lib - find $(LIB)/sml/mlyacc -type d -name .svn | xargs rm -rf - find $(LIB)/sml/mlyacc -type f -name .ignore | xargs rm -rf - cd $(LIB)/sml && rm -rf cml + cd $(LIB)/sml && rm -rf $(LIBRARIES) + $(MAKE) -C $(SRC)/lib/ckit-lib + $(MAKE) -C $(SRC)/lib/smlnj-lib $(CP) $(SRC)/lib/cml/. $(LIB)/sml/cml - find $(LIB)/sml/cml -type d -name .svn | xargs rm -rf - find $(LIB)/sml/cml -type f -name .ignore | xargs rm -rf - cd $(LIB)/sml && rm -rf smlnj-lib - $(MAKE) -C $(SRC)/lib/smlnj-lib - $(CP) $(SRC)/lib/smlnj-lib/smlnj-lib/. $(LIB)/sml/smlnj-lib - cd $(LIB)/sml && rm -rf ckit-lib - $(MAKE) -C $(SRC)/lib/ckit-lib $(CP) $(SRC)/lib/ckit-lib/ckit/. $(LIB)/sml/ckit-lib - cd $(LIB)/sml && rm -rf mlnlffi-lib $(CP) $(SRC)/lib/mlnlffi/. $(LIB)/sml/mlnlffi-lib - find $(LIB)/sml/mlnlffi-lib -type d -name .svn | xargs rm -rf - find $(LIB)/sml/mlnlffi-lib -type f -name .ignore | xargs rm -rf + $(CP) $(SRC)/lib/mlyacc/. $(LIB)/sml/mlyacc-lib + $(CP) $(SRC)/lib/smlnj-lib/smlnj-lib/. $(LIB)/sml/smlnj-lib + find $(LIB)/sml -type d -name .svn | xargs rm -rf + find $(LIB)/sml -type f -name .ignore | xargs rm -rf - .PHONY: libraries libraries: $(MAKE) libraries-no-check - for f in mlyacc-lib cml smlnj-lib ckit-lib mlnlffi-lib; do \ + for f in $(LIBRARIES); do \ echo "Type checking $$f library."; \ $(MLTON) -disable-ann deadCode \ -stop tc \ @@ -266,7 +264,7 @@ rm -rf $(SOURCEDIR) mkdir -p $(SOURCEDIR) ( cd $(SRC) && tar -cpf - . ) | ( cd $(SOURCEDIR) && tar -xpf - ) - $(CP) $(SOURCEDIR)/doc/mlton.spec $(TOPDIR)/SPECS/mlton.spec + $(CP) $(SOURCEDIR)/$(SPEC) $(TOPDIR)/SPECS/mlton.spec ( cd $(TOPDIR)/SOURCES && tar -cpf - mlton-$(VERSION) ) \ | $(GZIP) >$(SOURCEDIR).tgz rm -rf $(SOURCEDIR) @@ -289,9 +287,7 @@ .PHONY: script script: - @echo 'Setting lib in mlton script.' - sed "/^lib=/s;'.*';\"\`dirname \$$0\`/../lib\";" \ - <bin/mlton-script >$(MLTON) + $(CP) bin/mlton-script $(MLTON) chmod a+x $(MLTON) $(CP) $(SRC)/bin/platform $(LIB) @@ -309,16 +305,20 @@ $(MAKE) -C $(NLFFIGEN) $(MAKE) -C $(PROF) $(MAKE) -C $(YACC) - $(CP) $(LEX)/$(LEX) $(NLFFIGEN)/$(NLFFIGEN) $(PROF)/$(PROF) $(YACC)/$(YACC) $(BIN)/ + $(CP) $(LEX)/$(LEX)$(EXE) \ + $(NLFFIGEN)/$(NLFFIGEN)$(EXE) \ + $(PROF)/$(PROF)$(EXE) \ + $(YACC)/$(YACC)$(EXE) \ + $(BIN)/ .PHONY: version version: @echo 'Instantiating version numbers.' for f in \ package/debian/changelog \ - package/rpm/mlton.spec \ + $(SPEC) \ package/freebsd/Makefile \ - mlton/control/control.sml; \ + mlton/control/control-flags.sml; \ do \ sed "s/\(.*\)MLTONVERSION\(.*\)/\1$(VERSION)\2/" <$$f >z && \ mv z $$f; \ @@ -330,7 +330,7 @@ world-no-check: @echo 'Making world.' $(MAKE) basis-no-check - $(LIB)/$(AOUT) @MLton -- $(LIB)/world + $(LIB)/$(AOUT)$(EXE) @MLton -- $(LIB)/world .PHONY: world world: @@ -346,6 +346,9 @@ # puts them. DESTDIR = $(CURDIR)/install PREFIX = /usr +ifeq ($(TARGET_OS), darwin) +PREFIX = /usr/local +endif ifeq ($(TARGET_OS), solaris) PREFIX = /usr/local endif @@ -369,27 +372,33 @@ .PHONY: install install: install-docs install-no-docs +MAN_PAGES = \ + mllex.1 \ + mlnlffigen.1 \ + mlprof.1 \ + mlton.1 \ + mlyacc.1 + .PHONY: install-no-docs install-no-docs: mkdir -p $(TLIB) $(TBIN) $(TMAN) $(CP) $(LIB)/. $(TLIB)/ rm -f $(TLIB)/self/libmlton-gdb.a - sed "/^lib=/s;'.*';'$(prefix)/$(ULIB)';" \ + sed "/^lib=/s;.*;lib='$(prefix)/$(ULIB)';" \ <$(SRC)/bin/mlton-script >$(TBIN)/mlton chmod a+x $(TBIN)/mlton - $(CP) $(BIN)/$(LEX) $(BIN)/$(PROF) $(BIN)/$(YACC) $(TBIN)/ - ( cd $(SRC)/man && tar cf - mllex.1 mlprof.1 mlton.1 mlyacc.1 ) | \ + cd $(BIN) && $(CP) $(LEX) $(NLFFIGEN) $(PROF) $(YACC) $(TBIN)/ + ( cd $(SRC)/man && tar cf - $(MAN_PAGES)) | \ ( cd $(TMAN)/ && tar xf - ) if $(GZIP_MAN); then \ - cd $(TMAN) && $(GZIP) mllex.1 mlprof.1 mlton.1 \ - mlyacc.1; \ + cd $(TMAN) && $(GZIP) $(MAN_PAGES); \ fi case "$(TARGET_OS)" in \ - darwin|solaris) \ + cygwin|darwin|solaris) \ ;; \ *) \ - for f in $(TLIB)/$(AOUT) \ - $(TBIN)/$(LEX) $(TBIN)/$(PROF) \ + for f in $(TLIB)/$(AOUT) $(TBIN)/$(LEX) \ + $(TBIN)/$(NLFFIGEN) $(TBIN)/$(PROF) \ $(TBIN)/$(YACC); do \ strip --remove-section=.comment \ --remove-section=.note $$f; \ @@ -399,15 +408,14 @@ .PHONY: install-docs install-docs: mkdir -p $(TDOC) - ( \ - cd $(SRC)/doc && \ - $(CP) changelog examples license README $(TDOC)/ \ + ( \ + cd $(SRC)/doc && \ + $(CP) changelog examples guide license README $(TDOC)/ \ ) - ( \ - cd $(SRC)/util && \ - $(CP) cmcat cm2mlb $(TDOC)/ \ + ( \ + cd $(SRC)/util && \ + $(CP) cmcat cm2mlb $(TDOC)/ \ ) - rm -rf $(TDOC)/user-guide for f in callcc command-line hello-world same-fringe signals \ size taut thread1 thread2 thread-switch timeout \ ; do \ @@ -428,7 +436,8 @@ $(CP) $(SRC)/debian/copyright $(SRC)/debian/README.Debian $(TDOC)/ $(CP) $(SRC)/debian/changelog $(TDOC)/changelog.Debian mkdir -p $(TDOCBASE) - for f in mllex mlyacc; do \ + for f in mllex mlton mlyacc; do \ $(CP) $(SRC)/debian/$$f.doc-base $(TDOCBASE)/$$f; \ done cd $(TDOC)/ && $(GZIP) changelog changelog.Debian + chown -R root.root $(TDOC) Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/libs/basis-extra/basis-extra.mlb =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/libs/basis-extra/basis-extra.mlb 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/libs/basis-extra/basis-extra.mlb 2005-11-06 21:26:45 UTC (rev 4165) @@ -166,6 +166,8 @@ ../../mlton/signal.sml ../../mlton/process.sig ../../mlton/process.sml + ../../mlton/gc.sig + ../../mlton/gc.sml ../../mlton/rusage.sig ../../mlton/rusage.sml @@ -214,8 +216,6 @@ in ../../mlton/ffi.sml end - ../../mlton/gc.sig - ../../mlton/gc.sml ../../mlton/int-inf.sig ../../mlton/platform.sig ../../mlton/platform.sml Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/misc/primitive.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -400,7 +400,7 @@ val setHashConsDuringGC = _import "GC_setHashConsDuringGC": bool -> unit; val setMessages = _import "GC_setMessages": bool -> unit; - val setRusage = _import "GC_setRusage": bool -> unit; + val setRusageMeasureGC = _import "GC_setRusageMeasureGC": bool -> unit; val setSummary = _import "GC_setSummary": bool -> unit; val unpack = _import "MLton_GC_unpack": unit -> unit; end @@ -1350,7 +1350,7 @@ val modf = _import "Real64_modf": real * real ref -> real; val nextAfter = _import "Real64_nextAfter": real * real -> real; val round = _prim "Real64_round": real -> real; - val signBit = _import "Real64_signBit": real -> bool; + val signBit = _import "Real64_signBit": real -> int; val strto = _import "Real64_strto": NullString.t -> real; val toInt = _prim "Real64_toWordS32": real -> int; val ~ = _prim "Real64_neg": real -> real; @@ -1423,7 +1423,7 @@ val minNormalPos = #1 _symbol "Real32_minNormalPos": real GetSet.t; () val minPos = #1 _symbol "Real32_minPos": real GetSet.t; () val modf = _import "Real32_modf": real * real ref -> real; - val signBit = _import "Real32_signBit": real -> bool; + val signBit = _import "Real32_signBit": real -> int; val strto = _import "Real32_strto": NullString.t -> real; val toInt = _prim "Real32_toWordS32": real -> int; val ~ = _prim "Real32_neg": real -> real; Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/exn.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/exn.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/exn.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -14,19 +14,31 @@ val addExnMessager = General.addExnMessager val history: t -> string list = - if keepHistory - then (setInitExtra (NONE: extra) - ; setExtendExtra (fn e => - case e of - NONE => SOME (MLtonCallStack.current ()) - | SOME _ => e) - ; fn e => (case extra e of - NONE => [] - | SOME cs => - (* The tl gets rid of the anonymous function - * passed to setExtendExtra above. - *) - tl (MLtonCallStack.toStrings cs))) + if keepHistory then + (setInitExtra (NONE: extra) + ; setExtendExtra (fn e => + case e of + NONE => SOME (MLtonCallStack.current ()) + | SOME _ => e) + ; (fn e => + case extra e of + NONE => [] + | SOME cs => + let + (* Gets rid of the anonymous function passed to + * setExtendExtra above. + *) + fun loop xs = + case xs of + [] => [] + | x :: xs => + if String.isPrefix "MLtonExn.fn " x then + xs + else + loop xs + in + loop (MLtonCallStack.toStrings cs) + end)) else fn _ => [] local Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/gc.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/gc.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/gc.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -11,7 +11,6 @@ val collect: unit -> unit val pack: unit -> unit val setMessages: bool -> unit - val setRusage: bool -> unit val setSummary: bool -> unit val unpack: unit -> unit end Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -11,7 +11,8 @@ type t = {utime: Time.time, (* user time *) stime: Time.time (* system time *) } - + + val measureGC: bool -> unit val rusage: unit -> {children: t, gc: t, self: t} Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/mlton/rusage.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -28,16 +28,23 @@ utime = toTime (utimeSec, utimeUsec)} end - fun rusage () = - let - val () = Prim.ru () - open Prim + val measureGC = Primitive.GC.setRusageMeasureGC + + val rusage = + let + val () = measureGC true in - {children = collect (children_utime_sec, children_utime_usec, - children_stime_sec, children_stime_usec), - gc = collect (gc_utime_sec, gc_utime_usec, - gc_stime_sec, gc_stime_usec), - self = collect (self_utime_sec, self_utime_usec, - self_stime_sec, self_stime_usec)} + fn () => + let + val () = Prim.ru () + open Prim + in + {children = collect (children_utime_sec, children_utime_usec, + children_stime_sec, children_stime_usec), + gc = collect (gc_utime_sec, gc_utime_usec, + gc_stime_sec, gc_stime_usec), + self = collect (self_utime_sec, self_utime_usec, + self_stime_sec, self_stime_usec)} + end end end Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/posix/stub-mingw.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/posix/stub-mingw.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/posix/stub-mingw.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -73,6 +73,7 @@ val getppid = stub ("getppid", getppid) val getuid = stub ("getuid", getuid) val setgid = stub ("setgid", setgid) + val setgroups = stub ("stegroups", setgroups) val setpgid = stub ("setpgid", setpgid) val setsid = stub ("setsid", setsid) val setuid = stub ("setuid", setuid) Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.fun =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.fun 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.fun 2005-11-06 21:26:45 UTC (rev 4165) @@ -48,7 +48,7 @@ val minPos = minPos val precision = precision val radix = radix - val signBit = signBit + val signBit = fn r => signBit r <> 0 val toLarge = toLarge end Modified: mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/basis-library/real/real.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -41,7 +41,7 @@ val nextAfterUp: real -> real val precision: int val radix: int - val signBit: real -> bool + val signBit: real -> int val strto: NullString.t -> real val toInt: real -> int val toLarge: real -> LargeReal.real Modified: mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/benchmark/Makefile 2005-11-06 21:26:45 UTC (rev 4165) @@ -23,7 +23,6 @@ $(NAME): $(NAME).mlb $(shell PATH=$(BIN):$$PATH && $(MLTON) -stop f $(NAME).mlb) @echo 'Compiling $(NAME)' $(MLTON) $(FLAGS) $(NAME).mlb - size $(NAME) $(NAME).sml: $(NAME).cm $(shell $(MLTON) -stop f $(NAME).cm) mlton -stop sml $(NAME).cm Modified: mlton/branches/on-20050822-x86_64-branch/bin/add-cross =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bin/add-cross 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/bin/add-cross 2005-11-06 21:26:45 UTC (rev 4165) @@ -89,8 +89,19 @@ mmake TARGET=$crossTarget TARGET_ARCH=$crossArch TARGET_OS=$crossOS \ mlbpathmap targetmap ) +case "$crossOS" in +mingw) + suf='.exe' +;; +*) + suf='' +;; +esac case "$crossOS" in +mingw) + libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32' +;; solaris) libs='-lrt -lnsl -lsocket' ;; @@ -103,5 +114,5 @@ ssh $machine "cd $tmp/runtime && cat >$exe.c && gcc -I. -o $exe $exe.c libmlton.a -lgmp -lm $libs" -ssh $machine "$tmp/runtime/$exe" >"$lib/$crossTarget/constants" +ssh $machine "$tmp/runtime/$exe$suf" >"$lib/$crossTarget/constants" ssh $machine "rm -rf $tmp" Modified: mlton/branches/on-20050822-x86_64-branch/bin/clean =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bin/clean 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/bin/clean 2005-11-06 21:26:45 UTC (rev 4165) @@ -17,20 +17,19 @@ ignore='.ignore' doit () { - rm -rf '.#'* .*~ *~ *.a *.o .cm core mlmon.out + rm -rf '.#'* .*~ *~ *.a *.o .cm core mlmon.out svn-commit.* if [ -r $ignore ]; then for f in `cat $ignore`; do rm -rf $f; done fi for f in `ls`; do if [ -d $f ]; then - cd $f; - if [ -r Makefile ] && - grep $grepFlags '^clean:' Makefile ; then - $bin/mmake clean + cd $f + if [ -r Makefile ]; then + $bin/mmake clean || doit else doit - fi && - cd ..; + fi + cd .. fi done } Copied: mlton/branches/on-20050822-x86_64-branch/bin/grab-wiki (from rev 4164, mlton/trunk/bin/grab-wiki) Copied: mlton/branches/on-20050822-x86_64-branch/bin/make-pdf-guide (from rev 4164, mlton/trunk/bin/make-pdf-guide) Modified: mlton/branches/on-20050822-x86_64-branch/bin/mlton-script =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bin/mlton-script 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/bin/mlton-script 2005-11-06 21:26:45 UTC (rev 4165) @@ -68,6 +68,7 @@ -cc-opt "-I$lib/include" \ -cc-opt '-O1' \ -cc-opt '-fno-strict-aliasing -fomit-frame-pointer -w' \ + -mlb-path-map "$lib/mlb-path-map" \ -target-as-opt amd64 \ '-m32 -mtune=opteron' \ @@ -77,10 +78,8 @@ -target-cc-opt darwin '-I/sw/include' \ -target-cc-opt solaris \ '-Wa,-xarch=v8plusa - -fcall-used-g5 - -fcall-used-g7 -mcpu=ultrasparc' \ - -target-cc-opt sparc '-mv8 -m32' \ + -target-cc-opt sparc '-mcpu=v8 -m32' \ -target-cc-opt x86 \ '-fno-strength-reduce -fschedule-insns Modified: mlton/branches/on-20050822-x86_64-branch/bin/regression =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bin/regression 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/bin/regression 2005-11-06 21:26:45 UTC (rev 4165) @@ -54,6 +54,7 @@ dir=`dirname $0` src=`cd $dir/.. && pwd` bin="$src/build/bin" +lib="$src/build/lib" mlton="$bin/mlton" flags="-type-check true $flags" if [ $cross = 'yes' ]; then @@ -68,6 +69,8 @@ tmp=/tmp/z.regression.$$ PATH=$bin:$src/bin/.:$PATH +eval `$lib/platform` + compFail () { echo "compilation of $f failed with $flags" } @@ -101,99 +104,98 @@ case `host-os` in mingw) case "$f" in - mutex|prodcons|signals2) + cmdline|command-line|filesys|mutex|posix-exit|prodcons|signals2|timeout|unixpath) continue ;; esac esac case "$f" in serialize) - echo "skipping $f" + continue ;; + esac + echo "testing $f" + case "$f" in + exnHistory*) + extraFlags="-const 'Exn.keepHistory true'" + ;; *) - echo "testing $f" - case "$f" in - exnHistory*) - extraFlags="-const 'Exn.keepHistory true'" + extraFlags="" + ;; + esac + case "$runOnly" in + no) + mlb="$f.mlb" + echo "\$(SML_LIB)/basis/basis.mlb + \$(SML_LIB)/basis/mlton.mlb + \$(SML_LIB)/basis/sml-nj.mlb + ann + \"allowFFI true\" + \"allowOverload true\" + \"nonexhaustiveMatch ignore\" + \"redundantMatch ignore\" + in $f.sml + end" >$mlb + cmd="$mlton $flags $extraFlags -output $f $mlb" + eval $cmd + rm $mlb + if [ "$?" -ne '0' ] || + [ "$cross" = 'no' -a ! -x "$f" ]; then + compFail $f + fi + ;; + yes) + case $crossTarget in + *mingw) + libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32' ;; + *solaris) + libs='-lnsl -lsocket -lrt' + ;; *) - extraFlags="" + libs='' ;; esac - case "$runOnly" in - no) - mlb="$f.mlb" - echo "\$(SML_LIB)/basis/basis.mlb - \$(SML_LIB)/basis/mlton.mlb - \$(SML_LIB)/basis/sml-nj.mlb - ann - \"allowFFI true\" - \"allowOverload true\" - \"nonexhaustiveMatch ignore\" - \"redundantMatch ignore\" - in $f.sml - end" >$mlb - cmd="$mlton $flags $extraFlags -output $f $mlb" - eval $cmd - rm $mlb - if [ "$?" -ne '0' ] || - [ "$cross" = 'no' -a ! -x "$f" ]; then - compFail $f - fi + libs="-lmlton -lgmp $libs -lgdtoa -lm" + # Must use $f.[0-9].[cS], not $f.*.[cS], because the + # latter will include other files, e.g. for finalize, + # it will also include finalize.2. + files="$f.[0-9].[cS]" + if [ 0 -ne `ls $f.[0-9][0-9].[cS] 2>/dev/null | wc -l` ]; then + files="$files $f.[0-9][0-9].[cS]" + fi + gcc -o $f -w -O1 \ + -I "../build/lib/include" \ + -L"../build/lib/$crossTarget" \ + -L/usr/pkg/lib \ + -L/usr/local/lib \ + $files $libs + ;; + esac + if [ ! -r $f.nonterm -a $cross = 'no' -a -x $f ]; then + nonZeroMsg='Nonzero exit status.' + case $crossTarget in + *mingw) + nonZeroMsg="$nonZeroMsg"'\r' ;; - yes) - case $crossTarget in - *mingw) - libs='-lws2_32 -lkernel32 -lpsapi -lnetapi32' - ;; - *solaris) - libs='-lnsl -lsocket' - ;; - *) - libs='' - ;; - esac - libs="-lmlton -lgmp $libs -lgdtoa -lm" - # Must use $f.[0-9].[cS], not $f.*.[cS], because the - # latter will include other files, e.g. for finalize, - # it will also include finalize.2. - files="$f.[0-9].[cS]" - if ls $f.[0-9][0-9].[cS] >/dev/null 2>&1; then - files="$files $f.[0-9][0-9].[cS]" + esac + ( ./$f || echo -e "$nonZeroMsg" ) >$tmp 2>&1 + if [ -r $f.ok ]; then + compare="$f.$HOST_ARCH-$HOST_OS.ok" + if [ ! -r $compare ]; then + compare="$f.ok" fi - gcc -o $f -w -O1 \ - -I "../build/lib/include" \ - -L"../build/lib/$crossTarget" \ - -L/usr/pkg/lib \ - -L/usr/local/lib \ - $files $libs - ;; - esac - if [ ! -r $f.nonterm -a $cross = 'no' -a -x $f ]; then - nonZeroMsg='Nonzero exit status.' case $crossTarget in *mingw) - nonZeroMsg="$nonZeroMsg"'\r' + compare="$f.sed.ok" + sed 's/$/\r/' <"$f.ok" >"$compare" ;; esac - ( ./$f || echo -e "$nonZeroMsg" ) >$tmp 2>&1 - if [ -r $f.ok ]; then - case $crossTarget in - *mingw) - compare="$f.sed.ok" - sed 's/$/\r/' <"$f.ok" >"$compare" - ;; - *) - compare="$f.ok" - ;; - esac - if ! diff $compare $tmp; then - echo "difference with $flags" - fi + if ! diff $compare $tmp; then + echo "difference with $flags" fi fi - ;; - esac + fi done if [ "$cross" = 'yes' -o "$runOnly" = 'yes' -o "$short" = 'yes' ]; then exit 0 @@ -204,7 +206,7 @@ f=`basename $f .sml` tmpf=/tmp/$f.$$ case "$f" in - fxp) + fxp|hamlet) echo "skipping $f" ;; *) Modified: mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/bytecode/interpret.c 2005-11-06 21:26:45 UTC (rev 4165) @@ -6,7 +6,6 @@ */ #include "platform.h" -#include <stdint.h> #include "interpret.h" #include "c-chunk.h" // c-chunk.h must come before opcode.h because it // redefines some opcode symbols Modified: mlton/branches/on-20050822-x86_64-branch/doc/README =================================================================== --- mlton/branches/on-20050822-x86_64-branch/doc/README 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/doc/README 2005-11-06 21:26:45 UTC (rev 4165) @@ -2,8 +2,9 @@ programming language. MLton has the following features. + Runs on a variety of platforms. - o X86: Linux, Cygwin/Windows, FreeBSD, and NetBSD. - o Sparc: Solaris. + o PowerPC: Debian, Mac OSX + o X86: Linux, Cygwin/Windows, FreeBSD, NetBSD, OpenBSD + o Sparc: Debian, Solaris. + Generates standalone executables with excellent running times. + Supports the full SML 97 language. + A complete basis library matching the latest specification. @@ -34,8 +35,8 @@ cm2mlb/ a utility for producing ML Basis programs in SML/NJ cmcat/ a utility for producing whole programs in SML/NJ examples/ example SML programs + guide/ MLton guide license/ license information mllex.ps.gz user guide for mllex lexer generator mlyacc.ps.gz user guide for mlyacc parser generator - user-guide/ html user guide - user-guide.ps.gz user guide for MLton + Modified: mlton/branches/on-20050822-x86_64-branch/doc/changelog =================================================================== --- mlton/branches/on-20050822-x86_64-branch/doc/changelog 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/doc/changelog 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,29 @@ Here are the changes since version 20041109. +* 2005-11-03 + - Removed MLton.GC.setRusage. + - Added MLton.Rusage.measureGC. + +* 2005-09-11 + - Fixed bug in display of types with large numbers of type + variables, which could cause unhandled exception Chr. + +* 2005-09-08 + - Fixed bug in type inference of flexible records that would show up + as "Type error: variable applied to wrong number of type args" + +* 2005-09-06 + - Fixed bug in Real.signBit, which had assumed that the underlying + C signbit returned 0 or 1, when in fact any nonzero value is + allowed to indicate the signbit is set. + +* 2005-09-05 + - Added -mlb-path-map switch. + +* 2005-08-25 + - Fixed bug in MLton.Finalizable.touch, which was not keeping alive + finalizable values in all cases. + * 2005-08-18 - Added SML/NJ Library and CKit Library from SML/NJ 110.55 to standard distribution. Copied: mlton/branches/on-20050822-x86_64-branch/doc/guide (from rev 4164, mlton/trunk/doc/guide) Modified: mlton/branches/on-20050822-x86_64-branch/ide/emacs/esml-gen.el =================================================================== --- mlton/branches/on-20050822-x86_64-branch/ide/emacs/esml-gen.el 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/ide/emacs/esml-gen.el 2005-11-06 21:26:45 UTC (rev 4165) @@ -33,7 +33,7 @@ 2.4 of the Definition.") (defconst esml-sml-alphanumeric-chars - "abcdefghijklmnopqrstuvxyzABCDEFGHIJKLMNOPQRSTUVXYZ0123456789'_" + "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'_" "A string of all Standard ML alphanumeric characters as defined in section 2.4 of the Definition.") Modified: mlton/branches/on-20050822-x86_64-branch/ide/emacs/mlton.el =================================================================== --- mlton/branches/on-20050822-x86_64-branch/ide/emacs/mlton.el 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/ide/emacs/mlton.el 2005-11-06 21:26:45 UTC (rev 4165) @@ -10,6 +10,7 @@ ;; markers so that file edits don't interfere with locating subsequent errros. (setq mlton-command "mlton") +(setq mlton-flags "") (setq mlton-main-file "mlton-main-file undefined") (setq mlton-output-buffer "*mlton-output*") (setq mlton-errors nil) @@ -95,6 +96,7 @@ (kill-buffer mlton-output-buffer)) (find-file mlton-main-file) (shell-command (concat mlton-command + " " mlton-flags " " " -stop tc " (file-name-nondirectory mlton-main-file)) mlton-output-buffer) Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/c.mlb =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/c.mlb 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/c.mlb 2005-11-06 21:26:45 UTC (rev 4165) @@ -15,7 +15,7 @@ * author: Matthias Blume (bl...@re...) *) local - internals/c-int.$(TARGET_ARCH)-$(TARGET_OS).mlb + internals/c-int.mlb in structure Tag Copied: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.mlb (from rev 4164, mlton/trunk/lib/mlnlffi/internals/c-int.mlb) Deleted: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.x86-unix.mlb =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.x86-unix.mlb 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/internals/c-int.x86-unix.mlb 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,35 +0,0 @@ -local - $(MLTON_ROOT)/basis/basis.mlb - - ../memory/memory.x86-unix.mlb - - ../c.sig - ../c-debug.sig - c-int.sig - c-int.sml - c.sml - c-debug.sml - - ../zstring.sig - zstring.sml - tag.sml -in - structure Tag - - structure MLRep - signature C - structure C - signature C_INT - structure C_Int - signature C_DEBUG - structure C_Debug - - signature ZSTRING - structure ZString - - signature DYN_LINKAGE - structure DynLinkage - - signature CMEMORY - structure CMemory -end Copied: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.32bit-unix.mlb (from rev 4164, mlton/trunk/lib/mlnlffi/memory/memory.32bit-unix.mlb) Copied: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.mlb (from rev 4164, mlton/trunk/lib/mlnlffi/memory/memory.mlb) Deleted: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.x86-unix.mlb =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.x86-unix.mlb 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/memory.x86-unix.mlb 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,25 +0,0 @@ -local - $(MLTON_ROOT)/basis/basis.mlb - $(MLTON_ROOT)/basis/mlton.mlb - - linkage.sig - ann "allowFFI true" in - linkage-libdl.sml - end - bitop-fn.sml - mlrep-i8i16i32i32i64f32f64.sml - memaccess.sig - memaccess-a4c1s2i4l4ll8f4d8.sml - memalloc.sig - ann "allowFFI true" in - memalloc-a4-unix.sml - end - memory.sig - memory.sml -in - signature CMEMORY - structure CMemory - signature DYN_LINKAGE - structure DynLinkage - structure MLRep -end Copied: mlton/branches/on-20050822-x86_64-branch/lib/mlnlffi/memory/platform (from rev 4164, mlton/trunk/lib/mlnlffi/memory/platform) Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -12,7 +12,7 @@ * This is necessary to handle duplicate elements. *) (* sortArray mutates the array it is passed and returns the same array *) - val sortArray: 'a array * ('a * 'a -> bool) -> 'a array + val sortArray: 'a array * ('a * 'a -> bool) -> unit val sortList: 'a list * ('a * 'a -> bool) -> 'a list val sortVector: 'a vector * ('a * 'a -> bool) -> 'a vector end Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/quick-sort.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -21,9 +21,9 @@ * Then, it does an insertion sort over the whole array to fix up the unsorted * segments. *) -fun 'a sortArray (a: 'a array, op <= : 'a * 'a -> bool): 'a array = +fun 'a sortArray (a: 'a array, op <= : 'a * 'a -> bool): unit = if 0 = Array.length a - then a + then () else let fun x i = sub (a, i) @@ -41,7 +41,7 @@ then () else let - val _ = swap (l, randInt (l, u)) + val () = swap (l, randInt (l, u)) val t = x l (* Partition based on page 115. *) fun loop (i, j) = @@ -86,16 +86,23 @@ else (i, xi)) val last = length a - 1 val () = swap (m, last) - val _ = qsort (0, last - 1) - val _ = InsertionSort.sort (a, op <=) + val () = qsort (0, last - 1) + val () = InsertionSort.sort (a, op <=) in - a + () end -fun sortList (l, f) = - Array.toList (sortArray (Array.fromList l, f)) - -fun sortVector (v, f) = - Array.toVector (sortArray (Array.fromVector v, f)) +local + fun make (from, to) (l, f) = + let + val a = from l + val () = sortArray (a, f) + in + to a + end +in + val sortList = fn z => make (Array.fromList, Array.toList) z + val sortVector = fn z => make (Array.fromVector, Array.toVector) z +end end Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/string1.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/string1.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton/basic/string1.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -19,7 +19,7 @@ val last = String0.last -val layout = Layout.str o escapeSML +val layout = Layout.str fun forall (s, f) = let Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/gc.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/gc.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/gc.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/itimer.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/itimer.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/itimer.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/mlton.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/mlton.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/mlton.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -278,6 +278,7 @@ structure ProcEnv = struct fun setenv _ = raise Fail "setenv" + fun setgroups _ = raise Fail "setgroups" end structure Process = @@ -407,6 +408,8 @@ struct type t = {stime: Time.time, utime: Time.time} + fun measureGC _ = () + (* Fake it with Posix.ProcEnv.times *) fun rusage () = let @@ -478,6 +481,11 @@ type t = word end + structure Ctl = + struct + fun getERROR _ = NONE + end + structure Host = struct type t = {name: string} @@ -495,6 +503,7 @@ fun accept _ = raise Fail "Socket.accept" fun connect _ = raise Fail "Socket.connect" + fun fdToSock _ = raise Fail "Socket.fdToSock" fun listen _ = raise Fail "Socket.listen" fun listenAt _ = raise Fail "Socket.listenAt" fun shutdownRead _ = raise Fail "Socket.shutdownWrite" Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/random.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/random.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/random.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rlimit.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rlimit.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rlimit.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rusage.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rusage.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/rusage.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. @@ -11,6 +12,7 @@ stime: Time.time (* system time *) } + val measureGC: bool -> unit val rusage: unit -> {children: t, gc: t, self: t} Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/signal.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/signal.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/signal.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/socket.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/socket.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/socket.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. @@ -15,6 +16,13 @@ type t = word end + structure Ctl: + sig + val getERROR: + ('af, 'sock_type) Socket.sock + -> (string * Posix.Error.syserror option) option + end + structure Host: sig type t = {name: string} @@ -36,4 +44,6 @@ val listenAt: Port.t -> t val shutdownRead: TextIO.instream -> unit val shutdownWrite: TextIO.outstream -> unit + + val fdToSock: Posix.FileSys.file_desc -> ('af, 'sock_type) Socket.sock end Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/syslog.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/syslog.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/syslog.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/word.sig =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/word.sig 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs/word.sig 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,6 @@ -(* Copyright (C) 2002-2005 Henry Cejtin, Matthew Fluet, Suresh +(* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. * * MLton is released under a BSD-style license. * See the file MLton-LICENSE for details. Modified: mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs-in-smlnj/sources.cm =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs-in-smlnj/sources.cm 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/mlton-stubs-in-smlnj/sources.cm 2005-11-06 21:26:45 UTC (rev 4165) @@ -53,6 +53,7 @@ structure RealVector structure SML90 structure SMLofNJ +structure Socket structure String structure StringCvt structure Substring Modified: mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT.sml =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT.sml 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT.sml 2005-11-06 21:26:45 UTC (rev 4165) @@ -243,35 +243,35 @@ (* Create Menu callback *) - val gCreateMenuFA = _export "glutCreateMenuArgument": int -> unit; + val gCreateMenuFA = _export "glutCreateMenuArgument": (int -> unit) -> unit; val callGCreateMenuF = _import "callGlutCreateMenu": unit -> int; (* Display function callback *) - val gDisplayFA = _export "glutDisplayFuncArgument": unit -> unit; + val gDisplayFA = _export "glutDisplayFuncArgument": (unit -> unit) -> unit; val callGDisplayF = _import "callGlutDisplayFunc": unit -> unit; (* Idle function callback *) - val gIdleFA = _export "glutIdleFuncArgument": unit -> unit; + val gIdleFA = _export "glutIdleFuncArgument": (unit -> unit) -> unit; val callGIdleF = _import "callGlutIdleFunc": unit -> unit; (* Reshape function callback *) - val gReshapeFA = _export "glutReshapeFuncArgument": int * int -> unit; + val gReshapeFA = _export "glutReshapeFuncArgument": (int * int -> unit) -> unit; val callGReshapeF = _import "callGlutReshapeFunc": unit -> unit; (* Keyboard function callback *) - val gKbdFA = _export "glutKeyboardFuncArgument": char * int * int -> unit; + val gKbdFA = _export "glutKeyboardFuncArgument": (char * int * int -> unit) -> unit; val callGKbdF = _import "callGlutKeyboardFunc": unit -> unit; (* Mouse function callback *) - val gMouseFA = _export "glutMouseFuncArgument": GLenum * GLenum * int * int -> unit; + val gMouseFA = _export "glutMouseFuncArgument": (GLenum * GLenum * int * int -> unit) -> unit; val callGMouseF = _import "callGlutMouseFunc": unit -> unit; (* Special function callback *) - val gSpecFA = _export "glutSpecialFuncArgument": int * int * int -> unit; + val gSpecFA = _export "glutSpecialFuncArgument": (int * int * int -> unit) -> unit; val callGSpecF = _import "callGlutSpecialFunc": unit -> unit; (* Visibility function callback *) - val gVisibilityFA = _export "glutVisibilityFuncArgument": Word32.word -> unit; + val gVisibilityFA = _export "glutVisibilityFuncArgument": (Word32.word -> unit) -> unit; val callGVisibilityF = _import "callGlutVisibilityFunc": unit -> unit; Modified: mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT_c.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT_c.c 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLUT_c.c 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,6 +1,5 @@ /* Glut-export.c */ -#include <GL/gl.h> -#include <GL/glut.h> +#include "platform.h" #include "GLUT_h.h" int callGlutCreateMenu () Modified: mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLU_c.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLU_c.c 2005-11-06 21:12:46 UTC (rev 4164) +++ mlton/branches/on-20050822-x86_64-branch/lib/opengl/GLU_c.c 2005-11-06 21:26:45 UTC (rev 4165) @@ -1,5 +1,5 @@ /* GLU-export.c */ -#include <GL/glu.h> +#include "platform.h" #include "GLU_h.h" Modified: mlton/branches/on-20050822-x8... [truncated message content] |
From: Matthew F. <fl...@ml...> - 2005-11-06 13:12:48
|
Need to setTargetType to "self" for non x86-linux platforms. ---------------------------------------------------------------------- U mlton/trunk/mlton/main/main.fun ---------------------------------------------------------------------- Modified: mlton/trunk/mlton/main/main.fun =================================================================== --- mlton/trunk/mlton/main/main.fun 2005-11-06 20:04:36 UTC (rev 4163) +++ mlton/trunk/mlton/main/main.fun 2005-11-06 21:12:46 UTC (rev 4164) @@ -90,6 +90,17 @@ end | _ => Error.bug (concat ["strange target mapping: ", line]))) +fun setTargetType (target: string, usage): unit = + case List.peek (targetMap (), fn {target = t, ...} => target = t) of + NONE => usage (concat ["invalid target: ", target]) + | SOME {arch, os, ...} => + let + open Control + in + targetArch := arch + ; targetOS := os + end + fun hasNative () = let datatype z = datatype Control.arch @@ -439,9 +450,7 @@ SpaceString (fn t => (target := (if t = "self" then Self else Cross t); - case List.peek (targetMap (), fn {target = t', ...} => t = t') of - NONE => usage (concat ["invalid target: ", t]) - | SOME {arch, os, ...} => (targetArch := arch; targetOS := os)))), + setTargetType (t, usage)))), (Normal, "target-as-opt", " <target> <opt>", "target-dependent assembler option", (SpaceString2 (fn (target, opt) => @@ -501,6 +510,7 @@ (libDir := OS.Path.mkCanonical lib ; args) | _ => Error.bug "incorrect args from shell script" + val () = setTargetType ("self", usage) val result = parse args val targetArch = !targetArch val () = |
From: Matthew F. <fl...@ml...> - 2005-11-06 12:04:37
|
Wrong path to clean ---------------------------------------------------------------------- U mlton/trunk/mlyacc/doc/Makefile ---------------------------------------------------------------------- Modified: mlton/trunk/mlyacc/doc/Makefile =================================================================== --- mlton/trunk/mlyacc/doc/Makefile 2005-11-06 18:39:37 UTC (rev 4162) +++ mlton/trunk/mlyacc/doc/Makefile 2005-11-06 20:04:36 UTC (rev 4163) @@ -26,4 +26,4 @@ .PHONY: clean clean: - ../bin/clean + ../../bin/clean |
From: Matthew F. <fl...@ml...> - 2005-11-06 10:39:38
|
Makefile clean target ---------------------------------------------------------------------- U mlton/trunk/mlyacc/doc/Makefile ---------------------------------------------------------------------- Modified: mlton/trunk/mlyacc/doc/Makefile =================================================================== --- mlton/trunk/mlyacc/doc/Makefile 2005-11-06 17:12:54 UTC (rev 4161) +++ mlton/trunk/mlyacc/doc/Makefile 2005-11-06 18:39:37 UTC (rev 4162) @@ -23,3 +23,7 @@ mlyacc.ps: mlyacc.dvi dvips -o mlyacc.ps mlyacc.dvi + +.PHONY: clean +clean: + ../bin/clean |
From: Matthew F. <fl...@ml...> - 2005-11-06 09:13:48
|
More cleanup ---------------------------------------------------------------------- U mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile U mlton/branches/on-20050822-x86_64-branch/runtime/gc/TODO U mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h A mlton/branches/on-20050822-x86_64-branch/runtime/gc/object_predicates.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.c A mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack_predicates.c ---------------------------------------------------------------------- Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/Makefile 2005-11-06 17:12:54 UTC (rev 4161) @@ -83,6 +83,7 @@ array-allocate.c \ array.c \ atomic.c \ + call-stack.c \ cheney-copy.c \ controls.c \ copy-thread.c \ @@ -109,6 +110,7 @@ new-object.c \ object-size.c \ object.c \ + object_predicates.c \ pack.c \ pointer.c \ pointer_predicates.c \ @@ -116,6 +118,7 @@ share.c \ signals.c \ size.c \ + sources.c \ stack.c \ stack_predicates.c \ switch-thread.c \ @@ -167,6 +170,8 @@ garbage-collection.h \ new-object.h \ array-allocate.h \ + sources.h \ + call-stack.h \ profiling.h \ init-world.h \ world.h \ Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/TODO =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/TODO 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/TODO 2005-11-06 17:12:54 UTC (rev 4161) @@ -1,6 +1,7 @@ * reorder ZZZ_TYPE_INDEX * eliminate STRING_TYPE_INDEX, STRING_TYPE_HEADER in favor of WORD8. +* reorder SOURCE_SEQ_UNKNOWN * fix semantics of numNonPointers for normal objects to mean bytes of non-pointer data, rather than number of 32-bit words of non-pointer data. Rename to sizeNonPointers. @@ -19,4 +20,4 @@ be unnecessary. * Why do {load,save}Globals differ in the representation of the file? * Why does hash-table use malloc/free while generational maps use mmap/munmap? - +* The succssor field of GC_source appears to be unused. \ No newline at end of file Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -47,38 +47,3 @@ static inline size_t pad (GC_state s, size_t bytes, size_t extra) { return align (bytes + extra, s->alignment) - extra; } - -#if ASSERT -static inline bool isAlignedFrontier (GC_state s, pointer p) { - return isAligned ((size_t)p + GC_NORMAL_HEADER_SIZE, - s->alignment); -} -#endif - -static inline pointer alignFrontier (GC_state s, pointer p) { - size_t res; - - res = pad (s, (size_t)p, GC_NORMAL_HEADER_SIZE); - if (DEBUG_STACKS) - fprintf (stderr, FMTPTR" = stackReserved ("FMTPTR")\n", - (uintptr_t)p, (uintptr_t)res); - assert (isAlignedFrontier (s, (pointer)res)); - return (pointer)res; -} - -#if ASSERT -static inline bool isAlignedStackReserved (GC_state s, size_t reserved) { - return isAligned (GC_STACK_HEADER_SIZE + sizeof (struct GC_stack) + reserved, - s->alignment); -} -#endif - -static inline size_t alignStackReserved (GC_state s, size_t reserved) { - size_t res; - - res = pad (s, reserved, GC_STACK_HEADER_SIZE + sizeof (struct GC_stack)); - if (DEBUG_STACKS) - fprintf (stderr, "%zu = alignStackReserved (%zu)\n", res, reserved); - assert (isAlignedStackReserved (s, res)); - return res; -} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -62,7 +62,7 @@ } frontier = s->frontier; last = frontier + arraySize; - assert (isAlignedFrontier (s, last)); + assert (isFrontierAligned (s, last)); s->frontier = last; } *((GC_arrayCounter*)(frontier)) = 0; Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.c (from rev 4158, mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2005-11-04 22:09:10 UTC (rev 4158) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -0,0 +1,47 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +static void numStackFramesAux (GC_state s, + __attribute__ ((unused)) GC_frameIndex i) { + s->callStackState.numStackFrames++; +} + +uint32_t GC_numStackFrames (GC_state s) { + s->callStackState.numStackFrames = 0; + foreachStackFrame (s, numStackFramesAux); + if (DEBUG_CALL_STACK) + fprintf (stderr, "%"PRIu32" = GC_numStackFrames\n", + s->callStackState.numStackFrames); + return s->callStackState.numStackFrames; +} + +static void callStackAux (GC_state s, + GC_frameIndex i) { + if (DEBUG_CALL_STACK) + fprintf (stderr, "callStackAux ("FMTFI")\n", i); + s->callStackState.callStack[s->callStackState.numStackFrames] = i; + s->callStackState.numStackFrames++; +} + +void GC_callStack (GC_state s, pointer p) { + if (DEBUG_CALL_STACK) + fprintf (stderr, "GC_callStack\n"); + s->callStackState.numStackFrames = 0; + s->callStackState.callStack = (uint32_t*)p; + foreachStackFrame (s, callStackAux); +} + +uint32_t* GC_frameIndexSourceSeq (GC_state s, GC_frameIndex frameIndex) { + uint32_t *res; + + res = s->sourceMaps.sourceSeqs[s->sourceMaps.frameSources[frameIndex]]; + if (DEBUG_CALL_STACK) + fprintf (stderr, FMTPTR" = GC_frameIndexSourceSeq ("FMTFI")\n", + (uintptr_t)res, frameIndex); + return res; +} Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h (from rev 4158, mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2005-11-04 22:09:10 UTC (rev 4158) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -0,0 +1,16 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +struct GC_callStackState { + uint32_t numStackFrames; + uint32_t *callStack; +}; + +uint32_t GC_numStackFrames (GC_state s); +void GC_callStack (GC_state s, pointer p); +uint32_t* GC_frameIndexSourceSeq (GC_state s, GC_frameIndex frameIndex); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -120,7 +120,7 @@ s->forwardState.toStart = s->heap.start + s->heap.oldGenSize; if (DEBUG_GENERATIONAL) fprintf (stderr, "toStart = "FMTPTR"\n", (uintptr_t)s->forwardState.toStart); - assert (isAlignedFrontier (s, s->forwardState.toStart)); + assert (isFrontierAligned (s, s->forwardState.toStart)); s->forwardState.toLimit = s->forwardState.toStart + bytesAllocated; assert (invariantForGC (s)); s->cumulativeStatistics.numMinorGCs++; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/debug.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -24,6 +24,7 @@ DEBUG_SHARE = FALSE, DEBUG_SIGNALS = FALSE, DEBUG_SIZE = FALSE, + DEBUG_SOURCES = FALSE, DEBUG_STACKS = FALSE, DEBUG_THREADS = FALSE, DEBUG_WEAK = FALSE, Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -178,7 +178,7 @@ GC_foreachObjptrFun f, bool skipWeaks) { pointer b; - assert (isAlignedFrontier (s, front)); + assert (isFrontierAligned (s, front)); if (DEBUG_DETAILED) fprintf (stderr, "foreachObjptrInRange front = "FMTPTR" *back = "FMTPTR"\n", Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -71,7 +71,7 @@ */ if (stack->used <= stack->reserved / 4) { size_t new = - alignStackReserved + alignStackReserved (s, max (stack->reserved / 2, sizeofStackMinimumReserved (s, stack))); /* It's possible that new > stack->reserved if the stack @@ -180,7 +180,7 @@ cardStart = oldGenStart; checkAll: assert (cardIndex <= maxCardIndex); - assert (isAlignedFrontier (s, objectStart)); + assert (isFrontierAligned (s, objectStart)); if (cardIndex == maxCardIndex) goto done; checkCard: @@ -198,7 +198,7 @@ cardIndex, (uintptr_t)objectStart); lastObject = objectStart; skipObjects: - assert (isAlignedFrontier (s, objectStart)); + assert (isFrontierAligned (s, objectStart)); size = sizeofObject (s, advanceToObjectData (s, objectStart)); if (objectStart + size < cardStart) { objectStart += size; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -55,7 +55,7 @@ /*uintToCommaString*/(oldGenBytesRequested), /*uintToCommaString*/(nurseryBytesRequested)); h = &s->heap; - assert (isAlignedFrontier (s, h->start + h->oldGenSize + oldGenBytesRequested)); + assert (isFrontierAligned (s, h->start + h->oldGenSize + oldGenBytesRequested)); nurserySize = h->size - h->oldGenSize - oldGenBytesRequested; s->limitPlusSlop = h->start + h->size; s->limit = s->limitPlusSlop - GC_HEAP_LIMIT_SLOP; @@ -106,6 +106,6 @@ s->heap.nursery = alignFrontier (s, s->limitPlusSlop - nurserySize); s->frontier = s->heap.nursery; assert (nurseryBytesRequested <= (size_t)(s->limitPlusSlop - s->frontier)); - assert (isAlignedFrontier (s, s->heap.nursery)); + assert (isFrontierAligned (s, s->heap.nursery)); assert (hasHeapBytesFree (s, oldGenBytesRequested, nurseryBytesRequested)); } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -11,9 +11,10 @@ bool amInGC; bool amOriginal; char **atMLtons; /* Initial @MLton args, processed before command line. */ - int32_t atMLtonsLength; + uint32_t atMLtonsLength; uint32_t atomicState; 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; @@ -49,6 +50,7 @@ struct GC_heap secondaryHeap; /* Used for major copying collection. */ objptr signalHandlerThread; /* Handler for signals (in heap). */ struct GC_signalsInfo signalsInfo; + struct GC_sourceMaps sourceMaps; pointer stackBottom; /* Bottom of stack in current thread. */ pointer stackLimit; /* stackBottom + stackSize - maxFrameSize */ pointer stackTop; /* Top of stack in current thread. */ Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -49,7 +49,7 @@ GC_intInf bp; unsigned char *cp; - assert (isAlignedFrontier (s, s->frontier)); + assert (isFrontierAligned (s, s->frontier)); frontier = s->frontier; for (i= 0; i < s->intInfInitsLength; i++) { inits = &s->intInfInits[i]; @@ -111,7 +111,7 @@ bp->isneg = neg; frontier = alignFrontier (s, (pointer)&bp->limbs[alen]); } - assert (isAlignedFrontier (s, frontier)); + assert (isFrontierAligned (s, frontier)); GC_profileAllocInc (s, (size_t)(frontier - s->frontier)); s->frontier = frontier; s->cumulativeStatistics.bytesAllocated += frontier - s->frontier; @@ -122,7 +122,7 @@ pointer frontier; uint32_t i; - assert (isAlignedFrontier (s, s->frontier)); + assert (isFrontierAligned (s, s->frontier)); inits = s->vectorInits; frontier = s->frontier; for (i = 0; i < s->vectorInitsLength; i++) { @@ -171,7 +171,7 @@ (uintptr_t)frontier); GC_profileAllocInc (s, (size_t)(frontier - s->frontier)); s->cumulativeStatistics.bytesAllocated += (size_t)(frontier - s->frontier); - assert (isAlignedFrontier (s, frontier)); + assert (isFrontierAligned (s, frontier)); s->frontier = frontier; } Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -184,8 +184,8 @@ if (i == argc) die ("@MLton ram-slop missing argument."); s->controls.ratios.ramSlop = stringToFloat (argv[i++]); - } else if (0 == strcmp (arg, "show-prof")) { - showProf (s); + } else if (0 == strcmp (arg, "show-sources")) { + showSources (s); exit (0); } else if (0 == strcmp (arg, "stop")) { i++; @@ -308,21 +308,24 @@ fprintf (stderr, "total RAM = %zu RAM = %zu\n", /*uintToCommaString*/(s->sysvals.totalRam), /*uintToCommaString*/(s->sysvals.ram)); - if (DEBUG_PROFILE) { + if (DEBUG_SOURCES or DEBUG_PROFILE) { uint32_t i; - for (i = 0; i < s->profiling.frameSourcesLength; i++) { + for (i = 0; i < s->sourceMaps.frameSourcesLength; i++) { uint32_t j; uint32_t *sourceSeq; fprintf (stderr, "%"PRIu32"\n", i); - sourceSeq = s->profiling.sourceSeqs[s->profiling.frameSources[i]]; + sourceSeq = s->sourceMaps.sourceSeqs[s->sourceMaps.frameSources[i]]; for (j = 1; j <= sourceSeq[0]; j++) fprintf (stderr, "\t%s\n", - s->profiling.sourceNames[s->profiling.sources[sourceSeq[j]].nameIndex]); + s->sourceMaps.sourceNames[ + s->sourceMaps.sources[sourceSeq[j]].sourceNameIndex + ]); } } /* Initialize profiling. This must occur after processing - * command-line arguments, because those may just be doing a show - * prof, in which case we don't want to initialize the atExit. + * command-line arguments, because those may just be doing a + * show-sources, in which case we don't want to initialize the + * atExit. */ initProfiling (s); if (s->amOriginal) { @@ -334,7 +337,7 @@ } else { loadWorldFromFileName (s, worldFile); if (s->profiling.isOn and s->profiling.stack) - foreachStackFrame (s, enterFrame); + foreachStackFrame (s, enterFrameForProfiling); assert (invariantForMutator (s, TRUE, TRUE)); } s->amInGC = FALSE; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -41,9 +41,9 @@ } assert (isAligned (s->heap.size, s->sysvals.pageSize)); assert (isAligned ((size_t)s->heap.start, CARD_SIZE)); - assert (isAlignedFrontier (s, s->heap.start + s->heap.oldGenSize)); - assert (isAlignedFrontier (s, s->heap.nursery)); - assert (isAlignedFrontier (s, s->frontier)); + assert (isFrontierAligned (s, s->heap.start + s->heap.oldGenSize)); + assert (isFrontierAligned (s, s->heap.nursery)); + assert (isFrontierAligned (s, s->frontier)); assert (s->heap.nursery <= s->frontier); unless (0 == s->heap.size) { assert (s->heap.nursery <= s->frontier); @@ -66,7 +66,7 @@ assertIsObjptrInFromSpace, FALSE); /* Current thread. */ GC_stack stack = getStackCurrent(s); - assert (isAlignedStackReserved (s, stack->reserved)); + assert (isStackReservedAligned (s, stack->reserved)); assert (s->stackBottom == getStackBottom (s, stack)); assert (s->stackTop == getStackTop (s, stack)); assert (s->stackLimit == getStackLimit (s, stack)); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -86,6 +86,17 @@ *numObjptrsRet = numObjptrs; } +pointer alignFrontier (GC_state s, pointer p) { + size_t res; + + res = pad (s, (size_t)p, GC_NORMAL_HEADER_SIZE); + if (DEBUG_STACKS) + fprintf (stderr, FMTPTR" = alignFrontier ("FMTPTR")\n", + (uintptr_t)p, (uintptr_t)res); + assert (isFrontierAligned (s, (pointer)res)); + return (pointer)res; +} + /* advanceToObjectData (s, p) * * If p points at the beginning of an object, then advanceToObjectData @@ -95,7 +106,7 @@ GC_header header; pointer res; - assert (isAlignedFrontier (s, p)); + assert (isFrontierAligned (s, p)); header = *(GC_header*)p; if (0 == header) /* Looking at the counter word in an array. */ Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -120,4 +120,9 @@ void splitHeader (GC_state s, GC_header header, GC_objectTypeTag *tagRet, bool *hasIdentityRet, uint16_t *numNonObjptrsRet, uint16_t *numObjptrsRet); + +bool isFrontierAligned (GC_state s, pointer p); +pointer alignFrontier (GC_state s, pointer p); + pointer advanceToObjectData (GC_state s, pointer p); + Added: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object_predicates.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object_predicates.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object_predicates.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -0,0 +1,15 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +#if ASSERT +bool isFrontierAligned (GC_state s, pointer p) { + return isAligned ((size_t)p + GC_NORMAL_HEADER_SIZE, + s->alignment); +} +#endif + Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -6,140 +6,54 @@ * See the file MLton-LICENSE for details. */ -#define SOURCES_INDEX_UNKNOWN 0 -#define SOURCES_INDEX_GC 1 -#define SOURCE_SEQ_GC 1 -#define SOURCE_SEQ_UNKNOWN 0 - -static uint32_t numStackFrames; -static uint32_t *callStack; - -static void fillCallStack (__attribute__ ((unused))GC_state s, - GC_frameIndex i) { - if (DEBUG_CALL_STACK) - fprintf (stderr, "fillCallStack ("FMTFI")\n", i); - callStack[numStackFrames] = i; - numStackFrames++; +GC_profileMasterIndex sourceIndexToProfileMasterIndex (GC_state s, + GC_sourceIndex i) { + return s->sourceMaps.sources[i].sourceNameIndex + s->sourceMaps.sourcesLength; } -void GC_callStack (GC_state s, pointer p) { - if (DEBUG_CALL_STACK) - fprintf (stderr, "GC_callStack\n"); - numStackFrames = 0; - callStack = (uint32_t*)p; - foreachStackFrame (s, fillCallStack); +GC_sourceNameIndex profileMasterIndexToSourceNameIndex (GC_state s, + GC_profileMasterIndex i) { + assert (i >= s->sourceMaps.sourcesLength); + return i - s->sourceMaps.sourcesLength; } -static void incNumStackFrames (__attribute__ ((unused)) GC_state s, - __attribute__ ((unused)) GC_frameIndex i) { - numStackFrames++; +GC_profileStack getProfileStackInfo (GC_state s, GC_profileMasterIndex i) { + assert (s->profiling.data != NULL); + return &(s->profiling.data->stack[i]); } -uint32_t GC_numStackFrames (GC_state s) { - numStackFrames = 0; - foreachStackFrame (s, incNumStackFrames); - if (DEBUG_CALL_STACK) - fprintf (stderr, "%"PRIu32" = GC_numStackFrames\n", numStackFrames); - return numStackFrames; -} -static inline uint32_t topFrameSourceSeqIndex (GC_state s, GC_stack stack) { - return s->profiling.frameSources[getStackTopFrameIndex (s, stack)]; -} +static int profileDepth = 0; -uint32_t* GC_frameIndexSourceSeq (GC_state s, GC_frameIndex frameIndex) { - uint32_t *res; - - res = s->profiling.sourceSeqs[s->profiling.frameSources[frameIndex]]; - if (DEBUG_CALL_STACK) - fprintf (stderr, FMTPTR" = GC_frameIndexSourceSeq ("FMTFI")\n", - (uintptr_t)res, frameIndex); - return res; +static void profileIndent (void) { + int i; + + for (i = 0; i < profileDepth; ++i) + fprintf (stderr, " "); } -inline char* GC_sourceName (GC_state s, uint32_t i) { - if (i < s->profiling.sourcesLength) - return s->profiling.sourceNames[s->profiling.sources[i].nameIndex]; - else - return s->profiling.sourceNames[i - s->profiling.sourcesLength]; -} -static inline GC_profileStack profileStackInfo (GC_state s, uint32_t i) { - assert (s->profiling.data != NULL); - return &(s->profiling.data->stack[i]); -} - -static inline uint32_t profileMaster (GC_state s, uint32_t i) { - return s->profiling.sources[i].nameIndex + s->profiling.sourcesLength; -} - -static inline void removeFromStack (GC_state s, uint32_t i) { +void addToStackForProfiling (GC_state s, GC_profileMasterIndex i) { GC_profileData p; GC_profileStack ps; - uintmax_t totalInc; p = s->profiling.data; - ps = profileStackInfo (s, i); - totalInc = p->total - ps->lastTotal; + ps = getProfileStackInfo (s, i); if (DEBUG_PROFILE) - fprintf (stderr, "removing %s from stack ticksInc = %"PRIuMAX" ticksInGCInc = %"PRIuMAX"\n", - GC_sourceName (s, i), totalInc, - p->totalGC - ps->lastTotalGC); - ps->ticks += totalInc; - ps->ticksInGC += p->totalGC - ps->lastTotalGC; + fprintf (stderr, "adding %s to stack lastTotal = %"PRIuMAX" lastTotalGC = %"PRIuMAX"\n", + GC_sourceName (s, i), + p->total, + p->totalGC); + ps->lastTotal = p->total; + ps->lastTotalGC = p->totalGC; } -static void setProfTimer (long usec) { - struct itimerval iv; - - iv.it_interval.tv_sec = 0; - iv.it_interval.tv_usec = usec; - iv.it_value.tv_sec = 0; - iv.it_value.tv_usec = usec; - unless (0 == setitimer (ITIMER_PROF, &iv, NULL)) - die ("setProfTimer failed"); -} - -void GC_profileDone (GC_state s) { +void enterSourceForProfiling (GC_state s, GC_profileMasterIndex i) { GC_profileData p; - uint32_t sourceIndex; - - if (DEBUG_PROFILE) - fprintf (stderr, "GC_profileDone ()\n"); - assert (s->profiling.isOn); - if (PROFILE_TIME == s->profiling.kind) - setProfTimer (0); - s->profiling.isOn = FALSE; - p = s->profiling.data; - if (s->profiling.stack) { - for (sourceIndex = 0; - sourceIndex < s->profiling.sourcesLength + s->profiling.sourceNamesLength; - sourceIndex++) { - if (p->stack[sourceIndex].numOccurrences > 0) { - if (DEBUG_PROFILE) - fprintf (stderr, "done leaving %s\n", - GC_sourceName (s, sourceIndex)); - removeFromStack (s, sourceIndex); - } - } - } -} - -static int profileDepth = 0; - -static void profileIndent (void) { - int i; - - for (i = 0; i < profileDepth; ++i) - fprintf (stderr, " "); -} - -static inline void profileEnterSource (GC_state s, uint32_t i) { - GC_profileData p; GC_profileStack ps; p = s->profiling.data; - ps = profileStackInfo (s, i); + ps = getProfileStackInfo (s, i); if (0 == ps->numOccurrences) { ps->lastTotal = p->total; ps->lastTotalGC = p->totalGC; @@ -147,18 +61,18 @@ ps->numOccurrences++; } -static void profileEnter (GC_state s, uint32_t sourceSeqIndex) { +void enterForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex) { uint32_t i; GC_profileData p; - uint32_t sourceIndex; + GC_sourceIndex sourceIndex; uint32_t *sourceSeq; if (DEBUG_PROFILE) - fprintf (stderr, "profileEnter (%"PRIu32")\n", sourceSeqIndex); + fprintf (stderr, "enterForProfiling ("FMTSSI")\n", sourceSeqIndex); assert (s->profiling.stack); - assert (sourceSeqIndex < s->profiling.sourceSeqsLength); + assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength); p = s->profiling.data; - sourceSeq = s->profiling.sourceSeqs[sourceSeqIndex]; + sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex]; for (i = 1; i <= sourceSeq[0]; i++) { sourceIndex = sourceSeq[i]; if (DEBUG_ENTER_LEAVE or DEBUG_PROFILE) { @@ -167,41 +81,58 @@ GC_sourceName (s, sourceIndex)); profileDepth++; } - profileEnterSource (s, sourceIndex); - profileEnterSource (s, profileMaster (s, sourceIndex)); + enterSourceForProfiling (s, (GC_profileMasterIndex)sourceIndex); + enterSourceForProfiling (s, sourceIndexToProfileMasterIndex (s, sourceIndex)); } } -static void enterFrame (GC_state s, uint32_t i) { - profileEnter (s, s->profiling.frameSources[i]); +void enterFrameForProfiling (GC_state s, GC_frameIndex i) { + enterForProfiling (s, s->sourceMaps.frameSources[i]); } -static inline void profileLeaveSource (GC_state s, uint32_t i) { +void GC_profileEnter (GC_state s) { + enterForProfiling (s, getStackTopFrameSourceSeqIndex (s, getStackCurrent (s))); +} + +void removeFromStackForProfiling (GC_state s, GC_profileMasterIndex i) { GC_profileData p; GC_profileStack ps; + p = s->profiling.data; + ps = getProfileStackInfo (s, i); if (DEBUG_PROFILE) - fprintf (stderr, "profileLeaveSource (%"PRIu32")\n", i); + fprintf (stderr, "removing %s from stack ticksInc = %"PRIuMAX" ticksGCInc = %"PRIuMAX"\n", + GC_sourceName (s, i), + p->total - ps->lastTotal, + p->totalGC - ps->lastTotalGC); + ps->ticks += p->total - ps->lastTotal; + ps->ticksGC += p->totalGC - ps->lastTotalGC; +} + +void leaveSourceForProfiling (GC_state s, GC_profileMasterIndex i) { + GC_profileData p; + GC_profileStack ps; + p = s->profiling.data; - ps = profileStackInfo (s, i); + ps = getProfileStackInfo (s, i); assert (ps->numOccurrences > 0); ps->numOccurrences--; if (0 == ps->numOccurrences) - removeFromStack (s, i); + removeFromStackForProfiling (s, i); } -static void profileLeave (GC_state s, uint32_t sourceSeqIndex) { +void leaveForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex) { int32_t i; GC_profileData p; - uint32_t sourceIndex; + GC_sourceIndex sourceIndex; uint32_t *sourceSeq; if (DEBUG_PROFILE) - fprintf (stderr, "profileLeave (%"PRIu32")\n", sourceSeqIndex); + fprintf (stderr, "profileLeave ("FMTSSI")\n", sourceSeqIndex); assert (s->profiling.stack); - assert (sourceSeqIndex < s->profiling.sourceSeqsLength); + assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength); p = s->profiling.data; - sourceSeq = s->profiling.sourceSeqs[sourceSeqIndex]; + sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex]; for (i = sourceSeq[0]; i > 0; i--) { sourceIndex = sourceSeq[i]; if (DEBUG_ENTER_LEAVE or DEBUG_PROFILE) { @@ -210,100 +141,81 @@ fprintf (stderr, "leaving %s)\n", GC_sourceName (s, sourceIndex)); } - profileLeaveSource (s, sourceIndex); - profileLeaveSource (s, profileMaster (s, sourceIndex)); + leaveSourceForProfiling (s, (GC_profileMasterIndex)sourceIndex); + leaveSourceForProfiling (s, sourceIndexToProfileMasterIndex (s, sourceIndex)); } } -static inline void profileInc (GC_state s, size_t amount, uint32_t sourceSeqIndex) { +void leaveFrameForProfiling (GC_state s, GC_frameIndex i) { + leaveForProfiling (s, s->sourceMaps.frameSources[i]); +} + +void GC_profileLeave (GC_state s) { + leaveForProfiling (s, getStackTopFrameSourceSeqIndex (s, getStackCurrent (s))); +} + + +void profileInc (GC_state s, size_t amount, GC_sourceSeqIndex sourceSeqIndex) { uint32_t *sourceSeq; - uint32_t topSourceIndex; + GC_sourceIndex topSourceIndex; if (DEBUG_PROFILE) - fprintf (stderr, "profileInc (%zu, %"PRIu32")\n", + fprintf (stderr, "profileInc (%zu, "FMTSSI")\n", amount, sourceSeqIndex); - assert (sourceSeqIndex < s->profiling.sourceSeqsLength); - sourceSeq = s->profiling.sourceSeqs[sourceSeqIndex]; - topSourceIndex = sourceSeq[0] > 0 ? sourceSeq[sourceSeq[0]] : SOURCES_INDEX_UNKNOWN; + assert (sourceSeqIndex < s->sourceMaps.sourceSeqsLength); + sourceSeq = s->sourceMaps.sourceSeqs[sourceSeqIndex]; + topSourceIndex = + sourceSeq[0] > 0 + ? sourceSeq[sourceSeq[0]] + : SOURCES_INDEX_UNKNOWN; if (DEBUG_PROFILE) { profileIndent (); fprintf (stderr, "bumping %s by %zu\n", GC_sourceName (s, topSourceIndex), amount); } s->profiling.data->countTop[topSourceIndex] += amount; - s->profiling.data->countTop[profileMaster (s, topSourceIndex)] += amount; + s->profiling.data->countTop[sourceIndexToProfileMasterIndex (s, topSourceIndex)] += amount; if (s->profiling.stack) - profileEnter (s, sourceSeqIndex); + enterForProfiling (s, sourceSeqIndex); if (SOURCES_INDEX_GC == topSourceIndex) s->profiling.data->totalGC += amount; else s->profiling.data->total += amount; if (s->profiling.stack) - profileLeave (s, sourceSeqIndex); + leaveForProfiling (s, sourceSeqIndex); } -void GC_profileEnter (GC_state s) { - profileEnter (s, topFrameSourceSeqIndex (s, getStackCurrent (s))); -} - -void GC_profileLeave (GC_state s) { - profileLeave (s, topFrameSourceSeqIndex (s, getStackCurrent (s))); -} - void GC_profileInc (GC_state s, size_t amount) { if (DEBUG_PROFILE) fprintf (stderr, "GC_profileInc (%zu)\n", amount); profileInc (s, amount, - s->amInGC - ? SOURCE_SEQ_GC - : topFrameSourceSeqIndex (s, getStackCurrent (s))); + s->amInGC + ? SOURCE_SEQ_GC + : getStackTopFrameSourceSeqIndex (s, getStackCurrent (s))); } void GC_profileAllocInc (GC_state s, size_t amount) { if (s->profiling.isOn and (PROFILE_ALLOC == s->profiling.kind)) { if (DEBUG_PROFILE) - fprintf (stderr, "GC_profileAllocInc (%u)\n", (uint)amount); + fprintf (stderr, "GC_profileAllocInc (%zu)\n", amount); GC_profileInc (s, amount); } } -static void showProf (GC_state s) { - uint32_t i; - uint32_t j; - - fprintf (stdout, "0x%08"PRIx32"\n", s->magic); - fprintf (stdout, "%"PRIu32"\n", s->profiling.sourceNamesLength); - for (i = 0; i < s->profiling.sourceNamesLength; i++) - fprintf (stdout, "%s\n", s->profiling.sourceNames[i]); - fprintf (stdout, "%"PRIu32"\n", s->profiling.sourcesLength); - for (i = 0; i < s->profiling.sourcesLength; i++) - fprintf (stdout, "%"PRIu32" %"PRIu32"\n", - s->profiling.sources[i].nameIndex, - s->profiling.sources[i].successorsIndex); - fprintf (stdout, "%"PRIu32"\n", s->profiling.sourceSeqsLength); - for (i = 0; i < s->profiling.sourceSeqsLength; i++) { - uint32_t *sourceSeq; - - sourceSeq = s->profiling.sourceSeqs[i]; - for (j = 1; j <= sourceSeq[0]; j++) - fprintf (stdout, "%"PRIu32" ", sourceSeq[j]); - fprintf (stdout, "\n"); - } -} GC_profileData GC_profileNew (GC_state s) { GC_profileData p; - uint32_t size; + uint32_t profileMasterLength; p = (GC_profileData)(malloc_safe (sizeof(*p))); p->total = 0; p->totalGC = 0; - size = s->profiling.sourcesLength + s->profiling.sourceNamesLength; - p->countTop = (uintmax_t*)(calloc_safe(size, sizeof(*(p->countTop)))); + profileMasterLength = s->sourceMaps.sourcesLength + s->sourceMaps.sourceNamesLength; + p->countTop = (uintmax_t*)(calloc_safe(profileMasterLength, sizeof(*(p->countTop)))); if (s->profiling.stack) - p->stack = + p->stack = (struct GC_profileStack *) - (calloc_safe(size, sizeof(*(p->stack)))); + (calloc_safe(profileMasterLength, sizeof(*(p->stack)))); if (DEBUG_PROFILE) fprintf (stderr, FMTPTR" = GC_profileNew ()\n", (uintptr_t)p); return p; @@ -316,7 +228,8 @@ free (p); } -static void profileWriteCount (GC_state s, GC_profileData p, int fd, uint32_t i) { +static void writeProfileCount (GC_state s, int fd, + GC_profileData p, GC_profileMasterIndex i) { writeUintmaxU (fd, p->countTop[i]); if (s->profiling.stack) { GC_profileStack ps; @@ -325,13 +238,12 @@ writeString (fd, " "); writeUintmaxU (fd, ps->ticks); writeString (fd, " "); - writeUintmaxU (fd, ps->ticksInGC); + writeUintmaxU (fd, ps->ticksGC); } writeNewline (fd); } void GC_profileWrite (GC_state s, GC_profileData p, int fd) { - uint32_t i; char* kind; if (DEBUG_PROFILE) @@ -360,37 +272,51 @@ writeString (fd, " "); writeUintmaxU (fd, p->totalGC); writeNewline (fd); - writeUint32U (fd, s->profiling.sourcesLength); + writeUint32U (fd, s->sourceMaps.sourcesLength); writeNewline (fd); - for (i = 0; i < s->profiling.sourcesLength; i++) - profileWriteCount (s, p, fd, i); - writeUint32U (fd, s->profiling.sourceNamesLength); + for (GC_sourceIndex i = 0; i < s->sourceMaps.sourcesLength; i++) + writeProfileCount (s, fd, p, + (GC_profileMasterIndex)i); + writeUint32U (fd, s->sourceMaps.sourceNamesLength); writeNewline (fd); - for (i = 0; i < s->profiling.sourceNamesLength; i++) - profileWriteCount (s, p, fd, i + s->profiling.sourcesLength); + for (GC_sourceNameIndex i = 0; i < s->sourceMaps.sourceNamesLength; i++) + writeProfileCount (s, fd, p, + (GC_profileMasterIndex)(i + s->sourceMaps.sourcesLength)); } + +void setProfTimer (long usec) { + struct itimerval iv; + + iv.it_interval.tv_sec = 0; + iv.it_interval.tv_usec = usec; + iv.it_value.tv_sec = 0; + iv.it_value.tv_usec = usec; + unless (0 == setitimer (ITIMER_PROF, &iv, NULL)) + die ("setProfTimer: setitimer failed"); +} + #if not HAS_TIME_PROFILING /* No time profiling on this platform. There is a check in * mlton/main/main.fun to make sure that time profiling is never * turned on. */ -static void profileTimeInit (GC_state s) __attribute__ ((noreturn)); -static void profileTimeInit (GC_state s) { +void initProfilingTime (GC_state s) __attribute__ ((noreturn)); +void initProfilingTime (__attribute__ ((unused)) GC_state s) { die ("no time profiling"); } #else -static GC_state catcherState; +static GC_state handleSigProfState; void GC_handleSigProf (pointer pc) { GC_frameIndex frameIndex; GC_state s; - uint32_t sourceSeqIndex; + GC_sourceSeqIndex sourceSeqIndex; - s = catcherState; + s = handleSigProfState; if (DEBUG_PROFILE) fprintf (stderr, "GC_handleSigProf ("FMTPTR")\n", (uintptr_t)pc); if (s->amInGC) @@ -398,10 +324,10 @@ else { frameIndex = getStackTopFrameIndex (s, getStackCurrent (s)); if (C_FRAME == s->frameLayouts[frameIndex].kind) - sourceSeqIndex = s->profiling.frameSources[frameIndex]; + sourceSeqIndex = s->sourceMaps.frameSources[frameIndex]; else { - if (s->profiling.textStart <= pc and pc < s->profiling.textEnd) - sourceSeqIndex = s->profiling.textSources [pc - s->profiling.textStart]; + if (s->sourceMaps.textStart <= pc and pc < s->sourceMaps.textEnd) + sourceSeqIndex = s->sourceMaps.textSources [pc - s->sourceMaps.textStart]; else { if (DEBUG_PROFILE) fprintf (stderr, "pc out of bounds\n"); @@ -412,69 +338,12 @@ profileInc (s, 1, sourceSeqIndex); } -static int compareSourceLabels (const void *v1, const void *v2) { - uintptr_t ui1; - uintptr_t ui2; - - ui1 = (uintptr_t)v1; - ui2 = (uintptr_t)v2; - - if (ui1 < ui2) - return -1; - else if (ui1 == ui2) - return 0; - else /* if (ui1 > ui2) */ - return 1; -} - -static void profileTimeInit (GC_state s) { - uint32_t i; - pointer p; +static void initProfilingTime (GC_state s) { struct sigaction sa; uint32_t sourceSeqsIndex; s->profiling.data = GC_profileNew (s); - /* Sort sourceLabels by address. */ - qsort (s->profiling.sourceLabels, - s->profiling.sourceLabelsLength, - sizeof (*s->profiling.sourceLabels), - compareSourceLabels); - if (0 == s->profiling.sourceLabels[s->profiling.sourceLabelsLength - 1].label) - die ("Max profile label is 0 -- something is wrong."); - if (DEBUG_PROFILE) - for (i = 0; i < s->profiling.sourceLabelsLength; i++) - fprintf (stderr, FMTPTR" %"PRIu32"\n", - (uintptr_t)s->profiling.sourceLabels[i].label, - s->profiling.sourceLabels[i].sourceSeqsIndex); - if (ASSERT) - for (i = 1; i < s->profiling.sourceLabelsLength; i++) - assert (s->profiling.sourceLabels[i-1].label - <= s->profiling.sourceLabels[i].label); - /* Initialize s->textSources. */ - s->profiling.textEnd = (pointer)(getTextEnd()); - s->profiling.textStart = (pointer)(getTextStart()); - if (ASSERT) - for (i = 0; i < s->profiling.sourceLabelsLength; i++) { - pointer label; - - label = s->profiling.sourceLabels[i].label; - assert (0 == label - or (s->profiling.textStart <= label - and label < s->profiling.textEnd)); - } - s->profiling.textSources = - (uint32_t*) - (calloc_safe((size_t)(s->profiling.textEnd - s->profiling.textStart), - sizeof(*(s->profiling.textSources)))); - p = s->profiling.textStart; - sourceSeqsIndex = SOURCE_SEQ_UNKNOWN; - for (i = 0; i < s->profiling.sourceLabelsLength; i++) { - for ( ; p < s->profiling.sourceLabels[i].label; p++) - s->profiling.textSources[p - s->profiling.textStart] = sourceSeqsIndex; - sourceSeqsIndex = s->profiling.sourceLabels[i].sourceSeqsIndex; - } - for ( ; p < s->profiling.textEnd; p++) - s->profiling.textSources[p - s->profiling.textStart] = sourceSeqsIndex; + initTextSources (s); /* * Install catcher, which handles SIGPROF and calls MLton_Profile_inc. * @@ -488,31 +357,31 @@ * in order to have profiling cover as much as possible, you want it * to occur right after the sigaltstack() call. */ - catcherState = s; + handleSigProfState = s; sigemptyset (&sa.sa_mask); setSigProfHandler (&sa); unless (sigaction (SIGPROF, &sa, NULL) == 0) - diee ("sigaction() failed"); + diee ("initProfilingTime: sigaction failed"); /* Start the SIGPROF timer. */ setProfTimer (10000); } #endif -/* profileEnd is for writing out an mlmon.out file even if the C code +/* atexitForProfiling is for writing out an mlmon.out file even if the C code * terminates abnormally, e.g. due to running out of memory. It will * only run if the usual SML profile atExit cleanup code did not * manage to run. */ -static GC_state profileEndState; +static GC_state atexitForProfilingState; -static void profileEnd (void) { +static void atexitForProfiling (void) { int fd; GC_state s; if (DEBUG_PROFILE) - fprintf (stderr, "profileEnd ()\n"); - s = profileEndState; + fprintf (stderr, "atexitForProfiling ()\n"); + s = atexitForProfilingState; if (s->profiling.isOn) { fd = creat ("mlmon.out", 0666); if (fd < 0) @@ -526,7 +395,7 @@ s->profiling.isOn = FALSE; else { s->profiling.isOn = TRUE; - assert (s->profiling.frameSourcesLength == s->frameLayoutsLength); + assert (s->sourceMaps.frameSourcesLength == s->frameLayoutsLength); switch (s->profiling.kind) { case PROFILE_ALLOC: case PROFILE_COUNT: @@ -535,10 +404,40 @@ case PROFILE_NONE: die ("impossible PROFILE_NONE"); case PROFILE_TIME: - profileTimeInit (s); + initProfilingTime (s); break; } - profileEndState = s; - atexit (profileEnd); + atexitForProfilingState = s; + atexit (atexitForProfiling); } } + +void GC_profileDone (GC_state s) { + GC_profileData p; + GC_profileMasterIndex profileMasterIndex; + + if (DEBUG_PROFILE) + fprintf (stderr, "GC_profileDone ()\n"); + assert (s->profiling.isOn); + if (PROFILE_TIME == s->profiling.kind) + setProfTimer (0); + s->profiling.isOn = FALSE; + p = s->profiling.data; + if (s->profiling.stack) { + uint32_t profileMasterLength = + s->sourceMaps.sourcesLength + s->sourceMaps.sourceNamesLength; + for (profileMasterIndex = 0; + profileMasterIndex < profileMasterLength; + profileMasterIndex++) { + if (p->stack[profileMasterIndex].numOccurrences > 0) { + if (DEBUG_PROFILE) + fprintf (stderr, "done leaving %s\n", + (profileMasterIndex < s->sourceMaps.sourcesLength) + ? GC_sourceName (s, (GC_sourceIndex)profileMasterIndex) + : s->sourceMaps.sourceNames[ + profileMasterIndexToSourceNameIndex (s, profileMasterIndex)]); + removeFromStackForProfiling (s, profileMasterIndex); + } + } + } +} Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -13,24 +13,14 @@ PROFILE_TIME, } GC_profileKind; -typedef struct GC_source { - uint32_t nameIndex; - uint32_t successorsIndex; -} *GC_source; - -typedef struct GC_sourceLabel { - pointer label; - uint32_t sourceSeqsIndex; -} *GC_sourceLabel; - /* If profileStack, then there is one struct GC_profileStack for each * function. */ typedef struct GC_profileStack { /* ticks counts ticks while the function was on the stack. */ uintmax_t ticks; - /* ticksInGC counts ticks in GC while the function was on the stack. */ - uintmax_t ticksInGC; + /* ticksGC counts ticks in GC while the function was on the stack. */ + uintmax_t ticksGC; /* lastTotal is the value of total when the oldest occurrence of f * on the stack was pushed, i.e., the most recent time that * numTimesOnStack changed from 0 to 1. lastTotal is used to @@ -46,11 +36,13 @@ uintmax_t numOccurrences; } *GC_profileStack; +typedef uint32_t GC_profileMasterIndex; + /* GC_profileData is used for both time and allocation profiling. * In the comments below, "ticks" mean clock ticks with time profiling and * bytes allocated with allocation profiling. * - * All of the arrays in GC_profileData are of length sourcesSize + sourceNamesSize. + * All of the arrays in GC_profileData are of length sourcesLength + sourceNamesLength. * The first sourceLength entries are for handling the duplicate copies of * functions, and the next sourceNamesLength entries are for the master versions. */ @@ -71,45 +63,29 @@ struct GC_profiling { GC_profileData data; - /* frameSources is an array of cardinality frameLayoutsLength that - * for each stack frame, gives an index into sourceSeqs of the - * sequence of source functions corresponding to the frame. - */ - uint32_t *frameSources; - uint32_t frameSourcesLength; bool isOn; GC_profileKind kind; - struct GC_sourceLabel *sourceLabels; - uint32_t sourceLabelsLength; - char **sourceNames; - uint32_t sourceNamesLength; - /* Each entry in sourceSeqs is a vector, whose first element is a - * length, and subsequent elements index into sources. - */ - uint32_t **sourceSeqs; - uint32_t sourceSeqsLength; - /* sources is an array of cardinality sourcesLength. Each entry - * specifies an index into sourceNames and an index into sourceSeqs, - * giving the name of the function and the successors, respectively. - */ - struct GC_source *sources; - uint32_t sourcesLength; bool stack; - pointer textEnd; - /* An array of indices, one entry for each address in the text - * segment, giving and index into sourceSeqs. - */ - uint32_t *textSources; - pointer textStart; }; -static void showProf (GC_state s); -void initProfiling (GC_state s); -static void enterFrame (GC_state s, uint32_t i); +void enterSourceForProfiling (GC_state s, GC_profileMasterIndex i); +void enterForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex); +void enterFrameForProfiling (GC_state s, GC_frameIndex i); +void GC_profileEnter (GC_state s); +void leaveSourceForProfiling (GC_state s, GC_profileMasterIndex i); +void leaveForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex); +void leaveFrameForProfiling (GC_state s, GC_frameIndex i); +void GC_profileLeave (GC_state s); -void GC_profileAllocInc (GC_state s, size_t bytes); +void GC_profileInc (GC_state s, size_t amount); +void GC_profileAllocInc (GC_state s, size_t amount); -void GC_profileEnter (GC_state s); +GC_profileData GC_profileNew (GC_state s); +void GC_profileFree (GC_state s, GC_profileData p); +void GC_profileWrite (GC_state s, GC_profileData p, int fd); -void GC_profileLeave (GC_state s); +void GC_handleSigProf (pointer pc); +void initProfiling (GC_state s); +void GC_profileDone (GC_state s); + Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -6,12 +6,14 @@ * See the file MLton-LICENSE for details. */ -/* ---------------------------------------------------------------- */ -/* Initialization */ -/* ---------------------------------------------------------------- */ +#if not HAS_SIGALTSTACK +void initSignalStack (__attribute__ ((unused)) GC_state s) { +} + +#else + void initSignalStack (GC_state s) { -#if HAS_SIGALTSTACK static stack_t altstack; size_t ss_size = align (SIGSTKSZ, s->sysvals.pageSize); size_t psize = s->sysvals.pageSize; @@ -20,5 +22,6 @@ altstack.ss_size = ss_size; altstack.ss_flags = 0; sigaltstack (&altstack, NULL); +} + #endif -} Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.c (from rev 4158, mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2005-11-04 22:09:10 UTC (rev 4158) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -0,0 +1,110 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +GC_sourceSeqIndex getStackTopFrameSourceSeqIndex (GC_state s, GC_stack stack) { + return s->sourceMaps.frameSources[getStackTopFrameIndex (s, stack)]; +} + +char* GC_sourceName (GC_state s, GC_sourceIndex i) { + assert (i < s->sourceMaps.sourcesLength); + return s->sourceMaps.sourceNames[s->sourceMaps.sources[i].sourceNameIndex]; +} + +static int compareSourceLabels (const void *v1, const void *v2) { + uintptr_t ui1; + uintptr_t ui2; + + ui1 = (uintptr_t)v1; + ui2 = (uintptr_t)v2; + + if (ui1 < ui2) + return -1; + else if (ui1 == ui2) + return 0; + else /* if (ui1 > ui2) */ + return 1; +} + +void sortSourceLabels (GC_state s) { + GC_sourceLabelIndex i; + + /* Sort sourceLabels by address. */ + qsort (s->sourceMaps.sourceLabels, + s->sourceMaps.sourceLabelsLength, + sizeof (*s->sourceMaps.sourceLabels), + compareSourceLabels); + if (0 == s->sourceMaps.sourceLabels[s->sourceMaps.sourceLabelsLength - 1].label) + die ("Max profile label is 0 -- something is wrong."); + if (DEBUG_SOURCES) + for (i = 0; i < s->sourceMaps.sourceLabelsLength; i++) + fprintf (stderr, FMTPTR" %"PRIu32"\n", + (uintptr_t)s->sourceMaps.sourceLabels[i].label, + s->sourceMaps.sourceLabels[i].sourceSeqIndex); + if (ASSERT) + for (i = 1; i < s->sourceMaps.sourceLabelsLength; i++) + assert (s->sourceMaps.sourceLabels[i-1].label + <= s->sourceMaps.sourceLabels[i].label); +} + +void initTextSources (GC_state s) { + GC_sourceLabelIndex i; + pointer p; + GC_sourceSeqIndex sourceSeqIndex; + + sortSourceLabels (s); + /* Initialize s->sourceMaps.textSources. */ + s->sourceMaps.textEnd = (pointer)(getTextEnd()); + s->sourceMaps.textStart = (pointer)(getTextStart()); + if (ASSERT) + for (i = 0; i < s->sourceMaps.sourceLabelsLength; i++) { + pointer label; + + label = s->sourceMaps.sourceLabels[i].label; + assert (0 == label + or (s->sourceMaps.textStart <= label + and label < s->sourceMaps.textEnd)); + } + s->sourceMaps.textSources = + (uint32_t*) + (calloc_safe((size_t)(s->sourceMaps.textEnd - s->sourceMaps.textStart), + sizeof(*(s->sourceMaps.textSources)))); + p = s->sourceMaps.textStart; + sourceSeqIndex = SOURCE_SEQ_UNKNOWN; + for (i = 0; i < s->sourceMaps.sourceLabelsLength; i++) { + for ( ; p < s->sourceMaps.sourceLabels[i].label; p++) + s->sourceMaps.textSources[p - s->sourceMaps.textStart] = sourceSeqIndex; + sourceSeqIndex = s->sourceMaps.sourceLabels[i].sourceSeqIndex; + } + for ( ; p < s->sourceMaps.textEnd; p++) + s->sourceMaps.textSources[p - s->sourceMaps.textStart] = sourceSeqIndex; +} + + +void showSources (GC_state s) { + uint32_t i; + uint32_t j; + + fprintf (stdout, "0x%08"PRIx32"\n", s->magic); + fprintf (stdout, "%"PRIu32"\n", s->sourceMaps.sourceNamesLength); + for (i = 0; i < s->sourceMaps.sourceNamesLength; i++) + fprintf (stdout, "%s\n", s->sourceMaps.sourceNames[i]); + fprintf (stdout, "%"PRIu32"\n", s->sourceMaps.sourcesLength); + for (i = 0; i < s->sourceMaps.sourcesLength; i++) + fprintf (stdout, "%"PRIu32" %"PRIu32"\n", + s->sourceMaps.sources[i].sourceNameIndex, + s->sourceMaps.sources[i].successorSourceSeqIndex); + fprintf (stdout, "%"PRIu32"\n", s->sourceMaps.sourceSeqsLength); + for (i = 0; i < s->sourceMaps.sourceSeqsLength; i++) { + uint32_t *sourceSeq; + + sourceSeq = s->sourceMaps.sourceSeqs[i]; + for (j = 1; j <= sourceSeq[0]; j++) + fprintf (stdout, "%"PRIu32" ", sourceSeq[j]); + fprintf (stdout, "\n"); + } +} Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h (from rev 4158, mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h) =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2005-11-04 22:09:10 UTC (rev 4158) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -0,0 +1,77 @@ +/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh + * Jagannathan, and Stephen Weeks. + * Copyright (C) 1997-2000 NEC Research Institute. + * + * MLton is released under a BSD-style license. + * See the file MLton-LICENSE for details. + */ + +typedef uint32_t GC_sourceNameIndex; +#define PRISNI PRIu32 +#define FMTSNI "%"PRISNI + +typedef uint32_t GC_sourceLabelIndex; +#define PRISLI PRIu32 +#define FMTSLI "%"PRISLI + +typedef uint32_t GC_sourceIndex; +#define PRISI PRIu32 +#define FMTSI "%"PRISI + +#define SOURCES_INDEX_UNKNOWN 0 +#define SOURCES_INDEX_GC 1 + +typedef uint32_t GC_sourceSeqIndex; +#define PRISSI PRIu32 +#define FMTSSI "%"PRISSI + +#define SOURCE_SEQ_GC 1 +#define SOURCE_SEQ_UNKNOWN 0 + +typedef struct GC_source { + GC_sourceNameIndex sourceNameIndex; + GC_sourceSeqIndex successorSourceSeqIndex; +} *GC_source; + +typedef struct GC_sourceLabel { + pointer label; + GC_sourceSeqIndex sourceSeqIndex; +} *GC_sourceLabel; + +struct GC_sourceMaps { + /* frameSources is an array of cardinality frameLayoutsLength that + * for each stack frame, gives an index into sourceSeqs of the + * sequence of source functions corresponding to the frame. + */ + GC_sourceSeqIndex *frameSources; + uint32_t frameSourcesLength; + struct GC_sourceLabel *sourceLabels; + uint32_t sourceLabelsLength; + char **sourceNames; + uint32_t sourceNamesLength; + /* Each entry in sourceSeqs is a vector, whose first element is a + * length, and subsequent elements index into sources. + */ + uint32_t **sourceSeqs; + uint32_t sourceSeqsLength; + /* sources is an array of cardinality sourcesLength. Each entry + * specifies an index into sourceNames and an index into sourceSeqs, + * giving the name of the function and the successors, respectively. + */ + struct GC_source *sources; + uint32_t sourcesLength; + pointer textEnd; + /* An array of indices, one entry for each address in the text + * segment, giving and index into sourceSeqs. + */ + GC_sourceSeqIndex *textSources; + pointer textStart; +}; + +GC_sourceSeqIndex getStackTopFrameSourceSeqIndex (GC_state s, GC_stack stack); +char* GC_sourceName (GC_state s, GC_sourceIndex i); + +void sortSourceLabels (GC_state s); +void initTextSources (GC_state s); + +void showSources (GC_state s); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -86,6 +86,16 @@ return res; } +size_t alignStackReserved (GC_state s, size_t reserved) { + size_t res; + + res = pad (s, reserved, GC_STACK_HEADER_SIZE + sizeof (struct GC_stack)); + if (DEBUG_STACKS) + fprintf (stderr, "%zu = alignStackReserved (%zu)\n", res, reserved); + assert (isStackReservedAligned (s, res)); + return res; +} + size_t sizeofStackWithHeaderAligned (GC_state s, size_t reserved) { size_t res; Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h 2005-11-06 17:12:54 UTC (rev 4161) @@ -50,6 +50,7 @@ #define GC_STACK_HEADER_SIZE GC_HEADER_SIZE bool isStackEmpty (GC_stack stack); +bool isStackReservedAligned (GC_state s, size_t reserved); void displayStack (GC_state s, GC_stack stack, FILE *stream); size_t sizeofStackSlop (GC_state s); @@ -64,6 +65,7 @@ uint16_t getStackTopFrameSize (GC_state s, GC_stack stack); size_t sizeofStackMinimumReserved (GC_state s, GC_stack stack); +size_t alignStackReserved (GC_state s, size_t reserved); size_t sizeofStackWithHeaderAligned (GC_state s, size_t reserved); size_t sizeofStackGrow (GC_state s, GC_stack stack); Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack_predicates.c =================================================================== --- mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack_predicates.c 2005-11-05 00:04:36 UTC (rev 4160) +++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack_predicates.c 2005-11-06 17:12:54 UTC (rev 4161) @@ -9,3 +9,11 @@ bool isStackEmpty (GC_stack stack) { return 0 == stack->used; } + +#if ASSERT +bool isStackReservedAligned (GC_state s, size_t reserved) { + return isAligned (GC_STACK_HEADER_SIZE + sizeof (struct GC_stack) + reserved, + s->alignment); +} +#endif + |