new preds array instead of hash

handle jsrs


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@551 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 511dee5e74
commit 610f77160f
  1. 29
      jode/jode/obfuscator/LocalOptimizer.java

@ -257,24 +257,29 @@ public class LocalOptimizer implements Opcodes {
*/ */
while (!changedInfos.isEmpty()) { while (!changedInfos.isEmpty()) {
InstrInfo info = (InstrInfo) changedInfos.pop(); InstrInfo info = (InstrInfo) changedInfos.pop();
Enumeration enum = info.instr.preds.elements(); Instruction instr = info.instr;
while (enum.hasMoreElements()) {
Instruction preInstr Instruction prevInstr = instr.prevByAddr;
= (Instruction) enum.nextElement(); if (prevInstr != null) {
if (preInstr.opcode == opc_jsr if (prevInstr.opcode == opc_jsr) {
&& info.instr != preInstr.succs[0]) { /* Prev instr is a jsr, continue with the
/* Prev expr is a jsr, continue with the
* corresponding ret, instead with the jsr. * corresponding ret, instead with the jsr.
*/ */
InstrInfo jsrInfo = InstrInfo jsrInfo =
(InstrInfo) instrInfos.get(preInstr); (InstrInfo) instrInfos.get(prevInstr);
for (int i = jsrInfo.retInstrs.length; i-- > 0; ) for (int i = jsrInfo.retInstrs.length; i-- > 0; )
promoteReads(info, jsrInfo.retInstrs[i], preInstr); promoteReads(info, jsrInfo.retInstrs[i], prevInstr);
} else } else if (!prevInstr.alwaysJumps)
promoteReads(info, preInstr, null); promoteReads(info, prevInstr, null);
} }
if (instr.preds != null) {
for (int i = 0; i < instr.preds.length; i++)
promoteReads(info, instr.preds[i], null);
}
for (int i=0; i < handlers.length; i++) { for (int i=0; i < handlers.length; i++) {
if (handlers[i].catcher == info.instr) { if (handlers[i].catcher == instr) {
for (Instruction preInstr = handlers[i].start; for (Instruction preInstr = handlers[i].start;
preInstr != handlers[i].end.nextByAddr; preInstr != handlers[i].end.nextByAddr;
preInstr = preInstr.nextByAddr) { preInstr = preInstr.nextByAddr) {

Loading…
Cancel
Save