1 /* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 /* enter and leave should be called at the start and end of every GC
10 * function that is exported to the outside world. They make sure
11 * that the function is run in a critical section and check the GC
14 void enter (GC_state s
) {
16 fprintf (stderr
, "enter\n");
17 /* used needs to be set because the mutator has changed s->stackTop. */
18 getStackCurrent(s
)->used
= sizeofGCStateCurrentStackUsed (s
);
19 getThreadCurrent(s
)->exnStack
= s
->exnStack
;
21 displayGCState (s
, stderr
);
23 assert (invariantForGC (s
));
25 fprintf (stderr
, "enter ok\n");
28 void leave (GC_state s
) {
30 fprintf (stderr
, "leave\n");
31 /* The mutator frontier invariant may not hold
32 * for functions that don't ensureBytesFree.
34 assert (invariantForMutator (s
, FALSE
, TRUE
));
37 fprintf (stderr
, "leave ok\n");