Merge commit '69c8c5136e3995bfbb999dd2cbf2396d19ddaebe' into dev-release
diff --git a/src/main/java/com/android/tools/r8/graph/CachedHashValueDexItem.java b/src/main/java/com/android/tools/r8/graph/CachedHashValueDexItem.java
index 749ce04..eda8647 100644
--- a/src/main/java/com/android/tools/r8/graph/CachedHashValueDexItem.java
+++ b/src/main/java/com/android/tools/r8/graph/CachedHashValueDexItem.java
@@ -26,11 +26,20 @@
}
hash = cache;
}
- assert cache == computeHashCode()
- : "Hash code for " + this + " has changed from " + hash + " to " + computeHashCode();
+ assert verifyHashCodeConsistent(cache);
return cache;
}
+ private boolean verifyHashCodeConsistent(int computedValue) {
+ int newComputedValue = computeHashCode();
+ if (newComputedValue == NOT_COMPUTED_HASH_VALUE) {
+ newComputedValue = SENTINEL_HASH_VALUE;
+ }
+ assert computedValue == newComputedValue
+ : "Hash code for " + this + " has changed from " + hash + " to " + newComputedValue;
+ return true;
+ }
+
@Override
public void flushCachedValues() {
super.flushCachedValues();
diff --git a/src/test/java/com/android/tools/r8/regress/b152973695/CompileToInvalidFileTest.java b/src/test/java/com/android/tools/r8/regress/b152973695/CompileToInvalidFileTest.java
index 36972c4..4f617ac 100644
--- a/src/test/java/com/android/tools/r8/regress/b152973695/CompileToInvalidFileTest.java
+++ b/src/test/java/com/android/tools/r8/regress/b152973695/CompileToInvalidFileTest.java
@@ -9,41 +9,46 @@
import com.android.tools.r8.ClassFileConsumer;
import com.android.tools.r8.CompilationFailedException;
+import com.android.tools.r8.DexIndexedConsumer.ArchiveConsumer;
+import com.android.tools.r8.ProgramConsumer;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
-import com.android.tools.r8.TestParametersCollection;
+import com.android.tools.r8.utils.BooleanUtils;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
+import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@RunWith(Parameterized.class)
public class CompileToInvalidFileTest extends TestBase {
+
private static final Path INVALID_FILE = Paths.get("!@#/\\INVALID_FILE");
- private final TestParameters parameters;
+ private final boolean classFileConsumer;
- @Parameterized.Parameters(name = "{0}")
- public static TestParametersCollection data() {
- return getTestParameters().withNoneRuntime().build();
+ @Parameterized.Parameters(name = "{0}, classfileConsumer: {1}")
+ public static List<Object[]> data() {
+ return buildParameters(getTestParameters().withNoneRuntime().build(), BooleanUtils.values());
}
- public CompileToInvalidFileTest(TestParameters parameters) {
- this.parameters = parameters;
+ public CompileToInvalidFileTest(TestParameters parameters, boolean classFileConsumer) {
+ this.classFileConsumer = classFileConsumer;
}
@Test
public void testCompileToInvalidFileD8() {
ensureInvalidFileIsInvalid();
+ ProgramConsumer programConsumer =
+ classFileConsumer
+ ? new ClassFileConsumer.ArchiveConsumer(INVALID_FILE)
+ : new ArchiveConsumer(INVALID_FILE);
try {
- testForD8()
- .addProgramClasses(Main.class)
- .setProgramConsumer(new ClassFileConsumer.ArchiveConsumer(INVALID_FILE))
- .compile();
+ testForD8().addProgramClasses(Main.class).setProgramConsumer(programConsumer).compile();
fail("Expected a CompilationFailedException but the code succeeded");
} catch (CompilationFailedException ex) {
assertInvalidFileNotFound(ex);
@@ -55,11 +60,15 @@
@Test
public void testCompileToInvalidFileR8() {
ensureInvalidFileIsInvalid();
+ ProgramConsumer programConsumer =
+ classFileConsumer
+ ? new ClassFileConsumer.ArchiveConsumer(INVALID_FILE)
+ : new ArchiveConsumer(INVALID_FILE);
try {
- testForR8(Backend.CF)
+ testForR8(classFileConsumer ? Backend.CF : Backend.DEX)
.addProgramClasses(Main.class)
.addKeepMainRule(Main.class)
- .setProgramConsumer(new ClassFileConsumer.ArchiveConsumer(INVALID_FILE))
+ .setProgramConsumer(programConsumer)
.compile();
fail("Expected a CompilationFailedException but the code succeeded");
} catch (CompilationFailedException ex) {
diff --git a/tools/golem.py b/tools/golem.py
index 586ac5e..27f0035 100755
--- a/tools/golem.py
+++ b/tools/golem.py
@@ -22,7 +22,7 @@
'proguardsettings',
'r8',
'remapper',
- 'retrace_benchmarks',
+ 'retrace_benchmark',
'sample_libraries',
'youtube',
]