diff options
Diffstat (limited to 'src/lj_obj.h')
-rw-r--r-- | src/lj_obj.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/lj_obj.h b/src/lj_obj.h index e5724859..438c83d4 100644 --- a/src/lj_obj.h +++ b/src/lj_obj.h | |||
@@ -131,7 +131,7 @@ typedef struct SBuf { | |||
131 | /* Frame link. */ | 131 | /* Frame link. */ |
132 | typedef union { | 132 | typedef union { |
133 | int32_t ftsz; /* Frame type and size of previous frame. */ | 133 | int32_t ftsz; /* Frame type and size of previous frame. */ |
134 | MRef pcr; /* Overlaps PC for Lua frames. */ | 134 | MRef pcr; /* Or PC for Lua frames. */ |
135 | } FrameLink; | 135 | } FrameLink; |
136 | 136 | ||
137 | /* Tagged value. */ | 137 | /* Tagged value. */ |
@@ -147,12 +147,16 @@ typedef LJ_ALIGN(8) union TValue { | |||
147 | , uint32_t it; /* Internal object tag. Must overlap MSW of number. */ | 147 | , uint32_t it; /* Internal object tag. Must overlap MSW of number. */ |
148 | ) | 148 | ) |
149 | }; | 149 | }; |
150 | #if LJ_FR2 | ||
151 | int64_t ftsz; /* Frame type and size of previous frame, or PC. */ | ||
152 | #else | ||
150 | struct { | 153 | struct { |
151 | LJ_ENDIAN_LOHI( | 154 | LJ_ENDIAN_LOHI( |
152 | GCRef func; /* Function for next frame (or dummy L). */ | 155 | GCRef func; /* Function for next frame (or dummy L). */ |
153 | , FrameLink tp; /* Link to previous frame. */ | 156 | , FrameLink tp; /* Link to previous frame. */ |
154 | ) | 157 | ) |
155 | } fr; | 158 | } fr; |
159 | #endif | ||
156 | struct { | 160 | struct { |
157 | LJ_ENDIAN_LOHI( | 161 | LJ_ENDIAN_LOHI( |
158 | uint32_t lo; /* Lower 32 bits of number. */ | 162 | uint32_t lo; /* Lower 32 bits of number. */ |
@@ -584,7 +588,11 @@ struct lua_State { | |||
584 | #define registry(L) (&G(L)->registrytv) | 588 | #define registry(L) (&G(L)->registrytv) |
585 | 589 | ||
586 | /* Macros to access the currently executing (Lua) function. */ | 590 | /* Macros to access the currently executing (Lua) function. */ |
591 | #if LJ_FR2 | ||
592 | #define curr_func(L) (&gcref((L->base-2)->gcr)->fn) | ||
593 | #else | ||
587 | #define curr_func(L) (&gcref((L->base-1)->fr.func)->fn) | 594 | #define curr_func(L) (&gcref((L->base-1)->fr.func)->fn) |
595 | #endif | ||
588 | #define curr_funcisL(L) (isluafunc(curr_func(L))) | 596 | #define curr_funcisL(L) (isluafunc(curr_func(L))) |
589 | #define curr_proto(L) (funcproto(curr_func(L))) | 597 | #define curr_proto(L) (funcproto(curr_func(L))) |
590 | #define curr_topL(L) (L->base + curr_proto(L)->framesize) | 598 | #define curr_topL(L) (L->base + curr_proto(L)->framesize) |
@@ -732,10 +740,16 @@ static LJ_AINLINE void setlightudV(TValue *o, void *p) | |||
732 | #if LJ_64 | 740 | #if LJ_64 |
733 | #define checklightudptr(L, p) \ | 741 | #define checklightudptr(L, p) \ |
734 | (((uint64_t)(p) >> 47) ? (lj_err_msg(L, LJ_ERR_BADLU), NULL) : (p)) | 742 | (((uint64_t)(p) >> 47) ? (lj_err_msg(L, LJ_ERR_BADLU), NULL) : (p)) |
743 | #else | ||
744 | #define checklightudptr(L, p) (p) | ||
745 | #endif | ||
746 | |||
747 | #if LJ_FR2 | ||
748 | #define setcont(o, f) ((o)->u64 = (uint64_t)(uintptr_t)(void *)(f)) | ||
749 | #elif LJ_64 | ||
735 | #define setcont(o, f) \ | 750 | #define setcont(o, f) \ |
736 | ((o)->u64 = (uint64_t)(void *)(f) - (uint64_t)lj_vm_asm_begin) | 751 | ((o)->u64 = (uint64_t)(void *)(f) - (uint64_t)lj_vm_asm_begin) |
737 | #else | 752 | #else |
738 | #define checklightudptr(L, p) (p) | ||
739 | #define setcont(o, f) setlightudV((o), (void *)(f)) | 753 | #define setcont(o, f) setlightudV((o), (void *)(f)) |
740 | #endif | 754 | #endif |
741 | 755 | ||