diff options
author | Mike Pall <mike> | 2010-04-21 01:45:58 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2010-04-21 01:45:58 +0200 |
commit | ab45481199e9c9dd3efec922647bcec122504bcb (patch) | |
tree | 0484341edff50a0afe98133ad66fb6a59915996a /src/lj_obj.c | |
parent | d8cb69ed076c3444258f63314662451c9d117cae (diff) | |
download | luajit-ab45481199e9c9dd3efec922647bcec122504bcb.tar.gz luajit-ab45481199e9c9dd3efec922647bcec122504bcb.tar.bz2 luajit-ab45481199e9c9dd3efec922647bcec122504bcb.zip |
No longer let the GC replace dead keys with the LJ_TDEADKEY tag.
Important: this changes the semantics of the write barrier!
Carefully read the big comment block in lj_obj.h
This helps HREFK key slot specialization and allows safely hoisting
HREF/HREFK across GC steps, too (fix for a barely reproducible bug).
Dead keys are only removed during a table resize (as before).
Diffstat (limited to 'src/lj_obj.c')
-rw-r--r-- | src/lj_obj.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/lj_obj.c b/src/lj_obj.c index 4363e790..0df51bc4 100644 --- a/src/lj_obj.c +++ b/src/lj_obj.c | |||
@@ -11,12 +11,12 @@ | |||
11 | /* Object type names. */ | 11 | /* Object type names. */ |
12 | LJ_DATADEF const char *const lj_obj_typename[] = { /* ORDER LUA_T */ | 12 | LJ_DATADEF const char *const lj_obj_typename[] = { /* ORDER LUA_T */ |
13 | "no value", "nil", "boolean", "userdata", "number", "string", | 13 | "no value", "nil", "boolean", "userdata", "number", "string", |
14 | "table", "function", "userdata", "thread", "proto", "upval" | 14 | "table", "function", "userdata", "thread", "proto" |
15 | }; | 15 | }; |
16 | 16 | ||
17 | LJ_DATADEF const char *const lj_obj_itypename[] = { /* ORDER LJ_T */ | 17 | LJ_DATADEF const char *const lj_obj_itypename[] = { /* ORDER LJ_T */ |
18 | "nil", "boolean", "boolean", "userdata", "string", "upval", "thread", | 18 | "nil", "boolean", "boolean", "userdata", "string", "upval", "thread", |
19 | "proto", "function", "deadkey", "table", "userdata", "number" | 19 | "proto", "function", "" /* Unused */, "table", "userdata", "number" |
20 | }; | 20 | }; |
21 | 21 | ||
22 | /* Compare two objects without calling metamethods. */ | 22 | /* Compare two objects without calling metamethods. */ |
@@ -25,14 +25,8 @@ int lj_obj_equal(cTValue *o1, cTValue *o2) | |||
25 | if (itype(o1) == itype(o2)) { | 25 | if (itype(o1) == itype(o2)) { |
26 | if (tvispri(o1)) | 26 | if (tvispri(o1)) |
27 | return 1; | 27 | return 1; |
28 | if (!tvisnum(o1)) { | 28 | if (!tvisnum(o1)) |
29 | #if LJ_64 | 29 | return gcrefeq(o1->gcr, o2->gcr); |
30 | if (tvislightud(o1)) | ||
31 | return o1->u64 == o2->u64; | ||
32 | else | ||
33 | #endif | ||
34 | return gcrefeq(o1->gcr, o2->gcr); | ||
35 | } | ||
36 | } else if (!tvisnum(o1) || !tvisnum(o2)) { | 30 | } else if (!tvisnum(o1) || !tvisnum(o2)) { |
37 | return 0; | 31 | return 0; |
38 | } | 32 | } |