diff --git a/jode/ChangeLog b/jode/ChangeLog index 0bd7efc..8d9b520 100644 --- a/jode/ChangeLog +++ b/jode/ChangeLog @@ -1,3 +1,18 @@ +2001-06-15 Jochen Hoenicke + + * jode/jvm/SyntheticAnalyzer.java.in: + (checkGetClass): Ignore nop opcodes. + (checkStaticAccess): Likewise. + (checkAccess): Likewise. + (checkConstructorAccess): Likewise. + + * jode/flow/TransformConstructors.java (Constructor): Ignore + OuterValues for static constructor. + + * jode/expr/NewArrayOperator.java (dumpExpression): Added + a missing breakOp. + * jode/expr/CompareToIntOperator.java (dumpExpression): Likewise. + 2001-06-01 Jochen Hoenicke * jode/obfuscator/modules/ConstantAnalyzer.java.in: diff --git a/jode/doc/Makefile.am b/jode/doc/Makefile.am index fb8aae1..4cb27ee 100644 --- a/jode/doc/Makefile.am +++ b/jode/doc/Makefile.am @@ -13,7 +13,7 @@ links.php \ usage.php HTML_FILES = $(PHP_FILES:%.php=$(srcdir)/%.html) -noinst_DATA = $(HTML_FILES) +# noinst_DATA = $(HTML_FILES) EXTRA_DIST = $(PHP_FILES) $(notdir $(HTML_FILES)) \ header.inc \ diff --git a/jode/jode/expr/CompareToIntOperator.java b/jode/jode/expr/CompareToIntOperator.java index 82f77f3..0589116 100644 --- a/jode/jode/expr/CompareToIntOperator.java +++ b/jode/jode/expr/CompareToIntOperator.java @@ -54,6 +54,7 @@ public class CompareToIntOperator extends Operator { throws java.io.IOException { subExpressions[0].dumpExpression(writer, 550); + writer.breakOp(); writer.print(" <=>"); if (allowsNaN) writer.print(greaterOnNaN ? "g" : "l"); diff --git a/jode/jode/expr/NewArrayOperator.java b/jode/jode/expr/NewArrayOperator.java index 4fa7dd5..2ed5895 100644 --- a/jode/jode/expr/NewArrayOperator.java +++ b/jode/jode/expr/NewArrayOperator.java @@ -57,6 +57,7 @@ public class NewArrayOperator extends Operator { writer.print("new "); writer.printType(flat.getHint()); for (int i=0; i< depth; i++) { + writer.breakOp(); writer.print("["); if (i < subExpressions.length) subExpressions[i].dumpExpression(writer, 0); diff --git a/jode/jode/flow/TransformConstructors.java b/jode/jode/flow/TransformConstructors.java index 2a1df7c..1e798d0 100644 --- a/jode/jode/flow/TransformConstructors.java +++ b/jode/jode/flow/TransformConstructors.java @@ -105,7 +105,8 @@ public class TransformConstructors { this.clazzAnalyzer = clazzAnalyzer; this.isStatic = isStatic; this.cons = cons; - this.outerValues = clazzAnalyzer.getOuterValues(); + if (!isStatic) + this.outerValues = clazzAnalyzer.getOuterValues(); lookForConstructorCall(); } diff --git a/jode/jode/jvm/SyntheticAnalyzer.java.in b/jode/jode/jvm/SyntheticAnalyzer.java.in index 4bf52ef..76080e9 100644 --- a/jode/jode/jvm/SyntheticAnalyzer.java.in +++ b/jode/jode/jvm/SyntheticAnalyzer.java.in @@ -117,6 +117,8 @@ public class SyntheticAnalyzer implements Opcodes { int i = 0; for (Iterator iter = bytecode.getInstructions().iterator(); iter.hasNext(); i++) { Instruction instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (i == getClassOpcodes.length || instr.getOpcode() != getClassOpcodes[i]) return false; @@ -152,6 +154,8 @@ public class SyntheticAnalyzer implements Opcodes { boolean dupSeen = false; Instruction instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() == opc_getstatic) { Reference ref = instr.getReference(); ClassInfo refClazz = TypeSignature.getClassInfo(ref.getClazz()); @@ -162,6 +166,8 @@ public class SyntheticAnalyzer implements Opcodes { if ((refField.getModifiers() & modifierMask) != Modifier.STATIC) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() < opc_ireturn || instr.getOpcode() > opc_areturn) return false; @@ -178,12 +184,16 @@ public class SyntheticAnalyzer implements Opcodes { slot += (instr.getOpcode() == opc_lload || instr.getOpcode() == opc_dload) ? 2 : 1; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); } if (instr.getOpcode() == (opc_dup - 3) + 3 * slot) { /* This is probably a opc_dup or opc_dup2, * preceding a opc_putstatic */ instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() != opc_putstatic) return false; dupSeen = true; @@ -201,6 +211,8 @@ public class SyntheticAnalyzer implements Opcodes { if ((refField.getModifiers() & modifierMask) != Modifier.STATIC) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (dupSeen) { if (instr.getOpcode() < opc_ireturn || instr.getOpcode() > opc_areturn) @@ -226,6 +238,8 @@ public class SyntheticAnalyzer implements Opcodes { || refType.getParameterTypes().length != params) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (refType.getReturnType() == Type.tVoid) { if (instr.getOpcode() != opc_return) return false; @@ -258,9 +272,13 @@ public class SyntheticAnalyzer implements Opcodes { Iterator iter = bytecode.getInstructions().iterator(); Instruction instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() != opc_aload || instr.getLocalSlot() != 0) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() == opc_getfield) { Reference ref = instr.getReference(); @@ -272,6 +290,8 @@ public class SyntheticAnalyzer implements Opcodes { if ((refField.getModifiers() & modifierMask) != 0) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() < opc_ireturn || instr.getOpcode() > opc_areturn) return false; @@ -288,12 +308,16 @@ public class SyntheticAnalyzer implements Opcodes { slot += (instr.getOpcode() == opc_lload || instr.getOpcode() == opc_dload) ? 2 : 1; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); } if (instr.getOpcode() == (opc_dup_x1 - 6) + 3 * slot) { /* This is probably a opc_dup_x1 or opc_dup2_x1, * preceding a opc_putfield */ instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (instr.getOpcode() != opc_putfield) return false; dupSeen = true; @@ -312,6 +336,8 @@ public class SyntheticAnalyzer implements Opcodes { return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (dupSeen) { if (instr.getOpcode() < opc_ireturn || instr.getOpcode() > opc_areturn) @@ -337,6 +363,8 @@ public class SyntheticAnalyzer implements Opcodes { || refType.getParameterTypes().length != params) return false; instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); if (refType.getReturnType() == Type.tVoid) { if (instr.getOpcode() != opc_return) return false; @@ -365,6 +393,8 @@ public class SyntheticAnalyzer implements Opcodes { Iterator iter = bytecode.getInstructions().iterator(); Instruction instr = (Instruction) iter.next(); + while (instr.getOpcode() == opc_nop && iter.hasNext()) + instr = (Instruction) iter.next(); int params = 0, slot = 0; while (instr.getOpcode() >= opc_iload && instr.getOpcode() <= opc_aload) {