diff --git a/compile.c b/compile.c index b25edcb8d2..6c6d933223 100644 --- a/compile.c +++ b/compile.c @@ -5964,8 +5964,14 @@ iseq_build_from_ary_body(rb_iseq_t *iseq, LINK_ANCHOR *anchor, } break; case TS_FUNCPTR: - if (!RTEST(op)) rb_raise(rb_eArgError, "cannot load funcptr"); - argv[j] = op; + { +#if SIZEOF_VALUE <= SIZEOF_LONG + long funcptr = NUM2LONG(op); +#else + LONG_LONG funcptr = NUM2LL(op); +#endif + argv[j] = (VALUE)funcptr; + } break; default: rb_raise(rb_eSyntaxError, "unknown operand: %c", insn_op_type((VALUE)insn_id, j)); diff --git a/iseq.c b/iseq.c index 7e1ac877c1..f1b38240a8 100644 --- a/iseq.c +++ b/iseq.c @@ -1987,7 +1987,14 @@ iseq_data_to_ary(rb_iseq_t *iseq) } break; case TS_FUNCPTR: - rb_ary_push(ary, Qnil); + { +#if SIZEOF_VALUE <= SIZEOF_LONG + VALUE val = LONG2NUM((SIGNED_VALUE)*seq); +#else + VALUE val = LL2NUM((SIGNED_VALUE)*seq); +#endif + rb_ary_push(ary, val); + } break; default: rb_bug("unknown operand: %c", insn_op_type(insn, j));