8059231: Verify that octane raytrace now works with optimistic types turned off. Add better logging for optimistic types in the compiler.
Reviewed-by: attila
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Wed Jul 05 20:03:24 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Mon Oct 06 10:43:57 2014 +0200
@@ -458,12 +458,14 @@
@Override
public DebugLogger initLogger(final Context ctxt) {
+ final boolean optimisticTypes = ctxt.getEnv()._optimistic_types;
return ctxt.getLogger(this.getClass(), new Consumer<DebugLogger>() {
@Override
public void accept(final DebugLogger newLogger) {
if (!Compiler.this.getScriptEnvironment()._lazy_compilation) {
newLogger.warning("WARNING: Running with lazy compilation switched off. This is not a default setting.");
}
+ newLogger.warning("Optimistic types are ", optimisticTypes ? "ENABLED." : "DISABLED.");
}
});
}
@@ -541,9 +543,10 @@
* @throws CompilationException if error occurs during compilation
*/
public FunctionNode compile(final FunctionNode functionNode, final CompilationPhases phases) throws CompilationException {
-
- log.finest("Starting compile job for ", DebugLogger.quote(functionNode.getName()), " phases=", quote(phases.getDesc()));
- log.indent();
+ if (log.isEnabled()) {
+ log.info("Starting compile job for ", DebugLogger.quote(functionNode.getName()), " phases=", quote(phases.getDesc()));
+ log.indent();
+ }
final String name = DebugLogger.quote(functionNode.getName());
@@ -560,7 +563,7 @@
long time = 0L;
for (final CompilationPhase phase : phases) {
- log.fine(phase, " starting for ", quote(name));
+ log.fine(phase, " starting for ", name);
try {
newFunctionNode = phase.apply(this, phases, newFunctionNode);
@@ -588,8 +591,11 @@
log.unindent();
if (info) {
- final StringBuilder sb = new StringBuilder();
- sb.append("Compile job for ").append(newFunctionNode.getSource()).append(':').append(quote(newFunctionNode.getName())).append(" finished");
+ final StringBuilder sb = new StringBuilder("Finished compile job for ");
+ sb.append(newFunctionNode.getSource()).
+ append(':').
+ append(quote(newFunctionNode.getName()));
+
if (time > 0L && timeLogger != null) {
assert env.isTimingEnabled();
sb.append(" in ").append(time).append(" ms");
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Options.properties Wed Jul 05 20:03:24 2017 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Options.properties Mon Oct 06 10:43:57 2014 +0200
@@ -203,6 +203,7 @@
nashorn.option.optimistic.types = { \
name="--optimistic-types", \
+ short_name="-ot", \
is_undocumented=true, \
desc="Use optimistic type assumptions with deoptimizing recompilation.", \
default=true \