Module: Internal::ByteDecoder

Included in:
RubyVM::Instruction
Defined in:
lib/decompiler/vm/bytedecoder.rb

Overview

A module for decoding YARV bytecode.

This is actually pretty cool. It’s actually a miniature VM, where the result of evaluating an expression is itself another expression. This turns out to be much simpler than a full ruby VM, but I think one could use this as a base for building one.

Example usage:

env = Internal::ByteDecoder::Environment.new(is.local_table)
is = RubyVM::InstructionSequence.new('1 + 1')
is.bytedecode(env)
env.expressions.each do |expr|
  puts expr
end
puts stack[-1]

Defined Under Namespace

Classes: Environment, Expression