Package erjang.beam.repr

Examples of erjang.beam.repr.FunctionInfo


  public ArrayList<FunctionRepr> partitionCodeByFunction() {
    int funCount = (exports==null?0:exports.length)
      + (localFunctions==null?0:localFunctions.length);
    ArrayList<FunctionRepr> functions = new ArrayList<FunctionRepr>(funCount);

    FunctionInfo fi = null;
    ArrayList<Insn> currentFunctionBody = null;
    for (Insn insn : code) {
      FunctionInfo newFI = null;
      if (insn.opcode() == BeamOpcode.label) { // We might switch to a new function
        int labelNr = ((Insn.I)insn).i1;
        newFI = functionAtLabel(labelNr+1);
        if (newFI==null) newFI = functionAtLabel(labelNr);
      } else if (insn.opcode() == BeamOpcode.int_code_end) {
        newFI = new FunctionInfo(null,null,-1,-1); // Easy way to handle last function
      }
      if (newFI != null && newFI != fi) { // Do switch
        if (fi != null) { // Add previous
          FunctionRepr fun = new FunctionRepr(fi, currentFunctionBody);
          functions.add(fun);
View Full Code Here


    for (int i=0; i<nExports; i++) {
      int fun_atom_nr = in.read4BE();
      int arity    = in.read4BE();
      int label    = in.read4BE();
      EAtom fun = atom(fun_atom_nr);
      exports[i] = new FunctionInfo(mod, fun, arity, label);
      addFunctionAtLabel(exports[i]);
      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+atom(fun_atom_nr)+"/"+arity+" @ "+label);
      }
    }
View Full Code Here

    for (int i=0; i<nLocals; i++) {
      int fun_atom_nr = in.read4BE();
      int arity    = in.read4BE();
      int label    = in.read4BE();
      EAtom fun = atom(fun_atom_nr);
      localFunctions[i] = new FunctionInfo(mod, fun, arity, label);
      addFunctionAtLabel(localFunctions[i]);
      if (log.isLoggable(Level.FINE) && atoms != null) {
        log.fine("- #"+(i+1)+": "+atom(fun_atom_nr)+"/"+arity+" @ "+label);
      }
    }
View Full Code Here

    public void visitModule(EAtom name) {
      this.moduleName = name;
    }

    public void visitExport(EAtom fun, int arity, int entryLabel) {
      raw_exports.add(new FunctionInfo(moduleName, fun, arity, entryLabel));
    }
View Full Code Here

TOP

Related Classes of erjang.beam.repr.FunctionInfo

Copyright © 2018 www.massapicom. 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.