Import Upstream version 20180207
[hcoop/debian/mlton.git] / runtime / gc / objptr.h
CommitLineData
7f918cf1
CE
1/* Copyright (C) 2005-2007 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 *
4 * MLton is released under a BSD-style license.
5 * See the file MLton-LICENSE for details.
6 */
7
8#if (defined (MLTON_GC_INTERNAL_TYPES))
9
10#define OBJPTR_TYPE__(z) uint ## z ## _t
11#define OBJPTR_TYPE_(z) OBJPTR_TYPE__(z)
12#define OBJPTR_TYPE OBJPTR_TYPE_(GC_MODEL_OBJPTR_SIZE)
13typedef OBJPTR_TYPE objptr;
14#define OBJPTR_SIZE sizeof(objptr)
15#define PRIxOBJPTR__(z) PRIx ## z
16#define PRIxOBJPTR_(z) PRIxOBJPTR__(z)
17#define PRIxOBJPTR PRIxOBJPTR_(GC_MODEL_OBJPTR_SIZE)
18#define FMTOBJPTR "0x%016"PRIxOBJPTR
19
20COMPILE_TIME_ASSERT(sizeof_voidStar__gte__sizeof_objptr,
21 sizeof(void*) >= sizeof(objptr));
22
23#define BOGUS_OBJPTR (objptr)0x1
24
25#endif /* (defined (MLTON_GC_INTERNAL_TYPES)) */
26
27#if (defined (MLTON_GC_INTERNAL_FUNCS))
28
29static inline bool isObjptr (objptr p);
30static inline pointer objptrToPointer (objptr O, pointer B);
31static inline objptr pointerToObjptr (pointer P, pointer B);
32static inline pointer fetchObjptrToPointer (pointer OP, pointer B);
33static inline void storeObjptrFromPointer (pointer OP, pointer P, pointer B);
34
35#endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */