[MLton-commit] r4216
Matthew Fluet
MLton@mlton.org
Sun, 13 Nov 2005 19:41:39 -0800
Making internal GC functions static
----------------------------------------------------------------------
U mlton/branches/on-20050822-x86_64-branch/Makefile
U mlton/branches/on-20050822-x86_64-branch/include/main.h
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/Signal.c
U mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/atomic.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/controls.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/copy-thread.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/current.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/enter_leave.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.h
A mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.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.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/major.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object-size.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.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/rusage.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/statistics.h
A mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.c
U 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/sysvals.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.h
D mlton/branches/on-20050822-x86_64-branch/runtime/gc/util.h
U mlton/branches/on-20050822-x86_64-branch/runtime/gc/weak.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
----------------------------------------------------------------------
Modified: mlton/branches/on-20050822-x86_64-branch/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/Makefile 2005-11-14 03:41:13 UTC (rev 4216)
@@ -16,7 +16,6 @@
LIB = $(BUILD)/lib
INC = $(LIB)/include
COMP = $(SRC)/mlton
-RUN = $(SRC)/runtime
MLTON = $(BIN)/mlton
AOUT = mlton-compile
ifeq (mingw, $(TARGET_OS))
@@ -274,15 +273,16 @@
runtime:
@echo 'Compiling MLton runtime system for $(TARGET).'
$(MAKE) -C runtime
- $(CP) $(RUN)/*.a $(LIB)/$(TARGET)/
- $(CP) runtime/*.h include/*.h $(INC)/
+ $(CP) include/*.h $(INC)/
+ $(CP) runtime/*.a $(LIB)/$(TARGET)/
mkdir -p $(INC)/gc
mkdir -p $(INC)/util
mkdir -p $(INC)/platform
- $(CP) bytecode/interpret.h $(INC)
+ $(CP) runtime/*.h $(INC)/
$(CP) runtime/gc/*.h $(INC)/gc
$(CP) runtime/util/*.h $(INC)/util
$(CP) runtime/platform/*.h $(INC)/platform
+ $(CP) bytecode/interpret.h $(INC)
$(MAKE) -C bytecode
bytecode/print-opcodes >$(LIB)/opcodes
ar r $(LIB)/$(TARGET)/libmlton.a bytecode/interpret.o
Modified: mlton/branches/on-20050822-x86_64-branch/include/main.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/include/main.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/include/main.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -9,9 +9,8 @@
#ifndef _MAIN_H_
#define _MAIN_H_
-#define MLTON_GC_INTERNAL
+#define MLTON_GC_INTERNAL_TYPES
#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.
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/mlton/main/lookup-constant.fun 2005-11-14 03:41:13 UTC (rev 4216)
@@ -73,7 +73,7 @@
in
List.foreach
(List.concat
- [["#define MLTON_GC_INTERNAL",
+ [["#define MLTON_GC_INTERNAL_TYPES",
"#include \"platform.h\"",
"struct GC_state gcState;",
"",
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/Makefile
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Makefile 2005-11-14 03:41:13 UTC (rev 4216)
@@ -62,12 +62,11 @@
-Wmissing-noreturn -Wmissing-format-attribute \
-Wpacked \
-Wredundant-decls \
- -Wnested-externs \
- -Winline -Wdisabled-optimization
+ -Wnested-externs
# -Wshadow \
# -Wmissing-prototypes \
# -Wmissing-declarations
-OPTWARNFLAGS = $(WARNFLAGS)
+OPTWARNFLAGS = $(WARNFLAGS) -Winline -Wdisabled-optimization
DEBUGWARNFLAGS = $(WARNFLAGS) -Wunused
UTILCFILES = \
@@ -183,9 +182,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) $(DEBUGCFLAGS) -c -o $@ $<
+ $(CC) $(DEBUGCFLAGS) $(DEBUGWARNFLAGS) -Wno-redundant-decls -c -o $@ $<
basis/Real/%.o: basis/Real/%.c gdtoa/arith.h
- $(CC) $(OPTCFLAGS) -O1 -fno-strict-aliasing -c -o $@ $<
+ $(CC) $(OPTCFLAGS) -O1 -fno-strict-aliasing $(OPTWARNFLAGS) -Wno-redundant-decls -c -o $@ $<
%-gdb.o: %.c $(HFILES)
$(CC) $(DEBUGCFLAGS) -c -o $@ $<
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/Posix/Signal.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -44,7 +44,7 @@
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).
+ * s->signalsPending (else there is a race condition).
*/
sigfillset (&sa.sa_mask);
sa.sa_handler = handler;
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/basis/IntInf.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,9 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-#define MLTON_GC_INTERNAL
+#define MLTON_GC_INTERNAL_TYPES
+#define MLTON_GC_INTERNAL_INTINF
#include "platform.h"
-#undef MLTON_GC_INTERNAL
enum {
DEBUG_INT_INF = FALSE,
@@ -42,7 +42,7 @@
bp = (GC_intInf)(arg - offsetof(struct GC_intInf, isneg));
if (DEBUG_INT_INF)
fprintf (stderr, "bp->header = 0x%08x\n", bp->header);
- assert (bp->header == GC_INTINF_HEADER);
+ assert (bp->header == GC_intInfHeader ());
return bp;
}
@@ -109,7 +109,7 @@
}
static inline void setFrontier (pointer p, uint bytes) {
- p = alignFrontier (&gcState, p);
+ p = GC_alignFrontier (&gcState, p);
assert (p - gcState.frontier <= bytes);
GC_profileAllocInc (&gcState, p - gcState.frontier);
gcState.frontier = p;
@@ -162,7 +162,7 @@
setFrontier ((pointer)(&bp->limbs[size]), bytes);
bp->counter = 0;
bp->length = size + 1; /* +1 for isNeg word */
- bp->header = GC_INTINF_HEADER;
+ bp->header = GC_intInfHeader ();
return (pointer)&bp->isneg;
}
@@ -364,7 +364,7 @@
}
sp->counter = 0;
sp->length = size;
- sp->header = GC_STRING_HEADER;
+ sp->header = GC_stringHeader ();
setFrontier ((pointer)(&sp->chars[align(size, 4)]), bytes);
return (pointer)str;
}
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,7 @@
* See the file MLton-LICENSE for details.
*/
-static inline size_t alignWithExtra (GC_state s, size_t bytes, size_t extra) {
+size_t alignWithExtra (GC_state s, size_t bytes, size_t extra) {
return align (bytes + extra, s->alignment) - extra;
}
@@ -25,3 +25,7 @@
assert (isFrontierAligned (s, (pointer)res));
return (pointer)res;
}
+
+pointer GC_alignFrontier (GC_state s, pointer p) {
+ return alignFrontier (s, p);
+}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/align.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,5 +6,12 @@
* See the file MLton-LICENSE for details.
*/
-bool isFrontierAligned (GC_state s, pointer p);
-pointer alignFrontier (GC_state s, pointer p);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static size_t alignWithExtra (GC_state s, size_t bytes, size_t extra);
+static bool isFrontierAligned (GC_state s, pointer p);
+static pointer alignFrontier (GC_state s, pointer p);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+pointer GC_alignFrontier (GC_state s, pointer p);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array-allocate.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,11 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
pointer GC_arrayAllocate (GC_state s,
size_t ensureBytesFree,
GC_arrayLength numElements,
GC_header header);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -24,6 +24,10 @@
return *(getArrayLengthp (a));
}
+uintmax_t GC_getArrayLength (pointer a) {
+ return ((uintmax_t)(getArrayLength (a)));
+}
+
/* getArrayCounterp (p)
*
* Returns a pointer to the counter for the array pointed to by p.
@@ -60,8 +64,3 @@
+ bytesNonObjptrs
+ (pointerIndex * OBJPTR_SIZE);
}
-
-
-GC_arrayLength GC_getArrayLength (pointer a) {
- return getArrayLength (a);
-}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/array.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* Array objects have the following layout:
*
@@ -28,10 +30,18 @@
#define FMTARRCTR "%"PRIxARRCTR
#define GC_ARRAY_HEADER_SIZE (GC_ARRAY_COUNTER_SIZE + GC_ARRAY_LENGTH_SIZE + GC_HEADER_SIZE)
-GC_arrayLength* getArrayLengthp (pointer a);
-GC_arrayLength getArrayLength (pointer a);
-GC_arrayCounter* getArrayCounterp (pointer a);
-GC_arrayCounter getArrayCounter (pointer a);
-pointer indexArrayAtPointerIndex (GC_state s, pointer a,
- GC_arrayCounter arrayIndex,
- uint32_t pointerIndex);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static inline GC_arrayLength* getArrayLengthp (pointer a);
+static inline GC_arrayLength getArrayLength (pointer a);
+static inline GC_arrayCounter* getArrayCounterp (pointer a);
+static inline GC_arrayCounter getArrayCounter (pointer a);
+static pointer indexArrayAtPointerIndex (GC_state s, pointer a,
+ GC_arrayCounter arrayIndex,
+ uint32_t pointerIndex);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+uintmax_t GC_getArrayLength (pointer a);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/atomic.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/atomic.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/atomic.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,5 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-void beginAtomic (GC_state s);
-void endAtomic (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void beginAtomic (GC_state s);
+static void endAtomic (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/call-stack.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,11 +6,19 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_callStackState {
uint32_t numStackFrames;
uint32_t *callStack;
};
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_BASIS))
+
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);
+
+#endif /* (defined (MLTON_GC_INTERNAL_BASIS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/cheney-copy.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,11 @@
* See the file MLton-LICENSE for details.
*/
-void updateWeaksForCheneyCopy (GC_state s);
-void swapHeapsForCheneyCopy (GC_state s);
-void majorCheneyCopyGC (GC_state s);
-void minorCheneyCopyGC (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void updateWeaksForCheneyCopy (GC_state s);
+static void swapHeapsForCheneyCopy (GC_state s);
+static void majorCheneyCopyGC (GC_state s);
+static void minorCheneyCopyGC (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/controls.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/controls.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/controls.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_ratios {
/* Minimum live ratio to use copying GC. */
float copy;
@@ -44,5 +46,11 @@
bool summary; /* Print a summary of gc info when program exits. */
};
-bool detailedGCTime (GC_state s);
-bool needGCTime (GC_state s);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static bool detailedGCTime (GC_state s);
+static bool needGCTime (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/copy-thread.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/copy-thread.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/copy-thread.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,15 @@
* See the file MLton-LICENSE for details.
*/
-GC_thread copyThread (GC_state s, GC_thread from, size_t size);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static GC_thread copyThread (GC_state s, GC_thread from, size_t size);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+#if (defined (MLTON_GC_INTERNAL_BASIS))
+
void GC_copyCurrentThread (GC_state s);
pointer GC_copyThread (GC_state s, pointer p);
+
+#endif /* (defined (MLTON_GC_INTERNAL_BASIS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/current.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/current.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/current.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,11 @@
* See the file MLton-LICENSE for details.
*/
-objptr getThreadCurrentObjptr (GC_state s);
-GC_thread getThreadCurrent (GC_state s);
-objptr getStackCurrentObjptr (GC_state s);
-GC_stack getStackCurrent (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static objptr getThreadCurrentObjptr (GC_state s);
+static GC_thread getThreadCurrent (GC_state s);
+static objptr getStackCurrentObjptr (GC_state s);
+static GC_stack getStackCurrent (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/dfs-mark.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,15 +6,23 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
typedef enum {
MARK_MODE,
UNMARK_MODE,
} GC_markMode;
-bool isPointerMarked (pointer p);
-bool isPointerMarkedByMode (pointer p, GC_markMode m);
-size_t dfsMarkByMode (GC_state s, pointer root,
- GC_markMode mode, bool shouldHashCons);
-void dfsMarkWithHashCons (GC_state s, objptr *opp);
-void dfsMarkWithoutHashCons (GC_state s, objptr *opp);
-void dfsUnmark (GC_state s, objptr *opp);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static bool isPointerMarked (pointer p);
+static bool isPointerMarkedByMode (pointer p, GC_markMode m);
+static size_t dfsMarkByMode (GC_state s, pointer root,
+ GC_markMode mode, bool shouldHashCons);
+static void dfsMarkWithHashCons (GC_state s, objptr *opp);
+static void dfsMarkWithoutHashCons (GC_state s, objptr *opp);
+static void dfsUnmark (GC_state s, objptr *opp);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/enter_leave.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/enter_leave.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/enter_leave.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,5 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-void enter (GC_state s);
-void leave (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void enter (GC_state s);
+static void leave (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/exports.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,10 +6,6 @@
* 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);
@@ -17,25 +13,6 @@
size_t GC_size (GC_state s, pointer root);
-void GC_startSignalHandler (GC_state s);
-void GC_finishSignalHandler (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_handleSigProf (pointer pc);
-
-
-void GC_saveWorld (GC_state s, int fd);
-
int GC_init (GC_state s, int argc, char **argv);
void GC_done (GC_state s);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/foreach.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,14 +6,16 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
typedef void (*GC_foreachObjptrFun) (GC_state s, objptr *opp);
-void callIfIsObjptr (GC_state s, GC_foreachObjptrFun f, objptr *opp);
+static void callIfIsObjptr (GC_state s, GC_foreachObjptrFun f, objptr *opp);
/* foreachGlobalObjptr (s, f)
*
* Apply f to each global object pointer into the heap.
*/
-void foreachGlobalObjptr (GC_state s, GC_foreachObjptrFun f);
+static void foreachGlobalObjptr (GC_state s, GC_foreachObjptrFun f);
/* foreachObjptrInObject (s, p, skipWeaks, f)
*
* Applies f to each object pointer in the object pointed to by p.
@@ -21,8 +23,8 @@
*
* If skipWeaks, then the object pointer in weak objects is skipped.
*/
-pointer foreachObjptrInObject (GC_state s, pointer p,
- GC_foreachObjptrFun f, bool skipWeaks);
+static pointer foreachObjptrInObject (GC_state s, pointer p,
+ GC_foreachObjptrFun f, bool skipWeaks);
/* foreachObjptrInRange (s, front, back, f, skipWeaks)
*
* Apply f to each pointer between front and *back, which should be a
@@ -34,8 +36,8 @@
*
* If skipWeaks, then the object pointer in weak objects is skipped.
*/
-pointer foreachObjptrInRange (GC_state s, pointer front, pointer *back,
- GC_foreachObjptrFun f, bool skipWeaks);
+static pointer foreachObjptrInRange (GC_state s, pointer front, pointer *back,
+ GC_foreachObjptrFun f, bool skipWeaks);
typedef void (*GC_foreachStackFrameFun) (GC_state s, GC_frameIndex i);
@@ -44,4 +46,6 @@
*
* Apply f to the frame index of each frame in the current stack.
*/
-void foreachStackFrame (GC_state s, GC_foreachStackFrameFun f);
+static void foreachStackFrame (GC_state s, GC_foreachStackFrameFun f);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/forward.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_forwardState {
bool amInMinorGC;
pointer back;
@@ -15,8 +17,14 @@
#define GC_FORWARDED ~((GC_header)0)
-bool isPointerInToSpace (GC_state s, pointer p);
-bool isObjptrInToSpace (GC_state s, objptr op);
-void forwardObjptr (GC_state s, objptr *opp);
-void forwardObjptrIfInNursery (GC_state s, objptr *opp);
-void forwardInterGenerationalObjptrs (GC_state s);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static bool isPointerInToSpace (GC_state s, pointer p);
+static bool isObjptrInToSpace (GC_state s, objptr op);
+static void forwardObjptr (GC_state s, objptr *opp);
+static void forwardObjptrIfInNursery (GC_state s, objptr *opp);
+static void forwardInterGenerationalObjptrs (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/frame.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* The "... reserved bytes ..." of a stack object constitute a linear
* sequence of frames. For the purposes of garbage collection, we
@@ -45,6 +47,12 @@
#define GC_RETURNADDRESS_SIZE sizeof(GC_returnAddress)
#define FMTRA "0x%016"PRIxPTR
-GC_frameIndex getFrameIndexFromReturnAddress (GC_state s, GC_returnAddress ra);
-GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex index);
-GC_frameLayout getFrameLayoutFromReturnAddress (GC_state s, GC_returnAddress ra);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static GC_frameIndex getFrameIndexFromReturnAddress (GC_state s, GC_returnAddress ra);
+static GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex index);
+static GC_frameLayout getFrameLayoutFromReturnAddress (GC_state s, GC_returnAddress ra);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/garbage-collection.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,19 +6,23 @@
* See the file MLton-LICENSE for details.
*/
-void minorGC (GC_state s);
-void majorGC (GC_state s, size_t bytesRequested, bool mayResize);
-void growStackCurrent (GC_state s);
-void enterGC (GC_state s);
-void leaveGC (GC_state s);
-void performGC (GC_state s,
- size_t oldGenBytesRequested,
- size_t nurseryBytesRequested,
- bool forceMajor,
- bool mayResize);
-void ensureInvariantForMutator (GC_state s, bool force);
-void ensureHasHeapBytesFree (GC_state s,
- size_t oldGenBytesRequested,
- size_t nurseryBytesRequested);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void minorGC (GC_state s);
+static void majorGC (GC_state s, size_t bytesRequested, bool mayResize);
+static void growStackCurrent (GC_state s);
+static void enterGC (GC_state s);
+static void leaveGC (GC_state s);
+static void performGC (GC_state s,
+ size_t oldGenBytesRequested,
+ size_t nurseryBytesRequested,
+ bool forceMajor,
+ bool mayResize);
+static void ensureInvariantForMutator (GC_state s, bool force);
+static void ensureHasHeapBytesFree (GC_state s,
+ size_t oldGenBytesRequested,
+ size_t nurseryBytesRequested);
void GC_gc (GC_state s, size_t bytesRequested, bool force,
char *file, int line);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/gc_state.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_state {
size_t alignment; /* */
bool amInGC;
@@ -61,10 +63,16 @@
GC_weak weaks; /* Linked list of (live) weak pointers */
};
-void displayGCState (GC_state s, FILE *stream);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
-size_t sizeofGCStateCurrentStackUsed (GC_state s);
-void setGCStateCurrentThreadAndStack (GC_state s);
-void setGCStateCurrentHeap (GC_state s,
- size_t oldGenBytesRequested,
- size_t nurseryBytesRequested);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void displayGCState (GC_state s, FILE *stream);
+
+static size_t sizeofGCStateCurrentStackUsed (GC_state s);
+static void setGCStateCurrentThreadAndStack (GC_state s);
+static void setGCStateCurrentHeap (GC_state s,
+ size_t oldGenBytesRequested,
+ size_t nurseryBytesRequested);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/generational.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/* must agree w/ cardSizeLog2 in ssa-to-rssa.fun */
#define CARD_SIZE_LOG2 8
#define CARD_SIZE TWOPOWER(CARD_SIZE_LOG2)
@@ -46,25 +48,31 @@
size_t crossMapValidSize;
};
-void displayGenerationalMaps (GC_state s,
- struct GC_generationalMaps *generational,
- FILE *stream);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
-GC_cardMapIndex pointerToCardMapIndexAbsolute (pointer p);
-GC_cardMapIndex sizeToCardMapIndex (size_t z);
-size_t cardMapIndexToSize (GC_cardMapIndex i);
-pointer pointerToCardMapAddr (GC_state s, pointer p);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
-bool isCardMarked (GC_state s, pointer p);
-void markCard (GC_state s, pointer p);
+static void displayGenerationalMaps (GC_state s,
+ struct GC_generationalMaps *generational,
+ FILE *stream);
-void setCardMapAbsolute (GC_state s);
-pointer getCrossMapCardStart (GC_state s, pointer p);
+static GC_cardMapIndex pointerToCardMapIndexAbsolute (pointer p);
+static GC_cardMapIndex sizeToCardMapIndex (size_t z);
+static size_t cardMapIndexToSize (GC_cardMapIndex i);
+static pointer pointerToCardMapAddr (GC_state s, pointer p);
-void clearCardMap (GC_state s);
-void clearCrossMap (GC_state s);
-void createCardMapAndCrossMap (GC_state s);
-void resizeCardMapAndCrossMap (GC_state s);
+static bool isCardMarked (GC_state s, pointer p);
+static void markCard (GC_state s, pointer p);
-bool isCrossMapOk (GC_state s);
-void updateCrossMap (GC_state s);
+static void setCardMapAbsolute (GC_state s);
+static pointer getCrossMapCardStart (GC_state s, pointer p);
+
+static void clearCardMap (GC_state s);
+static void clearCrossMap (GC_state s);
+static void createCardMapAndCrossMap (GC_state s);
+static void resizeCardMapAndCrossMap (GC_state s);
+
+static bool isCrossMapOk (GC_state s);
+static void updateCrossMap (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/handler.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,4 +6,12 @@
* See the file MLton-LICENSE for details.
*/
-void switchToSignalHandlerThreadIfNonAtomicAndSignalPending (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void switchToSignalHandlerThreadIfNonAtomicAndSignalPending (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+void GC_startSignalHandler (GC_state s);
+void GC_finishSignalHandler (GC_state s);
+void GC_handler (GC_state s, int signum);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/hash-cons.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/* ---------------------------------------------------------------- */
/* Object hash consing */
/* ---------------------------------------------------------------- */
@@ -29,15 +31,21 @@
bool mayInsert;
} *GC_objectHashTable;
-GC_objectHashTable allocHashTable (GC_state s);
-void freeHashTable (GC_objectHashTable t);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
-pointer insertHashTableElem (GC_state s,
- GC_objectHashTable t, GC_hash hash,
- pointer object, pointer max, bool mightBeThere);
-void growHashTableMaybe (GC_state s, GC_objectHashTable t);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
-pointer hashConsPointer (GC_state s, pointer object, bool countBytesHashConsed);
-void shareObjptr (GC_state s, objptr *opp);
+static GC_objectHashTable allocHashTable (GC_state s);
+static void freeHashTable (GC_objectHashTable t);
-void printBytesHashConsedMessage (GC_state s, uintmax_t total);
+static pointer insertHashTableElem (GC_state s,
+ GC_objectHashTable t, GC_hash hash,
+ pointer object, pointer max, bool mightBeThere);
+static void growHashTableMaybe (GC_state s, GC_objectHashTable t);
+
+static pointer hashConsPointer (GC_state s, pointer object, bool countBytesHashConsed);
+static void shareObjptr (GC_state s, objptr *opp);
+
+static void printBytesHashConsedMessage (GC_state s, uintmax_t total);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/heap.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* All ML objects (including ML execution stacks) are allocated in a
* contiguous heap. The heap has the following general layout:
@@ -28,27 +30,32 @@
#define GC_HEAP_LIMIT_SLOP 512
-bool isPointerInHeap (GC_state s, pointer p);
-bool isPointerInOldGen (GC_state s, pointer p);
-bool isPointerInNursery (GC_state s, pointer p);
-bool isPointerInFromSpace (GC_state s, pointer p);
-bool isObjptrInHeap (GC_state s, objptr op);
-bool isObjptrInOldGen (GC_state s, objptr op);
-bool isObjptrInNursery (GC_state s, objptr op);
-bool isObjptrInFromSpace (GC_state s, objptr op);
-bool hasHeapBytesFree (GC_state s, size_t oldGen, size_t nursery);
-bool isHeapInit (GC_heap h);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
-void displayHeap (GC_state s, GC_heap heap, FILE *stream);
-void initHeap (GC_state s, GC_heap h);
-size_t sizeofHeapDesired (GC_state s, size_t live, size_t currentSize);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
-void releaseHeap (GC_state s, GC_heap h);
-void shrinkHeap (GC_state s, GC_heap h, size_t keep);
-bool createHeap (GC_state s, GC_heap h, size_t desiredSize, size_t minSize);
-bool createHeapSecondary (GC_state s, size_t desiredSize);
-bool remapHeap (GC_state s, GC_heap h, size_t desiredSize, size_t minSize);
-void growHeap (GC_state s, size_t desiredSize, size_t minSize);
-void resizeHeap (GC_state s, size_t minSize);
-void resizeHeapSecondary (GC_state s);
+static bool isPointerInHeap (GC_state s, pointer p);
+static bool isPointerInOldGen (GC_state s, pointer p);
+static bool isPointerInNursery (GC_state s, pointer p);
+static bool isPointerInFromSpace (GC_state s, pointer p);
+static bool isObjptrInHeap (GC_state s, objptr op);
+static bool isObjptrInOldGen (GC_state s, objptr op);
+static bool isObjptrInNursery (GC_state s, objptr op);
+static bool isObjptrInFromSpace (GC_state s, objptr op);
+static bool hasHeapBytesFree (GC_state s, size_t oldGen, size_t nursery);
+static bool isHeapInit (GC_heap h);
+static void displayHeap (GC_state s, GC_heap heap, FILE *stream);
+static void initHeap (GC_state s, GC_heap h);
+static size_t sizeofHeapDesired (GC_state s, size_t live, size_t currentSize);
+
+static void releaseHeap (GC_state s, GC_heap h);
+static void shrinkHeap (GC_state s, GC_heap h, size_t keep);
+static bool createHeap (GC_state s, GC_heap h, size_t desiredSize, size_t minSize);
+static bool createHeapSecondary (GC_state s, size_t desiredSize);
+static bool remapHeap (GC_state s, GC_heap h, size_t desiredSize, size_t minSize);
+static void growHeap (GC_state s, size_t desiredSize, size_t minSize);
+static void resizeHeap (GC_state s, size_t minSize);
+static void resizeHeapSecondary (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/init-world.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/* GC_init uses the array of struct intInfInits in s at program start
* to allocate intInfs.
* The globalIndex'th entry of the globals array in s is set to the
@@ -30,7 +32,13 @@
GC_arrayLength numElements;
};
-size_t sizeofInitialBytesLive (GC_state s);
-void initIntInfs (GC_state s);
-void initVectors (GC_state s);
-void initWorld (GC_state s);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static size_t sizeofInitialBytesLive (GC_state s);
+static void initIntInfs (GC_state s);
+static void initVectors (GC_state s);
+static void initWorld (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/init.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,5 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-int processAtMLton (GC_state s, int argc,
- char **argv, char **worldFile);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static int processAtMLton (GC_state s, int argc,
+ char **argv, char **worldFile);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c (from rev 4206, 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-12 04:22:23 UTC (rev 4206)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -0,0 +1,11 @@
+/* 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_header GC_intInfHeader (void) {
+ return GC_INTINF_HEADER;
+}
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/int-inf.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/* Layout of intInfs.
* Note, the value passed around is a pointer to the isneg member.
*/
@@ -17,4 +19,16 @@
uint32_t limbs[1];
} *GC_intInf;
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
#define GC_INTINF_HEADER GC_WORD32_VECTOR_HEADER
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+#if (defined (MLTON_GC_INTERNAL_INTINF))
+
+GC_header GC_intInfHeader (void);
+
+#endif /* (defined (MLTON_GC_INTERNAL_INTINF)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/invariant.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,8 +6,12 @@
* See the file MLton-LICENSE for details.
*/
-void assertIsObjptrInFromSpace (GC_state s, objptr *opp);
-bool invariantForGC (GC_state s);
-bool invariantForMutatorFrontier (GC_state s);
-bool invariantForMutatorStack (GC_state s);
-bool invariantForMutator (GC_state s, bool frontier, bool stack);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void assertIsObjptrInFromSpace (GC_state s, objptr *opp);
+static bool invariantForGC (GC_state s);
+static bool invariantForMutatorFrontier (GC_state s);
+static bool invariantForMutatorStack (GC_state s);
+static bool invariantForMutator (GC_state s, bool frontier, bool stack);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/major.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/major.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/major.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,11 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
typedef enum {
GC_COPYING,
GC_MARK_COMPACT,
} GC_majorKind;
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/mark-compact.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,9 +6,13 @@
* See the file MLton-LICENSE for details.
*/
-void copyForThreadInternal (pointer dst, pointer src);
-void threadInternalObjptr (GC_state s, objptr *opp);
-void clearIfWeakAndUnmarkedForMarkCompact (GC_state s, pointer p);
-void updateForwardPointersForMarkCompact (GC_state s);
-void updateBackwardPointersAndSlideForMarkCompact (GC_state s);
-void majorMarkCompactGC (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void copyForThreadInternal (pointer dst, pointer src);
+static void threadInternalObjptr (GC_state s, objptr *opp);
+static void clearIfWeakAndUnmarkedForMarkCompact (GC_state s, pointer p);
+static void updateForwardPointersForMarkCompact (GC_state s);
+static void updateBackwardPointersAndSlideForMarkCompact (GC_state s);
+static void majorMarkCompactGC (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/model.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -5,6 +5,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
Consider the following schemes for representing object pointers and
mapping them to 64-bit native pointers.
@@ -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_TYPES)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/new-object.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,7 +6,11 @@
* See the file MLton-LICENSE for details.
*/
-pointer newObject (GC_state s, GC_header header,
- size_t bytesRequested, bool allocInOldGen);
-GC_stack newStack (GC_state s, size_t reserved, bool allocInOldGen);
-GC_thread newThread (GC_state s, size_t stackSize);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static pointer newObject (GC_state s, GC_header header,
+ size_t bytesRequested, bool allocInOldGen);
+static GC_stack newStack (GC_state s, size_t reserved, bool allocInOldGen);
+static GC_thread newThread (GC_state s, size_t stackSize);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/object-size.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/object-size.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object-size.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,8 +6,12 @@
* See the file MLton-LICENSE for details.
*/
-size_t sizeofArrayNoHeader (GC_state s, GC_arrayLength numElements,
- uint16_t numNonObjptrs, uint16_t numObjptrs);
-size_t sizeofStackNoHeader (GC_state s, GC_stack stack);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
-size_t sizeofObject (GC_state s, pointer p);
+static size_t sizeofArrayNoHeader (GC_state s, GC_arrayLength numElements,
+ uint16_t numNonObjptrs, uint16_t numObjptrs);
+static size_t sizeofStackNoHeader (GC_state s, GC_stack stack);
+
+static size_t sizeofObject (GC_state s, pointer p);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/object.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* There are four kinds of ML objects:
* array, normal (fixed size), stack, and weak.
@@ -17,8 +19,17 @@
WEAK_TAG,
} GC_objectTypeTag;
-const char* objectTypeTagToString (GC_objectTypeTag tag);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static const char* objectTypeTagToString (GC_objectTypeTag tag);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* Each object has a header, which immediately precedes the object data.
* A header has the following bit layout:
@@ -44,10 +55,19 @@
#define MARK_MASK 0x80000000
#define MARK_SHIFT 31
-GC_header* getHeaderp (pointer p);
-GC_header getHeader (pointer p);
-GC_header buildHeaderFromTypeIndex (uint32_t t);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static GC_header* getHeaderp (pointer p);
+static GC_header getHeader (pointer p);
+static GC_header buildHeaderFromTypeIndex (uint32_t t);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* Normal objects have the following layout:
*
@@ -64,6 +84,9 @@
*/
#define GC_NORMAL_HEADER_SIZE GC_HEADER_SIZE
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+
/* Array objects are described in "array.h" */
/* Stack objects are described in "stack.h" */
@@ -71,6 +94,8 @@
/* Weak objects are described in "weak.h" */
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* The type index of a header is an index into an array of object
* types, where each element describes the layout of an object. The
@@ -109,6 +134,10 @@
WORD16_VECTOR_TYPE_INDEX = 5,
};
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
#define GC_STACK_HEADER buildHeaderFromTypeIndex (STACK_TYPE_INDEX)
#define GC_THREAD_HEADER buildHeaderFromTypeIndex (THREAD_TYPE_INDEX)
#define GC_WEAK_GONE_HEADER buildHeaderFromTypeIndex (WEAK_GONE_TYPE_INDEX)
@@ -116,9 +145,9 @@
#define GC_WORD16_VECTOR_HEADER buildHeaderFromTypeIndex (WORD16_VECTOR_TYPE_INDEX)
#define GC_WORD32_VECTOR_HEADER buildHeaderFromTypeIndex (WORD32_VECTOR_TYPE_INDEX)
-void splitHeader (GC_state s, GC_header header,
- GC_objectTypeTag *tagRet, bool *hasIdentityRet,
- uint16_t *bytesNonObjptrsRet, uint16_t *numObjptrsRet);
+static void splitHeader (GC_state s, GC_header header,
+ GC_objectTypeTag *tagRet, bool *hasIdentityRet,
+ uint16_t *bytesNonObjptrsRet, uint16_t *numObjptrsRet);
+static pointer advanceToObjectData (GC_state s, pointer p);
-pointer advanceToObjectData (GC_state s, pointer p);
-
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/objptr.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -5,6 +5,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
#define OBJPTR_TYPE__(z) uint ## z ## _t
#define OBJPTR_TYPE_(z) OBJPTR_TYPE__(z)
#define OBJPTR_TYPE OBJPTR_TYPE_(GC_MODEL_BITSIZE)
@@ -21,8 +23,14 @@
#error gc model does not admit bogus object pointer
#endif
-bool isObjptr (objptr p);
-pointer objptrToPointer (objptr O, pointer B);
-objptr pointerToObjptr (pointer P, pointer B);
-pointer fetchObjptrToPointer (pointer OP, pointer B);
-void storeObjptrFromPointer (pointer OP, pointer P, pointer B);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static bool isObjptr (objptr p);
+static pointer objptrToPointer (objptr O, pointer B);
+static objptr pointerToObjptr (pointer P, pointer B);
+static pointer fetchObjptrToPointer (pointer OP, pointer B);
+static void storeObjptrFromPointer (pointer OP, pointer P, pointer B);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/pointer.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,10 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
#define BOGUS_POINTER (pointer)0x1
-bool isPointer (pointer p);
+static bool isPointer (pointer p);
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -7,7 +7,8 @@
*/
GC_profileMasterIndex sourceIndexToProfileMasterIndex (GC_state s,
- GC_sourceIndex i) {
+ GC_sourceIndex i)
+ {
return s->sourceMaps.sources[i].sourceNameIndex + s->sourceMaps.sourcesLength;
}
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/profiling.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
typedef enum {
PROFILE_ALLOC,
PROFILE_COUNT,
@@ -68,18 +70,48 @@
bool stack;
};
-void enterSourceForProfiling (GC_state s, GC_profileMasterIndex i);
-void enterForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex);
-void enterFrameForProfiling (GC_state s, GC_frameIndex i);
+#else
+
+struct GC_profileData;
+typedef struct GC_profileData *GC_profileData;
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static GC_profileMasterIndex sourceIndexToProfileMasterIndex (GC_state s, GC_sourceIndex i);
+static GC_sourceNameIndex profileMasterIndexToSourceNameIndex (GC_state s, GC_profileMasterIndex i);
+static GC_profileStack getProfileStackInfo (GC_state s, GC_profileMasterIndex i);
+
+static void addToStackForProfiling (GC_state s, GC_profileMasterIndex i);
+static void enterSourceForProfiling (GC_state s, GC_profileMasterIndex i);
+static void enterForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex);
+static void enterFrameForProfiling (GC_state s, GC_frameIndex i);
+
+static void removeFromStackForProfiling (GC_state s, GC_profileMasterIndex i);
+static void leaveSourceForProfiling (GC_state s, GC_profileMasterIndex i);
+static void leaveForProfiling (GC_state s, GC_sourceSeqIndex sourceSeqIndex);
+static void leaveFrameForProfiling (GC_state s, GC_frameIndex i);
+
+static void profileInc (GC_state s, size_t amount, GC_sourceSeqIndex sourceSeqIndex);
+
+static void setProfTimer (long usec);
+static void initProfiling (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
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_profileInc (GC_state s, size_t amount);
void GC_profileAllocInc (GC_state s, size_t amount);
-void initProfiling (GC_state s);
+GC_profileData GC_getProfileCurrent (GC_state s);
+void GC_setProfileCurrent (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_profileFree (GC_state s, GC_profileData p);
+
+void GC_profileDone (GC_state s);
+
+void GC_handleSigProf (pointer pc);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/rusage.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/rusage.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/rusage.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,14 +6,14 @@
* See the file MLton-LICENSE for details.
*/
-void rusageZero (struct rusage *ru);
-void rusagePlusMax (struct rusage *ru1,
- struct rusage *ru2,
- struct rusage *ru);
-void rusageMinusMax (struct rusage *ru1,
- struct rusage *ru2,
- struct rusage *ru);
-uintmax_t rusageTime (struct rusage *ru);
-uintmax_t getCurrentTime (void);
-void startTiming (struct rusage *ru_start);
-uintmax_t stopTiming (struct rusage *ru_start, struct rusage *ru_gc);
+static void rusageZero (struct rusage *ru);
+static void rusagePlusMax (struct rusage *ru1,
+ struct rusage *ru2,
+ struct rusage *ru);
+static void rusageMinusMax (struct rusage *ru1,
+ struct rusage *ru2,
+ struct rusage *ru);
+static uintmax_t rusageTime (struct rusage *ru);
+static uintmax_t getCurrentTime (void);
+static void startTiming (struct rusage *ru_start);
+static uintmax_t stopTiming (struct rusage *ru_start, struct rusage *ru_gc);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/signals.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_signalsInfo {
/* TRUE iff a signal handler is running. */
bool amInSignalHandler;
@@ -25,4 +27,10 @@
sigset_t signalsPending;
};
-void initSignalStack (GC_state s);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void initSignalStack (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/sources.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
typedef uint32_t GC_sourceNameIndex;
#define PRISNI PRIu32
#define FMTSNI "%"PRISNI
@@ -68,10 +70,16 @@
pointer textStart;
};
-GC_sourceSeqIndex getStackTopFrameSourceSeqIndex (GC_state s, GC_stack stack);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static 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);
+static void sortSourceLabels (GC_state s);
+static void initTextSources (GC_state s);
-void showSources (GC_state s);
+static void showSources (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
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-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/stack.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* Stack objects have the following layout:
*
@@ -49,24 +51,31 @@
#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);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
-size_t sizeofStackSlop (GC_state s);
-size_t sizeofStackInitial (GC_state s);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
-pointer getStackBottom (GC_state s, GC_stack stack);
-pointer getStackTop (GC_state s, GC_stack stack);
-pointer getStackLimitPlusSlop (GC_state s, GC_stack stack);
-pointer getStackLimit (GC_state s, GC_stack stack);
-GC_frameIndex getStackTopFrameIndex (GC_state s, GC_stack stack);
-GC_frameLayout getStackTopFrameLayout (GC_state s, GC_stack stack);
-uint16_t getStackTopFrameSize (GC_state s, GC_stack stack);
+static void displayStack (GC_state s, GC_stack stack, FILE *stream);
-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);
+static bool isStackEmpty (GC_stack stack);
+static bool isStackReservedAligned (GC_state s, size_t reserved);
-void copyStack (GC_state s, GC_stack from, GC_stack to);
+static size_t sizeofStackSlop (GC_state s);
+static size_t sizeofStackInitial (GC_state s);
+
+static pointer getStackBottom (GC_state s, GC_stack stack);
+static pointer getStackTop (GC_state s, GC_stack stack);
+static pointer getStackLimitPlusSlop (GC_state s, GC_stack stack);
+static pointer getStackLimit (GC_state s, GC_stack stack);
+static GC_frameIndex getStackTopFrameIndex (GC_state s, GC_stack stack);
+static GC_frameLayout getStackTopFrameLayout (GC_state s, GC_stack stack);
+static uint16_t getStackTopFrameSize (GC_state s, GC_stack stack);
+
+static size_t sizeofStackMinimumReserved (GC_state s, GC_stack stack);
+static size_t alignStackReserved (GC_state s, size_t reserved);
+static size_t sizeofStackWithHeaderAligned (GC_state s, size_t reserved);
+static size_t sizeofStackGrow (GC_state s, GC_stack stack);
+
+static void copyStack (GC_state s, GC_stack from, GC_stack to);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/statistics.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/statistics.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/statistics.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_cumulativeStatistics {
uintmax_t bytesAllocated;
uintmax_t bytesCopied;
@@ -40,3 +42,5 @@
GC_majorKind kind;
uintmax_t numMinorGCs;
};
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
Copied: mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.c (from rev 4206, mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h)
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h 2005-11-12 04:22:23 UTC (rev 4206)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -0,0 +1,11 @@
+/* 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_header GC_stringHeader (void) {
+ return GC_STRING_HEADER;
+}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/string.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/* Layout of strings.
* Note, the value passed around is a pointer to the chars member.
*/
@@ -16,4 +18,16 @@
char chars[1];
} *GC_string;
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
#define GC_STRING_HEADER GC_WORD8_VECTOR_HEADER
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+#if (defined (MLTON_GC_INTERNAL_INTINF))
+
+GC_header GC_stringHeader (void);
+
+#endif /* (defined (MLTON_GC_INTERNAL_INTINF)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/switch-thread.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/switch-thread.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/switch-thread.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,4 +6,10 @@
* See the file MLton-LICENSE for details.
*/
-void switchToThread (GC_state s, objptr op);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void switchToThread (GC_state s, objptr op);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+void GC_switchToThread (GC_state s, GC_thread t, size_t ensureBytesFree);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/sysvals.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/sysvals.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/sysvals.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,9 +6,13 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
struct GC_sysvals {
size_t ram;
size_t availRam;
size_t totalRam;
size_t pageSize;
};
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/thread.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
typedef struct GC_thread {
/* The order of these fields is important. The nonpointer fields
* must be first, because this object must appear to be a normal
@@ -22,6 +24,16 @@
#define BOGUS_EXN_STACK 0xFFFFFFFF
-void displayThread (GC_state s, GC_thread thread, FILE *stream);
-size_t sizeofThread (GC_state s);
+#else
+struct GC_thread;
+typedef struct GC_thread *GC_thread;
+
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void displayThread (GC_state s, GC_thread thread, FILE *stream);
+static size_t sizeofThread (GC_state s);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/translate.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,5 +6,9 @@
* See the file MLton-LICENSE for details.
*/
-void translateObjptr (GC_state s, objptr *opp);
-void translateHeap (GC_state s, pointer from, pointer to, size_t size);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void translateObjptr (GC_state s, objptr *opp);
+static void translateHeap (GC_state s, pointer from, pointer to, size_t size);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Deleted: mlton/branches/on-20050822-x86_64-branch/runtime/gc/util.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/util.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/util.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -1,52 +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.
- */
-#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 <stdbool.h>
-#include <iso646.h>
-#include <stdint.h>
-#include <inttypes.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <math.h>
-
-#include <fcntl.h>
-#include <signal.h>
-#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-
-#include "gmp.h"
-
-#include "../assert.h"
-
-
-/* issue error message and exit */
-extern void die (char *fmt, ...)
- __attribute__ ((format(printf, 1, 2)))
- __attribute__ ((noreturn));
-/* issue error message and exit. Also print strerror(errno). */
-extern void diee (char *fmt, ...)
- __attribute__ ((format(printf, 1, 2)))
- __attribute__ ((noreturn));
-
-static inline size_t meg (size_t n) {
- return n / (1024ul * 1024ul);
-}
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/weak.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/weak.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/weak.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,8 @@
* See the file MLton-LICENSE for details.
*/
+#if (defined (MLTON_GC_INTERNAL_TYPES))
+
/*
* Weak objects have the following layout:
*
@@ -31,8 +33,15 @@
objptr objptr;
} *GC_weak;
-size_t sizeofWeak (GC_state s);
-size_t offsetofWeak (GC_state s);
+#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
+
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static size_t sizeofWeak (GC_state s);
+static size_t offsetofWeak (GC_state s);
+
uint32_t GC_weakCanGet (GC_state s, pointer p);
pointer GC_weakGet (GC_state s, pointer p);
pointer GC_weakNew (GC_state s, GC_header header, pointer p);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc/world.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,6 +6,12 @@
* See the file MLton-LICENSE for details.
*/
-void loadWorldFromFD (GC_state s, int fd);
-void loadWorldFromFileName (GC_state s, char *fileName);
-void saveWorldToFD (GC_state s, int fd);
+#if (defined (MLTON_GC_INTERNAL_FUNCS))
+
+static void loadWorldFromFD (GC_state s, int fd);
+static void loadWorldFromFileName (GC_state s, char *fileName);
+static void saveWorldToFD (GC_state s, int fd);
+
+#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */
+
+void GC_saveWorld (GC_state s, int fd);
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc.c
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc.c 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc.c 2005-11-14 03:41:13 UTC (rev 4216)
@@ -6,9 +6,11 @@
* See the file MLton-LICENSE for details.
*/
-#define MLTON_GC_INTERNAL
+#define MLTON_GC_INTERNAL_TYPES
+#define MLTON_GC_INTERNAL_FUNCS
+#define MLTON_GC_INTERNAL_INTINF
+#define MLTON_GC_INTERNAL_BASIS
#include "platform.h"
-#undef MLTON_GC_INTERNAL
#include "gc/rusage.h"
#include "gc/virtual-memory.c"
@@ -39,6 +41,7 @@
#include "gc/heap_predicates.c"
#include "gc/init-world.c"
#include "gc/init.c"
+#include "gc/int-inf.c"
#include "gc/invariant.c"
#include "gc/mark-compact.c"
#include "gc/model.c"
@@ -55,6 +58,7 @@
#include "gc/size.c"
#include "gc/sources.c"
#include "gc/stack.c"
+#include "gc/string.c"
#include "gc/switch-thread.c"
#include "gc/thread.c"
#include "gc/translate.c"
Modified: mlton/branches/on-20050822-x86_64-branch/runtime/gc.h
===================================================================
--- mlton/branches/on-20050822-x86_64-branch/runtime/gc.h 2005-11-14 02:05:37 UTC (rev 4215)
+++ mlton/branches/on-20050822-x86_64-branch/runtime/gc.h 2005-11-14 03:41:13 UTC (rev 4216)
@@ -18,9 +18,6 @@
struct GC_state;
typedef struct GC_state *GC_state;
-
-#if (defined (MLTON_GC_INTERNAL))
-
#define GC_MODEL_NATIVE32
#include "gc/align.h"
@@ -35,7 +32,6 @@
#include "gc/weak.h"
#include "gc/int-inf.h"
#include "gc/string.h"
-
#include "gc/object-size.h"
#include "gc/generational.h"
#include "gc/heap.h"
@@ -69,15 +65,6 @@
#include "gc/copy-thread.h"
#include "gc/gc_state.h"
-#else /* not (defined (MLTON_GC_INTERNAL)) */
-
-struct GC_thread;
-typedef struct GC_thread *GC_thread;
-struct GC_profileData;
-typedef struct GC_profileData *GC_profileData;
-
-#endif /* (defined (MLTON_GC_INTERNAL)) */
-
#include "gc/platform.h"
#include "gc/gc_state_exports.h"
#include "gc/exports.h"