Class: Rubinius::InstructionSet::OpCode
- Inherits:
-
Object
- Object
- Rubinius::InstructionSet::OpCode
- Defined in:
- lib/rubinius/compiler/iseq.rb
Instance Attribute Summary collapse
-
#arg_count ⇒ Object
readonly
Returns the value of attribute arg_count.
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#bytecode ⇒ Object
readonly
Returns the value of attribute bytecode.
-
#control_flow ⇒ Object
readonly
Returns the value of attribute control_flow.
-
#opcode ⇒ Object
(also: #name)
readonly
Returns the value of attribute opcode.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#produced_position ⇒ Object
readonly
Returns the value of attribute produced_position.
-
#size ⇒ Object
(also: #width)
readonly
Returns the value of attribute size.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
-
#stack_consumed ⇒ Object
readonly
Returns the value of attribute stack_consumed.
-
#stack_difference ⇒ Object
readonly
Returns the value of attribute stack_difference.
-
#stack_produced ⇒ Object
readonly
Returns the value of attribute stack_produced.
-
#variable_stack ⇒ Object
readonly
Returns the value of attribute variable_stack.
Instance Method Summary collapse
-
#initialize(opcode, bytecode, params) ⇒ OpCode
constructor
A new instance of OpCode.
- #to_s ⇒ Object
- #variable_stack? ⇒ Boolean
Constructor Details
#initialize(opcode, bytecode, params) ⇒ OpCode
Returns a new instance of OpCode.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rubinius/compiler/iseq.rb', line 17 def initialize(opcode, bytecode, params) @opcode = opcode @bytecode = bytecode @args = params[:args] @arg_count = @args.size @size = @arg_count + 1 @position = nil @produced_position = nil @stack_consumed, @stack_produced = params[:stack] if @stack_consumed.kind_of? Fixnum if @stack_produced.kind_of? Fixnum @variable_stack = false @stack_difference = @stack_produced - @stack_consumed else @variable_stack = true produced_extra, @produced_position, @produced_times = @stack_produced @stack_difference = produced_extra - @stack_consumed end else @variable_stack = true extra, @position = @stack_consumed if @stack_produced.kind_of? Fixnum @stack_difference = @stack_produced - extra else produced_extra, @produced_position, @produced_times = @stack_produced @stack_difference = produced_extra - extra end end @control_flow = params[:control_flow] end |
Instance Attribute Details
#arg_count ⇒ Object (readonly)
Returns the value of attribute arg_count.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def arg_count @arg_count end |
#args ⇒ Object (readonly)
Returns the value of attribute args.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def args @args end |
#bytecode ⇒ Object (readonly)
Returns the value of attribute bytecode.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def bytecode @bytecode end |
#control_flow ⇒ Object (readonly)
Returns the value of attribute control_flow.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def control_flow @control_flow end |
#opcode ⇒ Object (readonly) Also known as: name
Returns the value of attribute opcode.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def opcode @opcode end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def position @position end |
#produced_position ⇒ Object (readonly)
Returns the value of attribute produced_position.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def produced_position @produced_position end |
#size ⇒ Object (readonly) Also known as: width
Returns the value of attribute size.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def size @size end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def stack @stack end |
#stack_consumed ⇒ Object (readonly)
Returns the value of attribute stack_consumed.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def stack_consumed @stack_consumed end |
#stack_difference ⇒ Object (readonly)
Returns the value of attribute stack_difference.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def stack_difference @stack_difference end |
#stack_produced ⇒ Object (readonly)
Returns the value of attribute stack_produced.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def stack_produced @stack_produced end |
#variable_stack ⇒ Object (readonly)
Returns the value of attribute variable_stack.
10 11 12 |
# File 'lib/rubinius/compiler/iseq.rb', line 10 def variable_stack @variable_stack end |
Instance Method Details
#to_s ⇒ Object
55 56 57 |
# File 'lib/rubinius/compiler/iseq.rb', line 55 def to_s @opcode.to_s end |
#variable_stack? ⇒ Boolean
51 52 53 |
# File 'lib/rubinius/compiler/iseq.rb', line 51 def variable_stack? @variable_stack end |