summaryrefslogtreecommitdiff
path: root/compile.c
diff options
authorJeremy Evans <code@jeremyevans.net>2024-03-06 09:10:00 -0800
committerGitHub <noreply@github.com>2024-03-06 09:10:00 -0800
commit6ea01d204ec4cc100378caf7993f4c353a19152f (patch)
treecc54fea90a0a71e0acb57e667230243fb28d0528 /compile.c
parent532ddc1745a3a9aaee4a1bdf3b6c81e5a3df0c81 (diff)
Fix dump of hidden local variable indexes
This fixes test failures when running tests with RUBY_ISEQ_DUMP_DEBUG=to_binary, which started after 5899f6aa55a02f211545d9cdaef4d86fa0b49528 was committed. Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/compile.c b/compile.c
index 810e206adf..02cffc9aca 100644
--- a/compile.c
+++ b/compile.c
@@ -11863,9 +11863,9 @@ ibf_load_id(const struct ibf_load *load, const ID id_index)
return 0;
}
VALUE sym = ibf_load_object(load, id_index);
- if (rb_type_p(sym, T_FIXNUM)) {
+ if (rb_integer_type_p(sym)) {
/* Load hidden local variables as indexes */
- return FIX2INT(sym);
+ return NUM2ULONG(sym);
}
return rb_sym2id(sym);
}
@@ -12393,7 +12393,7 @@ ibf_dump_local_table(struct ibf_dump *dump, const rb_iseq_t *iseq)
VALUE v = ibf_dump_id(dump, body->local_table[i]);
if (v == 0) {
/* Dump hidden local variables as indexes, so load_from_binary will work with them */
- v = ibf_dump_object(dump, ULONG2NUM(size-i+1));
+ v = ibf_dump_object(dump, ULONG2NUM(body->local_table[i]));
}
table[i] = v;
}
close