dead code elimination

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@193 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 8c276e920f
commit ea2addb1b6
  1. 11
      jode/jode/decompiler/CodeAnalyzer.java

@ -154,7 +154,9 @@ public class CodeAnalyzer implements Analyzer {
addr = instr[addr].getNextAddr(); addr = instr[addr].getNextAddr();
} }
excHandlers = new TransformExceptionHandlers(instr); methodHeader = instr[0];
methodHeader.markReachable();
excHandlers = new TransformExceptionHandlers();
for (int i=0; i<handlers.length; i += 4) { for (int i=0; i<handlers.length; i += 4) {
Type type = null; Type type = null;
int start = handlers[i + 0]; int start = handlers[i + 0];
@ -166,18 +168,21 @@ public class CodeAnalyzer implements Analyzer {
if (handlers[i + 3 ] != 0) if (handlers[i + 3 ] != 0)
type = Type.tClass(cpool.getClassName(handlers[i + 3])); type = Type.tClass(cpool.getClassName(handlers[i + 3]));
excHandlers.addHandler(start, end, handler, type); excHandlers.addHandler(instr[start], end,
instr[handler], type);
instr[handler].markReachable();
} }
} catch (IOException ex) { } catch (IOException ex) {
ex.printStackTrace(); ex.printStackTrace();
throw new ClassFormatError(ex.getMessage()); throw new ClassFormatError(ex.getMessage());
} }
FlowBlock.removeDeadCode(methodHeader);
if (Decompiler.isVerbose) if (Decompiler.isVerbose)
Decompiler.err.print('-'); Decompiler.err.print('-');
excHandlers.analyze(); excHandlers.analyze();
methodHeader = instr[0];
methodHeader.analyze(); methodHeader.analyze();
} }

Loading…
Cancel
Save