8057930: remove eval ID
authorattila
Tue, 09 Sep 2014 15:33:58 +0200
changeset 26504 ed05e2f4c2db
parent 26503 3ed48a01100c
child 26505 d29bf8787b43
8057930: remove eval ID Reviewed-by: hannesw, sundar
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java
nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java
nashorn/test/script/basic/JDK-8030182_2.js
nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED
nashorn/test/script/basic/es6/const-empty.js.EXPECTED
nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED
nashorn/test/script/basic/es6/const-redeclare.js.EXPECTED
nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED
nashorn/test/script/basic/es6/let-redeclare.js.EXPECTED
nashorn/test/script/basic/es6/let_const_reuse.js.EXPECTED
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java	Tue Sep 09 15:33:58 2014 +0200
@@ -71,7 +71,6 @@
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
 import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.parser.TokenType;
-import jdk.nashorn.internal.runtime.CodeInstaller;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.Source;
@@ -93,9 +92,6 @@
 
     private final DebugLogger log;
 
-    // needed only to get unique eval id
-    private final CodeInstaller<?> installer;
-
     /**
      * Constructor.
      */
@@ -143,7 +139,6 @@
             }
         });
 
-        this.installer = compiler.getCodeInstaller();
         this.log       = initLogger(compiler.getContext());
     }
 
@@ -566,16 +561,13 @@
     private String evalLocation(final IdentNode node) {
         final Source source = lc.getCurrentFunction().getSource();
         final int pos = node.position();
-        // Code installer is null when running with --compile-only, use 0 as id in that case
-        final long id = installer == null ? 0 : installer.getUniqueEvalId();
         return new StringBuilder().
             append(source.getName()).
             append('#').
             append(source.getLine(pos)).
             append(':').
             append(source.getColumn(pos)).
-            append("<eval>@").
-            append(id).
+            append("<eval>").
             toString();
     }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java	Tue Sep 09 15:33:58 2014 +0200
@@ -80,12 +80,6 @@
     public long getUniqueScriptId();
 
     /**
-     * Get next unique eval id
-     * @return unique eval id
-     */
-    public long getUniqueEvalId();
-
-    /**
      * Store a compiled script for later reuse
      * @param source the script source
      * @param mainClassName the main class name
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java	Tue Sep 09 15:33:58 2014 +0200
@@ -196,11 +196,6 @@
         }
 
         @Override
-        public long getUniqueEvalId() {
-            return context.getUniqueEvalId();
-        }
-
-        @Override
         public void storeScript(final String classInfoFile, final Source source, final String mainClassName,
                                 final Map<String,byte[]> classBytes, final Map<Integer, FunctionInitializer> initializers,
                                 final Object[] constants, final int compilationId) {
@@ -334,9 +329,6 @@
     /** Unique id for script. Used only when --loader-per-compile=false */
     private final AtomicLong uniqueScriptId;
 
-    /** Unique id for 'eval' */
-    private final AtomicLong uniqueEvalId;
-
     /** Optional class filter to use for Java classes. Can be null. */
     private final ClassFilter classFilter;
 
@@ -450,7 +442,6 @@
             this.uniqueScriptId = new AtomicLong();
         }
         this.errors    = errors;
-        this.uniqueEvalId = new AtomicLong();
 
         // if user passed -classpath option, make a class loader with that and set it as
         // thread context class loader so that script can access classes from that path.
@@ -1190,10 +1181,6 @@
              }, CREATE_LOADER_ACC_CTXT);
     }
 
-    private long getUniqueEvalId() {
-        return uniqueEvalId.getAndIncrement();
-    }
-
     private long getUniqueScriptId() {
         return uniqueScriptId.getAndIncrement();
     }
--- a/nashorn/test/script/basic/JDK-8030182_2.js	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8030182_2.js	Tue Sep 09 15:33:58 2014 +0200
@@ -41,6 +41,6 @@
 try {
     eval(str);
 } catch (e) {
-    print(e.stack.replace(/\\/g, '/').replace(/<eval>@[0-9]+/, '<eval>@<id>'));
+    print(e.stack.replace(/\\/g, '/'));
 }
 
--- a/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/JDK-8030182_2.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,3 +1,3 @@
 ReferenceError: "g" is not defined
-	at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@<id>:-1)
+	at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>:-1)
 	at <program> (test/script/basic/JDK-8030182_2.js:42)
--- a/nashorn/test/script/basic/es6/const-empty.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/const-empty.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,3 +1,3 @@
-SyntaxError: test/script/basic/es6/const-empty.js#33:4<eval>@1:2:7 Missing assignment to constant "x"
+SyntaxError: test/script/basic/es6/const-empty.js#33:4<eval>:2:7 Missing assignment to constant "x"
 const x;
        ^
--- a/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,9 +1,9 @@
-SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@2:3:8 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:3:8 Variable "x" has already been declared
     var x = {};
         ^
-SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:8 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:8 Variable "x" has already been declared
     var x = 2;
         ^
-SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:13 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:13 Variable "x" has already been declared
     function x () {}
              ^
--- a/nashorn/test/script/basic/es6/const-redeclare.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/const-redeclare.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,3 +1,3 @@
-SyntaxError: test/script/basic/es6/const-redeclare.js#33:4<eval>@1:2:6 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/const-redeclare.js#33:4<eval>:2:6 Variable "x" has already been declared
 const x = 2;
       ^
--- a/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,15 +1,15 @@
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@2:2:8 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "x" has already been declared
     let x = 2;
         ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:8 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:8 Variable "x" has already been declared
     var x = 2;
         ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:8 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "x" has already been declared
     var x = 2;
         ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:10 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:10 Variable "x" has already been declared
     const x = function (){};
           ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:13 Variable "a" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:13 Variable "a" has already been declared
     function a () {};
              ^
--- a/nashorn/test/script/basic/es6/let-redeclare.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/let-redeclare.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,3 +1,3 @@
-SyntaxError: test/script/basic/es6/let-redeclare.js#33:4<eval>@1:2:4 Variable "x" has already been declared
+SyntaxError: test/script/basic/es6/let-redeclare.js#33:4<eval>:2:4 Variable "x" has already been declared
 let x = 2;
     ^
--- a/nashorn/test/script/basic/es6/let_const_reuse.js.EXPECTED	Mon Sep 08 18:40:58 2014 +0200
+++ b/nashorn/test/script/basic/es6/let_const_reuse.js.EXPECTED	Tue Sep 09 15:33:58 2014 +0200
@@ -1,8 +1,8 @@
 ReferenceError: "a" is not defined
-SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a"
+SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>:3:8 Assignment to constant "a"
         a--
         ^
-SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a"
+SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>:3:8 Assignment to constant "a"
         a--
         ^
 ReferenceError: "a" is not defined