|
|
@ -21,48 +21,21 @@ package jode.decompiler; |
|
|
|
import java.io.*; |
|
|
|
import java.io.*; |
|
|
|
import jode.Decompiler; |
|
|
|
import jode.Decompiler; |
|
|
|
import jode.type.Type; |
|
|
|
import jode.type.Type; |
|
|
|
import jode.bytecode.AttributeInfo; |
|
|
|
import jode.bytecode.LocalVariableInfo; |
|
|
|
import jode.bytecode.ConstantPool; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class LocalVariableTable { |
|
|
|
public class LocalVariableTable { |
|
|
|
LocalVariableRangeList[] locals; |
|
|
|
LocalVariableRangeList[] locals; |
|
|
|
|
|
|
|
|
|
|
|
public LocalVariableTable(int size, ConstantPool constantPool, |
|
|
|
public LocalVariableTable(int maxLocals, LocalVariableInfo[] lvt) { |
|
|
|
AttributeInfo attr) { |
|
|
|
locals = new LocalVariableRangeList[maxLocals]; |
|
|
|
|
|
|
|
for (int i=0; i < maxLocals; i++) |
|
|
|
locals = new LocalVariableRangeList[size]; |
|
|
|
|
|
|
|
for (int i=0; i<size; i++) |
|
|
|
|
|
|
|
locals[i] = new LocalVariableRangeList(i); |
|
|
|
locals[i] = new LocalVariableRangeList(i); |
|
|
|
|
|
|
|
|
|
|
|
DataInputStream stream = new DataInputStream |
|
|
|
for (int i=0; i<lvt.length; i++) { |
|
|
|
(new ByteArrayInputStream(attr.getContents())); |
|
|
|
int length = (lvt[i].end.addr + lvt[i].end.length |
|
|
|
try { |
|
|
|
- lvt[i].start.addr); |
|
|
|
int count = stream.readUnsignedShort(); |
|
|
|
locals[lvt[i].slot].addLocal(lvt[i].start.addr, length, |
|
|
|
for (int i=0; i < count; i++) { |
|
|
|
lvt[i].name, Type.tType(lvt[i].type)); |
|
|
|
int start = stream.readUnsignedShort(); |
|
|
|
|
|
|
|
int end = start + stream.readUnsignedShort(); |
|
|
|
|
|
|
|
int nameIndex = stream.readUnsignedShort(); |
|
|
|
|
|
|
|
int typeIndex = stream.readUnsignedShort(); |
|
|
|
|
|
|
|
if (nameIndex == 0 || typeIndex == 0 |
|
|
|
|
|
|
|
|| constantPool.getTag(nameIndex) != constantPool.UTF8 |
|
|
|
|
|
|
|
|| constantPool.getTag(typeIndex) != constantPool.UTF8) { |
|
|
|
|
|
|
|
// This is probably an evil lvt as created by HashJava
|
|
|
|
|
|
|
|
// simply ignore it.
|
|
|
|
|
|
|
|
if (Decompiler.showLVT) |
|
|
|
|
|
|
|
Decompiler.err.println("Illegal entry, ignoring LVT"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String name = constantPool.getUTF8(nameIndex); |
|
|
|
|
|
|
|
Type type = Type.tType(constantPool.getUTF8(typeIndex)); |
|
|
|
|
|
|
|
int slot = stream.readUnsignedShort(); |
|
|
|
|
|
|
|
locals[slot].addLocal(start, end-start, name, type); |
|
|
|
|
|
|
|
if (Decompiler.showLVT) |
|
|
|
|
|
|
|
Decompiler.err.println("\t"+name + ": " + type |
|
|
|
|
|
|
|
+" range "+start+" - "+end |
|
|
|
|
|
|
|
+" slot "+slot); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (IOException ex) { |
|
|
|
|
|
|
|
ex.printStackTrace(Decompiler.err); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|