Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / gc / current.c
1 /* Copyright (C) 1999-2007 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 objptr getThreadCurrentObjptr (GC_state s) {
10 return s->currentThread;
11 }
12
13 GC_thread getThreadCurrent (GC_state s) {
14 pointer p = objptrToPointer(getThreadCurrentObjptr(s), s->heap.start);
15 return (GC_thread)(p + offsetofThread (s));
16 }
17
18 objptr getStackCurrentObjptr (GC_state s) {
19 GC_thread thread = getThreadCurrent(s);
20 return thread->stack;
21 }
22
23 GC_stack getStackCurrent (GC_state s) {
24 pointer p = objptrToPointer(getStackCurrentObjptr(s), s->heap.start);
25 return (GC_stack)p;
26 }