mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 14:03:26 +00:00
Merge branch 'userdata-align-16-support' into v2.1-defold
This commit is contained in:
commit
9c71baef6a
15
src/lj_obj.h
15
src/lj_obj.h
@ -320,16 +320,27 @@ typedef struct GCstr {
|
|||||||
/* -- Userdata object ----------------------------------------------------- */
|
/* -- Userdata object ----------------------------------------------------- */
|
||||||
|
|
||||||
/* Userdata object. Payload follows. */
|
/* Userdata object. Payload follows. */
|
||||||
typedef struct GCudata {
|
typedef struct LJ_ALIGN(LUA_USERDATA_ALIGNMENT) GCudata {
|
||||||
GCHeader;
|
GCHeader;
|
||||||
uint8_t udtype; /* Userdata type. */
|
uint8_t udtype; /* Userdata type. */
|
||||||
uint8_t unused2;
|
uint8_t unused2;
|
||||||
GCRef env; /* Should be at same offset in GCfunc. */
|
GCRef env; /* Should be at same offset in GCfunc. */
|
||||||
MSize len; /* Size of payload. */
|
MSize len; /* Size of payload. */
|
||||||
GCRef metatable; /* Must be at same offset in GCtab. */
|
GCRef metatable; /* Must be at same offset in GCtab. */
|
||||||
uint32_t align1; /* To force 8 byte alignment of the payload. */
|
|
||||||
|
uint32_t align0; /* To force 8 byte alignment of the payload. */
|
||||||
|
#if LUA_USERDATA_ALIGNMENT == 16
|
||||||
|
#ifndef LJ_GC64
|
||||||
|
uint64_t align1;/* To force 16 byte alignment of the payload. */
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
} GCudata;
|
} GCudata;
|
||||||
|
|
||||||
|
#undef LUA_STRUCT_ALIGNED
|
||||||
|
|
||||||
|
LJ_STATIC_ASSERT((sizeof(GCudata) % LUA_USERDATA_ALIGNMENT) == 0);
|
||||||
|
|
||||||
/* Userdata types. */
|
/* Userdata types. */
|
||||||
enum {
|
enum {
|
||||||
UDTYPE_USERDATA, /* Regular userdata. */
|
UDTYPE_USERDATA, /* Regular userdata. */
|
||||||
|
@ -123,6 +123,16 @@
|
|||||||
#define LUA_INTFRMLEN "l"
|
#define LUA_INTFRMLEN "l"
|
||||||
#define LUA_INTFRM_T long
|
#define LUA_INTFRM_T long
|
||||||
|
|
||||||
|
/* Allows for aligning the userdata struct. Valid values are 8 or 16. Default is 8.
|
||||||
|
*/
|
||||||
|
#if !defined(LUA_USERDATA_ALIGNMENT)
|
||||||
|
#define LUA_USERDATA_ALIGNMENT 8
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !(LUA_USERDATA_ALIGNMENT == 8 || LUA_USERDATA_ALIGNMENT == 16)
|
||||||
|
#error "Invalid LUA_USERDATA_ALIGNMENT (valid values are 8 or 16)"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Linkage of public API functions. */
|
/* Linkage of public API functions. */
|
||||||
#if defined(LUA_BUILD_AS_DLL)
|
#if defined(LUA_BUILD_AS_DLL)
|
||||||
#if defined(LUA_CORE) || defined(LUA_LIB)
|
#if defined(LUA_CORE) || defined(LUA_LIB)
|
||||||
|
Loading…
Reference in New Issue
Block a user