vm/codegen/instructions_gen.rb
# Generate a function (get_instruction_name) which, given +op+, returns
# a char* that is the name of the function that implements the instruction.
#
Generate a function (get_instruction_name) which, given +op+, returns
a char* that is the name of the function that implements the instruction.
Generate a function ( get_instruction_name ) which given + op + returns a char * that is the name of the function that implements the instruction .
def generate_names(methods)
    str =  "const char *rubinius::InstructionSequence::get_instruction_name(int op) {\n"
    str << "static const char instruction_names[] = {\n"
    methods.each do |impl|
      str << "  \"op_#{impl.name.opcode.to_s}\\0\"\n"
    end
    str << "};\n\n"
    offset = 0
    str << "static const unsigned int instruction_name_offsets[] = {\n"
    methods.each_with_index do |impl, index|
      str << ",\n" if index > 0
      str << "  #{offset}"
      offset += impl.name.opcode.to_s.length + 4
    end
    str << "\n};\n\n"
    str << <<CODE
  return instruction_names + instruction_name_offsets[op];
}
CODE
  end
def generate_names ( methods ) str = "const char *rubinius::InstructionSequence::get_instruction_name(int op) {\n" str << "static const char instruction_names[] = {\n" methods . each do | impl | str << "  \"op_#{impl.name.opcode.to_s}\\0\"\n" end str << "};\n\n" offset = 0 str << "static const unsigned int instruction_name_offsets[] = {\n" methods . each_with_index do | impl , index | str << ",\n" if index > 0 str << "  #{offset}" offset += impl . name . opcode . to_s . length + 4 end str << "\n};\n\n" str << <<CODE 
  return instruction_names + instruction_name_offsets[op];
}
 CODE end
Generate a function (get_instruction_name) which, given +op+, returns
a char* that is the name of the function that implements the instruction.
Generate a function ( get_instruction_name ) which given + op + returns a char * that is the name of the function that implements the instruction .
methods
<not_specific>