StackMapFramepublic class StackMapFrame extends Object StackMapFrame is used by {@link StackMapAttribute} to hold state of the stack
and local variables for a single execution branch.
Note that Long and Double types are represented by two entries in locals
and stack. Second entry sohould be always of type Top. |
Fields Summary |
---|
public Label | label | public List | locals | public List | stack |
Methods Summary |
---|
public void | getLabels(java.util.Set labels)
labels.add(label);
getTypeInfoLabels(labels, locals);
getTypeInfoLabels(labels, stack);
| private void | getTypeInfoLabels(java.util.Set labels, java.util.List info)
for (Iterator it = info.iterator(); it.hasNext();) {
StackMapType typeInfo = (StackMapType)it.next();
if (typeInfo.getType() == StackMapType.ITEM_Uninitialized) {
labels.add(typeInfo.getLabel());
}
}
| public int | read(oracle.toplink.libraries.asm.ClassReader cr, int off, char[] buf, int codeOff, oracle.toplink.libraries.asm.Label[] labels)
int n = cr.readUnsignedShort(off);
off += 2;
if (labels[n] == null) {
labels[n] = new Label();
}
label = labels[n];
off = readTypeInfo(cr, off, locals, labels, buf,
cr.readUnsignedShort(codeOff + 2)); // maxLocals
off = readTypeInfo(cr, off, stack, labels, buf,
cr.readUnsignedShort(codeOff)); // maxStack
return off;
| private int | readTypeInfo(oracle.toplink.libraries.asm.ClassReader cr, int off, java.util.List info, oracle.toplink.libraries.asm.Label[] labels, char[] buf, int max)
int n = 0;
if (max > StackMapAttribute.MAX_SIZE) {
n = cr.readInt(off);
off += 4;
} else {
n = cr.readUnsignedShort(off);
off += 2;
}
for (int j = 0; j < n; j++) {
int itemType = cr.readByte(off++);
StackMapType typeInfo = StackMapType.getTypeInfo(itemType);
info.add(typeInfo);
switch (itemType) {
// case StackMapType.ITEM_Long: //
// case StackMapType.ITEM_Double: //
// info.add(StackMapType.getTypeInfo(StackMapType.ITEM_Top));
// break;
case StackMapType.ITEM_Object: //
typeInfo.setObject(cr.readClass(off, buf));
off += 2;
break;
case StackMapType.ITEM_Uninitialized: //
int o = cr.readUnsignedShort(off);
off += 2;
if (labels[o] == null) {
labels[o] = new Label();
}
typeInfo.setLabel(labels[o]);
break;
}
}
return off;
| public java.lang.String | toString()
StringBuffer sb = new StringBuffer("Frame:L");
sb.append(System.identityHashCode(label));
sb.append(" locals").append(locals);
sb.append(" stack").append(stack);
return sb.toString();
| public void | write(oracle.toplink.libraries.asm.ClassWriter cw, int maxStack, int maxLocals, oracle.toplink.libraries.asm.ByteVector bv)
bv.putShort(label.getOffset());
writeTypeInfo(bv, cw, locals, maxLocals);
writeTypeInfo(bv, cw, stack, maxStack);
| private void | writeTypeInfo(oracle.toplink.libraries.asm.ByteVector bv, oracle.toplink.libraries.asm.ClassWriter cw, java.util.List info, int max)
if (max > StackMapAttribute.MAX_SIZE) {
bv.putInt(info.size());
} else {
bv.putShort(info.size());
}
for (int j = 0; j < info.size(); j++) {
StackMapType typeInfo = (StackMapType)info.get(j);
bv.putByte(typeInfo.getType());
switch (typeInfo.getType()) {
case StackMapType.ITEM_Object: //
bv.putShort(cw.newClass(typeInfo.getObject()));
break;
case StackMapType.ITEM_Uninitialized: //
bv.putShort(typeInfo.getLabel().getOffset());
break;
}
}
|
|