Пример #1
0
 public String getLntStr() throws ConstantPoolException {
   StringBuffer buf = new StringBuffer();
   buf.append("((\"" + cf.getName() + "\" \"" + name + "\"");
   buf.append("\n  (");
   for (int i = 0; i < params.size(); i++) {
     buf.append(ACL2utils.descToACL2TypeStr(params.get(i)));
     if (i < (params.size() - 1)) {
       buf.append(" ");
     }
   }
   buf.append(")\n");
   buf.append("      (returntype . " + ACL2utils.descToACL2TypeStr(returntype) + "))\n");
   buf.append("(");
   if (lnt != null) {
     int len = lnt.line_number_table_length;
     for (int i = 0; i < len; i++) {
       buf.append(
           "("
               + lnt.line_number_table[i].start_pc
               + " . "
               + lnt.line_number_table[i].line_number
               + ")\n");
     }
   }
   buf.append(")");
   buf.append(")");
   return buf.toString();
 }
Пример #2
0
  public String getLvtStr() throws ConstantPoolException {
    StringBuffer buf = new StringBuffer();
    buf.append("((\"" + cf.getName() + "\" \"" + name + "\"");
    buf.append("\n  (");

    for (int i = 0; i < params.size(); i++) {
      buf.append(ACL2utils.descToACL2TypeStr(params.get(i)));
      if (i < (params.size() - 1)) {
        buf.append(" ");
      }
    }
    buf.append(")\n");
    buf.append("      (returntype . " + ACL2utils.descToACL2TypeStr(returntype) + "))\n");
    buf.append("(");
    if (lvt != null) {
      int len = lvt.local_variable_table_length;
      for (int i = 0; i < len; i++) {
        printLocalVariableEntry(buf, i);
      }
    }
    buf.append(")");
    buf.append(")");
    return buf.toString();
  }
Пример #3
0
  /**
   * returns a pretty-printed String representing this method.
   *
   * @param lmargin The number of spaces of indentation to place before the output
   * @return A pretty-printed String representing this method.
   */
  public String toString(int lmargin) throws ConstantPoolException {
    if (!processed) {
      return "You must call processMethod first!";
    }

    StringBuilder sb = new StringBuilder();
    indent(sb, lmargin);
    sb.append("(method \"" + name + "\"");
    nl(sb, lmargin + 6, "(parameters ");
    for (int i = 0; i < params.size(); i++) {
      sb.append(ACL2utils.descToACL2TypeStr(params.get(i)));

      if (i < (params.size() - 1)) {
        sb.append(" ");
      }
    }
    sb.append(")");
    nl(sb, lmargin + 6, "(returntype . " + ACL2utils.descToACL2TypeStr(returntype) + ")");
    nl(sb, lmargin + 6, ACL2utils.accessFlagsToString(m.access_flags));

    nl(sb, lmargin + 6, "(code");
    if (cai != null && !no_method_body) {
      nl(
          sb,
          lmargin + 11,
          "(max_stack . "
              + max_stack
              + ")"
              + " (max_locals . "
              + max_locals
              + ")"
              + " (code_length . "
              + code_length
              + ")");
      nl(sb, lmargin + 11, "(parsedcode");

      for (int i = 0; i < m6instructions.size(); i++) {
        nl(sb, lmargin + 14, m6instructions.get(i));
      }
      sb.append(")");

      nl(sb, lmargin + 11, "(Exceptions ");
      for (int i = 0; i < cai.exception_table.length; i++) {
        Code_attribute.Exception_data ed = cai.exception_table[i];
        String catchType =
            ed.catch_type != 0
                ? cf.constant_pool.getClassInfo(ed.catch_type).getName().replace('/', '.')
                : "java/lang.Throwable";
        String acl2Type = ACL2utils.classNameToACL2TypeStr(catchType);
        nl(
            sb,
            lmargin + 13,
            "(handler "
                + ed.start_pc
                + " "
                + ed.end_pc
                + "  "
                + ed.handler_pc
                + " "
                + acl2Type
                + ")");
      }
      sb.append(')');

      nl(sb, lmargin + (sm != null ? 12 : 11), "(StackMap ");
      if (sm != null) {
        for (int i = 0; i < sm.entries.length; i++) {
          sb.append('\n');
          StackMap_attribute.stack_map_frame smf =
              (StackMap_attribute.stack_map_frame) sm.entries[i];
          appendStackMapFrame(sb, lmargin + 17, smf, cf.constant_pool, max_locals);
        }
      }
      sb.append(")");
    }
    sb.append("))");
    return sb.toString();
  }