1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/* Copyright (C) 1999-2007 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.
*/
void displayThread (GC_state s,
GC_thread thread,
FILE *stream) {
fprintf(stream,
"\t\texnStack = %"PRIuMAX"\n"
"\t\tbytesNeeded = %"PRIuMAX"\n"
"\t\tstack = "FMTOBJPTR"\n",
(uintmax_t)thread->exnStack,
(uintmax_t)thread->bytesNeeded,
thread->stack);
displayStack (s, (GC_stack)(objptrToPointer (thread->stack, s->heap.start)),
stream);
}
size_t sizeofThread (GC_state s) {
size_t res;
res = GC_NORMAL_HEADER_SIZE + sizeof (struct GC_thread);
res = align (res, s->alignment);
if (DEBUG) {
size_t check;
uint16_t bytesNonObjptrs, numObjptrs;
splitHeader (s, GC_THREAD_HEADER, NULL, NULL, &bytesNonObjptrs, &numObjptrs);
check = GC_NORMAL_HEADER_SIZE + (bytesNonObjptrs + (numObjptrs * OBJPTR_SIZE));
if (DEBUG_DETAILED)
fprintf (stderr,
"sizeofThread: res = %"PRIuMAX" check = %"PRIuMAX"\n",
(uintmax_t)res, (uintmax_t)check);
assert (check == res);
}
assert (isAligned (res, s->alignment));
return res;
}
size_t offsetofThread (GC_state s) {
return (sizeofThread (s)) - (GC_NORMAL_HEADER_SIZE + sizeof (struct GC_thread));
}
|