aboutsummaryrefslogtreecommitdiff
path: root/src/lj_def.h
diff options
context:
space:
mode:
authorMike Pall <mike>2015-01-03 15:23:58 +0100
committerMike Pall <mike>2015-01-03 15:23:58 +0100
commitcb481ddc8f9d92913ba07d998f4274bbf9711077 (patch)
tree852ffb4dd7c3cfdcf5c1ca6ae1531e5f9436d064 /src/lj_def.h
parent054e6abe37450344e20b373ec326055071029e9b (diff)
downloadluajit-cb481ddc8f9d92913ba07d998f4274bbf9711077.tar.gz
luajit-cb481ddc8f9d92913ba07d998f4274bbf9711077.tar.bz2
luajit-cb481ddc8f9d92913ba07d998f4274bbf9711077.zip
Add LJ_GC64 mode: 64 bit GC object references.
Actually NaN tagging with 47 bit pointers and 13+4 bit tags.
Diffstat (limited to 'src/lj_def.h')
-rw-r--r--src/lj_def.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lj_def.h b/src/lj_def.h
index 93420ba5..f4231239 100644
--- a/src/lj_def.h
+++ b/src/lj_def.h
@@ -47,7 +47,9 @@ typedef unsigned int uintptr_t;
47 47
48/* Various VM limits. */ 48/* Various VM limits. */
49#define LJ_MAX_MEM32 0x7fffff00 /* Max. 32 bit memory allocation. */ 49#define LJ_MAX_MEM32 0x7fffff00 /* Max. 32 bit memory allocation. */
50#define LJ_MAX_MEM LJ_MAX_MEM32 /* Max. total memory allocation. */ 50#define LJ_MAX_MEM64 ((uint64_t)1<<47) /* Max. 64 bit memory allocation. */
51/* Max. total memory allocation. */
52#define LJ_MAX_MEM (LJ_GC64 ? LJ_MAX_MEM64 : LJ_MAX_MEM32)
51#define LJ_MAX_ALLOC LJ_MAX_MEM /* Max. individual allocation length. */ 53#define LJ_MAX_ALLOC LJ_MAX_MEM /* Max. individual allocation length. */
52#define LJ_MAX_STR LJ_MAX_MEM32 /* Max. string length. */ 54#define LJ_MAX_STR LJ_MAX_MEM32 /* Max. string length. */
53#define LJ_MAX_BUF LJ_MAX_MEM32 /* Max. buffer length. */ 55#define LJ_MAX_BUF LJ_MAX_MEM32 /* Max. buffer length. */
@@ -67,7 +69,7 @@ typedef unsigned int uintptr_t;
67#define LJ_MAX_UPVAL 60 /* Max. # of upvalues. */ 69#define LJ_MAX_UPVAL 60 /* Max. # of upvalues. */
68 70
69#define LJ_MAX_IDXCHAIN 100 /* __index/__newindex chain limit. */ 71#define LJ_MAX_IDXCHAIN 100 /* __index/__newindex chain limit. */
70#define LJ_STACK_EXTRA 5 /* Extra stack space (metamethods). */ 72#define LJ_STACK_EXTRA (5+2*LJ_FR2) /* Extra stack space (metamethods). */
71 73
72#define LJ_NUM_CBPAGE 1 /* Number of FFI callback pages. */ 74#define LJ_NUM_CBPAGE 1 /* Number of FFI callback pages. */
73 75
@@ -101,7 +103,14 @@ typedef unsigned int uintptr_t;
101#define checki32(x) ((x) == (int32_t)(x)) 103#define checki32(x) ((x) == (int32_t)(x))
102#define checku32(x) ((x) == (uint32_t)(x)) 104#define checku32(x) ((x) == (uint32_t)(x))
103#define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x)) 105#define checkptr32(x) ((uintptr_t)(x) == (uint32_t)(uintptr_t)(x))
104#define checkptrGC(x) (checkptr32(x)) 106#define checkptr47(x) (((uint64_t)(x) >> 47) == 0)
107#if LJ_GC64
108#define checkptrGC(x) (checkptr47((x)))
109#elif LJ_64
110#define checkptrGC(x) (checkptr32((x)))
111#else
112#define checkptrGC(x) 1
113#endif
105 114
106/* Every half-decent C compiler transforms this into a rotate instruction. */ 115/* Every half-decent C compiler transforms this into a rotate instruction. */
107#define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1)))) 116#define lj_rol(x, n) (((x)<<(n)) | ((x)>>(-(int)(n)&(8*sizeof(x)-1))))