Skip to content

Commit 73d3e85

Browse files
committed
luajit: solve blockdebug falsely triggering since its flag collided with something
1 parent 0e6cbf7 commit 73d3e85

3 files changed

Lines changed: 4 additions & 3 deletions

File tree

LuaJIT-2.1/src/lj_cdata.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GCcdata *lj_cdata_newv(lua_State *L, CTypeID id, CTSize sz, CTSize align)
4343
setgcrefr(cd->nextgc, g->gc.root);
4444
setgcref(g->gc.root, obj2gco(cd));
4545
newwhite(g, obj2gco(cd));
46-
cd->marked |= 0x80;
46+
cd->marked |= LJ_GC_ISCDATA;
4747
cd->gct = ~LJ_TCDATA;
4848
cd->ctypeid = id;
4949
return cd;

LuaJIT-2.1/src/lj_gc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ enum {
2323
#define LJ_GC_CDATA_FIN 0x10
2424
#define LJ_GC_FIXED 0x20
2525
#define LJ_GC_SFIXED 0x40
26+
#define LJ_GC_ISCDATA 0x80
2627
#define LJ_GC_READONLY 0x80
27-
#define LJ_GC_BLOCKDEBUG 0x80 // Same as LJ_GC_READONLY, but we'll use this one for functions.
28+
#define LJ_GC_BLOCKDEBUG 0x08 // Same as LJ_GC_WEAKKEY but we can use it for functions
2829

2930
#define LJ_GC_WHITES (LJ_GC_WHITE0 | LJ_GC_WHITE1)
3031
#define LJ_GC_COLORS (LJ_GC_WHITES | LJ_GC_BLACK)

LuaJIT-2.1/src/lj_obj.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ typedef struct GCcdataVar {
358358
} GCcdataVar;
359359

360360
#define cdataptr(cd) ((void *)((cd)+1))
361-
#define cdataisv(cd) ((cd)->marked & 0x80)
361+
#define cdataisv(cd) ((cd)->marked & LJ_GC_ISCDATA)
362362
#define cdatav(cd) ((GCcdataVar *)((char *)(cd) - sizeof(GCcdataVar)))
363363
#define cdatavlen(cd) check_exp(cdataisv(cd), cdatav(cd)->len)
364364
#define sizecdatav(cd) (cdatavlen(cd) + cdatav(cd)->extra)

0 commit comments

Comments
 (0)