summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2019-11-09 21:40:38 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2019-11-09 21:40:38 -0800
commit5c168c7e7f73d400db45980115dedab4deefcda7 (patch)
tree9e6ae3df84029eff369e3f83f307124db3d3ed81 /iseq.c
parent0483d01f6bdd3d16b31244a7aaadb4c31f6ecee7 (diff)
Support RB_BUILTIN in ISeq#to_a
Diffstat (limited to 'iseq.c')
-rw-r--r--iseq.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/iseq.c b/iseq.c
index 0b19056120..48a4d4b677 100644
--- a/iseq.c
+++ b/iseq.c
@@ -2802,6 +2802,21 @@ iseq_data_to_ary(const rb_iseq_t *iseq)
rb_ary_push(ary, val);
}
break;
+ case TS_BUILTIN:
+ {
+ VALUE val = rb_hash_new();
+#if SIZEOF_VALUE <= SIZEOF_LONG
+ VALUE func_ptr = LONG2NUM((SIGNED_VALUE)((RB_BUILTIN)*seq)->func_ptr);
+#else
+ VALUE func_ptr = LL2NUM((SIGNED_VALUE)((RB_BUILTIN)*seq)->func_ptr);
+#endif
+ rb_hash_aset(val, ID2SYM(rb_intern("func_ptr")), func_ptr);
+ rb_hash_aset(val, ID2SYM(rb_intern("argc")), INT2NUM(((RB_BUILTIN)*seq)->argc));
+ rb_hash_aset(val, ID2SYM(rb_intern("index")), INT2NUM(((RB_BUILTIN)*seq)->index));
+ rb_hash_aset(val, ID2SYM(rb_intern("name")), rb_str_new_cstr(((RB_BUILTIN)*seq)->name));
+ rb_ary_push(ary, val);
+ }
+ break;
default:
rb_bug("unknown operand: %c", insn_op_type(insn, j));
}