diff options
7 files changed, 21 insertions, 51 deletions
diff --git a/dx/src/com/android/jack/dx/dex/file/CatchStructs.java b/dx/src/com/android/jack/dx/dex/file/CatchStructs.java index 79bf4b4..188d8aa 100644 --- a/dx/src/com/android/jack/dx/dex/file/CatchStructs.java +++ b/dx/src/com/android/jack/dx/dex/file/CatchStructs.java @@ -182,10 +182,9 @@ public final class CatchStructs { /** * Writes this instance to the given stream. * - * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ - public void writeTo(DexFile file, AnnotatedOutput out) { + public void writeTo(AnnotatedOutput out) { finishProcessingIfNecessary(); if (out.annotates()) { diff --git a/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java b/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java index a1b2872..19538d7 100644 --- a/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java +++ b/dx/src/com/android/jack/dx/dex/file/ClassDataItem.java @@ -343,10 +343,10 @@ int size = staticFields.size(); out.annotate(0, offsetString() + " class data for " + thisClass.toHuman()); } - encodeSize(file, out, "static_fields", staticFields.size()); - encodeSize(file, out, "instance_fields", instanceFields.size()); - encodeSize(file, out, "direct_methods", directMethods.size()); - encodeSize(file, out, "virtual_methods", virtualMethods.size()); + encodeSize(out, "static_fields", staticFields.size()); + encodeSize(out, "instance_fields", instanceFields.size()); + encodeSize(out, "direct_methods", directMethods.size()); + encodeSize(out, "virtual_methods", virtualMethods.size()); encodeList(file, out, "static_fields", staticFields); encodeList(file, out, "instance_fields", instanceFields); @@ -362,12 +362,11 @@ int size = staticFields.size(); * Helper for {@link #encodeOutput}, which writes out the given * size value, annotating it as well (if annotations are enabled). * - * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to * @param label {@code non-null;} the label for the purposes of annotation * @param size {@code >= 0;} the size to write */ - private static void encodeSize(DexFile file, AnnotatedOutput out, String label, int size) { + private static void encodeSize(AnnotatedOutput out, String label, int size) { if (out.annotates()) { out.annotate(String.format(" %-21s %08x", label + "_size:", Integer.valueOf(size))); } diff --git a/dx/src/com/android/jack/dx/dex/file/CodeItem.java b/dx/src/com/android/jack/dx/dex/file/CodeItem.java index 5cf8c40..78cc332 100644 --- a/dx/src/com/android/jack/dx/dex/file/CodeItem.java +++ b/dx/src/com/android/jack/dx/dex/file/CodeItem.java @@ -250,7 +250,7 @@ public final class CodeItem extends OffsettedItem implements Code { out.writeInt(debugOff); out.writeInt(insnsSz); - writeCodes(file, out); + writeCodes(out); if (catches != null) { if (needPadding) { @@ -260,7 +260,7 @@ public final class CodeItem extends OffsettedItem implements Code { out.writeShort(0); } - catches.writeTo(file, out); + catches.writeTo(out); } if (annotates) { @@ -278,10 +278,9 @@ public final class CodeItem extends OffsettedItem implements Code { /** * Helper for {@link #writeTo0} which writes out the actual bytecode. * - * @param file {@code non-null;} file we are part of * @param out {@code non-null;} where to write to */ - private void writeCodes(DexFile file, AnnotatedOutput out) { + private void writeCodes(AnnotatedOutput out) { DalvInsnList insns = code.getInsns(); try { diff --git a/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java b/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java index 5439bf3..d9d0a5d 100644 --- a/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java +++ b/dx/src/com/android/jack/dx/dex/file/ImportedDebugInfoItem.java @@ -34,8 +34,6 @@ import com.android.jack.dx.rop.cst.CstIndexMap; import com.android.jack.dx.util.AnnotatedOutput; import com.android.jack.dx.util.ByteArrayAnnotatedOutput; -import java.io.PrintWriter; - import javax.annotation.CheckForNull; import javax.annotation.Nonnegative; import javax.annotation.Nonnull; @@ -117,15 +115,6 @@ public class ImportedDebugInfoItem extends OffsettedItem { throw new RuntimeException("unsupported"); } - /** - * Does a human-friendly dump of this instance. - * @param out {@code non-null;} where to dump - * @param prefix {@code non-null;} prefix to attach to each line of output - */ - public void debugPrint(PrintWriter out, String prefix) { - throw new RuntimeException("unsupported"); - } - /** {@inheritDoc} */ @Override protected void writeTo0(DexFile file, AnnotatedOutput out) { diff --git a/dx/src/com/android/jack/dx/ssa/Optimizer.java b/dx/src/com/android/jack/dx/ssa/Optimizer.java index 5e00e2e..7101be0 100644 --- a/dx/src/com/android/jack/dx/ssa/Optimizer.java +++ b/dx/src/com/android/jack/dx/ssa/Optimizer.java @@ -104,7 +104,7 @@ public class Optimizer { ssaMeth = SsaConverter.convertToSsaMethod(rmeth, paramWidth, isStatic); runSsaFormSteps(ssaMeth, steps); - RopMethod resultMeth = SsaToRop.convertToRopMethod(ssaMeth, false); + RopMethod resultMeth = SsaToRop.convertToRopMethod(ssaMeth); if (resultMeth.getBlocks().getRegCount() > advice.getMaxOptimalRegisterCount()) { // Try to see if we can squeeze it under the register count bar @@ -114,16 +114,13 @@ public class Optimizer { } /** - * Runs the optimizer with a strategy to minimize the number of rop-form - * registers used by the end result. Dex bytecode does not have instruction - * forms that take register numbers larger than 15 for all instructions. - * If we've produced a method that uses more than 16 registers, try again - * with a different strategy to see if we can get under the bar. The end - * result will be much more efficient. + * Dex bytecode does not have instruction forms that take register numbers larger than 15 for all + * instructions. If we've produced a method that uses more than 16 registers, try again by + * removing the CONST_COLLECTOR step to see if we can get under the bar. The end result will be + * much more efficient. * * @param rmeth method to process - * @param paramWidth the total width, in register-units, of this method's - * parameters + * @param paramWidth the total width, in register-units, of this method's parameters * @param isStatic true if this method has no 'this' pointer argument. * @param steps set of optional optimization steps to run * @return optimized method @@ -145,7 +142,7 @@ public class Optimizer { runSsaFormSteps(ssaMeth, newSteps); - resultMeth = SsaToRop.convertToRopMethod(ssaMeth, true); + resultMeth = SsaToRop.convertToRopMethod(ssaMeth); return resultMeth; } diff --git a/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java b/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java index 697caaa..7fb22d6 100644 --- a/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java +++ b/dx/src/com/android/jack/dx/ssa/back/FirstFitLocalCombiningAllocator.java @@ -124,11 +124,9 @@ public class FirstFitLocalCombiningAllocator extends RegisterAllocator { * * @param ssaMeth {@code non-null;} method to process * @param interference non-null interference graph for SSA registers - * @param minimizeRegisters true if converter should take steps to * minimize rop-form registers */ - public FirstFitLocalCombiningAllocator(SsaMethod ssaMeth, InterferenceGraph interference, - boolean minimizeRegisters) { + public FirstFitLocalCombiningAllocator(SsaMethod ssaMeth, InterferenceGraph interference) { super(ssaMeth, interference); ssaRegsMapped = new BitSet(ssaMeth.getRegCount()); diff --git a/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java b/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java index 8175cf2..cc8e5c5 100644 --- a/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java +++ b/dx/src/com/android/jack/dx/ssa/back/SsaToRop.java @@ -48,12 +48,6 @@ public class SsaToRop { /** {@code non-null;} method to process */ private final SsaMethod ssaMeth; - /** - * {@code true} if the converter should attempt to minimize - * the rop-form register count - */ - private final boolean minimizeRegisters; - /** {@code non-null;} interference graph */ private final InterferenceGraph interference; @@ -61,23 +55,19 @@ public class SsaToRop { * Converts a method in SSA form to ROP form. * * @param ssaMeth {@code non-null;} method to process - * @param minimizeRegisters {@code true} if the converter should - * attempt to minimize the rop-form register count * @return {@code non-null;} rop-form output */ - public static RopMethod convertToRopMethod(SsaMethod ssaMeth, boolean minimizeRegisters) { - return new SsaToRop(ssaMeth, minimizeRegisters).convert(); + public static RopMethod convertToRopMethod(SsaMethod ssaMeth) { + return new SsaToRop(ssaMeth).convert(); } /** * Constructs an instance. * * @param ssaMethod {@code non-null;} method to process - * @param minimizeRegisters {@code true} if the converter should * attempt to minimize the rop-form register count */ - private SsaToRop(SsaMethod ssaMethod, boolean minimizeRegisters) { - this.minimizeRegisters = minimizeRegisters; + private SsaToRop(SsaMethod ssaMethod) { this.ssaMeth = ssaMethod; this.interference = LivenessAnalyzer.constructInterferenceGraph(ssaMethod); } @@ -96,8 +86,7 @@ public class SsaToRop { // allocator = new NullRegisterAllocator(ssaMeth, interference); // allocator = new FirstFitAllocator(ssaMeth, interference); - RegisterAllocator allocator = - new FirstFitLocalCombiningAllocator(ssaMeth, interference, minimizeRegisters); + RegisterAllocator allocator = new FirstFitLocalCombiningAllocator(ssaMeth, interference); RegisterMapper mapper = allocator.allocateRegisters(); |