Class: Rubinius::InstructionSet
- Inherits:
-
Object
- Object
- Rubinius::InstructionSet
- Defined in:
- lib/rubinius/compiler/iseq.rb,
lib/rubinius/compiler/opcodes.rb
Defined Under Namespace
Classes: InvalidOpCode, OpCode
Constant Summary collapse
- CALL_FLAG_CONCAT =
2
Class Method Summary collapse
-
.[](name_or_id) ⇒ Object
Returns an opcode given its name or numeric ID.
-
.opcode(id, name, params = {}) ⇒ Object
Utility method for defining the opcodes.
-
.opcodes ⇒ Object
Returns an array of OpCode instances.
-
.opcodes_map ⇒ Object
Returns the opcode map.
Class Method Details
.[](name_or_id) ⇒ Object
Returns an opcode given its name or numeric ID.
83 84 85 86 87 |
# File 'lib/rubinius/compiler/iseq.rb', line 83 def self.[](name_or_id) opcode = opcodes[opcodes_map[name_or_id]] raise InvalidOpCode, "Invalid opcode #{op.inspect}" unless opcode opcode end |
.opcode(id, name, params = {}) ⇒ Object
Utility method for defining the opcodes.
74 75 76 77 |
# File 'lib/rubinius/compiler/iseq.rb', line 74 def self.opcode(id, name, params={}) opcodes[id] = OpCode.new name, id, params opcodes_map[name] = opcodes_map[id] = id end |
.opcodes ⇒ Object
Returns an array of OpCode instances.
69 70 71 |
# File 'lib/rubinius/compiler/iseq.rb', line 69 def self.opcodes @opcodes ||= [] end |
.opcodes_map ⇒ Object
Returns the opcode map.
64 65 66 |
# File 'lib/rubinius/compiler/iseq.rb', line 64 def self.opcodes_map @opcodes_map ||= Rubinius::LookupTable.new end |