Issue #8543 has been updated by B Kelly. Hi, Just a data point: With ruby 2.2.0dev (2014-04-16 trunk 45576) [i386-mswin32_100], the rb_iseq_load example in https://bugs.ruby-lang.org/issues/8543 is producing the correct output. (I will attempt to test with more complicated programs soon.) Regards, Bill ---------------------------------------- Bug #8543: rb_iseq_load https://bugs.ruby-lang.org/issues/8543#change-46226 * Author: Alexey Voskov * Status: Open * Priority: Low * Assignee: Koichi Sasada * Category: YARV * Target version: current: 2.2.0 * ruby -v: ruby 2.0.0p234 (2013-06-19 revision 41434) [x86_64-darwin11.4.2] * Backport: 1.9.3: DONTNEED, 2.0.0: REQUIRED ---------------------------------------- I noticed an unusual behaviour of undocumented rb_iseq_load function. Its work differs in different Ruby versions. I'm trying to protect some Ruby source code by its conversion to YARV p-code and using the next strategy: 1) Convert code to array data = RubyVM::InstructionSequence.compile_file('hello.rb').to_a 2) Pass a compiled source to the rb_iseq_load function and evaluate it iseq = iseq_load.(data) iseq.eval Sample programs are supplied in the attachments. "hello.rb" --------------------------- puts "tralivali" def funct(a,b) a**b end 3.times { |i| puts "Hello, world#{funct(2,i)}!" } ------------------------ The differences Ruby 1.9.3 (ruby 1.9.3p194 (2012-04-20) [i386-mingw32]) Correct work. Output: ------------------------- tralivali Hello, world1! Hello, world2! Hello, world4! -------------------- Ruby 2.0.0 (ruby 2.0.0p193 (2013-05-14) [x64-mingw32]) Incorrect work (omits the code inside code blocks). Output ------------------------- tralivali ------------------------- Attempts of loading bigger programs by means of rb_iseq_load in Ruby 2.0.0 usually ends with a segmentation fault. Such behaviour also can be reproduced by means of iseq Ruby extension ("for iseq freaks") https://github.com/wanabe/iseq P.S. I understand that it is an undocumented feature. ---Files-------------------------------- hello.rb (102 Bytes) rb_pack.rb (931 Bytes) -- https://bugs.ruby-lang.org/