ruby-changes:40925
From: ko1 <ko1@a...>
Date: Thu, 10 Dec 2015 00:11:22 +0900 (JST)
Subject: [ruby-changes:40925] ko1:r53004 (trunk): * iseq.c: rename methods
ko1 2015-12-10 00:10:57 +0900 (Thu, 10 Dec 2015) New Revision: 53004 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53004 Log: * iseq.c: rename methods RubyVM::InstructionSequence#to_binary_format -> #to_binary RubyVM::InstructionSequence.from_binary_format -> .load_from_binary RubyVM::InstructionSequence.from_binary_format_extra_data -> .load_from_binary_extra_data * iseq.c: fix document of iseq.to_binary. [Fix GH-1134] * sample/iseq_loader.rb: catch up this change. * test/lib/iseq_loader_checker.rb: ditto. Modified files: trunk/ChangeLog trunk/iseq.c trunk/sample/iseq_loader.rb trunk/test/lib/iseq_loader_checker.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 53003) +++ ChangeLog (revision 53004) @@ -1,3 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Dec 10 00:06:56 2015 Koichi Sasada <ko1@a...> + + * iseq.c: rename methods + RubyVM::InstructionSequence#to_binary_format -> #to_binary + RubyVM::InstructionSequence.from_binary_format -> .load_from_binary + RubyVM::InstructionSequence.from_binary_format_extra_data -> + .load_from_binary_extra_data + + * iseq.c: fix document of iseq.to_binary. + [Fix GH-1134] + + * sample/iseq_loader.rb: catch up this change. + + * test/lib/iseq_loader_checker.rb: ditto. + Wed Dec 9 17:02:03 2015 Nobuyoshi Nakada <nobu@r...> * regparse.h (SET_NTYPE): get rid of breaking strict aliasing. Index: sample/iseq_loader.rb =================================================================== --- sample/iseq_loader.rb (revision 53003) +++ sample/iseq_loader.rb (revision 53004) @@ -70,9 +70,9 @@ class RubyVM::InstructionSequence https://github.com/ruby/ruby/blob/trunk/sample/iseq_loader.rb#L70 $ISEQ_LOADER_LOADED += 1 STDERR.puts "[ISEQ_LOADER] #{Process.pid} load #{fname} from #{iseq_key}" if COMPILE_DEBUG binary = read_compiled_iseq(fname, iseq_key) - iseq = RubyVM::InstructionSequence.from_binary_format(binary) - # p [extra_data(iseq.path), RubyVM::InstructionSequence.from_binary_format_extra_data(binary)] - # raise unless extra_data(iseq.path) == RubyVM::InstructionSequence.from_binary_format_extra_data(binary) + iseq = RubyVM::InstructionSequence.load_from_binary(binary) + # p [extra_data(iseq.path), RubyVM::InstructionSequence.load_from_binary_extra_data(binary)] + # raise unless extra_data(iseq.path) == RubyVM::InstructionSequence.load_from_binary_extra_data(binary) iseq elsif COMPILE_IF_NOT_COMPILED compile_and_save_iseq(fname, iseq_key) @@ -92,7 +92,7 @@ class RubyVM::InstructionSequence https://github.com/ruby/ruby/blob/trunk/sample/iseq_loader.rb#L92 STDERR.puts "[RUBY_COMPILED_FILE] compile #{fname}" if COMPILE_DEBUG iseq = RubyVM::InstructionSequence.compile_file(fname) - binary = iseq.to_binary_format(extra_data(fname)) + binary = iseq.to_binary(extra_data(fname)) write_compiled_iseq(fname, iseq_key, binary) iseq end Index: iseq.c =================================================================== --- iseq.c (revision 53003) +++ iseq.c (revision 53004) @@ -2334,23 +2334,23 @@ rb_iseqw_local_variables(VALUE iseqval) https://github.com/ruby/ruby/blob/trunk/iseq.c#L2334 /* * call-seq: - * iseq.to_binary_format(extra_data = nil) -> binary str + * iseq.to_binary(extra_data = nil) -> binary str * * Returns serialized iseq binary format data as a String object. * A correspnding iseq object is created by - * RubyVM::InstructionSequence.from_binary_format() method. + * RubyVM::InstructionSequence.load_from_binary() method. * * String extra_data will be saved with binary data. * You can access this data with - * RubyVM::InstructionSequence.from_binary_format_extra_data(binary). + * RubyVM::InstructionSequence.load_from_binary_extra_data(binary). * * Note that the translated binary data is not portable. * You can not move this binary data to another machine. - * You can not use the binary data whcih is created by another + * You can not use the binary data which is created by another * version/another architecture of Ruby. */ static VALUE -iseqw_to_binary_format(int argc, VALUE *argv, VALUE self) +iseqw_to_binary(int argc, VALUE *argv, VALUE self) { VALUE opt; rb_scan_args(argc, argv, "01", &opt); @@ -2359,10 +2359,10 @@ iseqw_to_binary_format(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/iseq.c#L2359 /* * call-seq: - * RubyVM::InstructionSequence.from_binary_format(binary) -> iseq + * RubyVM::InstructionSequence.load_from_binary(binary) -> iseq * * Load an iseq object from binary format String object - * created by RubyVM::InstructionSequence.to_binary_format. + * created by RubyVM::InstructionSequence.to_binary. * * This loader does not have a verifier, so that loading broken/modified * binary causes critical problem. @@ -2371,19 +2371,19 @@ iseqw_to_binary_format(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/iseq.c#L2371 * You should use binary data translated by yourself. */ static VALUE -iseqw_s_from_binary_format(VALUE self, VALUE str) +iseqw_s_load_from_binary(VALUE self, VALUE str) { return iseqw_new(iseq_ibf_load(str)); } /* * call-seq: - * RubyVM::InstructionSequence.from_binary_format_extra_data(binary) -> str + * RubyVM::InstructionSequence.load_from_binary_extra_data(binary) -> str * * Load extra data embed into binary format String object. */ static VALUE -iseqw_s_from_binary_format_extra_data(VALUE self, VALUE str) +iseqw_s_load_from_binary_extra_data(VALUE self, VALUE str) { return iseq_ibf_load_extra_data(str); } @@ -2419,9 +2419,9 @@ Init_ISeq(void) https://github.com/ruby/ruby/blob/trunk/iseq.c#L2419 rb_define_method(rb_cISeq, "to_a", iseqw_to_a, 0); rb_define_method(rb_cISeq, "eval", iseqw_eval, 0); - rb_define_method(rb_cISeq, "to_binary_format", iseqw_to_binary_format, -1); - rb_define_singleton_method(rb_cISeq, "from_binary_format", iseqw_s_from_binary_format, 1); - rb_define_singleton_method(rb_cISeq, "from_binary_format_extra_data", iseqw_s_from_binary_format_extra_data, 1); + rb_define_method(rb_cISeq, "to_binary", iseqw_to_binary, -1); + rb_define_singleton_method(rb_cISeq, "load_from_binary", iseqw_s_load_from_binary, 1); + rb_define_singleton_method(rb_cISeq, "load_from_binary_extra_data", iseqw_s_load_from_binary_extra_data, 1); /* location APIs */ Index: test/lib/iseq_loader_checker.rb =================================================================== --- test/lib/iseq_loader_checker.rb (revision 53003) +++ test/lib/iseq_loader_checker.rb (revision 53004) @@ -51,18 +51,18 @@ class RubyVM::InstructionSequence https://github.com/ruby/ruby/blob/trunk/test/lib/iseq_loader_checker.rb#L51 RubyVM::InstructionSequence.iseq_load(ary) }) if CHECK_TO_A && defined?(RubyVM::InstructionSequence.iseq_load) - # check to_binary_format + # check to_binary i2_bin = compare_dump_and_load(i1, proc{|iseq| begin - iseq.to_binary_format + iseq.to_binary rescue RuntimeError => e # not a toplevel # STDERR.puts [:failed, e, iseq].inspect nil end }, proc{|bin| - iseq = RubyVM::InstructionSequence.from_binary_format(bin) + iseq = RubyVM::InstructionSequence.load_from_binary(bin) # STDERR.puts iseq.inspect iseq }) if CHECK_TO_BINARY -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/