diff options
Diffstat (limited to 'src/lj_bcwrite.c')
-rw-r--r-- | src/lj_bcwrite.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lj_bcwrite.c b/src/lj_bcwrite.c index ec6f13c8..de200ef4 100644 --- a/src/lj_bcwrite.c +++ b/src/lj_bcwrite.c | |||
@@ -71,8 +71,6 @@ static void bcwrite_ktabk(BCWriteCtx *ctx, cTValue *o, int narrow) | |||
71 | *p++ = BCDUMP_KTAB_NUM; | 71 | *p++ = BCDUMP_KTAB_NUM; |
72 | p = lj_strfmt_wuleb128(p, o->u32.lo); | 72 | p = lj_strfmt_wuleb128(p, o->u32.lo); |
73 | p = lj_strfmt_wuleb128(p, o->u32.hi); | 73 | p = lj_strfmt_wuleb128(p, o->u32.hi); |
74 | } else if (tvistab(o)) { /* Write the nil value marker as a nil. */ | ||
75 | *p++ = BCDUMP_KTAB_NIL; | ||
76 | } else { | 74 | } else { |
77 | lj_assertBCW(tvispri(o), "unhandled type %d", itype(o)); | 75 | lj_assertBCW(tvispri(o), "unhandled type %d", itype(o)); |
78 | *p++ = BCDUMP_KTAB_NIL+~itype(o); | 76 | *p++ = BCDUMP_KTAB_NIL+~itype(o); |
@@ -135,7 +133,7 @@ static void bcwrite_ktab_sorted_hash(BCWriteCtx *ctx, Node *node, MSize nhash) | |||
135 | TValue **heap = ctx->heap; | 133 | TValue **heap = ctx->heap; |
136 | MSize i = nhash; | 134 | MSize i = nhash; |
137 | for (;; node--) { /* Build heap. */ | 135 | for (;; node--) { /* Build heap. */ |
138 | if (!tvisnil(&node->val)) { | 136 | if (!tvisnil(&node->key)) { |
139 | bcwrite_ktabk_heap_insert(heap, --i, nhash, &node->key); | 137 | bcwrite_ktabk_heap_insert(heap, --i, nhash, &node->key); |
140 | if (i == 0) break; | 138 | if (i == 0) break; |
141 | } | 139 | } |
@@ -165,7 +163,7 @@ static void bcwrite_ktab(BCWriteCtx *ctx, char *p, const GCtab *t) | |||
165 | MSize i, hmask = t->hmask; | 163 | MSize i, hmask = t->hmask; |
166 | Node *node = noderef(t->node); | 164 | Node *node = noderef(t->node); |
167 | for (i = 0; i <= hmask; i++) | 165 | for (i = 0; i <= hmask; i++) |
168 | nhash += !tvisnil(&node[i].val); | 166 | nhash += !tvisnil(&node[i].key); |
169 | } | 167 | } |
170 | /* Write number of array slots and hash slots. */ | 168 | /* Write number of array slots and hash slots. */ |
171 | p = lj_strfmt_wuleb128(p, narray); | 169 | p = lj_strfmt_wuleb128(p, narray); |
@@ -186,7 +184,7 @@ static void bcwrite_ktab(BCWriteCtx *ctx, char *p, const GCtab *t) | |||
186 | } else { | 184 | } else { |
187 | MSize i = nhash; | 185 | MSize i = nhash; |
188 | for (;; node--) | 186 | for (;; node--) |
189 | if (!tvisnil(&node->val)) { | 187 | if (!tvisnil(&node->key)) { |
190 | bcwrite_ktabk(ctx, &node->key, 0); | 188 | bcwrite_ktabk(ctx, &node->key, 0); |
191 | bcwrite_ktabk(ctx, &node->val, 1); | 189 | bcwrite_ktabk(ctx, &node->val, 1); |
192 | if (--i == 0) break; | 190 | if (--i == 0) break; |