From 6ea01d204ec4cc100378caf7993f4c353a19152f Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Wed, 6 Mar 2024 09:10:00 -0800 Subject: [PATCH] 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 --- compile.c | 6 +++--- 1 file 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; }