[MLton-commit] r6245
Matthew Fluet
fluet at mlton.org
Sun Dec 9 10:25:15 PST 2007
Leave debugging of GMP memory management functions disabled.
----------------------------------------------------------------------
U mlton/trunk/runtime/gc/int-inf.c
----------------------------------------------------------------------
Modified: mlton/trunk/runtime/gc/int-inf.c
===================================================================
--- mlton/trunk/runtime/gc/int-inf.c 2007-12-09 18:23:24 UTC (rev 6244)
+++ mlton/trunk/runtime/gc/int-inf.c 2007-12-09 18:25:14 UTC (rev 6245)
@@ -364,15 +364,14 @@
return pointerToObjptr ((pointer)&sp->obj, gcState.heap.start);
}
-#ifdef DEBUG
-
+/*
static GC_state intInfMemoryFuncsState;
static void * wrap_alloc_func(size_t size) {
if (DEBUG_INT_INF)
fprintf (stderr, "alloc_func (size = %"PRIuMAX") = ",
(uintmax_t)size);
- void * res = malloc(size);
+ void * res = (*alloc_func_ptr)(size);
if (DEBUG_INT_INF)
fprintf (stderr, FMTPTR"\n", (uintptr_t)res);
return res;
@@ -384,7 +383,7 @@
"old_size = %"PRIuMAX", new_size = %"PRIuMAX") = ",
(uintptr_t)ptr, (uintmax_t)old_size, (uintmax_t)new_size);
assert (! isPointerInHeap(intInfMemoryFuncsState, (pointer)ptr));
- void * res = realloc(ptr, new_size);
+ void * res = (*realloc_func_ptr)(ptr, old_size, new_size);
if (DEBUG_INT_INF)
fprintf (stderr, FMTPTR"\n", (uintptr_t)res);
return res;
@@ -395,7 +394,7 @@
fprintf (stderr, "free_func (ptr = "FMTPTR", size = %"PRIuMAX")",
(uintptr_t)ptr, (uintmax_t)size);
assert (! isPointerInHeap(intInfMemoryFuncsState, (pointer)ptr));
- free(ptr);
+ (*free_func_ptr)(ptr, size);
if (DEBUG_INT_INF)
fprintf (stderr, "\n");
return;
@@ -403,11 +402,12 @@
void initIntInf (GC_state s) {
intInfMemoryFuncsState = s;
+ mp_get_memory_functions (&alloc_func_ptr, &realloc_func_ptr, &free_func_ptr);
mp_set_memory_functions (&wrap_alloc_func, &wrap_realloc_func, &wrap_free_func);
return;
}
-#else
+*/
+
void initIntInf (__attribute__ ((unused)) GC_state s) {
return;
}
-#endif
More information about the MLton-commit
mailing list