Commit | Line | Data |
---|---|---|
7f918cf1 CE |
1 | /* Copyright (C) 1999-2008 Henry Cejtin, Matthew Fluet, Suresh |
2 | * Jagannathan, and Stephen Weeks. | |
3 | * Copyright (C) 1997-2000 NEC Research Institute. | |
4 | * | |
5 | * MLton is released under a BSD-style license. | |
6 | * See the file MLton-LICENSE for details. | |
7 | */ | |
8 | ||
9 | void GC_share (GC_state s, pointer object) { | |
10 | size_t bytesExamined; | |
11 | size_t bytesHashConsed; | |
12 | ||
13 | enter (s); /* update stack in heap, in case it is reached */ | |
14 | if (DEBUG_SHARE) | |
15 | fprintf (stderr, "GC_share "FMTPTR"\n", (uintptr_t)object); | |
16 | if (DEBUG_SHARE or s->controls.messages) | |
17 | s->lastMajorStatistics.bytesHashConsed = 0; | |
18 | // Don't hash cons during the first round of marking. | |
19 | bytesExamined = dfsMarkByMode (s, object, MARK_MODE, FALSE, FALSE); | |
20 | s->objectHashTable = allocHashTable (s); | |
21 | // Hash cons during the second round of (un)marking. | |
22 | dfsMarkByMode (s, object, UNMARK_MODE, TRUE, FALSE); | |
23 | freeHashTable (s->objectHashTable); | |
24 | bytesHashConsed = s->lastMajorStatistics.bytesHashConsed; | |
25 | s->cumulativeStatistics.bytesHashConsed += bytesHashConsed; | |
26 | if (DEBUG_SHARE or s->controls.messages) | |
27 | printBytesHashConsedMessage (bytesHashConsed, bytesExamined); | |
28 | leave (s); | |
29 | } |