Insert a jump to end-of-method after a valued return, since try-catch analysis

needs it.
opc_return shouldn't occur in new bytecode interface


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1273 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 24 years ago
parent b14a4f5e86
commit 712f5d03dd
  1. 9
      jode/jode/decompiler/MethodAnalyzer.java
  2. 5
      jode/jode/decompiler/Opcodes.java

@ -478,13 +478,20 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
Opcodes.addOpcode(flows[i], instr, this); Opcodes.addOpcode(flows[i], instr, this);
} }
Block[] succs = blocks[i].getSuccs(); Block[] succs = blocks[i].getSuccs();
FlowBlock[] flowSuccs = new FlowBlock[succs.length]; FlowBlock[] flowSuccs;
int lastOpcode = blocks[i].getInstructions()[last].getOpcode();
if (lastOpcode >= Opcodes.opc_ireturn
&& lastOpcode <= Opcodes.opc_areturn) {
flowSuccs = new FlowBlock[] { FlowBlock.END_OF_METHOD };
} else {
flowSuccs = new FlowBlock[succs.length];
for (int j=0; j< succs.length; j++) { for (int j=0; j< succs.length; j++) {
if (succs[j] == null) if (succs[j] == null)
flowSuccs[j] = FlowBlock.END_OF_METHOD; flowSuccs[j] = FlowBlock.END_OF_METHOD;
else else
flowSuccs[j] = flows[succs[j].getBlockNr()]; flowSuccs[j] = flows[succs[j].getBlockNr()];
} }
}
flows[i].setSuccessors(flowSuccs); flows[i].setSuccessors(flowSuccs);
} }

@ -338,9 +338,8 @@ public abstract class Opcodes implements jode.bytecode.Opcodes {
break; break;
} }
case opc_return: case opc_return:
flow.appendBlock(createBlock throw new InternalError("opc_return no longer allowed");
(ma, instr, new ReturnBlock()));
break;
case opc_getstatic: case opc_getstatic:
case opc_getfield: { case opc_getfield: {
Reference ref = instr.getReference(); Reference ref = instr.getReference();

Loading…
Cancel
Save