aboutsummaryrefslogtreecommitdiff
path: root/src/lj_bcwrite.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lj_bcwrite.c')
-rw-r--r--src/lj_bcwrite.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/lj_bcwrite.c b/src/lj_bcwrite.c
index de200ef4..d5e10ab2 100644
--- a/src/lj_bcwrite.c
+++ b/src/lj_bcwrite.c
@@ -71,6 +71,8 @@ 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;
74 } else { 76 } else {
75 lj_assertBCW(tvispri(o), "unhandled type %d", itype(o)); 77 lj_assertBCW(tvispri(o), "unhandled type %d", itype(o));
76 *p++ = BCDUMP_KTAB_NIL+~itype(o); 78 *p++ = BCDUMP_KTAB_NIL+~itype(o);
@@ -133,7 +135,7 @@ static void bcwrite_ktab_sorted_hash(BCWriteCtx *ctx, Node *node, MSize nhash)
133 TValue **heap = ctx->heap; 135 TValue **heap = ctx->heap;
134 MSize i = nhash; 136 MSize i = nhash;
135 for (;; node--) { /* Build heap. */ 137 for (;; node--) { /* Build heap. */
136 if (!tvisnil(&node->key)) { 138 if (!tvisnil(&node->val)) {
137 bcwrite_ktabk_heap_insert(heap, --i, nhash, &node->key); 139 bcwrite_ktabk_heap_insert(heap, --i, nhash, &node->key);
138 if (i == 0) break; 140 if (i == 0) break;
139 } 141 }
@@ -163,7 +165,7 @@ static void bcwrite_ktab(BCWriteCtx *ctx, char *p, const GCtab *t)
163 MSize i, hmask = t->hmask; 165 MSize i, hmask = t->hmask;
164 Node *node = noderef(t->node); 166 Node *node = noderef(t->node);
165 for (i = 0; i <= hmask; i++) 167 for (i = 0; i <= hmask; i++)
166 nhash += !tvisnil(&node[i].key); 168 nhash += !tvisnil(&node[i].val);
167 } 169 }
168 /* Write number of array slots and hash slots. */ 170 /* Write number of array slots and hash slots. */
169 p = lj_strfmt_wuleb128(p, narray); 171 p = lj_strfmt_wuleb128(p, narray);