Package erjang.beam.repr

Examples of erjang.beam.repr.Insn.opcode()


public class Rewriter {
    public void rewriteFunctionBody(List<Insn> body, FunctionInfo sig) {
  ListIterator<Insn> it = body.listIterator();
  while (it.hasNext()) {
      final Insn insn = it.next();
      switch (insn.opcode()) {
      case call_fun: {
    int save_pos = savePos(it);
    boolean trigger = (it.hasNext() &&
           it.next().opcode() == BeamOpcode.deallocate &&
           it.hasNext() &&
View Full Code Here


        vis.visitBegin(exh);

        for (int insn_idx = 0; insn_idx < insns.size(); insn_idx++) {
          Insn insn_ = insns.get(insn_idx);
          BeamOpcode opcode = insn_.opcode();
          TypeMap type_map = this.map[insn_idx];

          switch (opcode) {
          case func_info: {
            Insn.AAI insn = (Insn.AAI)insn_;
View Full Code Here

            Arg src  = src_arg(insn_idx, insn.src);
            Arg dest = dest_arg(insn_idx, insn.dest);

            if (insns.size() > insn_idx+1) {
            Insn next_insn = insns.get(insn_idx+1);
            if (next_insn.opcode() == BeamOpcode.K_return) {
              vis.visitInsn(BeamOpcode.K_return, src);
              insn_idx += 1;
              break;
            }
            }
View Full Code Here

          case is_tuple: {
           
            if (insn_idx+1 < insns.size()) {
            Insn next_insn = insns.get(insn_idx+1);
            if (next_insn.opcode() == BeamOpcode.test_arity) {
             
              int this_fail = decode_labelref(((Insn.L)insn_).label, this.map[insn_idx].exh);
              int next_fail = decode_labelref(((Insn.L)next_insn).label, this.map[insn_idx+1].exh);

              if (this_fail == next_fail) {
View Full Code Here

                + this.block_label + ":" + insn_idx);
          }

          map[insn_idx] = current;
          Insn insn_ = insns.get(insn_idx);
          BeamOpcode code = insn_.opcode();
          last_opcode = code; last_insn = insn_;
          /*
           * System.out.println(name + "(" + bb_label + "):" + i +
           * " :: " + current + "" + insn);
           */
 
View Full Code Here

          case is_tuple: {
           
            if (insn_idx+1 < insns.size()) {
            Insn next_insn = insns.get(insn_idx+1);
            if (next_insn.opcode() == BeamOpcode.test_arity) {
             
              if (this.map[insn_idx+1] == null) {
                this.map[insn_idx+1] = this.map[insn_idx];
              }
             
View Full Code Here

    code = new ArrayList<Insn>();
    Insn insn;
    do {
      insn = readInstruction();
      code.add(insn);
    } while (insn.opcode() != BeamOpcode.int_code_end);
    }

    public Insn readInstruction() throws IOException {
    int opcode_no = in.read1();
    BeamOpcode opcode = BeamOpcode.decode(opcode_no);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.