Tue, 09 Sep 2014 15:33:58 +0200
8057930: remove eval ID
Reviewed-by: hannesw, sundar
1.1 --- a/src/jdk/nashorn/internal/codegen/Lower.java Tue Sep 09 11:14:12 2014 -0700 1.2 +++ b/src/jdk/nashorn/internal/codegen/Lower.java Tue Sep 09 15:33:58 2014 +0200 1.3 @@ -71,7 +71,6 @@ 1.4 import jdk.nashorn.internal.ir.visitor.NodeVisitor; 1.5 import jdk.nashorn.internal.parser.Token; 1.6 import jdk.nashorn.internal.parser.TokenType; 1.7 -import jdk.nashorn.internal.runtime.CodeInstaller; 1.8 import jdk.nashorn.internal.runtime.Context; 1.9 import jdk.nashorn.internal.runtime.JSType; 1.10 import jdk.nashorn.internal.runtime.Source; 1.11 @@ -93,9 +92,6 @@ 1.12 1.13 private final DebugLogger log; 1.14 1.15 - // needed only to get unique eval id 1.16 - private final CodeInstaller<?> installer; 1.17 - 1.18 /** 1.19 * Constructor. 1.20 */ 1.21 @@ -143,7 +139,6 @@ 1.22 } 1.23 }); 1.24 1.25 - this.installer = compiler.getCodeInstaller(); 1.26 this.log = initLogger(compiler.getContext()); 1.27 } 1.28 1.29 @@ -566,16 +561,13 @@ 1.30 private String evalLocation(final IdentNode node) { 1.31 final Source source = lc.getCurrentFunction().getSource(); 1.32 final int pos = node.position(); 1.33 - // Code installer is null when running with --compile-only, use 0 as id in that case 1.34 - final long id = installer == null ? 0 : installer.getUniqueEvalId(); 1.35 return new StringBuilder(). 1.36 append(source.getName()). 1.37 append('#'). 1.38 append(source.getLine(pos)). 1.39 append(':'). 1.40 append(source.getColumn(pos)). 1.41 - append("<eval>@"). 1.42 - append(id). 1.43 + append("<eval>"). 1.44 toString(); 1.45 } 1.46
2.1 --- a/src/jdk/nashorn/internal/runtime/CodeInstaller.java Tue Sep 09 11:14:12 2014 -0700 2.2 +++ b/src/jdk/nashorn/internal/runtime/CodeInstaller.java Tue Sep 09 15:33:58 2014 +0200 2.3 @@ -80,12 +80,6 @@ 2.4 public long getUniqueScriptId(); 2.5 2.6 /** 2.7 - * Get next unique eval id 2.8 - * @return unique eval id 2.9 - */ 2.10 - public long getUniqueEvalId(); 2.11 - 2.12 - /** 2.13 * Store a compiled script for later reuse 2.14 * @param source the script source 2.15 * @param mainClassName the main class name
3.1 --- a/src/jdk/nashorn/internal/runtime/Context.java Tue Sep 09 11:14:12 2014 -0700 3.2 +++ b/src/jdk/nashorn/internal/runtime/Context.java Tue Sep 09 15:33:58 2014 +0200 3.3 @@ -196,11 +196,6 @@ 3.4 } 3.5 3.6 @Override 3.7 - public long getUniqueEvalId() { 3.8 - return context.getUniqueEvalId(); 3.9 - } 3.10 - 3.11 - @Override 3.12 public void storeScript(final String classInfoFile, final Source source, final String mainClassName, 3.13 final Map<String,byte[]> classBytes, final Map<Integer, FunctionInitializer> initializers, 3.14 final Object[] constants, final int compilationId) { 3.15 @@ -334,9 +329,6 @@ 3.16 /** Unique id for script. Used only when --loader-per-compile=false */ 3.17 private final AtomicLong uniqueScriptId; 3.18 3.19 - /** Unique id for 'eval' */ 3.20 - private final AtomicLong uniqueEvalId; 3.21 - 3.22 /** Optional class filter to use for Java classes. Can be null. */ 3.23 private final ClassFilter classFilter; 3.24 3.25 @@ -450,7 +442,6 @@ 3.26 this.uniqueScriptId = new AtomicLong(); 3.27 } 3.28 this.errors = errors; 3.29 - this.uniqueEvalId = new AtomicLong(); 3.30 3.31 // if user passed -classpath option, make a class loader with that and set it as 3.32 // thread context class loader so that script can access classes from that path. 3.33 @@ -1190,10 +1181,6 @@ 3.34 }, CREATE_LOADER_ACC_CTXT); 3.35 } 3.36 3.37 - private long getUniqueEvalId() { 3.38 - return uniqueEvalId.getAndIncrement(); 3.39 - } 3.40 - 3.41 private long getUniqueScriptId() { 3.42 return uniqueScriptId.getAndIncrement(); 3.43 }
4.1 --- a/test/script/basic/JDK-8030182_2.js Tue Sep 09 11:14:12 2014 -0700 4.2 +++ b/test/script/basic/JDK-8030182_2.js Tue Sep 09 15:33:58 2014 +0200 4.3 @@ -41,6 +41,6 @@ 4.4 try { 4.5 eval(str); 4.6 } catch (e) { 4.7 - print(e.stack.replace(/\\/g, '/').replace(/<eval>@[0-9]+/, '<eval>@<id>')); 4.8 + print(e.stack.replace(/\\/g, '/')); 4.9 } 4.10
5.1 --- a/test/script/basic/JDK-8030182_2.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 5.2 +++ b/test/script/basic/JDK-8030182_2.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 5.3 @@ -1,3 +1,3 @@ 5.4 ReferenceError: "g" is not defined 5.5 - at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>@<id>:-1) 5.6 + at <program> (test/script/basic/JDK-8030182_2.js#42:4<eval>:-1) 5.7 at <program> (test/script/basic/JDK-8030182_2.js:42)
6.1 --- a/test/script/basic/es6/const-empty.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 6.2 +++ b/test/script/basic/es6/const-empty.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 6.3 @@ -1,3 +1,3 @@ 6.4 -SyntaxError: test/script/basic/es6/const-empty.js#33:4<eval>@1:2:7 Missing assignment to constant "x" 6.5 +SyntaxError: test/script/basic/es6/const-empty.js#33:4<eval>:2:7 Missing assignment to constant "x" 6.6 const x; 6.7 ^
7.1 --- a/test/script/basic/es6/const-redeclare-extra.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 7.2 +++ b/test/script/basic/es6/const-redeclare-extra.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 7.3 @@ -1,9 +1,9 @@ 7.4 -SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@2:3:8 Variable "x" has already been declared 7.5 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:3:8 Variable "x" has already been declared 7.6 var x = {}; 7.7 ^ 7.8 -SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:8 Variable "x" has already been declared 7.9 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:8 Variable "x" has already been declared 7.10 var x = 2; 7.11 ^ 7.12 -SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>@4:2:13 Variable "x" has already been declared 7.13 +SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:13 Variable "x" has already been declared 7.14 function x () {} 7.15 ^
8.1 --- a/test/script/basic/es6/const-redeclare.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 8.2 +++ b/test/script/basic/es6/const-redeclare.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 8.3 @@ -1,3 +1,3 @@ 8.4 -SyntaxError: test/script/basic/es6/const-redeclare.js#33:4<eval>@1:2:6 Variable "x" has already been declared 8.5 +SyntaxError: test/script/basic/es6/const-redeclare.js#33:4<eval>:2:6 Variable "x" has already been declared 8.6 const x = 2; 8.7 ^
9.1 --- a/test/script/basic/es6/let-redeclare-extra.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 9.2 +++ b/test/script/basic/es6/let-redeclare-extra.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 9.3 @@ -1,15 +1,15 @@ 9.4 -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@2:2:8 Variable "x" has already been declared 9.5 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "x" has already been declared 9.6 let x = 2; 9.7 ^ 9.8 -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:8 Variable "x" has already been declared 9.9 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:8 Variable "x" has already been declared 9.10 var x = 2; 9.11 ^ 9.12 -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:8 Variable "x" has already been declared 9.13 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "x" has already been declared 9.14 var x = 2; 9.15 ^ 9.16 -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:2:10 Variable "x" has already been declared 9.17 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:10 Variable "x" has already been declared 9.18 const x = function (){}; 9.19 ^ 9.20 -SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>@4:3:13 Variable "a" has already been declared 9.21 +SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:13 Variable "a" has already been declared 9.22 function a () {}; 9.23 ^
10.1 --- a/test/script/basic/es6/let-redeclare.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 10.2 +++ b/test/script/basic/es6/let-redeclare.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 10.3 @@ -1,3 +1,3 @@ 10.4 -SyntaxError: test/script/basic/es6/let-redeclare.js#33:4<eval>@1:2:4 Variable "x" has already been declared 10.5 +SyntaxError: test/script/basic/es6/let-redeclare.js#33:4<eval>:2:4 Variable "x" has already been declared 10.6 let x = 2; 10.7 ^
11.1 --- a/test/script/basic/es6/let_const_reuse.js.EXPECTED Tue Sep 09 11:14:12 2014 -0700 11.2 +++ b/test/script/basic/es6/let_const_reuse.js.EXPECTED Tue Sep 09 15:33:58 2014 +0200 11.3 @@ -1,8 +1,8 @@ 11.4 ReferenceError: "a" is not defined 11.5 -SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a" 11.6 +SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>:3:8 Assignment to constant "a" 11.7 a-- 11.8 ^ 11.9 -SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>@4:3:8 Assignment to constant "a" 11.10 +SyntaxError: test/script/basic/es6/let_const_reuse.js#35:9<eval>:3:8 Assignment to constant "a" 11.11 a-- 11.12 ^ 11.13 ReferenceError: "a" is not defined