diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-16 05:54:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-16 05:54:32 +0000 |
commit | 97628bff1211a6bc7bac53e75d0ceef64db3bc60 (patch) | |
tree | baeb4899369d7548a7dc3d3aa7243297766bb95a /compile.c | |
parent | bad77a862ea27d9e9182c68581341e1d65aa5356 (diff) | |
download | ruby-97628bff1211a6bc7bac53e75d0ceef64db3bc60.tar.gz |
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
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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)); |