mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-05 07:58:40 +00:00
8145669: apply2call optimized callsite fails after becoming megamorphic
Reviewed-by: jlaskey, hannesw
This commit is contained in:
parent
fe32b31552
commit
ddf5ec8ed8
@ -414,6 +414,13 @@ grant codeBase "file:/${basedir}/test/script/basic/*" {
|
||||
permission java.util.PropertyPermission "nashorn.test.*", "read";
|
||||
};
|
||||
|
||||
grant codeBase "file:/${basedir}/test/script/basic/apply_to_call/*" {
|
||||
permission java.io.FilePermission "${basedir}/test/script/-", "read";
|
||||
permission java.io.FilePermission "$${user.dir}", "read";
|
||||
permission java.util.PropertyPermission "user.dir", "read";
|
||||
permission java.util.PropertyPermission "nashorn.test.*", "read";
|
||||
};
|
||||
|
||||
grant codeBase "file:/${basedir}/test/script/basic/parser/*" {
|
||||
permission java.io.FilePermission "${basedir}/test/script/-", "read";
|
||||
permission java.io.FilePermission "$${user.dir}", "read";
|
||||
|
||||
@ -972,6 +972,13 @@ public class ScriptFunction extends ScriptObject {
|
||||
}
|
||||
}
|
||||
|
||||
// Is this an unstable callsite which was earlier apply-to-call optimized?
|
||||
// If so, earlier apply2call would have exploded arguments. We have to convert
|
||||
// that as an array again!
|
||||
if (isUnstable && NashornCallSiteDescriptor.isApplyToCall(desc)) {
|
||||
boundHandle = MH.asCollector(boundHandle, Object[].class, type.parameterCount() - 2);
|
||||
}
|
||||
|
||||
boundHandle = pairArguments(boundHandle, type);
|
||||
|
||||
if (bestInvoker.getSwitchPoints() != null) {
|
||||
|
||||
32
nashorn/test/script/basic/apply_to_call/JDK-8145669.js
Normal file
32
nashorn/test/script/basic/apply_to_call/JDK-8145669.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JDK-8145669: apply2call optimized callsite fails after becoming megamorphic
|
||||
*
|
||||
* @test
|
||||
* @option --unstable-relink-threshold=1
|
||||
* @run
|
||||
*/
|
||||
|
||||
load(__DIR__ + "apply_to_call2.js");
|
||||
@ -0,0 +1,8 @@
|
||||
start
|
||||
4711
|
||||
23
|
||||
17
|
||||
Overwriting call now
|
||||
1
|
||||
2
|
||||
3
|
||||
32
nashorn/test/script/basic/apply_to_call/JDK-8145669_2.js
Normal file
32
nashorn/test/script/basic/apply_to_call/JDK-8145669_2.js
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
/**
|
||||
* JDK-8145669: apply2call optimized callsite fails after becoming megamorphic
|
||||
*
|
||||
* @test
|
||||
* @option --unstable-relink-threshold=1
|
||||
* @run
|
||||
*/
|
||||
|
||||
load(__DIR__ + "apply_to_call_varargs.js");
|
||||
@ -0,0 +1,66 @@
|
||||
[red=0, green=255, blue=255]
|
||||
undefined
|
||||
[red=1, green=255, blue=255]
|
||||
undefined
|
||||
[red=2, green=255, blue=255]
|
||||
undefined
|
||||
[red=3, green=255, blue=255]
|
||||
undefined
|
||||
[red=4, green=255, blue=255]
|
||||
undefined
|
||||
[red=5, green=255, blue=255]
|
||||
undefined
|
||||
[red=6, green=255, blue=255]
|
||||
undefined
|
||||
[red=7, green=255, blue=255]
|
||||
undefined
|
||||
[red=8, green=255, blue=255]
|
||||
undefined
|
||||
[red=9, green=255, blue=255]
|
||||
undefined
|
||||
[red=10, green=255, blue=255]
|
||||
undefined
|
||||
[red=11, green=255, blue=255]
|
||||
undefined
|
||||
[red=12, green=255, blue=255]
|
||||
undefined
|
||||
[red=13, green=255, blue=255]
|
||||
undefined
|
||||
[red=14, green=255, blue=255]
|
||||
undefined
|
||||
[red=15, green=255, blue=255]
|
||||
undefined
|
||||
Swapping out call
|
||||
[red=0, green=255, blue=255]
|
||||
undefined
|
||||
[red=1, green=255, blue=255]
|
||||
undefined
|
||||
[red=2, green=255, blue=255]
|
||||
undefined
|
||||
[red=3, green=255, blue=255]
|
||||
undefined
|
||||
[red=4, green=255, blue=255]
|
||||
undefined
|
||||
[red=5, green=255, blue=255]
|
||||
undefined
|
||||
[red=6, green=255, blue=255]
|
||||
undefined
|
||||
[red=7, green=255, blue=255]
|
||||
undefined
|
||||
[red=8, green=255, blue=255]
|
||||
undefined
|
||||
[red=9, green=255, blue=255]
|
||||
undefined
|
||||
[red=10, green=255, blue=255]
|
||||
undefined
|
||||
[red=11, green=255, blue=255]
|
||||
undefined
|
||||
[red=12, green=255, blue=255]
|
||||
undefined
|
||||
[red=13, green=255, blue=255]
|
||||
undefined
|
||||
[red=14, green=255, blue=255]
|
||||
undefined
|
||||
[red=15, green=255, blue=255]
|
||||
undefined
|
||||
All done!
|
||||
Loading…
x
Reference in New Issue
Block a user