-
Bug
-
Resolution: Unresolved
-
P4
-
11
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When computing the TypeBounds for an AND expression, an undefined type produces java.lang.AssertionError.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the attached test case.
2. Run: java -cp <path to compiled test class> -ea Test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Test class runs to completion without an assertion failure.
ACTUAL -
An internal assertion fails:
Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for <eval>:1
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:437)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:631)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:657)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:727)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:907)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.getBest(ScriptFunctionData.java:393)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(ScriptFunctionData.java:252)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:917)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1880)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:104)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:96)
at jdk.dynalink/jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:161)
at jdk.dynalink/jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:109)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.lambda$getGuardedInvocation$0(LinkerServicesImpl.java:137)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.getWithLookupInternal(LinkerServicesImpl.java:168)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:135)
at jdk.dynalink/jdk.dynalink.DynamicLinker.relink(DynamicLinker.java:242)
at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$1$\^eval\_/0x0000000840154840.:program(<eval>:1)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:655)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:513)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:527)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:456)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:413)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:409)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:162)
at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at Test.main(Test.java:6)
Caused by: java.lang.AssertionError: object<type=Undefined>
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.<init>(CodeGenerator.java:770)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.maybeNew(CodeGenerator.java:793)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.notNarrowerThan(CodeGenerator.java:778)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadAND_OR(CodeGenerator.java:3889)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$2.enterAND(CodeGenerator.java:1087)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor.enterBinaryNode(NodeOperatorVisitor.java:111)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.BinaryNode.accept(BinaryNode.java:332)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:865)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:841)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadAndDiscard(CodeGenerator.java:3701)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.enterExpressionStatement(CodeGenerator.java:1727)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.ExpressionStatement.accept(ExpressionStatement.java:81)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Node.accept(Node.java:286)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Block.accept(Block.java:235)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Block.accept(Block.java:511)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:405)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:47)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(CompilationPhase.java:635)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:424)
... 26 more
---------- BEGIN SOURCE ----------
import javax.script.ScriptEngineManager;
public class Test {
public static void main(String[] args) throws Exception {
new ScriptEngineManager().getEngineByName("nashorn")
.eval("function x(){ var p;(p && p)}; x();");
}
}
---------- END SOURCE ----------
FREQUENCY : always
openjdk version "11.0.19" 2023-04-18
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu122.04.1, mixed mode, sharing)
A DESCRIPTION OF THE PROBLEM :
When computing the TypeBounds for an AND expression, an undefined type produces java.lang.AssertionError.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile the attached test case.
2. Run: java -cp <path to compiled test class> -ea Test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Test class runs to completion without an assertion failure.
ACTUAL -
An internal assertion fails:
Exception in thread "main" java.lang.AssertionError: Failed generating bytecode for <eval>:1
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:437)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase.apply(CompilationPhase.java:631)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.Compiler.compile(Compiler.java:657)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.compileTypeSpecialization(RecompilableScriptFunctionData.java:727)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.RecompilableScriptFunctionData.getBest(RecompilableScriptFunctionData.java:907)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.getBest(ScriptFunctionData.java:393)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.getBestInvoker(ScriptFunctionData.java:252)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.findCallMethod(ScriptFunction.java:917)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptObject.lookup(ScriptObject.java:1880)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:104)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.linker.NashornLinker.getGuardedInvocation(NashornLinker.java:96)
at jdk.dynalink/jdk.dynalink.linker.support.CompositeTypeBasedGuardingDynamicLinker.getGuardedInvocation(CompositeTypeBasedGuardingDynamicLinker.java:161)
at jdk.dynalink/jdk.dynalink.linker.support.CompositeGuardingDynamicLinker.getGuardedInvocation(CompositeGuardingDynamicLinker.java:109)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.lambda$getGuardedInvocation$0(LinkerServicesImpl.java:137)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.getWithLookupInternal(LinkerServicesImpl.java:168)
at jdk.dynalink/jdk.dynalink.LinkerServicesImpl.getGuardedInvocation(LinkerServicesImpl.java:135)
at jdk.dynalink/jdk.dynalink.DynamicLinker.relink(DynamicLinker.java:242)
at jdk.scripting.nashorn.scripts/jdk.nashorn.internal.scripts.Script$Recompilation$1$\^eval\_/0x0000000840154840.:program(<eval>:1)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunctionData.invoke(ScriptFunctionData.java:655)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptFunction.invoke(ScriptFunction.java:513)
at jdk.scripting.nashorn/jdk.nashorn.internal.runtime.ScriptRuntime.apply(ScriptRuntime.java:527)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:456)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:413)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:409)
at jdk.scripting.nashorn/jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:162)
at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:264)
at Test.main(Test.java:6)
Caused by: java.lang.AssertionError: object<type=Undefined>
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.<init>(CodeGenerator.java:770)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.maybeNew(CodeGenerator.java:793)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$TypeBounds.notNarrowerThan(CodeGenerator.java:778)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadAND_OR(CodeGenerator.java:3889)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator$2.enterAND(CodeGenerator.java:1087)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor.enterBinaryNode(NodeOperatorVisitor.java:111)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.BinaryNode.accept(BinaryNode.java:332)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:865)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadExpression(CodeGenerator.java:841)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.loadAndDiscard(CodeGenerator.java:3701)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CodeGenerator.enterExpressionStatement(CodeGenerator.java:1727)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.ExpressionStatement.accept(ExpressionStatement.java:81)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Node.accept(Node.java:286)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Block.accept(Block.java:235)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.Block.accept(Block.java:511)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:405)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextNode$Acceptor.accept(LexicalContextNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.LexicalContextExpression.accept(LexicalContextExpression.java:47)
at jdk.scripting.nashorn/jdk.nashorn.internal.ir.FunctionNode.accept(FunctionNode.java:57)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase.transformFunction(CompilationPhase.java:635)
at jdk.scripting.nashorn/jdk.nashorn.internal.codegen.CompilationPhase$BytecodeGenerationPhase.transform(CompilationPhase.java:424)
... 26 more
---------- BEGIN SOURCE ----------
import javax.script.ScriptEngineManager;
public class Test {
public static void main(String[] args) throws Exception {
new ScriptEngineManager().getEngineByName("nashorn")
.eval("function x(){ var p;(p && p)}; x();");
}
}
---------- END SOURCE ----------
FREQUENCY : always