class SyntaxTree::YARV::Instruction
This is a base class for all YARV
instructions. It provides a few convenience methods for working with instructions.
Public Instance Methods
This returns an array of labels.
# File lib/syntax_tree/yarv/instructions.rb, line 33 def branch_targets [] end
This method creates an instruction that represents the canonical (non-specialized) form of this instruction. If this instruction is not a specialized instruction, then this method returns ‘self`.
# File lib/syntax_tree/yarv/instructions.rb, line 11 def canonical self end
Whether or not this instruction falls through to the next instruction if its branching fails.
# File lib/syntax_tree/yarv/instructions.rb, line 44 def falls_through? false end
Whether or not this instruction leaves the current frame.
# File lib/syntax_tree/yarv/instructions.rb, line 38 def leaves? false end
This returns the size of the instruction in terms of the number of slots it occupies in the instruction sequence. Effectively this is 1 plus the number of operands.
# File lib/syntax_tree/yarv/instructions.rb, line 18 def length 1 end
This returns the number of values that are popped off the stack.
# File lib/syntax_tree/yarv/instructions.rb, line 28 def pops 0 end
This returns the number of values that are pushed onto the stack.
# File lib/syntax_tree/yarv/instructions.rb, line 23 def pushes 0 end
Does the instruction have side effects? Control-flow counts as a side-effect, as do some special-case instructions like Leave
. By default every instruction is marked as having side effects.
# File lib/syntax_tree/yarv/instructions.rb, line 51 def side_effects? true end