vm/codegen/instructions_gen.rb
# Wraps instruction implementation code provided by instructions.rb.
# It also captures some meta info using parsetree to generate
# better output.
#
Wraps instruction implementation code provided by instructions.rb.
It also captures some meta info using parsetree to generate
better output.
Wraps instruction implementation code provided by instructions . rb . It also captures some meta info using parsetree to generate better output .
def inject_superops(impls)
    start = impls.size
    @superinsns.each_with_index do |combo, superop|
      args = []
      combo.each do |op|
        args << :opcode
        args += InstructionSet[op].args
      end
      args.shift
      stack = [0,0]
      combo.each do |op|
        insn_stack = InstructionSet[op].stack
        stack[0] += insn_stack[0]
        stack[1] += insn_stack[1]
      end
      info = {
        :opcode => "superop_#{superop}".to_sym,
        :bytecode => start + superop,
        :args => args,
        :stack => stack
      }
      ins = InstructionSet::OpCode.new info
      composite = combo.map { |op| impls[InstructionSet[op].bytecode] }
      code = construct_code(composite)
      impl = Implementation.new(ins, nil, 0, code)
      impl.args = args
      impl.super_insn = true
      impls << impl
    end
  end
def inject_superops ( impls ) start = impls . size @superinsns . each_with_index do | combo , superop | args = [ ] combo . each do | op | args << :opcode args += InstructionSet [ op ] . args end args . shift stack = [ 0 , 0 ] combo . each do | op | insn_stack = InstructionSet [ op ] . stack stack [ 0 ] += insn_stack [ 0 ] stack [ 1 ] += insn_stack [ 1 ] end info = { :opcode => "superop_#{superop}" . to_sym , :bytecode => start + superop , :args => args , :stack => stack } ins = InstructionSet :: OpCode . new info composite = combo . map { | op | impls [ InstructionSet [ op ] . bytecode ] } code = construct_code ( composite ) impl = Implementation . new ( ins , nil , 0 , code ) impl . args = args impl . super_insn = true impls << impl end end
Wraps instruction implementation code provided by instructions.rb.
Wraps instruction implementation code provided by instructions . rb .
impls
<not_specific>