protected int resolveLabel(LabelNode label) {
   if (labels.containsKey(label)) {
     return labels.get(label);
   } else {
     int newLabelIndex = labels.size() + 1;
     labels.put(label, newLabelIndex);
     return newLabelIndex;
   }
 }
Пример #2
0
  public LabelNode getOrCreateGotoLabel(String name) {
    name = name.toLowerCase();
    if (gotoLabels == null) gotoLabels = new HashMap<String, LabelNode>();

    LabelNode label = gotoLabels.get(name);
    if (label == null) gotoLabels.put(name, label = new LabelNode());

    return label;
  }
Пример #3
0
  @SuppressWarnings("unchecked")
  void writeFooter() {
    LabelNode endL = new LabelNode();
    node.instructions.add(endL);

    for (LocalVariable variable : localVariables.values()) {
      String description =
          Type.getDescriptor(variable.getClazz() == null ? Object.class : variable.getClazz());
      if (variable.name.equals("~this")) {
        // if (variable.getClazz() != Memory.class && !clazz.statement.isTrait()) {
        description = "L" + clazz.entity.getCompiledInternalName() + ";";
        // }
      }

      node.localVariables.add(
          new LocalVariableNode(
              variable.name,
              description,
              null,
              variable.label == null ? labelStart : variable.label,
              variable.getEndLabel() == null ? endL : variable.getEndLabel(),
              variable.index));
    }

    // node.maxStack = this.stackMaxSize;  !!! we don't need this, see: ClassWriter.COMPUTE_FRAMES
    // node.maxLocals = this.localVariables.size();
  }
Пример #4
0
 public LocalVariable getLocalVariable(String variable) {
   return localVariables.get(variable);
 }
Пример #5
0
 public LocalVariable addLocalVariable(String variable, LabelNode label, Class clazz) {
   LocalVariable result;
   localVariables.put(
       variable, result = new LocalVariable(variable, localVariables.size(), label, clazz));
   return result;
 }
Пример #6
0
 public LabelNode getGotoLabel(String name) {
   return gotoLabels == null ? null : gotoLabels.get(name.toLowerCase());
 }