Permalink
Browse files

Modified CompiledMethod#decode to use #local_names

* CompiledMethod#decode now leverages new #local_names
  method to return the names of locals accessed via
  push_local/set_local etc.
* Removed excludes, as all decode specs now pass
  • Loading branch information...
1 parent 89c1026 commit 79da85bb1b1d63e617251b3a3ea6b0657c1e8ddb @agardiner agardiner committed Jan 7, 2008
Showing with 6 additions and 9 deletions.
  1. +2 −4 kernel/core/compiled_method.rb
  2. +4 −4 kernel/core/iseq.rb
  3. +0 −1 spec/data/core/compiledmethod/decode_excludes.txt
@@ -221,10 +221,8 @@ def initialize(inst, cm, ip)
case @op.args[i]
when :literal
@args[i] = cm.literals[@args[i]]
- when :slot_local
- @args[i] = cm.bonus[0].at(args[i]) if cm.bonus && cm.bonus[0]
- when :stack_local
- @args[i] = cm.bonus[1].at(args[i]) if cm.bonus && cm.bonus[1]
+ when :local
+ @args[i] = cm.local_names[args[i]] if cm.local_names
end
end
@ip = ip
View
@@ -5,7 +5,7 @@ class InstructionSet
# Each opcode consists of a hash identifying:
# - the opcode symbol,
# - an array of the arguments required by the opcode, which may be of types
- # :int, :literal, :slot_local, :stack_local, :field, :primitive, :ip,
+ # :int, :literal, :local, :field, :primitive, :ip,
# :depth, or :cache
# IMPORTANT: Do not change the order of opcodes! The position in this array
# is the opcode's instuction bytecode.
@@ -27,8 +27,8 @@ class InstructionSet
{:opcode => :goto_if_false, :args => [:ip]},
{:opcode => :goto_if_true, :args => [:ip]},
{:opcode => :swap_stack, :args => []},
- {:opcode => :set_local, :args => [:slot_local]},
- {:opcode => :push_local, :args => [:slot_local]},
+ {:opcode => :set_local, :args => [:local]},
+ {:opcode => :push_local, :args => [:local]},
{:opcode => :push_exception, :args => []},
{:opcode => :make_array, :args => [:int], :vm_flags => [:check_interrupts]},
{:opcode => :set_ivar, :args => [:literal], :vm_flags => [:check_interrupts]},
@@ -105,7 +105,7 @@ class InstructionSet
{:opcode => :set_call_flags, :args => [:int]},
{:opcode => :yield_debugger, :args => [], :vm_flags => [:check_interrupts]},
{:opcode => :from_fp, :args => [:int]},
- {:opcode => :set_local_from_fp, :args => [:slot_local, :int]},
+ {:opcode => :set_local_from_fp, :args => [:local, :int]},
{:opcode => :make_rest_fp, :args => [:int], :vm_flags => [:check_interrupts]},
{:opcode => :allocate_stack, :args => [:int]},
{:opcode => :deallocate_stack, :args => [:int]},
@@ -1 +0,0 @@
-CompiledMethod::Instruction #args returns local variable names, rather than the index into the locals tuple

0 comments on commit 79da85b

Please sign in to comment.