changeset 26499:2c45298da366

8057611: Nashorn did not dump the JOx classes to disk when running with the -d flag Reviewed-by: attila, sundar, hannesw
author lagergren
date Fri, 05 Sep 2014 16:28:02 +0200
parents ca7093bd5fd1
children 85ea77a73bb8
files nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Thu Sep 04 18:57:14 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java	Fri Sep 05 16:28:02 2014 +0200
@@ -53,6 +53,7 @@
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
+
 import jdk.nashorn.internal.codegen.ClassEmitter.Flag;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.runtime.AccessorProperty;
@@ -308,7 +309,7 @@
         newEmptyInit(className, classEmitter);
         newAllocate(className, classEmitter);
 
-        return toByteArray(classEmitter);
+        return toByteArray(className, classEmitter);
     }
 
     /**
@@ -341,7 +342,7 @@
         initWithArguments.returnVoid();
         initWithArguments.end();
 
-        return toByteArray(classEmitter);
+        return toByteArray(className, classEmitter);
     }
 
     /**
@@ -484,15 +485,13 @@
      * @param classEmitter Open class emitter.
      * @return Byte codes for the class.
      */
-    private byte[] toByteArray(final ClassEmitter classEmitter) {
+    private byte[] toByteArray(final String className, final ClassEmitter classEmitter) {
         classEmitter.end();
 
         final byte[] code = classEmitter.toByteArray();
         final ScriptEnvironment env = context.getEnv();
 
-        if (env._print_code && env._print_code_dir == null) {
-            env.getErr().println(ClassEmitter.disassemble(code));
-        }
+        DumpBytecode.dumpBytecode(env, log, code, className);
 
         if (env._verify_code) {
             context.verify(code);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Thu Sep 04 18:57:14 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java	Fri Sep 05 16:28:02 2014 +0200
@@ -27,7 +27,6 @@
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
-
 import java.lang.invoke.CallSite;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;