summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-16 05:54:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-16 05:54:32 +0000
commit97628bff1211a6bc7bac53e75d0ceef64db3bc60 (patch)
treebaeb4899369d7548a7dc3d3aa7243297766bb95a /compile.c
parentbad77a862ea27d9e9182c68581341e1d65aa5356 (diff)
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.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/compile.c b/compile.c
index b25edcb..6c6d933 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));