From 97628bff1211a6bc7bac53e75d0ceef64db3bc60 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 16 Dec 2014 05:54:32 +0000 Subject: compile.c: wrap funcptr * compile.c (iseq_build_from_ary_body): enclose funcptr with Integer as raw pointer cannot appear in an Array. * iseq.c (iseq_data_to_ary): extract funcptr from Integer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48863 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- compile.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'compile.c') 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)); -- cgit v1.2.3