8242921: test/hotspot/jtreg/runtime/CompactStrings/TestMethodNames.java uses nashorn script engine
Put method names in a .jcod file instead of using nashorn to generate them Reviewed-by: lfoltan, coleenp
This commit is contained in:
parent
09e8b7ca4d
commit
941643ece9
test/hotspot/jtreg
@ -95,7 +95,6 @@ gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java 8241293 macosx-x64
|
|||||||
|
|
||||||
runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
|
runtime/jni/terminatedThread/TestTerminatedThread.java 8219652 aix-ppc64
|
||||||
runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all
|
runtime/ReservedStack/ReservedStackTest.java 8231031 generic-all
|
||||||
runtime/CompactStrings/TestMethodNames.java 8242921 generic-all
|
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -21,23 +21,19 @@
|
|||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import javax.script.*;
|
|
||||||
import java.util.function.*;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @test
|
* @test
|
||||||
* @bug 8164612
|
* @bug 8164612
|
||||||
* @summary Test method names containing Latin-1 supplement characters.
|
* @summary Test method names containing Latin-1 supplement characters.
|
||||||
|
* @compile methodNames.jcod
|
||||||
* @run main/othervm -XX:+CompactStrings TestMethodNames
|
* @run main/othervm -XX:+CompactStrings TestMethodNames
|
||||||
* @run main/othervm -XX:-CompactStrings TestMethodNames
|
* @run main/othervm -XX:-CompactStrings TestMethodNames
|
||||||
*/
|
*/
|
||||||
public class TestMethodNames {
|
public class TestMethodNames {
|
||||||
public static void main(String[] args) throws Exception {
|
|
||||||
ScriptEngineManager m = new ScriptEngineManager();
|
|
||||||
ScriptEngine e = m.getEngineByName("nashorn");
|
|
||||||
|
|
||||||
e.eval("({get \"\0\"(){}})[\"\0\"]");
|
public static void main(String[] args) throws Exception {
|
||||||
e.eval("({get \"\\x80\"(){}})[\"\\x80\"]");
|
// Load class containing methods with names containing Latin-1
|
||||||
e.eval("({get \"\\xff\"(){}})[\"\\xff\"]");
|
// supplement characters.
|
||||||
|
Class newClass = Class.forName("methodNames");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
187
test/hotspot/jtreg/runtime/CompactStrings/methodNames.jcod
Normal file
187
test/hotspot/jtreg/runtime/CompactStrings/methodNames.jcod
Normal file
@ -0,0 +1,187 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2020, 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This .jcod file contains three methods containing Latin-1 supplement
|
||||||
|
// characters in their names. The method names are:
|
||||||
|
// "get \ufffd\ufffd"
|
||||||
|
// "get \u0080"
|
||||||
|
// "get \u00ff"
|
||||||
|
class methodNames {
|
||||||
|
0xCAFEBABE;
|
||||||
|
0; // minor version
|
||||||
|
59; // version
|
||||||
|
[32] { // Constant Pool
|
||||||
|
; // first element is empty
|
||||||
|
Method #2 #3; // #1 at 0x0A
|
||||||
|
class #4; // #2 at 0x0F
|
||||||
|
NameAndType #5 #6; // #3 at 0x12
|
||||||
|
Utf8 "java/lang/Object"; // #4 at 0x17
|
||||||
|
Utf8 "<init>"; // #5 at 0x2A
|
||||||
|
Utf8 "()V"; // #6 at 0x33
|
||||||
|
Field #8 #9; // #7 at 0x39
|
||||||
|
class #10; // #8 at 0x3E
|
||||||
|
NameAndType #11 #12; // #9 at 0x41
|
||||||
|
Utf8 "java/lang/System"; // #10 at 0x46
|
||||||
|
Utf8 "out"; // #11 at 0x59
|
||||||
|
Utf8 "Ljava/io/PrintStream;"; // #12 at 0x5F
|
||||||
|
String #14; // #13 at 0x77
|
||||||
|
Utf8 "get \ufffd\ufffd"; // #14 at 0x7A
|
||||||
|
Method #16 #17; // #15 at 0x7F
|
||||||
|
class #18; // #16 at 0x84
|
||||||
|
NameAndType #19 #20; // #17 at 0x87
|
||||||
|
Utf8 "java/io/PrintStream"; // #18 at 0x8C
|
||||||
|
Utf8 "println"; // #19 at 0xA2
|
||||||
|
Utf8 "(Ljava/lang/String;)V"; // #20 at 0xAC
|
||||||
|
String #22; // #21 at 0xC4
|
||||||
|
Utf8 "get \u0080"; // #22 at 0xC7
|
||||||
|
String #24; // #23 at 0xCC
|
||||||
|
Utf8 "get \u00ff"; // #24 at 0xCF
|
||||||
|
class #26; // #25 at 0xD4
|
||||||
|
Utf8 "methodNames"; // #26 at 0xD7
|
||||||
|
Utf8 "Code"; // #27 at 0xDC
|
||||||
|
Utf8 "LineNumberTable"; // #28 at 0xE3
|
||||||
|
Utf8 "(Ljava/lang/Object;)Ljava/lang/Object;"; // #29 at 0xF5
|
||||||
|
Utf8 "SourceFile"; // #30 at 0x011E
|
||||||
|
Utf8 "methodNames.java"; // #31 at 0x012B
|
||||||
|
} // Constant Pool
|
||||||
|
|
||||||
|
0x0021; // access [ ACC_PUBLIC ACC_SUPER ]
|
||||||
|
#25;// this_cpx
|
||||||
|
#2;// super_cpx
|
||||||
|
|
||||||
|
[0] { // Interfaces
|
||||||
|
} // Interfaces
|
||||||
|
|
||||||
|
[0] { // fields
|
||||||
|
} // fields
|
||||||
|
|
||||||
|
[4] { // methods
|
||||||
|
{ // Member at 0x0141
|
||||||
|
0x0001; // access
|
||||||
|
#5; // name_cpx
|
||||||
|
#6; // sig_cpx
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#27, 29) { // Code at 0x0149
|
||||||
|
1; // max_stack
|
||||||
|
1; // max_locals
|
||||||
|
Bytes[5]{
|
||||||
|
0x2AB70001B1;
|
||||||
|
}
|
||||||
|
[0] { // Traps
|
||||||
|
} // end Traps
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#28, 6) { // LineNumberTable at 0x0160
|
||||||
|
[1] { // LineNumberTable
|
||||||
|
0 1; // at 0x016C
|
||||||
|
}
|
||||||
|
} // end LineNumberTable
|
||||||
|
} // Attributes
|
||||||
|
} // end Code
|
||||||
|
} // Attributes
|
||||||
|
} // Member
|
||||||
|
;
|
||||||
|
{ // Member at 0x016C
|
||||||
|
0x0001; // access
|
||||||
|
#14; // name_cpx
|
||||||
|
#29; // sig_cpx
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#27, 38) { // Code at 0x0174
|
||||||
|
2; // max_stack
|
||||||
|
2; // max_locals
|
||||||
|
Bytes[10]{
|
||||||
|
0xB20007120DB6000F;
|
||||||
|
0x2BB0;
|
||||||
|
}
|
||||||
|
[0] { // Traps
|
||||||
|
} // end Traps
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#28, 10) { // LineNumberTable at 0x0190
|
||||||
|
[2] { // LineNumberTable
|
||||||
|
0 4; // at 0x019C
|
||||||
|
8 5; // at 0x01A0
|
||||||
|
}
|
||||||
|
} // end LineNumberTable
|
||||||
|
} // Attributes
|
||||||
|
} // end Code
|
||||||
|
} // Attributes
|
||||||
|
} // Member
|
||||||
|
;
|
||||||
|
{ // Member at 0x01A0
|
||||||
|
0x0001; // access
|
||||||
|
#22; // name_cpx
|
||||||
|
#29; // sig_cpx
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#27, 38) { // Code at 0x01A8
|
||||||
|
2; // max_stack
|
||||||
|
2; // max_locals
|
||||||
|
Bytes[10]{
|
||||||
|
0xB200071215B6000F;
|
||||||
|
0x2BB0;
|
||||||
|
}
|
||||||
|
[0] { // Traps
|
||||||
|
} // end Traps
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#28, 10) { // LineNumberTable at 0x01C4
|
||||||
|
[2] { // LineNumberTable
|
||||||
|
0 9; // at 0x01D0
|
||||||
|
8 10; // at 0x01D4
|
||||||
|
}
|
||||||
|
} // end LineNumberTable
|
||||||
|
} // Attributes
|
||||||
|
} // end Code
|
||||||
|
} // Attributes
|
||||||
|
} // Member
|
||||||
|
;
|
||||||
|
{ // Member at 0x01D4
|
||||||
|
0x0001; // access
|
||||||
|
#24; // name_cpx
|
||||||
|
#29; // sig_cpx
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#27, 38) { // Code at 0x01DC
|
||||||
|
2; // max_stack
|
||||||
|
2; // max_locals
|
||||||
|
Bytes[10]{
|
||||||
|
0xB200071217B6000F;
|
||||||
|
0x2BB0;
|
||||||
|
}
|
||||||
|
[0] { // Traps
|
||||||
|
} // end Traps
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#28, 10) { // LineNumberTable at 0x01F8
|
||||||
|
[2] { // LineNumberTable
|
||||||
|
0 14; // at 0x0204
|
||||||
|
8 15; // at 0x0208
|
||||||
|
}
|
||||||
|
} // end LineNumberTable
|
||||||
|
} // Attributes
|
||||||
|
} // end Code
|
||||||
|
} // Attributes
|
||||||
|
} // Member
|
||||||
|
} // methods
|
||||||
|
|
||||||
|
[1] { // Attributes
|
||||||
|
Attr(#30, 2) { // SourceFile at 0x020A
|
||||||
|
#31;
|
||||||
|
} // end SourceFile
|
||||||
|
} // Attributes
|
||||||
|
} // end class methodNames
|
Loading…
x
Reference in New Issue
Block a user