Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / runtime / gc / objptr.h
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)
13 typedef 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
20 COMPILE_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
29 static inline bool isObjptr (objptr p);
30 static inline pointer objptrToPointer (objptr O, pointer B);
31 static inline objptr pointerToObjptr (pointer P, pointer B);
32 static inline pointer fetchObjptrToPointer (pointer OP, pointer B);
33 static inline void storeObjptrFromPointer (pointer OP, pointer P, pointer B);
34
35 #endif /* (defined (MLTON_GC_INTERNAL_FUNCS)) */