From: Adam Strzelecki Date: 2008-06-05T23:50:10+09:00 Subject: [ruby-core:17123] Re: Bytecode handling (compilation) extensions to Ruby 1.9 Just wanted to say thanks again, it works like a charm. I've reenabled rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1) and it rocks: --- test_vm_save_restore.rb ---------------------------- #!/usr/bin/env ruby-1.9 require 'zlib' code = VM::InstructionSequence.compile_file 'sample.rb' File.open "simple.rbvm", "w" do |file| file << Zlib::Deflate.deflate(Marshal.dump(code.to_a)) end code = nil # Make sure we don't work with old code anymore File.open "simple.rbvm", "r" do |file| code = VM::InstructionSequence.load Marshal.restore(Zlib::Inflate.inflate(file.read)) end code.eval -------------------------------------------------------- So iseq_load checking magic, version1, version2, format_type and rasing exception if they don't match would be enough validation to reenable VM::InstructionSequence.load in official repository? Cheers, -- Adam Strzelecki |: nanoant.com :|