--- a/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java Tue Jun 24 19:43:44 2014 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/Compiler.java Tue Jun 24 19:29:41 2014 +0200
@@ -45,7 +45,6 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
import java.util.TreeMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -122,11 +121,7 @@
* that using whatever was at program point 17 as an int failed.
*/
private final Map<Integer, Type> invalidatedProgramPoints;
- /**
- * The snapshot of invalidatedProgramPoints before the compilation. Used to compare it to invalidatedProgramPoints,
- * and if the two are equal, not write the type information to a file.
- */
- private final Map<Integer, Type> invalidatedProgramPointsOnEntry;
+
/**
* Descriptor of the location where we write the type information after compilation.
*/
@@ -381,7 +376,6 @@
this.firstCompileUnitName = firstCompileUnitName();
this.strict = isStrict;
- this.invalidatedProgramPointsOnEntry = typeInformationFile == null ? null : new HashMap<>(this.invalidatedProgramPoints);
this.optimistic = env._optimistic_types;
}
@@ -537,7 +531,7 @@
time += (env.isTimingEnabled() ? phase.getEndTime() - phase.getStartTime() : 0L);
}
- if(typeInformationFile != null && !phases.isRestOfCompilation() && !Objects.equals(invalidatedProgramPoints, invalidatedProgramPointsOnEntry)) {
+ if(typeInformationFile != null && !phases.isRestOfCompilation()) {
OptimisticTypesPersistence.store(typeInformationFile, invalidatedProgramPoints);
}
--- a/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java Tue Jun 24 19:43:44 2014 +0530
+++ b/nashorn/src/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java Tue Jun 24 19:29:41 2014 +0200
@@ -136,11 +136,7 @@
}
dout.flush();
} catch(final Exception e) {
- final long now = System.currentTimeMillis();
- if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
- getLogger().warning("Failed to write " + file, e);
- lastReportedError = now;
- }
+ reportError("write", file, e);
}
}
return null;
@@ -190,17 +186,21 @@
}
}
} catch (final Exception e) {
- final long now = System.currentTimeMillis();
- if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
- getLogger().warning("Failed to read " + file, e);
- lastReportedError = now;
- }
+ reportError("read", file, e);
return null;
}
}
});
}
+ private static void reportError(final String msg, final File file, final Exception e) {
+ final long now = System.currentTimeMillis();
+ if(now - lastReportedError > ERROR_REPORT_THRESHOLD) {
+ getLogger().warning(String.format("Failed to %s %s", msg, file), e);
+ lastReportedError = now;
+ }
+ }
+
private static File createCacheDir() {
if(Options.getBooleanProperty("nashorn.typeInfo.disabled")) {
return null;