Fixed a typo in a comment and in a method name. Made ClassWriter.invokeProcessors static since it no longer relies on any non-static fields.
This commit is contained in:
committed by
Roman Shevchenko
parent
f643b1c870
commit
c32fce0d02
@@ -118,7 +118,7 @@ public class BasicBlock implements IGraphNode {
|
|||||||
block.removePredecessor(this);
|
block.removePredecessor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: unify block comparisons: id or direkt equality
|
// FIXME: unify block comparisons: id or direct equality
|
||||||
public void replaceSuccessor(BasicBlock oldBlock, BasicBlock newBlock) {
|
public void replaceSuccessor(BasicBlock oldBlock, BasicBlock newBlock) {
|
||||||
for (int i = 0; i < succs.size(); i++) {
|
for (int i = 0; i < succs.size(); i++) {
|
||||||
if (succs.get(i).id == oldBlock.id) {
|
if (succs.get(i).id == oldBlock.id) {
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class ClassWriter {
|
|||||||
interceptor = DecompilerContext.getPoolInterceptor();
|
interceptor = DecompilerContext.getPoolInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeProcessors(ClassNode node) {
|
private static void invokeProcessors(ClassNode node) {
|
||||||
ClassWrapper wrapper = node.getWrapper();
|
ClassWrapper wrapper = node.getWrapper();
|
||||||
StructClass cl = wrapper.getClassStruct();
|
StructClass cl = wrapper.getClassStruct();
|
||||||
|
|
||||||
|
|||||||
@@ -422,7 +422,8 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
Exprent index_store = stack.pop();
|
Exprent index_store = stack.pop();
|
||||||
Exprent arr_store = stack.pop();
|
Exprent arr_store = stack.pop();
|
||||||
AssignmentExprent arrassign =
|
AssignmentExprent arrassign =
|
||||||
new AssignmentExprent(new ArrayExprent(arr_store, index_store, arrtypes[instr.opcode - opc_iastore], bytecode_offsets), value, bytecode_offsets);
|
new AssignmentExprent(new ArrayExprent(arr_store, index_store, arrtypes[instr.opcode - opc_iastore], bytecode_offsets), value,
|
||||||
|
bytecode_offsets);
|
||||||
exprlist.add(arrassign);
|
exprlist.add(arrassign);
|
||||||
break;
|
break;
|
||||||
case opc_iadd:
|
case opc_iadd:
|
||||||
@@ -552,13 +553,15 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
case opc_getstatic:
|
case opc_getstatic:
|
||||||
case opc_getfield:
|
case opc_getfield:
|
||||||
pushEx(stack, exprlist,
|
pushEx(stack, exprlist,
|
||||||
new FieldExprent(pool.getLinkConstant(instr.getOperand(0)), instr.opcode == opc_getstatic ? null : stack.pop(), bytecode_offsets));
|
new FieldExprent(pool.getLinkConstant(instr.getOperand(0)), instr.opcode == opc_getstatic ? null : stack.pop(),
|
||||||
|
bytecode_offsets));
|
||||||
break;
|
break;
|
||||||
case opc_putstatic:
|
case opc_putstatic:
|
||||||
case opc_putfield:
|
case opc_putfield:
|
||||||
Exprent valfield = stack.pop();
|
Exprent valfield = stack.pop();
|
||||||
Exprent exprfield =
|
Exprent exprfield =
|
||||||
new FieldExprent(pool.getLinkConstant(instr.getOperand(0)), instr.opcode == opc_putstatic ? null : stack.pop(), bytecode_offsets);
|
new FieldExprent(pool.getLinkConstant(instr.getOperand(0)), instr.opcode == opc_putstatic ? null : stack.pop(),
|
||||||
|
bytecode_offsets);
|
||||||
exprlist.add(new AssignmentExprent(exprfield, valfield, bytecode_offsets));
|
exprlist.add(new AssignmentExprent(exprfield, valfield, bytecode_offsets));
|
||||||
break;
|
break;
|
||||||
case opc_invokevirtual:
|
case opc_invokevirtual:
|
||||||
@@ -755,7 +758,7 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
return prlst;
|
return prlst;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean endsWithSemikolon(Exprent expr) {
|
public static boolean endsWithSemicolon(Exprent expr) {
|
||||||
int type = expr.type;
|
int type = expr.type;
|
||||||
return !(type == Exprent.EXPRENT_SWITCH ||
|
return !(type == Exprent.EXPRENT_SWITCH ||
|
||||||
type == Exprent.EXPRENT_MONITOR ||
|
type == Exprent.EXPRENT_MONITOR ||
|
||||||
@@ -768,7 +771,8 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
if (stat instanceof BasicBlockStatement) {
|
if (stat instanceof BasicBlockStatement) {
|
||||||
BasicBlock block = ((BasicBlockStatement)stat).getBlock();
|
BasicBlock block = ((BasicBlockStatement)stat).getBlock();
|
||||||
List<Integer> offsets = block.getInstrOldOffsets();
|
List<Integer> offsets = block.getInstrOldOffsets();
|
||||||
if (!offsets.isEmpty() && offsets.size() > block.getSeq().length()) { // some instructions have been deleted, but we still have offsets
|
if (!offsets.isEmpty() &&
|
||||||
|
offsets.size() > block.getSeq().length()) { // some instructions have been deleted, but we still have offsets
|
||||||
tracer.addMapping(offsets.get(offsets.size() - 1)); // add the last offset
|
tracer.addMapping(offsets.get(offsets.size() - 1)); // add the last offset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -840,7 +844,7 @@ public class ExprProcessor implements CodeConstants {
|
|||||||
if (expr.type == Exprent.EXPRENT_MONITOR && ((MonitorExprent)expr).getMonType() == MonitorExprent.MONITOR_ENTER) {
|
if (expr.type == Exprent.EXPRENT_MONITOR && ((MonitorExprent)expr).getMonType() == MonitorExprent.MONITOR_ENTER) {
|
||||||
buf.append("{}"); // empty synchronized block
|
buf.append("{}"); // empty synchronized block
|
||||||
}
|
}
|
||||||
if (endsWithSemikolon(expr)) {
|
if (endsWithSemicolon(expr)) {
|
||||||
buf.append(";");
|
buf.append(";");
|
||||||
}
|
}
|
||||||
buf.appendLineSeparator();
|
buf.appendLineSeparator();
|
||||||
|
|||||||
@@ -68,7 +68,9 @@ public class BasicBlockStatement extends Statement {
|
|||||||
// *****************************************************************************
|
// *****************************************************************************
|
||||||
|
|
||||||
public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) {
|
public TextBuffer toJava(int indent, BytecodeMappingTracer tracer) {
|
||||||
return ExprProcessor.listToJava(varDefinitions, indent, tracer).append(ExprProcessor.listToJava(exprents, indent, tracer));
|
TextBuffer tb = ExprProcessor.listToJava(varDefinitions, indent, tracer);
|
||||||
|
tb.append(ExprProcessor.listToJava(exprents, indent, tracer));
|
||||||
|
return tb;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Statement getSimpleCopy() {
|
public Statement getSimpleCopy() {
|
||||||
|
|||||||
Reference in New Issue
Block a user