diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-03 22:16:58 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-03 22:16:58 +0000 |
commit | 9581954a964c6b20bafd133a19da3e27aa135dce (patch) | |
tree | 606bf98bc1047ff5df8773e65ef3e3ee7d599a80 /ext | |
parent | 0c662b34313699223f08df54c5dcd8c481ff8a95 (diff) | |
download | ruby-9581954a964c6b20bafd133a19da3e27aa135dce.tar.gz |
mostly fix rb_iseq_load
This allows reporters commenters of [Feature #8543] to load
instruction sequences directly. Some test cases are still failing
but documented in test/-ext-/iseq_load/test_iseq_load.rb.
* compile.c (rb_iseq_build_from_exception): entry->sp is unsigned
(iseq_build_callinfo_from_hash): account for kw_arg
(iseq_build_from_ary_body): update for r35459
(CHECK_STRING, CHECK_INTEGER): remove unused checks
(int_param): new function for checking new `params' hash
(iseq_build_kw): new function for loading rb_iseq_param_keyword
(rb_iseq_build_from_ary): account for `misc' entry and general
structure changes
[Feature #8543]
* iseq.c (CHECK_HASH): new macro (for `misc' and `param' entries)
(iseq_load): account for `misc' and `params' hashes
(iseq_data_to_ary): add final opt to arg_opt_labels,
fix kw support, account for unsigned entry->sp
* ext/-test-/iseq_load/iseq_load.c: new ext for test
* ext/-test-/iseq_load/extconf.rb: ditto
* test/-ext-/iseq_load/test_iseq_load.rb: new test
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/-test-/iseq_load/extconf.rb | 1 | ||||
-rw-r--r-- | ext/-test-/iseq_load/iseq_load.c | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ext/-test-/iseq_load/extconf.rb b/ext/-test-/iseq_load/extconf.rb new file mode 100644 index 0000000000..860f30befd --- /dev/null +++ b/ext/-test-/iseq_load/extconf.rb @@ -0,0 +1 @@ +create_makefile("-test-/iseq_load/iseq_load") diff --git a/ext/-test-/iseq_load/iseq_load.c b/ext/-test-/iseq_load/iseq_load.c new file mode 100644 index 0000000000..ffdde347e1 --- /dev/null +++ b/ext/-test-/iseq_load/iseq_load.c @@ -0,0 +1,21 @@ +#include <ruby.h> + +VALUE rb_iseq_load(VALUE data, VALUE parent, VALUE opt); + +static VALUE +iseq_load(int argc, VALUE *argv, VALUE self) +{ + VALUE data, opt = Qnil; + + rb_scan_args(argc, argv, "11", &data, &opt); + + return rb_iseq_load(data, 0, opt); +} + +void +Init_iseq_load(void) +{ + VALUE rb_cISeq = rb_eval_string("RubyVM::InstructionSequence"); + + rb_define_singleton_method(rb_cISeq, "iseq_load", iseq_load, -1); +} |