From 165ea18b0e977109c90d84cd3e01183de04e8996 Mon Sep 17 00:00:00 2001
From: Mike Pall <mike>
Date: Sat, 12 Aug 2023 14:37:35 +0200
Subject: Add workaround for bytecode dump of builtins.

Reported by Hang Zhou. Thanks to Sergey Kaplun. #1038
---
 src/lj_bcwrite.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/lj_bcwrite.c b/src/lj_bcwrite.c
index 2c70ff47..d3986ea4 100644
--- a/src/lj_bcwrite.c
+++ b/src/lj_bcwrite.c
@@ -189,7 +189,8 @@ static void bcwrite_knum(BCWriteCtx *ctx, GCproto *pt)
       goto save_int;
     } else {
       /* Write a 33 bit ULEB128 for the int (lsb=0) or loword (lsb=1). */
-      if (!LJ_DUALNUM) {  /* Narrow number constants to integers. */
+      if (!LJ_DUALNUM && o->u32.hi != LJ_KEYINDEX) {
+	/* Narrow number constants to integers. */
 	lua_Number num = numV(o);
 	k = lj_num2int(num);
 	if (num == (lua_Number)k) {  /* -0 is never a constant. */
-- 
cgit v1.2.3-55-g6feb