Project

General

Profile

Bug #9455

Blocks do not round-trip properly through ISeq dump/load

Added by Charlie Somerville about 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
ruby -v:
trunk
Backport:
1.9.3: DONTNEED, 2.0.0: DONE, 2.1: DONE
[ruby-core:60146]

Description

Blocks passed to methods do not round-trip properly when dumped with RubyVM::InstructionSequence#to_a and then loaded again with rb_iseq_load.

This is because iseq_data_to_ary in iseq.c stores serialized blocks under the :blockptr key (https://github.com/ruby/ruby/blob/trunk/iseq.c#L1813), but expects them to be stored in the :block key when loading them back up (https://github.com/ruby/ruby/blob/trunk/compile.c#L5811).

This affects trunk, 2.1.0 and 2.0.0.


Related issues

Duplicated by Ruby trunk - Bug #7995: RubyVM::InstructionSequence to_a not working for blocks Closed 03/02/2013

Associated revisions

Revision 44720
Added by Charlie Somerville about 2 years ago

compile.c: use correct key for block when loading serialized iseqs

  • compile.c (iseq_build_from_ary_body): Use :blockptr instead of :block as hash key when loading serialized instruction sequences from arrays. [Bug #9455]

Revision 44720
Added by Charlie Somerville about 2 years ago

compile.c: use correct key for block when loading serialized iseqs

  • compile.c (iseq_build_from_ary_body): Use :blockptr instead of :block as hash key when loading serialized instruction sequences from arrays. [Bug #9455]

History

#1 [ruby-core:60147] Updated by Charlie Somerville about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

Applied in changeset r44720.


compile.c: use correct key for block when loading serialized iseqs

  • compile.c (iseq_build_from_ary_body): Use :blockptr instead of :block as hash key when loading serialized instruction sequences from arrays. [Bug #9455]

#2 [ruby-core:60923] Updated by Yui NARUSE almost 2 years ago

  • Backport changed from 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: REQUIRED to 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: DONE

#3 [ruby-core:60970] Updated by Tomoyuki Chikanaga almost 2 years ago

  • Backport changed from 1.9.3: DONTNEED, 2.0.0: REQUIRED, 2.1: DONE to 1.9.3: DONTNEED, 2.0.0: DONE, 2.1: DONE

r44720 was backported to ruby_2_0_0 at r45106.

#4 [ruby-core:67030] Updated by _ wanabe about 1 year ago

  • Duplicated by Bug #7995: RubyVM::InstructionSequence to_a not working for blocks added

Also available in: Atom PDF