FileDocCategorySizeDatePackage
ASMStackMapAttribute.javaAPI DocGlassfish v2 API5174Thu Mar 02 11:51:20 GMT 2006oracle.toplink.libraries.asm.util.attrs

ASMStackMapAttribute

public class ASMStackMapAttribute extends StackMapAttribute implements ASMifiable
An {@link ASMifiable} {@link StackMapAttribute} sub class.
author
Eugene Kuleshov

Fields Summary
Constructors Summary
Methods Summary
public voidasmify(java.lang.StringBuffer buf, java.lang.String varName, java.util.Map labelNames)

    buf.append("{\n");
    buf.append("StackMapAttribute ").append(varName).append("Attr");
    buf.append(" = new StackMapAttribute();\n");
    if (frames.size() > 0) {
      for (int i = 0; i < frames.size(); i++) {
        asmify((StackMapFrame)frames.get(i), buf, varName + "frame" + i, labelNames);
      }
    }
    buf.append(varName).append(".visitAttribute(").append(varName);
    buf.append("Attr);\n}\n");
  
voidasmify(oracle.toplink.libraries.asm.attrs.StackMapFrame f, java.lang.StringBuffer buf, java.lang.String varName, java.util.Map labelNames)

    declareLabel(buf, labelNames, f.label);
    buf.append("{\n");
    
    buf.append("StackMapFrame ").append(varName).append( " = new StackMapFrame();\n");
    
    buf.append(varName).append(".label = ")
      .append(labelNames.get(f.label)).append(";\n");

    asmifyTypeInfo(buf, varName, labelNames, f.locals, "locals");
    asmifyTypeInfo(buf, varName, labelNames, f.stack, "stack");

    buf.append( "cvAttr.frames.add(").append(varName).append(");\n");
    buf.append("}\n");
  
voidasmifyTypeInfo(java.lang.StringBuffer buf, java.lang.String varName, java.util.Map labelNames, java.util.List infos, java.lang.String field)

    if (infos.size() > 0) {
      buf.append("{\n");
      for (int i = 0; i < infos.size(); i++) {
        StackMapType typeInfo = (StackMapType)infos.get(i);
        String localName = varName + "Info" + i;
        int type = typeInfo.getType();
        buf.append("StackMapType ").append(localName)
          .append(" = StackMapType.getTypeInfo( StackMapType.ITEM_")
          .append(StackMapType.ITEM_NAMES[type]).append(");\n");

        switch (type) {
          case StackMapType.ITEM_Object:  //
            buf.append(localName).append(".setObject(\"")
              .append(typeInfo.getObject()).append("\");\n");
            break;

          case StackMapType.ITEM_Uninitialized:  //
            declareLabel(buf, labelNames, typeInfo.getLabel());
            buf.append(localName).append(".setLabel(")
              .append(labelNames.get(typeInfo.getLabel())).append(");\n");
            break;
        }
        buf.append(varName).append(".").append(field)
          .append(".add(").append(localName).append(");\n");
      }
      buf.append("}\n");
    }
  
static voiddeclareLabel(java.lang.StringBuffer buf, java.util.Map labelNames, oracle.toplink.libraries.asm.Label l)

    String name = (String)labelNames.get(l);
    if (name == null) {
      name = "l" + labelNames.size();
      labelNames.put(l, name);
      buf.append("Label ").append(name).append(" = new Label();\n");
    }
  
protected oracle.toplink.libraries.asm.Attributeread(oracle.toplink.libraries.asm.ClassReader cr, int off, int len, char[] buf, int codeOff, oracle.toplink.libraries.asm.Label[] labels)

    StackMapAttribute attr = 
      (StackMapAttribute)super.read(cr, off, len, buf, codeOff, labels);
    
    ASMStackMapAttribute result = new ASMStackMapAttribute();
    result.frames = attr.frames;
    return result;