[MLton-commit] r6012
Matthew Fluet
fluet at mlton.org
Tue Sep 11 17:37:20 PDT 2007
Assertions when read/write savedThread field
----------------------------------------------------------------------
U mlton/trunk/runtime/gc/gc_state.c
U mlton/trunk/runtime/gc/handler.c
----------------------------------------------------------------------
Modified: mlton/trunk/runtime/gc/gc_state.c
===================================================================
--- mlton/trunk/runtime/gc/gc_state.c 2007-09-12 00:36:21 UTC (rev 6011)
+++ mlton/trunk/runtime/gc/gc_state.c 2007-09-12 00:37:19 UTC (rev 6012)
@@ -162,13 +162,19 @@
}
pointer GC_getSavedThread (GC_state s) {
- pointer p = objptrToPointer (s->savedThread, s->heap.start);
+ pointer p;
+
+ assert(s->savedThread != BOGUS_OBJPTR);
+ p = objptrToPointer (s->savedThread, s->heap.start);
s->savedThread = BOGUS_OBJPTR;
return p;
}
void GC_setSavedThread (GC_state s, pointer p) {
- objptr op = pointerToObjptr (p, s->heap.start);
+ objptr op;
+
+ assert(s->savedThread == BOGUS_OBJPTR);
+ op = pointerToObjptr (p, s->heap.start);
s->savedThread = op;
}
Modified: mlton/trunk/runtime/gc/handler.c
===================================================================
--- mlton/trunk/runtime/gc/handler.c 2007-09-12 00:36:21 UTC (rev 6011)
+++ mlton/trunk/runtime/gc/handler.c 2007-09-12 00:37:19 UTC (rev 6012)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
+/* Copyright (C) 1999-2007 Henry Cejtin, Matthew Fluet, Suresh
* Jagannathan, and Stephen Weeks.
* Copyright (C) 1997-2000 NEC Research Institute.
*
@@ -24,6 +24,7 @@
assert (s->signalsInfo.signalIsPending);
s->signalsInfo.signalIsPending = FALSE;
s->signalsInfo.amInSignalHandler = TRUE;
+ assert (s->savedThread == BOGUS_OBJPTR);
s->savedThread = s->currentThread;
/* Set s->atomicState to 2 when switching to the signal handler
* thread; leaving the runtime will decrement s->atomicState to 1,
More information about the MLton-commit
mailing list