-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
579 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
test/hotspot/jtreg/compiler/controldependency/TestAntiDependencyForPinnedLoads.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2024, 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. | ||
*/ | ||
|
||
/** | ||
* @test | ||
* @bug 8337066 | ||
* @summary Test that MergeMem is skipped when looking for stores | ||
* @run main/othervm -Xbatch -XX:-TieredCompilation | ||
* -XX:CompileCommand=compileonly,java.lang.StringUTF16::reverse | ||
* compiler.controldependency.TestAntiDependencyForPinnedLoads | ||
*/ | ||
|
||
package compiler.controldependency; | ||
|
||
public class TestAntiDependencyForPinnedLoads { | ||
public static void main(String[] args) { | ||
for(int i = 0; i < 50_000; i++) { | ||
String str = "YYYY年MM月DD日"; | ||
StringBuffer strBuffer = new StringBuffer(str); | ||
String revStr = strBuffer.reverse().toString(); | ||
if (!revStr.equals("日DD月MM年YYYY")) throw new InternalError("FAIL"); | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
test/hotspot/jtreg/compiler/types/TestBadMemSliceWithInterfaces.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* Copyright (c) 2024, Red Hat, Inc. 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. | ||
*/ | ||
|
||
/** | ||
* @test | ||
* @bug 8340214 | ||
* @summary C2 compilation asserts with "no node with a side effect" in PhaseIdealLoop::try_sink_out_of_loop | ||
* | ||
* @run main/othervm -XX:-BackgroundCompilation TestBadMemSliceWithInterfaces | ||
* | ||
*/ | ||
|
||
public class TestBadMemSliceWithInterfaces { | ||
public static void main(String[] args) { | ||
B b = new B(); | ||
C c = new C(); | ||
for (int i = 0; i < 20_000; i++) { | ||
test1(b, c, true); | ||
test1(b, c, false); | ||
b.field = 0; | ||
c.field = 0; | ||
int res = test2(b, c, true); | ||
if (res != 42) { | ||
throw new RuntimeException("incorrect result " + res); | ||
} | ||
res = test2(b, c, false); | ||
if (res != 42) { | ||
throw new RuntimeException("incorrect result " + res); | ||
} | ||
} | ||
} | ||
|
||
private static void test1(B b, C c, boolean flag) { | ||
A a; | ||
if (flag) { | ||
a = b; | ||
} else { | ||
a = c; | ||
} | ||
for (int i = 0; i < 1000; i++) { | ||
a.field = 42; | ||
} | ||
} | ||
|
||
private static int test2(B b, C c, boolean flag) { | ||
A a; | ||
if (flag) { | ||
a = b; | ||
} else { | ||
a = c; | ||
} | ||
int v = 0; | ||
for (int i = 0; i < 2; i++) { | ||
v += a.field; | ||
a.field = 42; | ||
} | ||
return v; | ||
} | ||
|
||
interface I { | ||
void m(); | ||
} | ||
|
||
static class A { | ||
int field; | ||
} | ||
|
||
static class B extends A implements I { | ||
@Override | ||
public void m() { | ||
|
||
} | ||
} | ||
|
||
static class C extends A implements I { | ||
@Override | ||
public void m() { | ||
|
||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
test/hotspot/jtreg/runtime/reflect/ComponentTypeFieldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2024, 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. | ||
*/ | ||
|
||
/* | ||
* @test | ||
* @bug 8337622 | ||
* @summary (reflect) java.lang.Class componentType field not found. | ||
* @library /test/lib | ||
* @modules java.base/java.lang:open | ||
* @run main ComponentTypeFieldTest | ||
*/ | ||
|
||
import java.lang.reflect.Field; | ||
import static jdk.test.lib.Asserts.*; | ||
|
||
public class ComponentTypeFieldTest { | ||
|
||
public static void main(String[] args) throws Exception { | ||
Field f = Class.class.getDeclaredField("componentType"); | ||
f.setAccessible(true); | ||
Object val = f.get(Runnable.class); | ||
assertTrue(val == null); | ||
System.out.println("val is " + val); | ||
|
||
Object arrayVal = f.get(Integer[].class); | ||
System.out.println("val is " + arrayVal); | ||
String arrayValString = arrayVal.toString(); | ||
assertTrue(arrayValString.equals("class java.lang.Integer")); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.