From 966a42f9b39840ab9eab6dc3cdc6fdd69abf9873 Mon Sep 17 00:00:00 2001
From: Chris Plummer
Date: Tue, 12 Mar 2024 20:54:18 +0000
Subject: [PATCH 01/58] 8324868: debug agent does not properly handle
interrupts of a virtual thread
Reviewed-by: sspitsyn, amenkov
---
.../share/native/libjdwp/threadControl.c | 131 ++++------
test/jdk/ProblemList-Xcomp.txt | 3 +-
test/jdk/com/sun/jdi/InterruptHangTest.java | 233 ++++++++++++++----
3 files changed, 241 insertions(+), 126 deletions(-)
diff --git a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c
index 5628f8b44db43..00c34844c986a 100644
--- a/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c
+++ b/src/jdk.jdwp.agent/share/native/libjdwp/threadControl.c
@@ -1549,7 +1549,7 @@ threadControl_resumeAll(void)
* resume any vthread with a suspendCount == 1, and we want to ignore
* vthreads with a suspendCount > 0. Therefore we don't want
* ResumeAllVirtualThreads resuming these vthreads. We must first
- * build a list of them to pass to as the exclude list.
+ * build a list of them to pass as the exclude list.
*/
enumerateOverThreadList(env, &runningVThreads, excludeCountHelper,
&excludeCnt);
@@ -2117,28 +2117,25 @@ threadControl_onEventHandlerEntry(jbyte sessionID, EventInfo *evinfo, jobject cu
}
static void
-doPendingTasks(JNIEnv *env, ThreadNode *node)
+doPendingTasks(JNIEnv *env, jthread thread, int pendingInterrupt, jobject pendingStop)
{
/*
- * Take care of any pending interrupts/stops, and clear out
- * info on pending interrupts/stops.
+ * Take care of any pending interrupts/stops.
*/
- if (node->pendingInterrupt) {
+ if (pendingInterrupt) {
JVMTI_FUNC_PTR(gdata->jvmti,InterruptThread)
- (gdata->jvmti, node->thread);
+ (gdata->jvmti, thread);
/*
* TO DO: Log error
*/
- node->pendingInterrupt = JNI_FALSE;
}
- if (node->pendingStop != NULL) {
+ if (pendingStop != NULL) {
JVMTI_FUNC_PTR(gdata->jvmti,StopThread)
- (gdata->jvmti, node->thread, node->pendingStop);
+ (gdata->jvmti, thread, pendingStop);
/*
* TO DO: Log error
*/
- tossGlobalRef(env, &(node->pendingStop));
}
}
@@ -2147,35 +2144,44 @@ threadControl_onEventHandlerExit(EventIndex ei, jthread thread,
struct bag *eventBag)
{
ThreadNode *node;
+ JNIEnv *env = getEnv();
log_debugee_location("threadControl_onEventHandlerExit()", thread, NULL, 0);
if (ei == EI_THREAD_END) {
- eventHandler_lock(); /* for proper lock order */
- }
- debugMonitorEnter(threadLock);
-
- node = findRunningThread(thread);
- if (node == NULL) {
- EXIT_ERROR(AGENT_ERROR_NULL_POINTER,"thread list corrupted");
- } else {
- JNIEnv *env;
-
- env = getEnv();
- if (ei == EI_THREAD_END) {
- removeThread(env, node);
- node = NULL; /* has been freed */
- } else {
- /* No point in doing this if the thread is about to die.*/
- doPendingTasks(env, node);
- node->eventBag = eventBag;
- node->current_ei = 0;
+ eventHandler_lock(); /* for proper lock order - see removeThread() call below */
+ debugMonitorEnter(threadLock);
+ node = findRunningThread(thread);
+ if (node == NULL) {
+ EXIT_ERROR(AGENT_ERROR_NULL_POINTER,"thread list corrupted");
}
- }
-
- debugMonitorExit(threadLock);
- if (ei == EI_THREAD_END) {
+ removeThread(env, node); // Grabs handlerLock, thus the reason for first grabbing it above.
+ node = NULL; // We exiting the threadLock. No longer safe to access.
+ debugMonitorExit(threadLock);
eventHandler_unlock();
+ } else {
+ debugMonitorEnter(threadLock);
+ node = findRunningThread(thread);
+ if (node == NULL) {
+ EXIT_ERROR(AGENT_ERROR_NULL_POINTER,"thread list corrupted");
+ }
+ /* No need to do the following if the thread is about to die.*/
+ int pendingInterrupt = node->pendingInterrupt;
+ jobject pendingStop = node->pendingStop;
+ jthread thread = node->thread;
+ node->pendingInterrupt = JNI_FALSE;
+ node->pendingStop = NULL;
+ node->eventBag = eventBag;
+ node->current_ei = 0;
+ node = NULL; // We exiting the threadLock. No longer safe to access.
+ // doPendingTasks() may do an upcall to java, and we don't want to hold any
+ // locks when doing that. Thus we got all our node updates done first
+ // and can now exit the threadLock.
+ debugMonitorExit(threadLock);
+ doPendingTasks(env, thread, pendingInterrupt, pendingStop);
+ if (pendingStop != NULL) {
+ tossGlobalRef(env, &pendingStop);
+ }
}
}
@@ -2219,29 +2225,9 @@ threadControl_applicationThreadStatus(jthread thread,
jvmtiError
threadControl_interrupt(jthread thread)
{
- ThreadNode *node;
- jvmtiError error;
-
- error = JVMTI_ERROR_NONE;
-
log_debugee_location("threadControl_interrupt()", thread, NULL, 0);
- debugMonitorEnter(threadLock);
-
- node = findThread(&runningThreads, thread);
- if ((node == NULL) || !HANDLING_EVENT(node)) {
- error = JVMTI_FUNC_PTR(gdata->jvmti,InterruptThread)
- (gdata->jvmti, thread);
- } else {
- /*
- * Hold any interrupts until after the event is processed.
- */
- node->pendingInterrupt = JNI_TRUE;
- }
-
- debugMonitorExit(threadLock);
-
- return error;
+ return JVMTI_FUNC_PTR(gdata->jvmti,InterruptThread)(gdata->jvmti, thread);
}
void
@@ -2308,26 +2294,20 @@ threadControl_saveCLEInfo(JNIEnv *env, jthread thread, EventIndex ei,
debugMonitorExit(threadLock);
}
+/*
+ * Support for getting an interrupt in an application thread while doing
+ * a debugMonitorWait().
+ */
void
threadControl_setPendingInterrupt(jthread thread)
{
ThreadNode *node;
- /*
- * vmTestbase/nsk/jdb/kill/kill001/kill001.java seems to be the only code
- * that triggers this function. Is uses ThreadReference.Stop.
- *
- * Since ThreadReference.Stop is not supported for vthreads, we should never
- * get here with a vthread.
- */
- JDI_ASSERT(!isVThread(thread));
-
debugMonitorEnter(threadLock);
- node = findThread(&runningThreads, thread);
- if (node != NULL) {
- node->pendingInterrupt = JNI_TRUE;
- }
+ node = findRunningThread(thread);
+ JDI_ASSERT(node != NULL);
+ node->pendingInterrupt = JNI_TRUE;
debugMonitorExit(threadLock);
}
@@ -2512,23 +2492,13 @@ threadControl_setEventMode(jvmtiEventMode mode, EventIndex ei, jthread thread)
}
/*
- * Returns the current thread, if the thread has generated at least
- * one event, and has not generated a thread end event.
+ * Returns the current thread.
*/
jthread
threadControl_currentThread(void)
{
- jthread thread;
-
- debugMonitorEnter(threadLock);
- {
- ThreadNode *node;
-
- node = findThread(&runningThreads, NULL);
- thread = (node == NULL) ? NULL : node->thread;
- }
- debugMonitorExit(threadLock);
-
+ jthread thread = NULL;
+ jvmtiError error = JVMTI_FUNC_PTR(gdata->jvmti,GetCurrentThread)(gdata->jvmti, &thread);
return thread;
}
@@ -2670,6 +2640,7 @@ dumpThread(ThreadNode *node) {
tty_message("\tthreadState: 0x%x", getThreadState(node));
tty_message("\ttoBeResumed: %d", node->toBeResumed);
tty_message("\tis_vthread: %d", node->is_vthread);
+ tty_message("\tpendingInterrupt: %d", node->pendingInterrupt);
tty_message("\tcurrentInvoke.pending: %d", node->currentInvoke.pending);
tty_message("\tcurrentInvoke.started: %d", node->currentInvoke.started);
tty_message("\tcurrentInvoke.available: %d", node->currentInvoke.available);
diff --git a/test/jdk/ProblemList-Xcomp.txt b/test/jdk/ProblemList-Xcomp.txt
index 5f7f4a912aaa8..6e8953c521e87 100644
--- a/test/jdk/ProblemList-Xcomp.txt
+++ b/test/jdk/ProblemList-Xcomp.txt
@@ -27,5 +27,6 @@
#
#############################################################################
-java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
+java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
java/lang/management/MemoryMXBean/CollectionUsageThreshold.java 8318668 generic-all
+com/sun/jdi/InterruptHangTest.java 8306679,8043571 generic-all
diff --git a/test/jdk/com/sun/jdi/InterruptHangTest.java b/test/jdk/com/sun/jdi/InterruptHangTest.java
index e2c238eee4954..a8062586d27e0 100644
--- a/test/jdk/com/sun/jdi/InterruptHangTest.java
+++ b/test/jdk/com/sun/jdi/InterruptHangTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -28,76 +28,175 @@
/**
* @test
* @bug 6459476
- * @summary Debuggee is blocked, looks like running
+ * @summary Test interrupting debuggee with single stepping enable
* @author jjh
*
* @run build TestScaffold VMConnection TargetListener TargetAdapter
* @run compile -g InterruptHangTest.java
- * @run driver InterruptHangTest
+ * @run driver InterruptHangTest precise
+ * @run driver InterruptHangTest aggressive
+ * @run driver InterruptHangTest remote
*/
/**
- * Debuggee has two threads. Debugger keeps stepping in
- * the first thread. The second thread keeps interrupting the first
- * thread. If a long time goes by with the debugger not getting
- * a step event, the test fails.
+ * The debuggee loops in the main thread while the debugger has single stepping
+ * enabled for the debuggee's main thread. The main thread is repeatedly
+ * interrupted while it is looping. If a long time goes by with the debugger
+ * not getting a single step event, the test fails.
+ *
+ * Interrupts are generated in 3 difference modes:
+ * precise - The debuggee creates a 2nd thread that repeatedly calls
+ * Thread.interrupt() on the main thread, but does so in a controlled
+ * fashion that allows to test to verify that every interrupt is
+ * received and handled.
+ * aggressive - The debuggee creates a 2nd thread that repeatedly calls
+ * Thread.interrupt() on the main thread, but does so at a high pace
+ * and without any coordination with the main thread. Because of
+ * this it is not possible to account for all the interrupts since some
+ * might be done before the previous interrupt is handled.
+ * remote - Much like the "aggressive" mode, except interrupts are remotely
+ * generated by the debugger using ThreadReference.interrupt(). There
+ * is no "precise" mode for remotely generated interrupts since it is
+ * difficult to coordinate between the debugger and debuggee in a
+ * reasonable way.
*/
+
class InterruptHangTarg {
- public static String sync = "sync";
+ static String sync = "sync";
+ static int interruptsSent;
+ static boolean remoteMode;
+ static boolean preciseMode;
+ static boolean aggressiveMode;
+
+ private final static int INTERRUPTS_EXPECTED = 200;
+
public static void main(String[] args){
- int answer = 0;
+ int answer = 0; // number of interrupts answered
+
System.out.println("Howdy!");
- Thread interruptorThread = DebuggeeWrapper.newThread(new Interruptor(Thread.currentThread()));
- synchronized(sync) {
+ remoteMode = "remote".equals(args[0]);
+ preciseMode = "precise".equals(args[0]);
+ aggressiveMode = "aggressive".equals(args[0]);
+
+ if (!remoteMode && !preciseMode && !aggressiveMode) {
+ throw new RuntimeException("Invalid first arg for debuggee: " + args[0]);
+ }
+
+ // Create the debuggee interruptor thread if needed.
+ Thread interruptorThread;
+ if (preciseMode) {
+ interruptorThread =
+ DebuggeeWrapper.newThread(new PreciseInterruptor(Thread.currentThread()));
interruptorThread.start();
- try {
- sync.wait();
- } catch (InterruptedException ee) {
- System.out.println("Debuggee interruptee: interrupted before starting loop");
- }
+ } else if (aggressiveMode) {
+ interruptorThread =
+ DebuggeeWrapper.newThread(new AggressiveInterruptor(Thread.currentThread()));
+ interruptorThread.start();
+ } else {
+ interruptorThread = null; // we are in "remote" interrupt mode
}
// Debugger will keep stepping thru this loop
- for (int ii = 0; ii < 200; ii++) {
- answer++;
+ for (int ii = 0; ii < INTERRUPTS_EXPECTED; ii++) {
+ boolean wasInterrupted = false;
try {
- // Give other thread a chance to run
+ // Give other thread a chance to interrupt
Thread.sleep(100);
} catch (InterruptedException ee) {
- System.out.println("Debuggee interruptee: interrupted at iteration: "
- + ii);
+ answer++;
+ wasInterrupted = true;
+ boolean isInterrupted = Thread.currentThread().isInterrupted();
+ System.out.println("Debuggee interruptee(" + ii + "): isInterrupted(" + isInterrupted + ")");
+ if (preciseMode) {
+ // When Thread.sleep() is interrupted, the interrupted status of the thread
+ // should remain cleared (since InterruptedException was thrown), and the
+ // the next interrupt won't come in until after the sync.notify() below.
+ // Note this is not true for the aggressive and remote modes since
+ // interrupts can come in at any time, even while we are handling
+ // an intrrupt.
+ if (isInterrupted) {
+ throw new RuntimeException("Thread should not have interrupted status set.");
+ }
+ synchronized(InterruptHangTarg.sync) {
+ // Let the interruptor thread know it can start interrupting again
+ sync.notify();
+ }
+ }
+ }
+ // Every Thread.sleep() call should get interrupted
+ if (!wasInterrupted) {
+ throw new RuntimeException("Thread was never interrupted during sleep: " + ii);
+ }
+ }
+
+ if (interruptorThread != null) {
+ synchronized(InterruptHangTarg.sync) {
+ // Kill the interrupter thread
+ interruptorThread.interrupt();
}
}
- // Kill the interrupter thread
- interruptorThread.interrupt();
+
+ // Print how many times an interrupt was sent. When in remote mode, the RemoteInterruptor
+ // is in a different process, so interruptsSent is not updated, therefore we don't
+ // print it here. The RemoteInterruptor thread keeps its own count and prints
+ // it before it exits.
+ if (!remoteMode) {
+ System.out.println("interrupts sent: " + interruptsSent);
+ }
+
+ // When in precise mode, make sure that every interrupt sent resulted in
+ // an InterruptedException. Note the interruptor always ends up sending
+ // one extra interrupt at the end.
+ if (preciseMode && interruptsSent != answer + 1) {
+ throw new RuntimeException("Too many interrupts sent. Sent: " + interruptsSent +
+ ". Expected to send: " + answer + 1);
+ }
System.out.println("Goodbye from InterruptHangTarg!");
}
-}
-class Interruptor implements Runnable {
- Thread interruptee;
- Interruptor(Thread interruptee) {
- this.interruptee = interruptee;
+ static class AggressiveInterruptor implements Runnable {
+ Thread interruptee;
+ AggressiveInterruptor(Thread interruptee) {
+ this.interruptee = interruptee;
+ }
+
+ public void run() {
+ while (true) {
+ InterruptHangTarg.interruptsSent++;
+ interruptee.interrupt();
+ try {
+ Thread.sleep(5);
+ } catch (InterruptedException ee) {
+ System.out.println("Debuggee Interruptor: finished after " +
+ InterruptHangTarg.interruptsSent + " iterrupts");
+ break;
+ }
+ }
+ }
}
- public void run() {
- synchronized(InterruptHangTarg.sync) {
- InterruptHangTarg.sync.notify();
+ static class PreciseInterruptor implements Runnable {
+ Thread interruptee;
+ PreciseInterruptor(Thread interruptee) {
+ this.interruptee = interruptee;
}
- int ii = 0;
- while(true) {
- ii++;
- interruptee.interrupt();
- try {
- Thread.sleep(10);
- } catch (InterruptedException ee) {
- System.out.println("Debuggee Interruptor: finished after " +
- ii + " iterrupts");
- break;
+ public void run() {
+ synchronized(InterruptHangTarg.sync) {
+ while (true) {
+ InterruptHangTarg.interruptsSent++;
+ interruptee.interrupt();
+ try {
+ // Wait until the interruptee has handled the interrupt
+ InterruptHangTarg.sync.wait();
+ } catch (InterruptedException ee) {
+ System.out.println("Debuggee Interruptor: finished after " +
+ InterruptHangTarg.interruptsSent + " iterrupts");
+ break;
+ }
+ }
}
-
}
}
}
@@ -105,16 +204,48 @@ public void run() {
/********** test program **********/
public class InterruptHangTest extends TestScaffold {
+ class RemoteInterruptor extends Thread {
+ static int interruptsSent;
+ ThreadReference interruptee;
+
+ RemoteInterruptor(ThreadReference interruptee) {
+ this.interruptee = interruptee;
+ }
+
+ public void run() {
+ try {
+ while (true) {
+ interruptee.interrupt();
+ interruptsSent++;
+ Thread.sleep(5);
+ }
+ } catch (InterruptedException ee) {
+ println("RemoteInterruptor thread: Unexpected Interrupt");
+ throw new RuntimeException(ee);
+ } catch (IllegalThreadStateException | VMDisconnectedException ee) {
+ println("RemoteInterruptor thread: Got expected " + ee.getClass().getSimpleName()
+ + " after " + interruptsSent + " interrupts sent. Exiting.");
+ } catch (Throwable ee) {
+ println("RemoteInterruptor thread: Got unexpected exception after "
+ + interruptsSent + " interrupts sent. Exiting with exception.");
+ ee.printStackTrace(System.out);
+ throw new RuntimeException(ee);
+ }
+ }
+ }
+
ThreadReference mainThread;
Thread timerThread;
String sync = "sync";
static int nSteps = 0;
+ static boolean remoteMode;
InterruptHangTest (String args[]) {
super(args);
}
public static void main(String[] args) throws Exception {
+ remoteMode = "remote".equals(args[0]);
new InterruptHangTest(args).startTests();
}
@@ -174,11 +305,23 @@ public void run() {
}
};
+ Thread remoteInterruptorThread = null;
+ if (remoteMode) {
+ // Create a thread to call ThreadReference.interrupt() on the
+ // debuggee main thread.
+ remoteInterruptorThread = new RemoteInterruptor(mainThread);
+ remoteInterruptorThread.setName("RemoteInterruptor");
+ remoteInterruptorThread.setDaemon(true);
+ remoteInterruptorThread.start();
+ }
+
/*
* resume the target listening for events
*/
-
listenUntilVMDisconnect();
+ if (remoteInterruptorThread != null) {
+ remoteInterruptorThread.join();
+ }
timerThread.interrupt();
/*
@@ -186,9 +329,9 @@ public void run() {
* if anything has called failure("foo") testFailed will be true
*/
if (!testFailed) {
- println("InterruptHangTest: passed");
+ println("InterruptHangTest("+ args[0] + "): passed");
} else {
- throw new Exception("InterruptHangTest: failed");
+ throw new Exception("InterruptHangTest("+ args[0] + "): failed");
}
}
}
From d5b95a0ed38b10ed9f51d20255e06eb38fdd8b82 Mon Sep 17 00:00:00 2001
From: Justin Lu
Date: Tue, 12 Mar 2024 21:10:30 +0000
Subject: [PATCH 02/58] 8327631: Update IANA Language Subtag Registry to
Version 2024-03-07
Reviewed-by: naoto, iris
---
.../data/lsrdata/language-subtag-registry.txt | 78 ++++++++++++++++++-
.../Locale/LanguageSubtagRegistryTest.java | 5 +-
2 files changed, 80 insertions(+), 3 deletions(-)
diff --git a/src/java.base/share/data/lsrdata/language-subtag-registry.txt b/src/java.base/share/data/lsrdata/language-subtag-registry.txt
index c6937ee80f140..4737c50e425c5 100644
--- a/src/java.base/share/data/lsrdata/language-subtag-registry.txt
+++ b/src/java.base/share/data/lsrdata/language-subtag-registry.txt
@@ -1,4 +1,4 @@
-File-Date: 2023-10-16
+File-Date: 2024-03-07
%%
Type: language
Subtag: aa
@@ -882,6 +882,7 @@ Type: language
Subtag: sa
Description: Sanskrit
Added: 2005-10-16
+Scope: macrolanguage
%%
Type: language
Subtag: sc
@@ -8028,6 +8029,12 @@ Description: Lowland Oaxaca Chontal
Added: 2009-07-29
%%
Type: language
+Subtag: cls
+Description: Classical Sanskrit
+Added: 2024-03-04
+Macrolanguage: sa
+%%
+Type: language
Subtag: clt
Description: Lautu Chin
Added: 2012-08-12
@@ -30916,6 +30923,11 @@ Description: Ririo
Added: 2009-07-29
%%
Type: language
+Subtag: rrm
+Description: Moriori
+Added: 2024-03-04
+%%
+Type: language
Subtag: rro
Description: Waima
Added: 2009-07-29
@@ -37660,6 +37672,12 @@ Description: Venezuelan Sign Language
Added: 2009-07-29
%%
Type: language
+Subtag: vsn
+Description: Vedic Sanskrit
+Added: 2024-03-04
+Macrolanguage: sa
+%%
+Type: language
Subtag: vsv
Description: Valencian Sign Language
Description: Llengua de signes valenciana
@@ -47559,6 +47577,13 @@ Comments: Aluku dialect of the "Busi Nenge Tongo" English-based Creole
continuum in Eastern Suriname and Western French Guiana
%%
Type: variant
+Subtag: anpezo
+Description: Anpezo standard of Ladin
+Added: 2024-03-04
+Prefix: lld
+Comments: Represents the standard written form of Ladin in Anpezo
+%%
+Type: variant
Subtag: ao1990
Description: Portuguese Language Orthographic Agreement of 1990 (Acordo
Ortográfico da Língua Portuguesa de 1990)
@@ -47779,6 +47804,22 @@ Added: 2012-02-05
Prefix: en
%%
Type: variant
+Subtag: fascia
+Description: Fascia standard of Ladin
+Added: 2024-03-04
+Prefix: lld
+Comments: Represents the standard written form of Ladin in Fascia which
+ unified the three subvarieties Cazet, Brach and Moenat
+%%
+Type: variant
+Subtag: fodom
+Description: Fodom standard of Ladin
+Added: 2024-03-04
+Prefix: lld
+Comments: Represents the standard written form of Ladin in Livinallongo
+ and Colle Santa Lucia
+%%
+Type: variant
Subtag: fonipa
Description: International Phonetic Alphabet
Added: 2006-12-11
@@ -47819,6 +47860,13 @@ Prefix: oc
Comments: Occitan variant spoken in Gascony
%%
Type: variant
+Subtag: gherd
+Description: Gherdëina standard of Ladin
+Added: 2024-03-04
+Prefix: lld
+Comments: Represents the standard written form of Ladin in Gherdëina
+%%
+Type: variant
Subtag: grclass
Description: Classical Occitan orthography
Added: 2018-04-22
@@ -48120,6 +48168,15 @@ Comments: Peano’s Interlingua, created in 1903 by Giuseppe Peano as an
Added: 2020-03-12
%%
Type: variant
+Subtag: pehoeji
+Description: Hokkien Vernacular Romanization System
+Description: Pe̍h-ōe-jī orthography/romanization
+Added: 2024-03-04
+Prefix: nan-Latn
+Comments: Modern Hokkien Vernacular Romanization System, evolved from
+ the New Dictionary in the Amoy by John Van Nest Talmage in 1894
+%%
+Type: variant
Subtag: petr1708
Description: Petrine orthography
Added: 2010-10-10
@@ -48254,6 +48311,16 @@ Added: 2021-07-17
Prefix: da
%%
Type: variant
+Subtag: tailo
+Description: Taiwanese Hokkien Romanization System for Hokkien
+ languages
+Description: Tâi-lô orthography/romanization
+Added: 2024-03-04
+Prefix: nan-Latn
+Comments: Taiwanese Hokkien Romanization System (Tâi-lô) published in
+ 2006 by the Taiwan Ministry of Education
+%%
+Type: variant
Subtag: tarask
Description: Belarusian in Taraskievica orthography
Added: 2007-04-27
@@ -48317,6 +48384,15 @@ Comments: The most ancient dialect of Sanskrit used in verse and prose
composed until about the 4th century B.C.E.
%%
Type: variant
+Subtag: valbadia
+Description: Val Badia standard of Ladin
+Added: 2024-03-04
+Prefix: lld
+Comments: Represents the standard written form of Ladin in the Val
+ Badia, unifying the three variants Marô, Mesaval and Badiot spoken
+ in this valley
+%%
+Type: variant
Subtag: valencia
Description: Valencian
Added: 2007-03-06
diff --git a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java
index d0141b304a880..04a6e89db7b59 100644
--- a/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java
+++ b/test/jdk/java/util/Locale/LanguageSubtagRegistryTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -25,8 +25,9 @@
* @test
* @bug 8025703 8040211 8191404 8203872 8222980 8225435 8241082 8242010 8247432
* 8258795 8267038 8287180 8302512 8304761 8306031 8308021 8313702 8318322
+ * 8327631
* @summary Checks the IANA language subtag registry data update
- * (LSR Revision: 2023-10-16) with Locale and Locale.LanguageRange
+ * (LSR Revision: 2024-03-07) with Locale and Locale.LanguageRange
* class methods.
* @run main LanguageSubtagRegistryTest
*/
From f3d0c45cbb29dbaba7b9b7360b0152d901e68f68 Mon Sep 17 00:00:00 2001
From: Doug Simon
Date: Tue, 12 Mar 2024 22:40:04 +0000
Subject: [PATCH 03/58] 8327829: [JVMCI]
runtime/ClassUnload/ConstantPoolDependsTest.java fails on libgraal
Reviewed-by: dholmes, never
---
.../runtime/ClassUnload/ConstantPoolDependsTest.java | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java b/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java
index a61c8cf4f2f8f..db490bd760ad5 100644
--- a/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java
+++ b/test/hotspot/jtreg/runtime/ClassUnload/ConstantPoolDependsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -39,6 +39,8 @@
import jdk.test.lib.classloader.ClassUnloadCommon;
import java.lang.ref.Reference;
+import java.util.List;
+import java.util.Set;
public class ConstantPoolDependsTest {
public static WhiteBox wb = WhiteBox.getWhiteBox();
public static final String MY_TEST = "ConstantPoolDependsTest$c1c";
@@ -78,10 +80,7 @@ static void test() throws Throwable {
public static void main(String args[]) throws Throwable {
test();
- ClassUnloadCommon.triggerUnloading(); // should unload
- System.gc();
- System.out.println("Should unload p2.c2 just now");
- ClassUnloadCommon.failIf(wb.isClassAlive(MY_TEST), "should be unloaded");
- ClassUnloadCommon.failIf(wb.isClassAlive("p2.c2"), "should be unloaded");
+ Set aliveClasses = ClassUnloadCommon.triggerUnloading(List.of(MY_TEST, "p2.c2"));
+ ClassUnloadCommon.failIf(!aliveClasses.isEmpty(), "should be unloaded: " + aliveClasses);
}
}
From 5d4bfad12b650b9f7c512a071830c58b8f1d020b Mon Sep 17 00:00:00 2001
From: Denghui Dong
Date: Wed, 13 Mar 2024 00:00:21 +0000
Subject: [PATCH 04/58] 8327693: C1: LIRGenerator::_instruction_for_operand is
only read by assertion code
Reviewed-by: gli, chagedorn
---
src/hotspot/share/c1/c1_LIRGenerator.cpp | 20 +++++++++-----------
src/hotspot/share/c1/c1_LIRGenerator.hpp | 9 +++++++--
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/src/hotspot/share/c1/c1_LIRGenerator.cpp b/src/hotspot/share/c1/c1_LIRGenerator.cpp
index b17bed7e3f200..7335e521474a7 100644
--- a/src/hotspot/share/c1/c1_LIRGenerator.cpp
+++ b/src/hotspot/share/c1/c1_LIRGenerator.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -205,9 +205,11 @@ void LIRItem::set_result(LIR_Opr opr) {
assert(value()->operand()->is_illegal() || value()->operand()->is_constant(), "operand should never change");
value()->set_operand(opr);
+#ifdef ASSERT
if (opr->is_virtual()) {
_gen->_instruction_for_operand.at_put_grow(opr->vreg_number(), value(), nullptr);
}
+#endif
_result = opr;
}
@@ -1494,28 +1496,22 @@ LIR_Opr LIRGenerator::operand_for_instruction(Instruction* x) {
assert(x->as_Phi() || x->as_Local() != nullptr, "only for Phi and Local");
// allocate a virtual register for this local or phi
x->set_operand(rlock(x));
+#ifdef ASSERT
_instruction_for_operand.at_put_grow(x->operand()->vreg_number(), x, nullptr);
+#endif
}
}
return x->operand();
}
-
-Instruction* LIRGenerator::instruction_for_opr(LIR_Opr opr) {
- if (opr->is_virtual()) {
- return instruction_for_vreg(opr->vreg_number());
- }
- return nullptr;
-}
-
-
+#ifdef ASSERT
Instruction* LIRGenerator::instruction_for_vreg(int reg_num) {
if (reg_num < _instruction_for_operand.length()) {
return _instruction_for_operand.at(reg_num);
}
return nullptr;
}
-
+#endif
void LIRGenerator::set_vreg_flag(int vreg_num, VregFlag f) {
if (_vreg_flags.size_in_bits() == 0) {
@@ -2660,7 +2656,9 @@ void LIRGenerator::do_Base(Base* x) {
assert(as_ValueType(t)->tag() == local->type()->tag(), "check");
#endif // __SOFTFP__
local->set_operand(dest);
+#ifdef ASSERT
_instruction_for_operand.at_put_grow(dest->vreg_number(), local, nullptr);
+#endif
java_index += type2size[t];
}
diff --git a/src/hotspot/share/c1/c1_LIRGenerator.hpp b/src/hotspot/share/c1/c1_LIRGenerator.hpp
index 20101fd02dd59..518cd5fa5e724 100644
--- a/src/hotspot/share/c1/c1_LIRGenerator.hpp
+++ b/src/hotspot/share/c1/c1_LIRGenerator.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -166,7 +166,9 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
PhiResolverState _resolver_state;
BlockBegin* _block;
int _virtual_register_number;
+#ifdef ASSERT
Values _instruction_for_operand;
+#endif
BitMap2D _vreg_flags; // flags which can be set on a per-vreg basis
LIR_List* _lir;
@@ -223,9 +225,11 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
assert(!opr->is_register() || opr->is_virtual(), "should never set result to a physical register");
x->set_operand(opr);
assert(opr == x->operand(), "must be");
+#ifdef ASSERT
if (opr->is_virtual()) {
_instruction_for_operand.at_put_grow(opr->vreg_number(), x, nullptr);
}
+#endif
}
void set_no_result(Value x) { assert(!x->has_uses(), "can't have use"); x->clear_operand(); }
@@ -507,9 +511,10 @@ class LIRGenerator: public InstructionVisitor, public BlockClosure {
, _barrier_set(BarrierSet::barrier_set()->barrier_set_c1()) {
}
+#ifdef ASSERT
// for virtual registers, maps them back to Phi's or Local's
- Instruction* instruction_for_opr(LIR_Opr opr);
Instruction* instruction_for_vreg(int reg_num);
+#endif
void set_vreg_flag (int vreg_num, VregFlag f);
bool is_vreg_flag_set(int vreg_num, VregFlag f);
From 3b18c5dc5d5885fe5ebaabd9cd74f033a584e4ae Mon Sep 17 00:00:00 2001
From: Christian Stein
Date: Wed, 13 Mar 2024 06:44:04 +0000
Subject: [PATCH 05/58] 8323605: Java source launcher should not require
`--source ...` to enable preview
Reviewed-by: mcimadamore, dholmes
---
src/java.base/share/man/java.1 | 5 +++++
.../tools/javac/launcher/RelevantJavacOptions.java | 6 ++++--
.../sun/tools/javac/resources/launcher.properties | 5 +----
.../javac/launcher/BasicSourceLauncherTests.java | 6 +-----
.../tools/javac/launcher/SourceLauncherTest.java | 12 ++++--------
5 files changed, 15 insertions(+), 19 deletions(-)
diff --git a/src/java.base/share/man/java.1 b/src/java.base/share/man/java.1
index d386fb15b8f63..6499d70f98927 100644
--- a/src/java.base/share/man/java.1
+++ b/src/java.base/share/man/java.1
@@ -279,6 +279,11 @@ the compilation.
This sets both the source version accepted by compiler and the system
API that may be used by the code in the source file.
.IP \[bu] 2
+If \f[V]--enable-preview\f[R] is specified, the \f[V]--source N\f[R]
+arguments can be omitted.
+If the Java runtime version is \f[V]N\f[R], then \f[V]--release N\f[R]
+is implied when compiling source files.
+.IP \[bu] 2
If a \f[V]module-info.java\f[R] file exists in the
\f[V]\f[R] directory, its module declaration is used to
define a named module that will contain all the classes compiled from
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/RelevantJavacOptions.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/RelevantJavacOptions.java
index 88d1c875bc518..f619807f9bfc9 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/RelevantJavacOptions.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/RelevantJavacOptions.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -112,7 +112,9 @@ static RelevantJavacOptions of(ProgramDescriptor program, String... runtimeArgs)
programOptions.add(opt);
subsequentOptions.add(opt);
if (sourceOpt == null) {
- throw new Fault(Errors.EnablePreviewRequiresSource);
+ String feature = String.valueOf(Runtime.version().feature());
+ programOptions.addAll(List.of("--release", feature));
+ subsequentOptions.addAll(List.of("--release", feature));
}
}
default -> {
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties
index 134d2ccd839c3..1bf209a7fd6c9 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2018, 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
@@ -139,9 +139,6 @@ launcher.err.no.value.for.option=\
launcher.err.invalid.value.for.source=\
invalid value for --source option: {0}
-launcher.err.enable.preview.requires.source=\
- --enable-preview must be used with --source
-
launcher.err.unnamed.pkg.not.allowed.named.modules=\
unnamed package is not allowed in named modules
diff --git a/test/langtools/tools/javac/launcher/BasicSourceLauncherTests.java b/test/langtools/tools/javac/launcher/BasicSourceLauncherTests.java
index 1a686a8a38f6d..bf44a704b315a 100644
--- a/test/langtools/tools/javac/launcher/BasicSourceLauncherTests.java
+++ b/test/langtools/tools/javac/launcher/BasicSourceLauncherTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -100,11 +100,7 @@ void main() {
}
""");
- // Replace with plain Run.of(hi) once implict classes are out of preview
- System.setProperty("jdk.internal.javac.source", String.valueOf(Runtime.version().feature()));
var run = Run.of(hi, List.of("--enable-preview"), List.of());
- System.clearProperty("jdk.internal.javac.source");
-
assertAll("# " + run,
() -> assertLinesMatch(
"""
diff --git a/test/langtools/tools/javac/launcher/SourceLauncherTest.java b/test/langtools/tools/javac/launcher/SourceLauncherTest.java
index a054415cfe188..cfa6c8ec9e519 100644
--- a/test/langtools/tools/javac/launcher/SourceLauncherTest.java
+++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -51,12 +51,9 @@
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
import java.util.List;
import java.util.Properties;
import java.util.regex.Pattern;
-import java.util.stream.Collectors;
import com.sun.tools.javac.launcher.SourceLauncher;
import com.sun.tools.javac.launcher.Fault;
@@ -534,10 +531,9 @@ public void testEnablePreviewNoSource(Path base) throws IOException {
List log = new JavaTask(tb)
.vmOptions("--enable-preview")
.className(base.resolve("HelloWorld.java").toString())
- .run(Task.Expect.FAIL)
- .getOutputLines(Task.OutputKind.STDERR);
- log = log.stream().filter(s->!s.matches("^Picked up .*JAVA.*OPTIONS:.*")).collect(Collectors.toList());
- checkEqual("stderr", log, List.of("error: --enable-preview must be used with --source"));
+ .run(Task.Expect.SUCCESS)
+ .getOutputLines(Task.OutputKind.STDOUT);
+ checkEqual("stdout", log, List.of("Hello World! []"));
}
@Test
From cc9a8aba67f4e240c8de2d1ae15d1b80bfa446a0 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 13 Mar 2024 08:09:22 +0000
Subject: [PATCH 06/58] 8327460: Compile tests with the same visibility rules
as product code
Reviewed-by: erikj, jvernee, dholmes, alanb
---
make/common/TestFilesCompilation.gmk | 24 +++++++++----
make/test/JtregNativeJdk.gmk | 17 +--------
.../macosx/native/applauncher/MacLauncher.cpp | 11 +++---
.../shenandoah/compiler/libLinkToNativeRBP.c | 6 +---
.../runtime/ErrorHandling/TestDwarf.java | 2 +-
.../ErrorHandling/libTestDwarfHelper.h | 8 +++--
.../jdk/java/foreign/CallGeneratorHelper.java | 14 ++------
.../foreign/arraystructs/libArrayStructs.c | 8 ++---
.../capturecallstate/libCaptureCallState.c | 8 ++---
test/jdk/java/foreign/critical/libCritical.c | 8 ++---
.../java/foreign/dontrelease/libDontRelease.c | 8 ++---
test/jdk/java/foreign/libAddressDereference.c | 8 ++---
test/jdk/java/foreign/libIntrinsics.c | 10 ++----
test/jdk/java/foreign/libLibraryLookup.c | 8 ++---
test/jdk/java/foreign/libLookupTest.c | 13 +++----
test/jdk/java/foreign/libNull.c | 10 ++----
test/jdk/java/foreign/libSafeAccess.c | 8 ++---
.../jdk/java/foreign/libTestUpcallHighArity.c | 8 ++---
.../java/foreign/libTestUpcallStructScope.c | 8 ++---
.../java/foreign/loaderLookup/lookup/libFoo.c | 8 ++---
test/jdk/java/foreign/nested/libNested.c | 9 ++---
.../jdk/java/foreign/normalize/libNormalize.c | 8 ++---
.../passheapsegment/libPassHeapSegment.c | 8 ++---
test/jdk/java/foreign/shared.h | 9 ++---
.../foreign/stackwalk/libAsyncStackWalk.cpp | 7 +---
.../foreign/stackwalk/libReentrantUpcalls.c | 8 ++---
.../jdk/java/foreign/stackwalk/libStackWalk.c | 8 ++---
.../java/foreign/upcalldeopt/libUpcallDeopt.c | 8 ++---
test/jdk/java/foreign/virtual/libVirtual.c | 8 ++---
.../AttachCurrentThread/libImplicitAttach.c | 9 +++--
test/jdk/tools/launcher/exeJliLaunchTest.c | 5 +--
.../jdk/test/lib/thread/libVThreadPinner.c | 8 ++---
test/lib/native/export.h | 35 +++++++++++++++++++
.../bench/java/lang/foreign/libCallOverhead.c | 8 ++---
.../java/lang/foreign/libCriticalCalls.c | 8 ++---
.../openjdk/bench/java/lang/foreign/libPtr.c | 10 ++----
.../bench/java/lang/foreign/libQSort.c | 9 ++---
.../bench/java/lang/foreign/libUpcalls.c | 8 ++---
.../lang/foreign/points/support/libPoint.c | 12 +++----
39 files changed, 145 insertions(+), 235 deletions(-)
create mode 100644 test/lib/native/export.h
diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk
index 626eb058f0a1b..85e01b0a521d2 100644
--- a/make/common/TestFilesCompilation.gmk
+++ b/make/common/TestFilesCompilation.gmk
@@ -56,22 +56,34 @@ define SetupTestFilesCompilationBody
$$(error There are duplicate test file names for $1: $$($1_DUPLICATED_NAMES))
endif
+ # Always include common test functionality
+ TEST_CFLAGS := -I$(TOPDIR)/test/lib/native
+
+ ifeq ($(TOOLCHAIN_TYPE), gcc)
+ TEST_CFLAGS += -fvisibility=hidden
+ TEST_LDFLAGS += -Wl,--exclude-libs,ALL
+ else ifeq ($(TOOLCHAIN_TYPE), clang)
+ TEST_CFLAGS += -fvisibility=hidden
+ else ifeq ($(TOOLCHAIN_TYPE), xlc)
+ TEST_CFLAGS += -qvisibility=hidden
+ endif
+
# The list to depend on starts out empty
$1 :=
ifeq ($$($1_TYPE), LIBRARY)
$1_PREFIX = lib
$1_OUTPUT_SUBDIR := lib
- $1_BASE_CFLAGS := $(CFLAGS_JDKLIB)
- $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB)
- $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(call SET_SHARED_LIBRARY_ORIGIN)
+ $1_BASE_CFLAGS := $(CFLAGS_JDKLIB) $$(TEST_CFLAGS)
+ $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB) $$(TEST_CFLAGS)
+ $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(TEST_LDFLAGS) $$(call SET_SHARED_LIBRARY_ORIGIN)
$1_COMPILATION_TYPE := LIBRARY
$1_LOG_TYPE := library
else ifeq ($$($1_TYPE), PROGRAM)
$1_PREFIX = exe
$1_OUTPUT_SUBDIR := bin
- $1_BASE_CFLAGS := $(CFLAGS_JDKEXE)
- $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE)
- $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
+ $1_BASE_CFLAGS := $(CFLAGS_JDKEXE) $$(TEST_CFLAGS)
+ $1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE) $$(TEST_CFLAGS)
+ $1_LDFLAGS := $(LDFLAGS_JDKEXE) $$(TEST_LDFLAGS) $(LDFLAGS_TESTEXE)
$1_COMPILATION_TYPE := EXECUTABLE
$1_LOG_TYPE := executable
else
diff --git a/make/test/JtregNativeJdk.gmk b/make/test/JtregNativeJdk.gmk
index 5f945e90dd288..e21280e8a5d18 100644
--- a/make/test/JtregNativeJdk.gmk
+++ b/make/test/JtregNativeJdk.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 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
@@ -53,8 +53,6 @@ BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeJliLaunchTest := \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli
-TEST_LIB_NATIVE_SRC := $(TOPDIR)/test/lib/native
-
# Platform specific setup
ifeq ($(call isTargetOs, windows), true)
BUILD_JDK_JTREG_EXCLUDE += libDirectIO.c libInheritedChannel.c \
@@ -69,14 +67,6 @@ ifeq ($(call isTargetOs, windows), true)
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exeNullCallerTest := $(LIBCXX) jvm.lib
BUILD_JDK_JTREG_EXECUTABLES_LIBS_exerevokeall := advapi32.lib
BUILD_JDK_JTREG_EXECUTABLES_CFLAGS_exeNullCallerTest := /EHsc
-
- # java.lang.foreign tests
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncStackWalk := -I$(TEST_LIB_NATIVE_SRC)
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLinkerInvokerUnnamed := -I$(TEST_LIB_NATIVE_SRC)
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLinkerInvokerModule := -I$(TEST_LIB_NATIVE_SRC)
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLoaderLookupInvoker := -I$(TEST_LIB_NATIVE_SRC)
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncInvokers := -I$(TEST_LIB_NATIVE_SRC)
-
BUILD_JDK_JTREG_LIBRARIES_LIBS_libTracePinnedThreads := jvm.lib
BUILD_JDK_JTREG_LIBRARIES_LIBS_libNewDirectByteBuffer := $(WIN_LIB_JAVA)
BUILD_JDK_JTREG_LIBRARIES_LIBS_libGetXSpace := $(WIN_LIB_JAVA)
@@ -88,15 +78,10 @@ else
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libNativeThread := -pthread
# java.lang.foreign tests
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncStackWalk := -I$(TEST_LIB_NATIVE_SRC)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libAsyncStackWalk := -pthread
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libAsyncInvokers := -I$(TEST_LIB_NATIVE_SRC)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libAsyncInvokers := -pthread
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLinkerInvokerUnnamed := -I$(TEST_LIB_NATIVE_SRC)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerUnnamed := -pthread
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLinkerInvokerModule := -I$(TEST_LIB_NATIVE_SRC)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLinkerInvokerModule := -pthread
- BUILD_JDK_JTREG_LIBRARIES_CFLAGS_libLoaderLookupInvoker := -I$(TEST_LIB_NATIVE_SRC)
BUILD_JDK_JTREG_LIBRARIES_LDFLAGS_libLoaderLookupInvoker := -pthread
BUILD_JDK_JTREG_LIBRARIES_LIBS_libExplicitAttach := -ljvm
diff --git a/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp b/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp
index 1d315b9f02ef9..5c9ca8e9a0414 100644
--- a/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp
+++ b/src/jdk.jpackage/macosx/native/applauncher/MacLauncher.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -23,13 +23,14 @@
* questions.
*/
-#include "AppLauncher.h"
#include "app.h"
+#include "AppLauncher.h"
+#include "ErrorHandling.h"
#include "FileUtils.h"
+#include "jni.h"
+#include "JvmLauncher.h"
#include "PackageFile.h"
#include "UnixSysInfo.h"
-#include "JvmLauncher.h"
-#include "ErrorHandling.h"
namespace {
@@ -89,7 +90,7 @@ void initJvmLauncher() {
} // namespace
-int main(int argc, char *argv[]) {
+JNIEXPORT int main(int argc, char *argv[]) {
if (jvmLauncher) {
// This is the call from the thread spawned by JVM.
// Skip initialization phase as we have done this already in the first
diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/libLinkToNativeRBP.c b/test/hotspot/jtreg/gc/shenandoah/compiler/libLinkToNativeRBP.c
index e57a86caa60a9..0f54c4c24022f 100644
--- a/test/hotspot/jtreg/gc/shenandoah/compiler/libLinkToNativeRBP.c
+++ b/test/hotspot/jtreg/gc/shenandoah/compiler/libLinkToNativeRBP.c
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT int foo() {
return 0;
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java
index 2ae46a36229f0..8c0c23e2a8b01 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/TestDwarf.java
@@ -125,7 +125,7 @@ private static void test() throws Exception {
new DwarfConstraint(1, "Java_TestDwarf_crashNativeMultipleMethods", "libTestDwarf.c", 70));
}
runAndCheck(new Flags(TestDwarf.class.getCanonicalName(), "nativeDereferenceNull"),
- new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 44));
+ new DwarfConstraint(0, "dereference_null", "libTestDwarfHelper.h", 46));
}
// The full pattern accepts lines like:
diff --git a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h
index 3a162560b8903..1da05c1c3d322 100644
--- a/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h
+++ b/test/hotspot/jtreg/runtime/ErrorHandling/libTestDwarfHelper.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,9 +21,11 @@
* questions.
*/
-#include "jni.h"
#include
+#include "export.h"
+#include "jni.h"
+
void unused1() {
}
@@ -39,7 +41,7 @@ void unused4() {
void unused5() {
}
-void dereference_null() {
+EXPORT void dereference_null() {
int* x = (int*)0;
*x = 34; // Crash
}
diff --git a/test/jdk/java/foreign/CallGeneratorHelper.java b/test/jdk/java/foreign/CallGeneratorHelper.java
index ee3930a56e799..132a89b75f19e 100644
--- a/test/jdk/java/foreign/CallGeneratorHelper.java
+++ b/test/jdk/java/foreign/CallGeneratorHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -213,11 +213,7 @@ public static void main(String[] args) {
static void generateDowncalls(boolean header) {
if (header) {
System.out.println(
- "#ifdef _WIN64\n" +
- "#define EXPORT __declspec(dllexport)\n" +
- "#else\n" +
- "#define EXPORT\n" +
- "#endif\n"
+ "#include \"export.h\"\n"
);
for (int j = 1; j <= MAX_FIELDS; j++) {
@@ -267,11 +263,7 @@ static void generateDowncallFunction(String fName, Ret ret, List para
static void generateUpcalls(boolean header) {
if (header) {
System.out.println(
- "#ifdef _WIN64\n" +
- "#define EXPORT __declspec(dllexport)\n" +
- "#else\n" +
- "#define EXPORT\n" +
- "#endif\n"
+ "#include \"export.h\"\n"
);
for (int j = 1; j <= MAX_FIELDS; j++) {
diff --git a/test/jdk/java/foreign/arraystructs/libArrayStructs.c b/test/jdk/java/foreign/arraystructs/libArrayStructs.c
index 28ab57093f529..7adf79551ec1f 100644
--- a/test/jdk/java/foreign/arraystructs/libArrayStructs.c
+++ b/test/jdk/java/foreign/arraystructs/libArrayStructs.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
struct S1 { char f0[1]; };
struct S2 { char f0[2]; };
diff --git a/test/jdk/java/foreign/capturecallstate/libCaptureCallState.c b/test/jdk/java/foreign/capturecallstate/libCaptureCallState.c
index 9a8925474a277..d76c9d7bedae4 100644
--- a/test/jdk/java/foreign/capturecallstate/libCaptureCallState.c
+++ b/test/jdk/java/foreign/capturecallstate/libCaptureCallState.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -23,11 +23,7 @@
#include
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void set_errno_V(int value) {
errno = value;
diff --git a/test/jdk/java/foreign/critical/libCritical.c b/test/jdk/java/foreign/critical/libCritical.c
index 52bfa60677ad7..cc03db3c43cfd 100644
--- a/test/jdk/java/foreign/critical/libCritical.c
+++ b/test/jdk/java/foreign/critical/libCritical.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -23,11 +23,7 @@
#include
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void empty() {}
diff --git a/test/jdk/java/foreign/dontrelease/libDontRelease.c b/test/jdk/java/foreign/dontrelease/libDontRelease.c
index c7a8f74308315..bcaeb6aaa7054 100644
--- a/test/jdk/java/foreign/dontrelease/libDontRelease.c
+++ b/test/jdk/java/foreign/dontrelease/libDontRelease.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,10 +21,6 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void test_ptr(void* ptr) {}
diff --git a/test/jdk/java/foreign/libAddressDereference.c b/test/jdk/java/foreign/libAddressDereference.c
index b78b3d02f3e29..d18d60e624eb7 100644
--- a/test/jdk/java/foreign/libAddressDereference.c
+++ b/test/jdk/java/foreign/libAddressDereference.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -22,11 +22,7 @@
*
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void* get_addr(void* align) {
return align;
diff --git a/test/jdk/java/foreign/libIntrinsics.c b/test/jdk/java/foreign/libIntrinsics.c
index 89d0a09c7b608..b52d2756fbaec 100644
--- a/test/jdk/java/foreign/libIntrinsics.c
+++ b/test/jdk/java/foreign/libIntrinsics.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -24,11 +24,7 @@
#include
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void empty() {
}
@@ -85,4 +81,4 @@ EXPORT short invoke_high_arity5(int x, double d, long long l, float f, char c, s
}
EXPORT short invoke_high_arity6(int x, double d, long long l, float f, char c, short s1, short s2) {
return s2;
-}
\ No newline at end of file
+}
diff --git a/test/jdk/java/foreign/libLibraryLookup.c b/test/jdk/java/foreign/libLibraryLookup.c
index 13719ad9ba898..dd575f52b962b 100644
--- a/test/jdk/java/foreign/libLibraryLookup.c
+++ b/test/jdk/java/foreign/libLibraryLookup.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
int count = 0;
diff --git a/test/jdk/java/foreign/libLookupTest.c b/test/jdk/java/foreign/libLookupTest.c
index d78b46528a198..055cae5e23eef 100644
--- a/test/jdk/java/foreign/libLookupTest.c
+++ b/test/jdk/java/foreign/libLookupTest.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,12 +21,7 @@
* questions.
*/
- #ifdef _WIN64
- #define EXPORT __declspec(dllexport)
- #else
- #define EXPORT
- #endif
-
- EXPORT void f() { }
- EXPORT int c = 42;
+#include "export.h"
+EXPORT void f() { }
+EXPORT int c = 42;
diff --git a/test/jdk/java/foreign/libNull.c b/test/jdk/java/foreign/libNull.c
index 52ea8493f216e..a93c8d776f178 100644
--- a/test/jdk/java/foreign/libNull.c
+++ b/test/jdk/java/foreign/libNull.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -21,12 +21,8 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
-
#include
+#include "export.h"
+
EXPORT void* get_null() { return NULL; }
diff --git a/test/jdk/java/foreign/libSafeAccess.c b/test/jdk/java/foreign/libSafeAccess.c
index 4b44e24054dff..f7a0bdb4554cf 100644
--- a/test/jdk/java/foreign/libSafeAccess.c
+++ b/test/jdk/java/foreign/libSafeAccess.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
struct Point {
int x;
diff --git a/test/jdk/java/foreign/libTestUpcallHighArity.c b/test/jdk/java/foreign/libTestUpcallHighArity.c
index 052bd2ce1686b..cd6b6de4e32ab 100644
--- a/test/jdk/java/foreign/libTestUpcallHighArity.c
+++ b/test/jdk/java/foreign/libTestUpcallHighArity.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
struct S_PDI { void* p0; double p1; int p2; };
diff --git a/test/jdk/java/foreign/libTestUpcallStructScope.c b/test/jdk/java/foreign/libTestUpcallStructScope.c
index e27ab0092cc7e..e778133b496de 100644
--- a/test/jdk/java/foreign/libTestUpcallStructScope.c
+++ b/test/jdk/java/foreign/libTestUpcallStructScope.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
struct S_PDI { void* p0; double p1; int p2; };
diff --git a/test/jdk/java/foreign/loaderLookup/lookup/libFoo.c b/test/jdk/java/foreign/loaderLookup/lookup/libFoo.c
index 68525215b9345..d9f07bcfd3aea 100644
--- a/test/jdk/java/foreign/loaderLookup/lookup/libFoo.c
+++ b/test/jdk/java/foreign/loaderLookup/lookup/libFoo.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -23,11 +23,7 @@
#include
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void foo(void) {
// do nothing
diff --git a/test/jdk/java/foreign/nested/libNested.c b/test/jdk/java/foreign/nested/libNested.c
index c31fb0dc4cc92..39becbb983164 100644
--- a/test/jdk/java/foreign/nested/libNested.c
+++ b/test/jdk/java/foreign/nested/libNested.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -21,11 +21,8 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
+
#ifdef _AIX
#pragma align (natural)
#endif
diff --git a/test/jdk/java/foreign/normalize/libNormalize.c b/test/jdk/java/foreign/normalize/libNormalize.c
index 4a21551278fe4..68c352d8e86de 100644
--- a/test/jdk/java/foreign/normalize/libNormalize.c
+++ b/test/jdk/java/foreign/normalize/libNormalize.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
// we use 'int' here to make sure the native code doesn't touch any of the bits
// the important part is that our Java code performs argument normalization
diff --git a/test/jdk/java/foreign/passheapsegment/libPassHeapSegment.c b/test/jdk/java/foreign/passheapsegment/libPassHeapSegment.c
index fdb1981ac6539..850c2db8be94d 100644
--- a/test/jdk/java/foreign/passheapsegment/libPassHeapSegment.c
+++ b/test/jdk/java/foreign/passheapsegment/libPassHeapSegment.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void test_args(void* ptr) {}
diff --git a/test/jdk/java/foreign/shared.h b/test/jdk/java/foreign/shared.h
index 0f6183891a720..72093a0d04da9 100644
--- a/test/jdk/java/foreign/shared.h
+++ b/test/jdk/java/foreign/shared.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,6 +21,8 @@
* questions.
*/
+#include "export.h"
+
#ifdef __clang__
#pragma clang optimize off
#elif defined __GNUC__
@@ -29,11 +31,6 @@
#pragma optimize( "", off )
#endif
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
#ifdef _AIX
#pragma align (natural)
#endif
diff --git a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
index 5461966d05527..afde767886909 100644
--- a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
+++ b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp
@@ -21,14 +21,9 @@
* questions.
*/
+#include "export.h"
#include "testlib_threads.hpp"
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
-
typedef void (*CB_t)(void);
static void start(void* ctxt) {
diff --git a/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c b/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c
index 3dd8ac07d9b2d..250c31256c6fe 100644
--- a/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c
+++ b/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void do_recurse(int depth, void (*cb)(int, void*)) {
cb(depth, cb);
diff --git a/test/jdk/java/foreign/stackwalk/libStackWalk.c b/test/jdk/java/foreign/stackwalk/libStackWalk.c
index 19d3f5e3d45b6..b2b03b50738a0 100644
--- a/test/jdk/java/foreign/stackwalk/libStackWalk.c
+++ b/test/jdk/java/foreign/stackwalk/libStackWalk.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void foo(void (*cb)(void)) {
cb();
diff --git a/test/jdk/java/foreign/upcalldeopt/libUpcallDeopt.c b/test/jdk/java/foreign/upcalldeopt/libUpcallDeopt.c
index ae2a8dc01731b..c51dbc937ac14 100644
--- a/test/jdk/java/foreign/upcalldeopt/libUpcallDeopt.c
+++ b/test/jdk/java/foreign/upcalldeopt/libUpcallDeopt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void foo(void (*cb)(int, int, int, int), int a0, int a1, int a2, int a3) {
cb(a0, a1, a2, a3);
diff --git a/test/jdk/java/foreign/virtual/libVirtual.c b/test/jdk/java/foreign/virtual/libVirtual.c
index 86c4c737a944a..7f7961da40898 100644
--- a/test/jdk/java/foreign/virtual/libVirtual.c
+++ b/test/jdk/java/foreign/virtual/libVirtual.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -22,11 +22,7 @@
*
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT int funcA() {
return 1;
diff --git a/test/jdk/java/lang/Thread/jni/AttachCurrentThread/libImplicitAttach.c b/test/jdk/java/lang/Thread/jni/AttachCurrentThread/libImplicitAttach.c
index a3dcb6ac050e3..ade58ccb7c02d 100644
--- a/test/jdk/java/lang/Thread/jni/AttachCurrentThread/libImplicitAttach.c
+++ b/test/jdk/java/lang/Thread/jni/AttachCurrentThread/libImplicitAttach.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -20,15 +20,18 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-#include
+
#include
+#include
+
+#include "export.h"
#define STACK_SIZE 0x100000
/**
* Creates n threads to execute the given function.
*/
-void start_threads(int n, void *(*f)(void *)) {
+EXPORT void start_threads(int n, void *(*f)(void *)) {
pthread_t tid;
pthread_attr_t attr;
int i;
diff --git a/test/jdk/tools/launcher/exeJliLaunchTest.c b/test/jdk/tools/launcher/exeJliLaunchTest.c
index 42b7118fec5f2..9157b309f56dc 100644
--- a/test/jdk/tools/launcher/exeJliLaunchTest.c
+++ b/test/jdk/tools/launcher/exeJliLaunchTest.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -28,9 +28,10 @@
* tools. The rest of the files will be linked in.
*/
+#include "export.h"
#include "java.h"
-int
+EXPORT int
main(int argc, char **args)
{
//avoid null-terminated array of arguments to test JDK-8303669
diff --git a/test/lib/jdk/test/lib/thread/libVThreadPinner.c b/test/lib/jdk/test/lib/thread/libVThreadPinner.c
index 958e636e3db80..31738c64f1bd7 100644
--- a/test/lib/jdk/test/lib/thread/libVThreadPinner.c
+++ b/test/lib/jdk/test/lib/thread/libVThreadPinner.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -23,11 +23,7 @@
#include
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
/*
* Call a function with the given function pointer.
diff --git a/test/lib/native/export.h b/test/lib/native/export.h
new file mode 100644
index 0000000000000..7e0eac383a53d
--- /dev/null
+++ b/test/lib/native/export.h
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+#ifndef TEST_LIB_NATIVE_EXPORT_H
+#define TEST_LIB_NATIVE_EXPORT_H
+
+#ifdef _WIN64
+ #define EXPORT __declspec(dllexport)
+#elif defined(__GNUC__)
+ #define EXPORT __attribute__((visibility("default")))
+#else
+ #define EXPORT
+#endif
+
+#endif // TEST_LIB_NATIVE_EXPORT_H
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverhead.c b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverhead.c
index 8ad44f58cec49..5297b77bb301c 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverhead.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/libCallOverhead.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void func() {}
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libCriticalCalls.c b/test/micro/org/openjdk/bench/java/lang/foreign/libCriticalCalls.c
index 6c76ef3d1b3f4..ca3838a50cab6 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/libCriticalCalls.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/libCriticalCalls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT int sum_ints(int* arr, int size) {
int sum = 0;
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c b/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c
index ed21ef198f30b..ed8bf5ffd4d61 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -21,14 +21,10 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
-
#include
+#include "export.h"
+
EXPORT long long id_long_long(long long value) {
return value;
}
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libQSort.c b/test/micro/org/openjdk/bench/java/lang/foreign/libQSort.c
index cafb83d8708c8..01fe313e8649c 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/libQSort.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/libQSort.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -21,12 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
-
+#include "export.h"
EXPORT int compar(const void* e0, const void* e1) {
int i0 = *((int*) e0);
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libUpcalls.c b/test/micro/org/openjdk/bench/java/lang/foreign/libUpcalls.c
index 220a890a812c2..fa534bca54ff2 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/libUpcalls.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/libUpcalls.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -21,11 +21,7 @@
* questions.
*/
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
+#include "export.h"
EXPORT void blank(void (*cb)(void)) {
cb();
diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/points/support/libPoint.c b/test/micro/org/openjdk/bench/java/lang/foreign/points/support/libPoint.c
index 5d4a23a8d6f39..5e1913e2aa7c4 100644
--- a/test/micro/org/openjdk/bench/java/lang/foreign/points/support/libPoint.c
+++ b/test/micro/org/openjdk/bench/java/lang/foreign/points/support/libPoint.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -20,17 +20,13 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-#include
+
#include
+#include
+#include "export.h"
#include "points.h"
-#ifdef _WIN64
-#define EXPORT __declspec(dllexport)
-#else
-#define EXPORT
-#endif
-
EXPORT double distance(Point p1, Point p2) {
int xDist = abs(p1.x - p2.x);
int yDist = abs(p1.y - p2.y);
From 07acc0bbad2cd5b37013d17785ca466429966a0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roberto=20Casta=C3=B1eda=20Lozano?=
Date: Wed, 13 Mar 2024 08:14:36 +0000
Subject: [PATCH 07/58] 8326385: [aarch64] C2: lightweight locking nodes kill
the box register without specifying this effect
Reviewed-by: aboldtch, dlong
---
src/hotspot/cpu/aarch64/aarch64.ad | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad
index a5943a13d61fe..171ce00ae5664 100644
--- a/src/hotspot/cpu/aarch64/aarch64.ad
+++ b/src/hotspot/cpu/aarch64/aarch64.ad
@@ -16019,33 +16019,33 @@ instruct cmpFastUnlock(rFlagsReg cr, iRegP object, iRegP box, iRegPNoSp tmp, iRe
ins_pipe(pipe_serial);
%}
-instruct cmpFastLockLightweight(rFlagsReg cr, iRegP object, iRegP box, iRegPNoSp tmp, iRegPNoSp tmp2)
+instruct cmpFastLockLightweight(rFlagsReg cr, iRegP object, iRegP box, iRegPNoSp tmp, iRegPNoSp tmp2, iRegPNoSp tmp3)
%{
predicate(LockingMode == LM_LIGHTWEIGHT);
match(Set cr (FastLock object box));
- effect(TEMP tmp, TEMP tmp2);
+ effect(TEMP tmp, TEMP tmp2, TEMP tmp3);
ins_cost(5 * INSN_COST);
- format %{ "fastlock $object,$box\t! kills $tmp,$tmp2" %}
+ format %{ "fastlock $object,$box\t! kills $tmp,$tmp2,$tmp3" %}
ins_encode %{
- __ fast_lock_lightweight($object$$Register, $box$$Register, $tmp$$Register, $tmp2$$Register);
+ __ fast_lock_lightweight($object$$Register, $tmp$$Register, $tmp2$$Register, $tmp3$$Register);
%}
ins_pipe(pipe_serial);
%}
-instruct cmpFastUnlockLightweight(rFlagsReg cr, iRegP object, iRegP box, iRegPNoSp tmp, iRegPNoSp tmp2)
+instruct cmpFastUnlockLightweight(rFlagsReg cr, iRegP object, iRegP box, iRegPNoSp tmp, iRegPNoSp tmp2, iRegPNoSp tmp3)
%{
predicate(LockingMode == LM_LIGHTWEIGHT);
match(Set cr (FastUnlock object box));
- effect(TEMP tmp, TEMP tmp2);
+ effect(TEMP tmp, TEMP tmp2, TEMP tmp3);
ins_cost(5 * INSN_COST);
- format %{ "fastunlock $object,$box\t! kills $tmp, $tmp2" %}
+ format %{ "fastunlock $object,$box\t! kills $tmp, $tmp2, $tmp3" %}
ins_encode %{
- __ fast_unlock_lightweight($object$$Register, $box$$Register, $tmp$$Register, $tmp2$$Register);
+ __ fast_unlock_lightweight($object$$Register, $tmp$$Register, $tmp2$$Register, $tmp3$$Register);
%}
ins_pipe(pipe_serial);
From 107cb536e75509ad63b245d20772eb2c3f73d595 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 13 Mar 2024 08:42:12 +0000
Subject: [PATCH 08/58] 8327701: Remove the xlc toolchain
Reviewed-by: jwaters, erikj
---
doc/building.html | 12 +-
doc/building.md | 7 +-
make/autoconf/build-performance.m4 | 5 +-
make/autoconf/flags-cflags.m4 | 86 ++-----------
make/autoconf/flags-ldflags.m4 | 13 --
make/autoconf/flags.m4 | 48 +------
make/autoconf/spec.gmk.template | 13 +-
make/autoconf/toolchain.m4 | 121 +++++-------------
make/common/modules/LauncherCommon.gmk | 4 +-
make/common/modules/LibCommon.gmk | 5 +-
make/common/native/Link.gmk | 5 -
make/common/native/Paths.gmk | 7 +-
make/hotspot/lib/CompileJvm.gmk | 3 -
make/modules/java.base/Lib.gmk | 1 -
make/modules/java.base/lib/CoreLibraries.gmk | 1 -
.../java.desktop/lib/Awt2dLibraries.gmk | 10 --
src/hotspot/os/aix/os_aix.cpp | 2 -
src/hotspot/share/utilities/debug.hpp | 7 +-
.../share/utilities/globalDefinitions_xlc.hpp | 14 +-
19 files changed, 61 insertions(+), 303 deletions(-)
diff --git a/doc/building.html b/doc/building.html
index a57d3d16abca2..a49d7153ba311 100644
--- a/doc/building.html
+++ b/doc/building.html
@@ -68,7 +68,8 @@
version number accordingly. If you have not installed the
BuildTools, but e.g. Professional, adjust the
product ID accordingly.
-
IBM XL C/C++
-
Please consult the AIX section of the Supported
-Build Platforms OpenJDK Build Wiki page for details about which
-versions of XLC are supported.
+
IBM Open XL C/C++
+
The minimum accepted version of Open XL is 17.1.1.4. This is in
+essence clang 15, and will be treated as such by the OpenJDK build
+system.
Boot JDK Requirements
Paradoxically, building the JDK requires a pre-existing JDK. This is
called the "boot JDK". The boot JDK does not, however, have to be a JDK
diff --git a/doc/building.md b/doc/building.md
index 5812b7529e31b..d60f7e94164f8 100644
--- a/doc/building.md
+++ b/doc/building.md
@@ -487,11 +487,10 @@ that the " characters are essential)
accordingly. If you have not installed the `BuildTools`, but e.g.
`Professional`, adjust the product ID accordingly.
-### IBM XL C/C++
+### IBM Open XL C/C++
-Please consult the AIX section of the [Supported Build Platforms](
-https://wiki.openjdk.org/display/Build/Supported+Build+Platforms) OpenJDK Build
-Wiki page for details about which versions of XLC are supported.
+The minimum accepted version of Open XL is 17.1.1.4. This is in essence clang
+15, and will be treated as such by the OpenJDK build system.
## Boot JDK Requirements
diff --git a/make/autoconf/build-performance.m4 b/make/autoconf/build-performance.m4
index 40ca9d41d33ff..4414ea0d93c9d 100644
--- a/make/autoconf/build-performance.m4
+++ b/make/autoconf/build-performance.m4
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -359,9 +359,6 @@ AC_DEFUN_ONCE([BPERF_SETUP_PRECOMPILED_HEADERS],
if test "x$ICECC" != "x"; then
AC_MSG_RESULT([no, does not work effectively with icecc])
PRECOMPILED_HEADERS_AVAILABLE=false
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- AC_MSG_RESULT([no, does not work with xlc])
- PRECOMPILED_HEADERS_AVAILABLE=false
elif test "x$TOOLCHAIN_TYPE" = xgcc; then
# Check that the compiler actually supports precomp headers.
echo "int alfa();" > conftest.h
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index dc4426d1d4531..78bca110357b8 100644
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -77,12 +77,6 @@ AC_DEFUN([FLAGS_SETUP_SHARED_LIBS],
fi
fi
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- SHARED_LIBRARY_FLAGS="-qmkshrobj -bM:SRE -bnoentry"
- SET_EXECUTABLE_ORIGIN=""
- SET_SHARED_LIBRARY_ORIGIN=''
- SET_SHARED_LIBRARY_NAME=''
-
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
SHARED_LIBRARY_FLAGS="-dll"
SET_EXECUTABLE_ORIGIN=''
@@ -152,8 +146,6 @@ AC_DEFUN([FLAGS_SETUP_DEBUG_SYMBOLS],
CFLAGS_DEBUG_SYMBOLS="-g ${GDWARF_FLAGS}"
ASFLAGS_DEBUG_SYMBOLS="-g"
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- CFLAGS_DEBUG_SYMBOLS="-g1"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CFLAGS_DEBUG_SYMBOLS="-Z7"
fi
@@ -219,11 +211,7 @@ AC_DEFUN([DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS],
AC_DEFUN([FLAGS_SETUP_WARNINGS],
[
# Set default value.
- if test "x$TOOLCHAIN_TYPE" != xxlc; then
- WARNINGS_AS_ERRORS_DEFAULT=true
- else
- WARNINGS_AS_ERRORS_DEFAULT=false
- fi
+ WARNINGS_AS_ERRORS_DEFAULT=true
UTIL_ARG_ENABLE(NAME: warnings-as-errors, DEFAULT: $WARNINGS_AS_ERRORS_DEFAULT,
RESULT: WARNINGS_AS_ERRORS,
@@ -273,15 +261,6 @@ AC_DEFUN([FLAGS_SETUP_WARNINGS],
DISABLED_WARNINGS="unknown-warning-option unused-parameter unused"
;;
-
- xlc)
- DISABLE_WARNING_PREFIX="-Wno-"
- CFLAGS_WARNINGS_ARE_ERRORS="-qhalt=w"
-
- # Possibly a better subset than "all" is "lan:trx:ret:zea:cmp:ret"
- WARNINGS_ENABLE_ALL="-qinfo=all -qformat=all"
- DISABLED_WARNINGS=""
- ;;
esac
AC_SUBST(DISABLE_WARNING_PREFIX)
AC_SUBST(BUILD_CC_DISABLE_WARNING_PREFIX)
@@ -363,15 +342,6 @@ AC_DEFUN([FLAGS_SETUP_OPTIMIZATION],
C_O_FLAG_SIZE="-Os"
C_O_FLAG_DEBUG="-O0"
C_O_FLAG_NONE="-O0"
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- C_O_FLAG_HIGHEST_JVM="-O3 -qhot=level=1 -qinline -qinlglue"
- C_O_FLAG_HIGHEST="-O3 -qhot=level=1 -qinline -qinlglue"
- C_O_FLAG_HI="-O3 -qinline -qinlglue"
- C_O_FLAG_NORM="-O2"
- C_O_FLAG_DEBUG="-qnoopt"
- # FIXME: Value below not verified.
- C_O_FLAG_DEBUG_JVM=""
- C_O_FLAG_NONE="-qnoopt"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
C_O_FLAG_HIGHEST_JVM="-O2 -Oy-"
C_O_FLAG_HIGHEST="-O2"
@@ -524,12 +494,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
else
DEBUG_CFLAGS_JDK="-DDEBUG"
- if test "x$TOOLCHAIN_TYPE" = xxlc; then
- # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
- # Hotspot now overflows its 64K TOC (currently only for debug),
- # so for debug we build with '-qpic=large -bbigtoc'.
- DEBUG_CFLAGS_JVM="-qpic=large"
- fi
if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
DEBUG_CFLAGS_JVM="-fpic -mcmodel=large"
fi
@@ -546,9 +510,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE -D_REENTRANT"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
ALWAYS_DEFINES_JVM="-D_GNU_SOURCE"
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- ALWAYS_DEFINES_JVM="-D_REENTRANT"
- ALWAYS_DEFINES_JDK="-D_GNU_SOURCE -D_REENTRANT -DSTDC"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# Access APIs for Windows 8 and above
# see https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=msvc-170
@@ -612,12 +573,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- # Suggested additions: -qsrcmsg to get improved error reporting
- # set -qtbtable=full for a better traceback table/better stacks in hs_err when xlc16 is used
- TOOLCHAIN_CFLAGS_JDK="-qtbtable=full -qchars=signed -qfullpath -qsaveopt -qstackprotect" # add on both CFLAGS
- TOOLCHAIN_CFLAGS_JVM="-qtbtable=full -qtune=balanced -fno-exceptions \
- -qalias=noansi -qstrict -qtls=default -qnortti -qnoeh -qignerrno -qstackprotect"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# The -utf-8 option sets source and execution character sets to UTF-8 to enable correct
# compilation of all source files regardless of the active code page on Windows.
@@ -626,7 +581,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
fi
# CFLAGS C language level for JDK sources (hotspot only uses C++)
- if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
LANGSTD_CFLAGS="-std=c11"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LANGSTD_CFLAGS="-std:c11"
@@ -634,12 +589,12 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK_CONLY="$LANGSTD_CFLAGS $TOOLCHAIN_CFLAGS_JDK_CONLY"
# CXXFLAGS C++ language level for all of JDK, including Hotspot.
- if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang || test "x$TOOLCHAIN_TYPE" = xxlc; then
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
LANGSTD_CXXFLAGS="-std=c++14"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
LANGSTD_CXXFLAGS="-std:c++14"
else
- AC_MSG_ERROR([Don't know how to enable C++14 for this toolchain])
+ AC_MSG_ERROR([Cannot enable C++14 for this toolchain])
fi
TOOLCHAIN_CFLAGS_JDK_CXXONLY="$TOOLCHAIN_CFLAGS_JDK_CXXONLY $LANGSTD_CXXFLAGS"
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM $LANGSTD_CXXFLAGS"
@@ -658,8 +613,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
WARNING_CFLAGS="$WARNINGS_ENABLE_ALL"
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- WARNING_CFLAGS="" # currently left empty
fi
# Set some additional per-OS defines.
@@ -684,31 +637,16 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
PICFLAG="-fPIC"
PIEFLAG="-fPIE"
- elif test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
- JVM_PICFLAG="-fpic -mcmodel=large -Wl,-bbigtoc
- JDK_PICFLAG="-fpic
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- # '-qpic' defaults to 'qpic=small'. This means that the compiler generates only
- # one instruction for accessing the TOC. If the TOC grows larger than 64K, the linker
- # will have to patch this single instruction with a call to some out-of-order code which
- # does the load from the TOC. This is of course slower, and we also would have
- # to use '-bbigtoc' for linking anyway so we could also change the PICFLAG to 'qpic=large'.
- # With 'qpic=large' the compiler will by default generate a two-instruction sequence which
- # can be patched directly by the linker and does not require a jump to out-of-order code.
- #
- # Since large TOC causes perf. overhead, only pay it where we must. Currently this is
- # for all libjvm variants (both gtest and normal) but no other binaries. So, build
- # libjvm with -qpic=large and link with -bbigtoc.
- JVM_PICFLAG="-qpic=large"
- JDK_PICFLAG="-qpic"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
PICFLAG=""
fi
- if test "x$TOOLCHAIN_TYPE" != xxlc; then
+ if test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
+ JVM_PICFLAG="-fpic -mcmodel=large"
+ else
JVM_PICFLAG="$PICFLAG"
- JDK_PICFLAG="$PICFLAG"
fi
+ JDK_PICFLAG="$PICFLAG"
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
# Linking is different on MacOSX
@@ -758,8 +696,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -DARCH='\"$FLAGS_CPU_LEGACY\"' \
-D$FLAGS_CPU_LEGACY"
- if test "x$FLAGS_CPU_BITS" = x64 && test "x$FLAGS_OS" != xaix; then
- # xlc on AIX defines _LP64=1 by default and issues a warning if we redefine it.
+ if test "x$FLAGS_CPU_BITS" = x64; then
$1_DEFINES_CPU_JDK="${$1_DEFINES_CPU_JDK} -D_LP64=1"
$1_DEFINES_CPU_JVM="${$1_DEFINES_CPU_JVM} -D_LP64=1"
fi
@@ -836,11 +773,6 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_CPU_DEP],
$1_CFLAGS_CPU="-mcpu=pwr8"
fi
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- if test "x$FLAGS_CPU" = xppc64; then
- $1_CFLAGS_CPU_JVM="-qarch=ppc64"
- fi
-
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
if test "x$FLAGS_CPU" = xx86; then
$1_CFLAGS_CPU_JVM="-arch:IA32"
diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
index 58bc4a44bfbdf..b0f56a53a3dea 100644
--- a/make/autoconf/flags-ldflags.m4
+++ b/make/autoconf/flags-ldflags.m4
@@ -86,11 +86,6 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
-Wl,-bernotok -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k"
BASIC_LDFLAGS_JVM_ONLY="$BASIC_LDFLAGS_JVM_ONLY -Wl,-lC_r -Wl,-bbigtoc"
fi
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- BASIC_LDFLAGS="-b64 -brtl -bnorwexec -bnolibpath -bnoexpall -bernotok -btextpsize:64K \
- -bdatapsize:64K -bstackpsize:64K"
- # libjvm.so has gotten too large for normal TOC size; compile with qpic=large and link with bigtoc
- BASIC_LDFLAGS_JVM_ONLY="-Wl,-lC_r -bbigtoc"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
BASIC_LDFLAGS="-opt:ref"
@@ -120,14 +115,6 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
fi
fi
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- # We need '-qminimaltoc' or '-qpic=large -bbigtoc' if the TOC overflows.
- # Hotspot now overflows its 64K TOC (currently only for debug),
- # so we build with '-qpic=large -bbigtoc'.
- if test "x$DEBUG_LEVEL" != xrelease; then
- DEBUGLEVEL_LDFLAGS_JVM_ONLY="$DEBUGLEVEL_LDFLAGS_JVM_ONLY -bbigtoc"
- fi
-
elif test "x$TOOLCHAIN_TYPE" = xclang && test "x$OPENJDK_TARGET_OS" = xaix; then
# We need '-fpic' or '-fpic -mcmodel=large -Wl,-bbigtoc' if the TOC overflows.
# Hotspot now overflows its 64K TOC (currently only for debug),
diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
index 147382f398eed..d50538108a471 100644
--- a/make/autoconf/flags.m4
+++ b/make/autoconf/flags.m4
@@ -261,12 +261,9 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
# The sysroot flags are needed for configure to be able to run the compilers
FLAGS_SETUP_SYSROOT_FLAGS
- # For xlc, the word size flag is required for correct behavior.
# For clang/gcc, the flag is only strictly required for reduced builds, but
# set it always where possible (x86 and ppc).
- if test "x$TOOLCHAIN_TYPE" = xxlc; then
- MACHINE_FLAG="-q${OPENJDK_TARGET_CPU_BITS}"
- elif test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
+ if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
if test "x$OPENJDK_TARGET_CPU_ARCH" = xx86 &&
test "x$OPENJDK_TARGET_CPU" != xx32 ||
test "x$OPENJDK_TARGET_CPU_ARCH" = xppc; then
@@ -321,47 +318,6 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
[
- # COMPILER_TARGET_BITS_FLAG : option for selecting 32- or 64-bit output
- # COMPILER_COMMAND_FILE_FLAG : option for passing a command file to the compiler
- # COMPILER_BINDCMD_FILE_FLAG : option for specifying a file which saves the binder
- # commands produced by the link step (currently AIX only)
- if test "x$TOOLCHAIN_TYPE" = xxlc; then
- COMPILER_TARGET_BITS_FLAG="-q"
- COMPILER_COMMAND_FILE_FLAG="-f"
- COMPILER_BINDCMD_FILE_FLAG="-bloadmap:"
- else
- COMPILER_TARGET_BITS_FLAG="-m"
- COMPILER_COMMAND_FILE_FLAG="@"
- COMPILER_BINDCMD_FILE_FLAG=""
-
- # Check if @file is supported by gcc
- if test "x$TOOLCHAIN_TYPE" = xgcc; then
- AC_MSG_CHECKING([if @file is supported by gcc])
- # Extra empty "" to prevent ECHO from interpreting '--version' as argument
- $ECHO "" "--version" > command.file
- # Redirect stderr and stdout to config.log (AS_MESSAGE_LOG_FD) via merge
- if $CXX @command.file 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
- AC_MSG_RESULT(yes)
- COMPILER_COMMAND_FILE_FLAG="@"
- else
- AC_MSG_RESULT(no)
- COMPILER_COMMAND_FILE_FLAG=
- fi
- $RM command.file
- fi
- fi
-
- AC_SUBST(COMPILER_TARGET_BITS_FLAG)
- AC_SUBST(COMPILER_COMMAND_FILE_FLAG)
- AC_SUBST(COMPILER_BINDCMD_FILE_FLAG)
-
- # Check that the compiler supports -mX (or -qX on AIX) flags
- # Set COMPILER_SUPPORTS_TARGET_BITS_FLAG to 'true' if it does
- FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_TARGET_BITS_FLAG}${OPENJDK_TARGET_CPU_BITS}],
- IF_TRUE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=true],
- IF_FALSE: [COMPILER_SUPPORTS_TARGET_BITS_FLAG=false])
- AC_SUBST(COMPILER_SUPPORTS_TARGET_BITS_FLAG)
-
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
CC_OUT_OPTION=-Fo
else
@@ -376,8 +332,6 @@ AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
GENDEPS_FLAGS="-MMD -MF"
elif test "x$TOOLCHAIN_TYPE" = xclang; then
GENDEPS_FLAGS="-MMD -MF"
- elif test "x$TOOLCHAIN_TYPE" = xxlc; then
- GENDEPS_FLAGS="-qmakedep=gcc -MF"
fi
AC_SUBST(GENDEPS_FLAGS)
])
diff --git a/make/autoconf/spec.gmk.template b/make/autoconf/spec.gmk.template
index 863a51eeb4afa..c0a0c9e1506bf 100644
--- a/make/autoconf/spec.gmk.template
+++ b/make/autoconf/spec.gmk.template
@@ -477,7 +477,7 @@ MACOSX_VERSION_MAX := @MACOSX_VERSION_MAX@
MACOSX_CODESIGN_MODE := @MACOSX_CODESIGN_MODE@
MACOSX_CODESIGN_IDENTITY := @MACOSX_CODESIGN_IDENTITY@
-# Toolchain type: gcc, clang, xlc, microsoft...
+# Toolchain type: gcc, clang, microsoft...
TOOLCHAIN_TYPE := @TOOLCHAIN_TYPE@
TOOLCHAIN_VERSION := @TOOLCHAIN_VERSION@
CC_VERSION_NUMBER := @CC_VERSION_NUMBER@
@@ -486,17 +486,6 @@ CXX_VERSION_NUMBER := @CXX_VERSION_NUMBER@
# Legacy support
HOTSPOT_TOOLCHAIN_TYPE := @HOTSPOT_TOOLCHAIN_TYPE@
-# Option used to tell the compiler whether to create 32- or 64-bit executables
-COMPILER_TARGET_BITS_FLAG := @COMPILER_TARGET_BITS_FLAG@
-COMPILER_SUPPORTS_TARGET_BITS_FLAG := @COMPILER_SUPPORTS_TARGET_BITS_FLAG@
-
-# Option used to pass a command file to the compiler
-COMPILER_COMMAND_FILE_FLAG := @COMPILER_COMMAND_FILE_FLAG@
-
-# Option for specifying a file which saves the binder commands
-# produced by the link step (for debugging, currently AIX only)
-COMPILER_BINDCMD_FILE_FLAG := @COMPILER_BINDCMD_FILE_FLAG@
-
CC_OUT_OPTION := @CC_OUT_OPTION@
# Flags used for overriding the default opt setting for a C/C++ source file.
diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4
index 15ebc0cbbbc63..acccac3e320c6 100644
--- a/make/autoconf/toolchain.m4
+++ b/make/autoconf/toolchain.m4
@@ -35,25 +35,23 @@
m4_include([toolchain_microsoft.m4])
# All valid toolchains, regardless of platform (used by help.m4)
-VALID_TOOLCHAINS_all="gcc clang xlc microsoft"
+VALID_TOOLCHAINS_all="gcc clang microsoft"
# These toolchains are valid on different platforms
VALID_TOOLCHAINS_linux="gcc clang"
VALID_TOOLCHAINS_macosx="clang"
-VALID_TOOLCHAINS_aix="xlc clang"
+VALID_TOOLCHAINS_aix="clang"
VALID_TOOLCHAINS_windows="microsoft"
# Toolchain descriptions
TOOLCHAIN_DESCRIPTION_clang="clang/LLVM"
TOOLCHAIN_DESCRIPTION_gcc="GNU Compiler Collection"
TOOLCHAIN_DESCRIPTION_microsoft="Microsoft Visual Studio"
-TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
# Minimum supported versions, empty means unspecified
TOOLCHAIN_MINIMUM_VERSION_clang="13.0"
TOOLCHAIN_MINIMUM_VERSION_gcc="10.0"
TOOLCHAIN_MINIMUM_VERSION_microsoft="19.28.0.0" # VS2019 16.8, aka MSVC 14.28
-TOOLCHAIN_MINIMUM_VERSION_xlc="17.1.1.4"
# Minimum supported linker versions, empty means unspecified
TOOLCHAIN_MINIMUM_LD_VERSION_gcc="2.18"
@@ -234,25 +232,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
# First toolchain type in the list is the default
DEFAULT_TOOLCHAIN=${VALID_TOOLCHAINS%% *}
- # On AIX the default toolchain depends on the installed (found) compiler
- # xlclang++ -> xlc toolchain
- # ibm-clang++_r -> clang toolchain
- # The compiler is searched on the PATH and TOOLCHAIN_PATH
- # xlclang++ has precedence over ibm-clang++_r if both are installed
- if test "x$OPENJDK_TARGET_OS" = xaix; then
- DEFAULT_TOOLCHAIN="clang"
- if test "x$TOOLCHAIN_PATH" != x; then
- if test -e ${TOOLCHAIN_PATH}/xlclang++; then
- DEFAULT_TOOLCHAIN="xlc"
- fi
- else
- UTIL_LOOKUP_PROGS(XLCLANG_TEST_PATH, xlclang++)
- if test "x$XLCLANG_TEST_PATH" != x; then
- DEFAULT_TOOLCHAIN="xlc"
- fi
- fi
- fi
-
if test "x$with_toolchain_type" = xlist; then
# List all toolchains
AC_MSG_NOTICE([The following toolchains are valid on this platform:])
@@ -277,48 +256,13 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETERMINE_TOOLCHAIN_TYPE],
fi
AC_SUBST(TOOLCHAIN_TYPE)
- # on AIX, check for xlclang++ on the PATH and TOOLCHAIN_PATH and use it if it is available
- if test "x$OPENJDK_TARGET_OS" = xaix; then
- if test "x$TOOLCHAIN_PATH" != x; then
- XLC_TEST_PATH=${TOOLCHAIN_PATH}/
- fi
- if test "x$TOOLCHAIN_TYPE" = xclang; then
- TOOLCHAIN_DESCRIPTION_clang="IBM Open XL C/C++"
- XLCLANG_VERSION_OUTPUT=`${XLC_TEST_PATH}ibm-clang++_r --version 2>&1 | $HEAD -n 1`
- $ECHO "$XLCLANG_VERSION_OUTPUT" | $GREP "IBM Open XL C/C++ for AIX" > /dev/null
- if test $? -eq 0; then
- AC_MSG_NOTICE([ibm-clang++_r output: $XLCLANG_VERSION_OUTPUT])
- else
- AC_MSG_ERROR([ibm-clang++_r version output check failed, output: $XLCLANG_VERSION_OUTPUT])
- fi
- else
- XLCLANG_VERSION_OUTPUT=`${XLC_TEST_PATH}xlclang++ -qversion 2>&1 | $HEAD -n 1`
- $ECHO "$XLCLANG_VERSION_OUTPUT" | $GREP "IBM XL C/C++ for AIX" > /dev/null
- if test $? -eq 0; then
- AC_MSG_NOTICE([xlclang++ output: $XLCLANG_VERSION_OUTPUT])
- else
- AC_MSG_ERROR([xlclang++ version output check failed, output: $XLCLANG_VERSION_OUTPUT])
- fi
- fi
- fi
-
- if test "x$OPENJDK_TARGET_OS" = xaix; then
- TOOLCHAIN_CC_BINARY_clang="ibm-clang_r"
- else
- TOOLCHAIN_CC_BINARY_clang="clang"
- fi
+ TOOLCHAIN_CC_BINARY_clang="ibm-clang_r clang"
TOOLCHAIN_CC_BINARY_gcc="gcc"
TOOLCHAIN_CC_BINARY_microsoft="cl"
- TOOLCHAIN_CC_BINARY_xlc="xlclang"
- if test "x$OPENJDK_TARGET_OS" = xaix; then
- TOOLCHAIN_CXX_BINARY_clang="ibm-clang++_r"
- else
- TOOLCHAIN_CXX_BINARY_clang="clang++"
- fi
+ TOOLCHAIN_CXX_BINARY_clang="ibm-clang++_r clang++"
TOOLCHAIN_CXX_BINARY_gcc="g++"
TOOLCHAIN_CXX_BINARY_microsoft="cl"
- TOOLCHAIN_CXX_BINARY_xlc="xlclang++"
# Use indirect variable referencing
toolchain_var_name=TOOLCHAIN_DESCRIPTION_$TOOLCHAIN_TYPE
@@ -408,25 +352,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
COMPILER=[$]$1
COMPILER_NAME=$2
- if test "x$TOOLCHAIN_TYPE" = xxlc; then
- # xlc -qversion output typically looks like
- # IBM XL C/C++ for AIX, V11.1 (5724-X13)
- # Version: 11.01.0000.0015
- COMPILER_VERSION_OUTPUT=`$COMPILER -qversion 2>&1`
- # Check that this is likely to be the IBM XL C compiler.
- $ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "IBM XL C" > /dev/null
- if test $? -ne 0; then
- ALT_VERSION_OUTPUT=`$COMPILER --version 2>&1`
- AC_MSG_NOTICE([The $COMPILER_NAME compiler (located as $COMPILER) does not seem to be the required $TOOLCHAIN_TYPE compiler.])
- AC_MSG_NOTICE([The result from running with -qversion was: "$COMPILER_VERSION_OUTPUT"])
- AC_MSG_NOTICE([The result from running with --version was: "$ALT_VERSION_OUTPUT"])
- AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
- fi
- # Collapse compiler output into a single line
- COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
- COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
- $SED -e 's/^.*Version: \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
- elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+ if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# There is no specific version flag, but all output starts with a version string.
# First line typically looks something like:
# Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.40219.01 for 80x86
@@ -465,12 +391,22 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
$SED -e 's/^.* \(@<:@1-9@:>@<:@0-9@:>@*\.@<:@0-9.@:>@*\)@<:@^0-9.@:>@.*$/\1/'`
elif test "x$TOOLCHAIN_TYPE" = xclang; then
# clang --version output typically looks like
- # Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
- # clang version 3.3 (tags/RELEASE_33/final)
+ # Apple clang version 15.0.0 (clang-1500.3.9.4)
+ # Target: arm64-apple-darwin23.2.0
+ # Thread model: posix
+ # InstalledDir: /Library/Developer/CommandLineTools/usr/bin
# or
- # Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
+ # clang version 10.0.0-4ubuntu1
# Target: x86_64-pc-linux-gnu
# Thread model: posix
+ # InstalledDir: /usr/bin
+ # Target: x86_64-pc-linux-gnu
+ # Thread model: posix
+ # or
+ # IBM Open XL C/C++ for AIX 17.1.0 (5725-C72, 5765-J18), clang version 13.0.0
+ # Target: powerpc-ibm-aix7.2.0.0
+ # Thread model: posix
+ # InstalledDir: /opt/IBM/openxlC/17.1.0/bin
COMPILER_VERSION_OUTPUT=`$COMPILER --version 2>&1`
# Check that this is likely to be clang
$ECHO "$COMPILER_VERSION_OUTPUT" | $GREP "clang" > /dev/null
@@ -479,10 +415,12 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_COMPILER_VERSION],
AC_MSG_NOTICE([The result from running with --version was: "$COMPILER_VERSION_OUTPUT"])
AC_MSG_ERROR([A $TOOLCHAIN_TYPE compiler is required. Try setting --with-tools-dir.])
fi
- # Collapse compiler output into a single line
- COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT`
+ # Remove "Thread model:" and further details from the version string, and
+ # collapse into a single line
+ COMPILER_VERSION_STRING=`$ECHO $COMPILER_VERSION_OUTPUT | \
+ $SED -e 's/ *Thread model: .*//'`
COMPILER_VERSION_NUMBER=`$ECHO $COMPILER_VERSION_OUTPUT | \
- $SED -e 's/^.* version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
+ $SED -e 's/^.*clang version \(@<:@1-9@:>@@<:@0-9.@:>@*\).*$/\1/'`
else
AC_MSG_ERROR([Unknown toolchain type $TOOLCHAIN_TYPE.])
fi
@@ -575,10 +513,7 @@ AC_DEFUN([TOOLCHAIN_EXTRACT_LD_VERSION],
LINKER=[$]$1
LINKER_NAME="$2"
- if test "x$TOOLCHAIN_TYPE" = xxlc; then
- LINKER_VERSION_STRING="Unknown"
- LINKER_VERSION_NUMBER="0.0"
- elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
+ if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# There is no specific version flag, but all output starts with a version string.
# First line typically looks something like:
# Microsoft (R) Incremental Linker Version 12.00.31101.0
@@ -1000,6 +935,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
fi
fi
fi
+ if test "x$OPENJDK_TARGET_OS" = xaix; then
+ # Make sure we have the Open XL version of clang on AIX
+
+ $ECHO "$CC_VERSION_STRING" | $GREP "IBM Open XL C/C++ for AIX" > /dev/null
+ if test $? -ne 0; then
+ AC_MSG_ERROR([ibm-clang_r version output check failed, output: $CC_VERSION_OUTPUT])
+ fi
+ fi
if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
# Check if linker has -z noexecstack.
diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk
index 8041e9fe681c3..95d8474f04522 100644
--- a/make/common/modules/LauncherCommon.gmk
+++ b/make/common/modules/LauncherCommon.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -39,8 +39,6 @@ ifeq ($(TOOLCHAIN_TYPE), gcc)
LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
else ifeq ($(TOOLCHAIN_TYPE), clang)
LAUNCHER_CFLAGS += -fvisibility=hidden
-else ifeq ($(TOOLCHAIN_TYPE), xlc)
- LAUNCHER_CFLAGS += -qvisibility=hidden
endif
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
diff --git a/make/common/modules/LibCommon.gmk b/make/common/modules/LibCommon.gmk
index 2450d2d1e0374..67d0ff1435fd3 100644
--- a/make/common/modules/LibCommon.gmk
+++ b/make/common/modules/LibCommon.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 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
@@ -44,9 +44,6 @@ ifeq ($(TOOLCHAIN_TYPE), gcc)
else ifeq ($(TOOLCHAIN_TYPE), clang)
CFLAGS_JDKLIB += -fvisibility=hidden
CXXFLAGS_JDKLIB += -fvisibility=hidden
-else ifeq ($(TOOLCHAIN_TYPE), xlc)
- CFLAGS_JDKLIB += -qvisibility=hidden
- CXXFLAGS_JDKLIB += -qvisibility=hidden
endif
# Put the libraries here.
diff --git a/make/common/native/Link.gmk b/make/common/native/Link.gmk
index fb23152d4fb9b..3390eb3c89906 100644
--- a/make/common/native/Link.gmk
+++ b/make/common/native/Link.gmk
@@ -133,11 +133,6 @@ define CreateDynamicLibraryOrExecutable
ifeq ($$($1_TYPE), LIBRARY)
# Generating a dynamic library.
$1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
-
- # Create loadmap on AIX. Helps in diagnosing some problems.
- ifneq ($(COMPILER_BINDCMD_FILE_FLAG), )
- $1_EXTRA_LDFLAGS += $(COMPILER_BINDCMD_FILE_FLAG)$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).loadmap
- endif
endif
$1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) \
diff --git a/make/common/native/Paths.gmk b/make/common/native/Paths.gmk
index 67aa61d86e968..e021a390289bd 100644
--- a/make/common/native/Paths.gmk
+++ b/make/common/native/Paths.gmk
@@ -209,12 +209,7 @@ define SetupObjectFileList
# If there are many object files, use an @-file...
ifneq ($$(word 17, $$($1_ALL_OBJS)), )
$1_OBJ_FILE_LIST := $$($1_OBJECT_DIR)/_$1_objectfilenames.txt
- ifneq ($(COMPILER_COMMAND_FILE_FLAG), )
- $1_LD_OBJ_ARG := $(COMPILER_COMMAND_FILE_FLAG)$$($1_OBJ_FILE_LIST)
- else
- # ...except for toolchains which don't support them.
- $1_LD_OBJ_ARG := `cat $$($1_OBJ_FILE_LIST)`
- endif
+ $1_LD_OBJ_ARG := @$$($1_OBJ_FILE_LIST)
# If we are building static library, 'AR' on macosx/aix may not support @-file.
ifeq ($$($1_TYPE), STATIC_LIBRARY)
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
index 19699be4aed35..859e75cfc9fa4 100644
--- a/make/hotspot/lib/CompileJvm.gmk
+++ b/make/hotspot/lib/CompileJvm.gmk
@@ -96,8 +96,6 @@ ifneq ($(DEBUG_LEVEL), release)
DISABLED_WARNINGS_gcc += strict-overflow
endif
-DISABLED_WARNINGS_xlc := tautological-compare shift-negative-value
-
DISABLED_WARNINGS_microsoft := 4624 4244 4291 4146 4127 4722
################################################################################
@@ -202,7 +200,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJVM, \
DISABLED_WARNINGS_clang_aix_debug.cpp := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_jvm.cpp := format-nonliteral, \
DISABLED_WARNINGS_clang_aix_osThread_aix.cpp := tautological-undefined-compare, \
- DISABLED_WARNINGS_xlc := $(DISABLED_WARNINGS_xlc), \
DISABLED_WARNINGS_microsoft := $(DISABLED_WARNINGS_microsoft), \
ASFLAGS := $(JVM_ASFLAGS), \
LDFLAGS := $(JVM_LDFLAGS), \
diff --git a/make/modules/java.base/Lib.gmk b/make/modules/java.base/Lib.gmk
index 54050d0798626..53fe95a1b0c2b 100644
--- a/make/modules/java.base/Lib.gmk
+++ b/make/modules/java.base/Lib.gmk
@@ -72,7 +72,6 @@ TARGETS += $(BUILD_LIBNET)
$(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
NAME := nio, \
OPTIMIZATION := HIGH, \
- WARNINGS_AS_ERRORS_xlc := false, \
CFLAGS := $(CFLAGS_JDKLIB), \
EXTRA_HEADER_DIRS := \
libnio/ch \
diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk
index b27013536f8e3..48d568952972b 100644
--- a/make/modules/java.base/lib/CoreLibraries.gmk
+++ b/make/modules/java.base/lib/CoreLibraries.gmk
@@ -59,7 +59,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
- WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc_ProcessImpl_md.c := unused-result, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
index aaf98d088fdad..048292e385b2d 100644
--- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk
+++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk
@@ -238,7 +238,6 @@ ifeq ($(call isTargetOs, windows macosx), false)
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
$(X_CFLAGS), \
- WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := int-to-pointer-cast, \
DISABLED_WARNINGS_gcc_awt_Taskbar.c := parentheses, \
DISABLED_WARNINGS_gcc_GLXSurfaceData.c := unused-function, \
@@ -482,14 +481,6 @@ else
HARFBUZZ_CFLAGS += -DHAVE_INTEL_ATOMIC_PRIMITIVES -DHB_NO_VISIBILITY
endif
- # Early re-canonizing has to be disabled to workaround an internal XlC compiler error
- # when building libharfbuzz
- ifeq ($(call isTargetOs, aix), true)
- ifneq ($(TOOLCHAIN_TYPE), clang)
- HARFBUZZ_CFLAGS += -qdebug=necan
- endif
- endif
-
# hb-ft.cc is not presently needed, and requires freetype 2.4.2 or later.
# hb-subset and hb-style APIs are not needed, excluded to cut on compilation time.
LIBFONTMANAGER_EXCLUDE_FILES += hb-ft.cc hb-subset-cff-common.cc \
@@ -571,7 +562,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
CFLAGS_windows = -DCC_NOEX, \
EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
EXTRA_SRC := $(LIBFONTMANAGER_EXTRA_SRC), \
- WARNINGS_AS_ERRORS_xlc := false, \
DISABLED_WARNINGS_gcc := $(HARFBUZZ_DISABLED_WARNINGS_gcc), \
DISABLED_WARNINGS_CXX_gcc := $(HARFBUZZ_DISABLED_WARNINGS_CXX_gcc), \
DISABLED_WARNINGS_clang := $(HARFBUZZ_DISABLED_WARNINGS_clang), \
diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp
index f6312f2f88206..38f8333e8ed41 100644
--- a/src/hotspot/os/aix/os_aix.cpp
+++ b/src/hotspot/os/aix/os_aix.cpp
@@ -84,9 +84,7 @@
#endif
// put OS-includes here (sorted alphabetically)
-#ifdef AIX_XLC_GE_17
#include
-#endif
#include
#include
#include
diff --git a/src/hotspot/share/utilities/debug.hpp b/src/hotspot/share/utilities/debug.hpp
index be0ee035d08e8..3a9adda905498 100644
--- a/src/hotspot/share/utilities/debug.hpp
+++ b/src/hotspot/share/utilities/debug.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -108,9 +108,8 @@ class DebuggingContext {
// constant evaluation.
#if defined(TARGET_COMPILER_gcc) || defined(TARGET_COMPILER_xlc)
-// gcc10 added both __has_builtin and __builtin_is_constant_evaluated.
-// clang has had __has_builtin for a long time, so likely also in xlclang++.
-// Similarly, clang has had __builtin_is_constant_evaluated for a long time.
+// Both __has_builtin and __builtin_is_constant_evaluated are available in our
+// minimum required versions of gcc and clang.
#ifdef __has_builtin
#if __has_builtin(__builtin_is_constant_evaluated)
diff --git a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp b/src/hotspot/share/utilities/globalDefinitions_xlc.hpp
index cb346db7c060e..9595452d39942 100644
--- a/src/hotspot/share/utilities/globalDefinitions_xlc.hpp
+++ b/src/hotspot/share/utilities/globalDefinitions_xlc.hpp
@@ -61,28 +61,18 @@
#include
-// check for xlc16 or higher
-#ifdef __ibmxl_version__
- #if __ibmxl_version__ < 16
- #error "xlc < 16 not supported"
- #endif
-#elif defined(__open_xl_version__)
+#if defined(__open_xl_version__)
#if __open_xl_version__ < 17
#error "open xlc < 17 not supported"
#endif
#else
- #error "xlc version not supported, macro __ibmxl_version__ or __open_xl_version__ not found"
+ #error "xlc version not supported, macro __open_xl_version__ not found"
#endif
#ifndef _AIX
#error "missing AIX-specific definition _AIX"
#endif
-// Shortcut for the new xlc 17 compiler
-#if defined(AIX) && defined(__open_xl_version__) && __open_xl_version__ >= 17
-#define AIX_XLC_GE_17
-#endif
-
// Use XLC compiler builtins instead of inline assembler
#define USE_XLC_BUILTINS
From 0ae4fa71e425316a695cfd7e14835effd0cf23b9 Mon Sep 17 00:00:00 2001
From: Joachim Kern
Date: Wed, 13 Mar 2024 10:12:57 +0000
Subject: [PATCH 09/58] 8327210: AIX: Delete obsolete parameter
Use64KPagesThreshold
Reviewed-by: gli, stuefe, mdoerr
---
src/hotspot/os/aix/globals_aix.hpp | 6 ------
src/hotspot/os/aix/os_aix.cpp | 14 +++-----------
test/hotspot/gtest/runtime/test_os.cpp | 2 +-
3 files changed, 4 insertions(+), 18 deletions(-)
diff --git a/src/hotspot/os/aix/globals_aix.hpp b/src/hotspot/os/aix/globals_aix.hpp
index fb353348a5364..6904bf9dc4510 100644
--- a/src/hotspot/os/aix/globals_aix.hpp
+++ b/src/hotspot/os/aix/globals_aix.hpp
@@ -66,12 +66,6 @@
product(bool, Use64KPages, true, \
"Use 64K pages if available.") \
\
- /* If VM uses 64K paged memory (shmat) for virtual memory: threshold below */ \
- /* which virtual memory allocations are done with 4K memory (mmap). This is */ \
- /* mainly for test purposes. */ \
- develop(uintx, Use64KPagesThreshold, 0, \
- "4K/64K page allocation threshold.") \
- \
/* Normally AIX commits memory on touch, but sometimes it is helpful to have */ \
/* explicit commit behaviour. This flag, if true, causes the VM to touch */ \
/* memory on os::commit_memory() (which normally is a noop). */ \
diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp
index 38f8333e8ed41..4885675a6a159 100644
--- a/src/hotspot/os/aix/os_aix.cpp
+++ b/src/hotspot/os/aix/os_aix.cpp
@@ -1,6 +1,6 @@
/*
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2023 SAP SE. All rights reserved.
+ * Copyright (c) 2012, 2024 SAP SE. 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
@@ -1970,11 +1970,7 @@ char* os::pd_reserve_memory(size_t bytes, bool exec) {
if (os::vm_page_size() == 4*K) {
return reserve_mmaped_memory(bytes, nullptr /* requested_addr */);
} else {
- if (bytes >= Use64KPagesThreshold) {
- return reserve_shmated_memory(bytes, nullptr /* requested_addr */);
- } else {
- return reserve_mmaped_memory(bytes, nullptr /* requested_addr */);
- }
+ return reserve_shmated_memory(bytes, nullptr /* requested_addr */);
}
}
@@ -2183,11 +2179,7 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool
if (os::vm_page_size() == 4*K) {
return reserve_mmaped_memory(bytes, requested_addr);
} else {
- if (bytes >= Use64KPagesThreshold) {
- return reserve_shmated_memory(bytes, requested_addr);
- } else {
- return reserve_mmaped_memory(bytes, requested_addr);
- }
+ return reserve_shmated_memory(bytes, requested_addr);
}
return addr;
diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp
index 990845c1ce721..55d30349ee5a9 100644
--- a/test/hotspot/gtest/runtime/test_os.cpp
+++ b/test/hotspot/gtest/runtime/test_os.cpp
@@ -957,7 +957,7 @@ TEST_VM(os, reserve_at_wish_address_shall_not_replace_mappings_largepages) {
#ifdef AIX
// On Aix, we should fail attach attempts not aligned to segment boundaries (256m)
TEST_VM(os, aix_reserve_at_non_shmlba_aligned_address) {
- if (Use64KPages && Use64KPagesThreshold == 0) {
+ if (Use64KPages) {
char* p = os::attempt_reserve_memory_at((char*)0x1f00000, M);
ASSERT_EQ(p, nullptr); // should have failed
p = os::attempt_reserve_memory_at((char*)((64 * G) + M), M);
From 49d8008947534898e2ba36e2d81d87d6ae4b4c02 Mon Sep 17 00:00:00 2001
From: Ivan Walulya
Date: Wed, 13 Mar 2024 10:15:11 +0000
Subject: [PATCH 10/58] 8327452: G1: Improve scalability of Merge Log Buffers
Reviewed-by: kbarrett, tschatzl
---
src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp | 2 +
src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp | 10 ++++
src/hotspot/share/gc/g1/g1Policy.cpp | 9 ++-
src/hotspot/share/gc/g1/g1RemSet.cpp | 69 +++++++++++++++++++---
4 files changed, 79 insertions(+), 11 deletions(-)
diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
index 43b582b7dd901..a39a082bc82ef 100644
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp
@@ -174,6 +174,7 @@ void G1GCPhaseTimes::reset() {
_cur_merge_heap_roots_time_ms = 0.0;
_cur_optional_merge_heap_roots_time_ms = 0.0;
_cur_prepare_merge_heap_roots_time_ms = 0.0;
+ _cur_distribute_log_buffers_time_ms = 0.0;
_cur_optional_prepare_merge_heap_roots_time_ms = 0.0;
_cur_pre_evacuate_prepare_time_ms = 0.0;
_cur_post_evacuate_cleanup_1_time_ms = 0.0;
@@ -459,6 +460,7 @@ double G1GCPhaseTimes::print_evacuate_initial_collection_set() const {
debug_time("Prepare Merge Heap Roots", _cur_prepare_merge_heap_roots_time_ms);
debug_phase_merge_remset();
+ debug_time("Distribute Log Buffers", _cur_distribute_log_buffers_time_ms);
debug_phase(_gc_par_phases[MergeLB]);
info_time("Evacuate Collection Set", _cur_collection_initial_evac_time_ms);
diff --git a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
index 713b411bda110..bae0dfa87a0c4 100644
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp
@@ -181,6 +181,8 @@ class G1GCPhaseTimes : public CHeapObj {
double _cur_prepare_merge_heap_roots_time_ms;
double _cur_optional_prepare_merge_heap_roots_time_ms;
+ double _cur_distribute_log_buffers_time_ms;
+
double _cur_pre_evacuate_prepare_time_ms;
double _cur_post_evacuate_cleanup_1_time_ms;
@@ -304,6 +306,10 @@ class G1GCPhaseTimes : public CHeapObj {
_cur_prepare_merge_heap_roots_time_ms += ms;
}
+ void record_distribute_log_buffers_time_ms(double ms) {
+ _cur_distribute_log_buffers_time_ms += ms;
+ }
+
void record_or_add_optional_prepare_merge_heap_roots_time(double ms) {
_cur_optional_prepare_merge_heap_roots_time_ms += ms;
}
@@ -376,6 +382,10 @@ class G1GCPhaseTimes : public CHeapObj {
return _cur_collection_start_sec;
}
+ double cur_distribute_log_buffers_time_ms() {
+ return _cur_distribute_log_buffers_time_ms;
+ }
+
double cur_collection_par_time_ms() {
return _cur_collection_initial_evac_time_ms +
_cur_optional_evac_time_ms +
diff --git a/src/hotspot/share/gc/g1/g1Policy.cpp b/src/hotspot/share/gc/g1/g1Policy.cpp
index 10227dfe2add8..6e2281e12f7ee 100644
--- a/src/hotspot/share/gc/g1/g1Policy.cpp
+++ b/src/hotspot/share/gc/g1/g1Policy.cpp
@@ -774,6 +774,10 @@ double G1Policy::logged_cards_processing_time() const {
size_t logged_dirty_cards = phase_times()->sum_thread_work_items(G1GCPhaseTimes::MergeLB, G1GCPhaseTimes::MergeLBDirtyCards);
size_t scan_heap_roots_cards = phase_times()->sum_thread_work_items(G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ScanHRScannedCards) +
phase_times()->sum_thread_work_items(G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ScanHRScannedCards);
+
+ double merge_logged_cards_time = average_time_ms(G1GCPhaseTimes::MergeLB) +
+ phase_times()->cur_distribute_log_buffers_time_ms();
+
// Approximate the time spent processing cards from log buffers by scaling
// the total processing time by the ratio of logged cards to total cards
// processed. There might be duplicate cards in different log buffers,
@@ -783,9 +787,9 @@ double G1Policy::logged_cards_processing_time() const {
// counts are zero, which happens especially during early GCs. So ascribe
// all of the time to the logged cards unless there are more total cards.
if (logged_dirty_cards >= scan_heap_roots_cards) {
- return all_cards_processing_time + average_time_ms(G1GCPhaseTimes::MergeLB);
+ return all_cards_processing_time + merge_logged_cards_time;
}
- return (all_cards_processing_time * logged_dirty_cards / scan_heap_roots_cards) + average_time_ms(G1GCPhaseTimes::MergeLB);
+ return (all_cards_processing_time * logged_dirty_cards / scan_heap_roots_cards) + merge_logged_cards_time;
}
// Anything below that is considered to be zero
@@ -874,6 +878,7 @@ void G1Policy::record_young_collection_end(bool concurrent_operation_is_full_mar
double avg_time_merge_cards = average_time_ms(G1GCPhaseTimes::MergeER) +
average_time_ms(G1GCPhaseTimes::MergeRS) +
average_time_ms(G1GCPhaseTimes::MergeLB) +
+ p->cur_distribute_log_buffers_time_ms() +
average_time_ms(G1GCPhaseTimes::OptMergeRS);
_analytics->report_cost_per_card_merge_ms(avg_time_merge_cards / total_cards_merged, is_young_only_pause);
}
diff --git a/src/hotspot/share/gc/g1/g1RemSet.cpp b/src/hotspot/share/gc/g1/g1RemSet.cpp
index 2112795221459..f8ea3ba7ed4e7 100644
--- a/src/hotspot/share/gc/g1/g1RemSet.cpp
+++ b/src/hotspot/share/gc/g1/g1RemSet.cpp
@@ -1258,39 +1258,90 @@ class G1MergeHeapRootsTask : public WorkerTask {
size_t cards_skipped() const { return _cards_skipped; }
};
- HeapRegionClaimer _hr_claimer;
+ uint _num_workers;
G1RemSetScanState* _scan_state;
- BufferNode::Stack _dirty_card_buffers;
+
+ // To mitigate contention due multiple threads accessing and popping BufferNodes from a shared
+ // G1DirtyCardQueueSet, we implement a sequential distribution phase. Here, BufferNodes are
+ // distributed to worker threads in a sequential manner utilizing the _dirty_card_buffers. By doing
+ // so, we effectively alleviate the bottleneck encountered during pop operations on the
+ // G1DirtyCardQueueSet. Importantly, this approach preserves the helping aspect among worker
+ // threads, allowing them to assist one another in case of imbalances in work distribution.
+ BufferNode::Stack* _dirty_card_buffers;
+
bool _initial_evacuation;
volatile bool _fast_reclaim_handled;
void apply_closure_to_dirty_card_buffers(G1MergeLogBufferCardsClosure* cl, uint worker_id) {
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
- while (BufferNode* node = _dirty_card_buffers.pop()) {
- cl->apply_to_buffer(node, worker_id);
- dcqs.deallocate_buffer(node);
+ for (uint i = 0; i < _num_workers; i++) {
+ uint index = (worker_id + i) % _num_workers;
+ while (BufferNode* node = _dirty_card_buffers[index].pop()) {
+ cl->apply_to_buffer(node, worker_id);
+ dcqs.deallocate_buffer(node);
+ }
}
}
public:
G1MergeHeapRootsTask(G1RemSetScanState* scan_state, uint num_workers, bool initial_evacuation) :
WorkerTask("G1 Merge Heap Roots"),
- _hr_claimer(num_workers),
+ _num_workers(num_workers),
_scan_state(scan_state),
- _dirty_card_buffers(),
+ _dirty_card_buffers(nullptr),
_initial_evacuation(initial_evacuation),
_fast_reclaim_handled(false)
{
if (initial_evacuation) {
+ Ticks start = Ticks::now();
+
+ _dirty_card_buffers = NEW_C_HEAP_ARRAY(BufferNode::Stack, num_workers, mtGC);
+ for (uint i = 0; i < num_workers; i++) {
+ new (&_dirty_card_buffers[i]) BufferNode::Stack();
+ }
+
G1DirtyCardQueueSet& dcqs = G1BarrierSet::dirty_card_queue_set();
BufferNodeList buffers = dcqs.take_all_completed_buffers();
- if (buffers._entry_count != 0) {
- _dirty_card_buffers.prepend(*buffers._head, *buffers._tail);
+
+ size_t entries_per_thread = ceil(buffers._entry_count / (double)num_workers);
+
+ BufferNode* head = buffers._head;
+ BufferNode* tail = head;
+
+ uint worker = 0;
+ while (tail != nullptr) {
+ size_t count = tail->size();
+ BufferNode* cur = tail->next();
+
+ while (count < entries_per_thread && cur != nullptr) {
+ tail = cur;
+ count += tail->size();
+ cur = tail->next();
+ }
+
+ tail->set_next(nullptr);
+ _dirty_card_buffers[worker++ % num_workers].prepend(*head, *tail);
+
+ assert(cur != nullptr || tail == buffers._tail, "Must be");
+ head = cur;
+ tail = cur;
}
+
+ Tickspan total = Ticks::now() - start;
+ G1CollectedHeap::heap()->phase_times()->record_distribute_log_buffers_time_ms(total.seconds() * 1000.0);
}
}
+ ~G1MergeHeapRootsTask() {
+ if (_dirty_card_buffers != nullptr) {
+ using Stack = BufferNode::Stack;
+ for (uint i = 0; i < _num_workers; i++) {
+ _dirty_card_buffers[i].~Stack();
+ }
+ FREE_C_HEAP_ARRAY(Stack, _dirty_card_buffers);
+ }
+ }
virtual void work(uint worker_id) {
G1CollectedHeap* g1h = G1CollectedHeap::heap();
G1GCPhaseTimes* p = g1h->phase_times();
From da4dd7c008da4be54ee5f58d1ac19f440fd2a74e Mon Sep 17 00:00:00 2001
From: Daniel Fuchs
Date: Wed, 13 Mar 2024 11:22:40 +0000
Subject: [PATCH 11/58] 8327989: java/net/httpclient/ManyRequest.java should
not use "localhost" in URIs
Reviewed-by: jpai, djelinski, gli
---
test/jdk/java/net/httpclient/ManyRequests.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/jdk/java/net/httpclient/ManyRequests.java b/test/jdk/java/net/httpclient/ManyRequests.java
index 8e3eb7eba94de..89f26d3a76131 100644
--- a/test/jdk/java/net/httpclient/ManyRequests.java
+++ b/test/jdk/java/net/httpclient/ManyRequests.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
@@ -187,7 +187,7 @@ static void test(HttpsServer server, HttpClient client) throws Exception {
URI baseURI = URIBuilder.newBuilder()
.scheme("https")
- .host(InetAddress.getLoopbackAddress().getHostName())
+ .loopback()
.port(port)
.path("/foo/x").build();
server.createContext("/foo", new TestEchoHandler());
From a4a5196351a3c8ce45e2e36d27842194cbfcc5ff Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Wed, 13 Mar 2024 11:40:38 +0000
Subject: [PATCH 12/58] 8327872: Convert
javax/swing/JToolTip/4644444/bug4644444.java applet test to main
Reviewed-by: prr, tr
---
.../swing/JToolTip/4644444/bug4644444.html | 44 ---
.../swing/JToolTip/4644444/bug4644444.java | 354 ------------------
test/jdk/javax/swing/JToolTip/bug4644444.java | 63 ++++
3 files changed, 63 insertions(+), 398 deletions(-)
delete mode 100644 test/jdk/javax/swing/JToolTip/4644444/bug4644444.html
delete mode 100644 test/jdk/javax/swing/JToolTip/4644444/bug4644444.java
create mode 100644 test/jdk/javax/swing/JToolTip/bug4644444.java
diff --git a/test/jdk/javax/swing/JToolTip/4644444/bug4644444.html b/test/jdk/javax/swing/JToolTip/4644444/bug4644444.html
deleted file mode 100644
index b7e9bcb03fe85..0000000000000
--- a/test/jdk/javax/swing/JToolTip/4644444/bug4644444.html
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
- bug4644444
-
-
-
-
bug4644444 Bug ID: 4644444
-
-
See the dialog box (usually in upper left corner) for instructions
-
-
-
-
diff --git a/test/jdk/javax/swing/JToolTip/4644444/bug4644444.java b/test/jdk/javax/swing/JToolTip/4644444/bug4644444.java
deleted file mode 100644
index 124c565a9cbd6..0000000000000
--- a/test/jdk/javax/swing/JToolTip/4644444/bug4644444.java
+++ /dev/null
@@ -1,354 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-import java.awt.*;
-import javax.swing.*;
-import java.awt.event.*;
-
-/*
- * test
- * @bug 4644444 8076246
-*/
-
-public class bug4644444 extends JApplet {
-
- JPanel panel;
- JButton button;
-
- public bug4644444() throws Exception {
- java.awt.EventQueue.invokeLater( () -> {
- panel = new JPanel();
- button = new JButton("whooo");
- button.setToolTipText("Somthing really long 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890");
- panel.add(button);
- getContentPane().add(panel);
- });
- }
-
- public void init() {
- String[][] instructionsSet =
- {
- {
- " Note : Incase of Assertion failure,user can enter",
- " remarks by pressing 'Assertion Fail Remarks ' button",
- " ",
- " You would see a testframe with a Button",
- " ",
- " ON ALL PLATFORMS",
- "1. Move the mouse on the button, ",
- " so that the tooltip attached to it comes up ",
- "2. Tool tip should get adjusted it-self to show ",
- " its full length of text. ",
- "3. If tooltip text gets cut, ",
- " press 'Assertion Fail' else press 'Assertion Pass'",
- "4. Similarly, move the applet to different locations of the screen, ",
- " & see if tooltip works properly everywhere. "
- }
- };
-
- String[] exceptionsSet =
- {
- "JToolTip is shown partially when placed very close to screen boundaries",
- };
-
- Sysout.setInstructionsWithExceptions(instructionsSet,exceptionsSet);
-
- }
-
- public void start (){}
-
- public void destroy(){
- if(Sysout.failStatus()) {
- String failMsg = Sysout.getFailureMessages();
- failMsg = failMsg.replace('\n',' ');
- throw new RuntimeException(failMsg);
- }// End destroy
- }
-}
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
- {
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.show();
- println( "Any messages for the tester will display here." );
- }
-
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.show();
- println( "Any messages for the tester will display here." );
- }
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- }
-
- public static void setInstructionsWithExceptions(String instructionsSet[][],
- String exceptionsSet[]) {
- createDialogWithInstructions(instructionsSet[0]);
- dialog.setInstructions(instructionsSet);
- dialog.setExceptionMessages(exceptionsSet);
- }
-
- public static String getFailureMessages() {
- return dialog.failureMessages;
- }
-
- public static boolean failStatus() {
- return dialog.failStatus;
- }
-
- }// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
- {
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 70;
-
- Panel assertPanel;
- Button assertPass,assertFail,remarks;
- HandleAssert handleAssert;
- boolean failStatus=false;
- int instructionCounter=0;
- String instructions[][];
- int exceptionCounter=0;
- String exceptionMessages[];
- String failureMessages=" ";
- String remarksMessage=null;
- RemarksDialog remarksDialog;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 14, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 3, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- assertPanel = new Panel(new FlowLayout());
- assertPass=new Button("Assertion Pass");
- assertPass.setName("Assertion Pass");
- assertFail=new Button("Assertion Fail");
- assertFail.setName("Assertion Fail");
- remarks = new Button("Assertion Fail Remarks");
- remarks.setEnabled(false);
- remarks.setName("Assertion Remarks");
- assertPanel.add(assertPass);
- assertPanel.add(assertFail);
- assertPanel.add(remarks);
- handleAssert = new HandleAssert();
- assertPass.addActionListener(handleAssert);
- assertFail.addActionListener(handleAssert);
- remarks.addActionListener(handleAssert);
- add("South",assertPanel);
- pack();
-
- show();
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- }
-
- public void emptyMessage() {
- messageText.setText("");
- }
-
- public void setInstructions(String insStr[][]) {
- instructions=insStr;
- }
-
- public void setExceptionMessages(String exceptionMessages[]) {
- this.exceptionMessages=exceptionMessages;
- }
-
- class HandleAssert implements ActionListener {
- public void actionPerformed(ActionEvent ae) {
- if(ae.getSource()==remarks) {
- remarksDialog = new RemarksDialog(TestDialog.this,
- "Assertion Remarks Dialog",true);
- remarks.setEnabled(false);
- if(remarksMessage!=null)
- failureMessages+=". User Remarks : "+remarksMessage;
- }
- else {
- if(instructionCounter"+
- exceptionMessages[exceptionCounter];
- }
- }
- exceptionCounter++;
- }
- }
- }
-
- class RemarksDialog extends Dialog implements ActionListener{
- Panel rootPanel,remarksPanel;
- TextArea textarea;
- Button addRemarks,cancelRemarks;
- public RemarksDialog(Dialog owner,String title,boolean modal) {
- super(owner,title,modal);
- rootPanel = new Panel(new BorderLayout());
- remarksPanel = new Panel(new FlowLayout());
- textarea = new TextArea(5,30);
- addRemarks=new Button("Add Remarks");
- addRemarks.addActionListener(this);
- cancelRemarks = new Button("Cancel Remarks");
- cancelRemarks.addActionListener(this);
- remarksPanel.add(addRemarks);
- remarksPanel.add(cancelRemarks);
- rootPanel.add(textarea,"Center");
- rootPanel.add(remarksPanel,"South");
- add(rootPanel);
- setBounds(150,150,400,200);
- setVisible(true);
- }
-
- public void actionPerformed(ActionEvent ae) {
- remarksMessage=null;
- if(ae.getSource()==addRemarks) {
- String msg = textarea.getText().trim();
- if (msg.length()>0)
- remarksMessage=msg;
- }
- dispose();
- }
-
- }
-
-}// TestDialog class
diff --git a/test/jdk/javax/swing/JToolTip/bug4644444.java b/test/jdk/javax/swing/JToolTip/bug4644444.java
new file mode 100644
index 0000000000000..2921ecf0da5cc
--- /dev/null
+++ b/test/jdk/javax/swing/JToolTip/bug4644444.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+
+/*
+ * @test
+ * @bug 4644444 8076246
+ * @summary JToolTip is shown improperly when placed very close to screen boundaries
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4644444
+ */
+
+public class bug4644444 {
+
+ private static final String INSTRUCTIONS = """
+ 1. Move the mouse on the button, so that the tooltip is visible.
+ 2. Tooltip should get adjusted itself to show its full length of text.
+ 3. Similarly, move the frame to different locations of the screen
+ & see if tooltip works properly everywhere.
+ 4. Press 'Pass' if tooltip text is fully visible else press 'Fail'. """;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame.builder()
+ .title("JToolTip Instructions")
+ .instructions(INSTRUCTIONS)
+ .testUI(bug4644444::createUI)
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JFrame createUI() {
+ JFrame frame = new JFrame("bug4644444");
+ JButton button = new JButton("Button");
+ button.setToolTipText("Something really long 1234567890 1234567890 " +
+ "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890");
+ frame.getContentPane().add(button);
+ frame.setSize(200, 80);
+ return frame;
+ }
+}
From 7d8561d56bf064e388417530b9b71755e4ac3f76 Mon Sep 17 00:00:00 2001
From: Christian Hagedorn
Date: Wed, 13 Mar 2024 13:58:47 +0000
Subject: [PATCH 13/58] 8327109: Refactor data graph cloning used in
create_new_if_for_predicate() into separate class
Reviewed-by: epeter, thartmann
---
src/hotspot/share/opto/loopPredicate.cpp | 88 ++++++++----------------
src/hotspot/share/opto/loopnode.hpp | 48 +++++++++++--
src/hotspot/share/opto/loopopts.cpp | 28 ++++++++
src/hotspot/share/opto/node.hpp | 2 +
src/hotspot/share/opto/replacednodes.cpp | 2 +-
5 files changed, 103 insertions(+), 65 deletions(-)
diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp
index fd0576832cf70..7fa4bc758c870 100644
--- a/src/hotspot/share/opto/loopPredicate.cpp
+++ b/src/hotspot/share/opto/loopPredicate.cpp
@@ -215,14 +215,16 @@ IfProjNode* PhaseIdealLoop::create_new_if_for_predicate(ParsePredicateSuccessPro
// Update ctrl and control inputs of all data nodes starting from 'node' to 'new_ctrl' which have 'old_ctrl' as
// current ctrl.
-void PhaseIdealLoop::set_ctrl_of_nodes_with_same_ctrl(Node* node, ProjNode* old_ctrl, Node* new_ctrl) {
- Unique_Node_List nodes_with_same_ctrl = find_nodes_with_same_ctrl(node, old_ctrl);
- for (uint j = 0; j < nodes_with_same_ctrl.size(); j++) {
- Node* next = nodes_with_same_ctrl[j];
- if (next->in(0) == old_ctrl) {
- _igvn.replace_input_of(next, 0, new_ctrl);
+void PhaseIdealLoop::set_ctrl_of_nodes_with_same_ctrl(Node* start_node, ProjNode* old_uncommon_proj,
+ Node* new_uncommon_proj) {
+ ResourceMark rm;
+ const Unique_Node_List nodes_with_same_ctrl = find_nodes_with_same_ctrl(start_node, old_uncommon_proj);
+ for (uint i = 0; i < nodes_with_same_ctrl.size(); i++) {
+ Node* node = nodes_with_same_ctrl[i];
+ if (node->in(0) == old_uncommon_proj) {
+ _igvn.replace_input_of(node, 0, new_uncommon_proj);
}
- set_ctrl(next, new_ctrl);
+ set_ctrl(node, new_uncommon_proj);
}
}
@@ -242,61 +244,31 @@ Unique_Node_List PhaseIdealLoop::find_nodes_with_same_ctrl(Node* node, const Pro
return nodes_with_same_ctrl;
}
-// Clone all nodes with the same ctrl as 'old_ctrl' starting from 'node' by following its inputs. Rewire the cloned nodes
-// to 'new_ctrl'. Returns the clone of 'node'.
-Node* PhaseIdealLoop::clone_nodes_with_same_ctrl(Node* node, ProjNode* old_ctrl, Node* new_ctrl) {
+// Clone all data nodes with a ctrl to the old uncommon projection from `start_node' by following its inputs. Rewire the
+// cloned nodes to the new uncommon projection. Returns the clone of the `start_node`.
+Node* PhaseIdealLoop::clone_nodes_with_same_ctrl(Node* start_node, ProjNode* old_uncommon_proj, Node* new_uncommon_proj) {
+ ResourceMark rm;
DEBUG_ONLY(uint last_idx = C->unique();)
- Unique_Node_List nodes_with_same_ctrl = find_nodes_with_same_ctrl(node, old_ctrl);
- Dict old_new_mapping = clone_nodes(nodes_with_same_ctrl); // Cloned but not rewired, yet
- rewire_cloned_nodes_to_ctrl(old_ctrl, new_ctrl, nodes_with_same_ctrl, old_new_mapping);
- Node* clone_phi_input = static_cast(old_new_mapping[node]);
- assert(clone_phi_input != nullptr && clone_phi_input->_idx >= last_idx, "must exist and be a proper clone");
- return clone_phi_input;
+ const Unique_Node_List nodes_with_same_ctrl = find_nodes_with_same_ctrl(start_node, old_uncommon_proj);
+ DataNodeGraph data_node_graph(nodes_with_same_ctrl, this);
+ const OrigToNewHashtable& orig_to_clone = data_node_graph.clone(new_uncommon_proj);
+ fix_cloned_data_node_controls(old_uncommon_proj, new_uncommon_proj, orig_to_clone);
+ Node** cloned_node_ptr = orig_to_clone.get(start_node);
+ assert(cloned_node_ptr != nullptr && (*cloned_node_ptr)->_idx >= last_idx, "must exist and be a proper clone");
+ return *cloned_node_ptr;
}
-// Clone all the nodes on 'list_to_clone' and return an old->new mapping.
-Dict PhaseIdealLoop::clone_nodes(const Node_List& list_to_clone) {
- Dict old_new_mapping(cmpkey, hashkey);
- for (uint i = 0; i < list_to_clone.size(); i++) {
- Node* next = list_to_clone[i];
- Node* clone = next->clone();
- _igvn.register_new_node_with_optimizer(clone);
- old_new_mapping.Insert(next, clone);
- }
- return old_new_mapping;
-}
-
-// Rewire inputs of the unprocessed cloned nodes (inputs are not updated, yet, and still point to the old nodes) by
-// using the old_new_mapping.
-void PhaseIdealLoop::rewire_cloned_nodes_to_ctrl(const ProjNode* old_ctrl, Node* new_ctrl,
- const Node_List& nodes_with_same_ctrl, const Dict& old_new_mapping) {
- for (uint i = 0; i < nodes_with_same_ctrl.size(); i++) {
- Node* next = nodes_with_same_ctrl[i];
- Node* clone = static_cast(old_new_mapping[next]);
- if (next->in(0) == old_ctrl) {
- // All data nodes with a control input to the uncommon projection in the chain need to be rewired to the new uncommon
- // projection (could not only be the last data node in the chain but also, for example, a DivNode within the chain).
- _igvn.replace_input_of(clone, 0, new_ctrl);
- set_ctrl(clone, new_ctrl);
+// All data nodes with a control input to the uncommon projection in the chain need to be rewired to the new uncommon
+// projection (could not only be the last data node in the chain but also, for example, a pinned DivNode within the chain).
+void PhaseIdealLoop::fix_cloned_data_node_controls(const ProjNode* old_uncommon_proj, Node* new_uncommon_proj,
+ const OrigToNewHashtable& orig_to_clone) {
+ auto orig_clone_action = [&](Node* orig, Node* clone) {
+ if (orig->in(0) == old_uncommon_proj) {
+ _igvn.replace_input_of(clone, 0, new_uncommon_proj);
+ set_ctrl(clone, new_uncommon_proj);
}
- rewire_inputs_of_clones_to_clones(new_ctrl, clone, old_new_mapping, next);
- }
-}
-
-// Rewire the inputs of the cloned nodes to the old nodes to the new clones.
-void PhaseIdealLoop::rewire_inputs_of_clones_to_clones(Node* new_ctrl, Node* clone, const Dict& old_new_mapping,
- const Node* next) {
- for (uint i = 1; i < next->req(); i++) {
- Node* in = next->in(i);
- if (!in->is_Phi()) {
- assert(!in->is_CFG(), "must be data node");
- Node* in_clone = static_cast(old_new_mapping[in]);
- if (in_clone != nullptr) {
- _igvn.replace_input_of(clone, i, in_clone);
- set_ctrl(clone, new_ctrl);
- }
- }
- }
+ };
+ orig_to_clone.iterate_all(orig_clone_action);
}
IfProjNode* PhaseIdealLoop::clone_parse_predicate_to_unswitched_loop(ParsePredicateSuccessProj* parse_predicate_proj,
diff --git a/src/hotspot/share/opto/loopnode.hpp b/src/hotspot/share/opto/loopnode.hpp
index 3d96ce3e0e27e..72436b7853073 100644
--- a/src/hotspot/share/opto/loopnode.hpp
+++ b/src/hotspot/share/opto/loopnode.hpp
@@ -1343,13 +1343,11 @@ class PhaseIdealLoop : public PhaseTransform {
private:
// Helper functions for create_new_if_for_predicate()
- void set_ctrl_of_nodes_with_same_ctrl(Node* node, ProjNode* old_ctrl, Node* new_ctrl);
+ void set_ctrl_of_nodes_with_same_ctrl(Node* start_node, ProjNode* old_uncommon_proj, Node* new_uncommon_proj);
Unique_Node_List find_nodes_with_same_ctrl(Node* node, const ProjNode* ctrl);
- Node* clone_nodes_with_same_ctrl(Node* node, ProjNode* old_ctrl, Node* new_ctrl);
- Dict clone_nodes(const Node_List& list_to_clone);
- void rewire_cloned_nodes_to_ctrl(const ProjNode* old_ctrl, Node* new_ctrl, const Node_List& nodes_with_same_ctrl,
- const Dict& old_new_mapping);
- void rewire_inputs_of_clones_to_clones(Node* new_ctrl, Node* clone, const Dict& old_new_mapping, const Node* next);
+ Node* clone_nodes_with_same_ctrl(Node* start_node, ProjNode* old_uncommon_proj, Node* new_uncommon_proj);
+ void fix_cloned_data_node_controls(const ProjNode* orig, Node* new_uncommon_proj,
+ const OrigToNewHashtable& orig_to_clone);
bool has_dominating_loop_limit_check(Node* init_trip, Node* limit, jlong stride_con, BasicType iv_bt,
Node* loop_entry);
@@ -1882,4 +1880,42 @@ class PathFrequency {
float to(Node* n);
};
+// Class to clone a data node graph by taking a list of data nodes. This is done in 2 steps:
+// 1. Clone the data nodes
+// 2. Fix the cloned data inputs pointing to the old nodes to the cloned inputs by using an old->new mapping.
+class DataNodeGraph : public StackObj {
+ PhaseIdealLoop* const _phase;
+ const Unique_Node_List& _data_nodes;
+ OrigToNewHashtable _orig_to_new;
+
+ public:
+ DataNodeGraph(const Unique_Node_List& data_nodes, PhaseIdealLoop* phase)
+ : _phase(phase),
+ _data_nodes(data_nodes),
+ // Use 107 as best guess which is the first resize value in ResizeableResourceHashtable::large_table_sizes.
+ _orig_to_new(107, MaxNodeLimit)
+ {
+#ifdef ASSERT
+ for (uint i = 0; i < data_nodes.size(); i++) {
+ assert(!data_nodes[i]->is_CFG(), "only data nodes");
+ }
+#endif
+ }
+ NONCOPYABLE(DataNodeGraph);
+
+ private:
+ void clone(Node* node, Node* new_ctrl);
+ void clone_data_nodes(Node* new_ctrl);
+ void rewire_clones_to_cloned_inputs();
+
+ public:
+ // Clone the provided data node collection and rewire the clones in such a way to create an identical graph copy.
+ // Set 'new_ctrl' as ctrl for the cloned nodes.
+ const OrigToNewHashtable& clone(Node* new_ctrl) {
+ assert(_orig_to_new.number_of_entries() == 0, "should not call this method twice in a row");
+ clone_data_nodes(new_ctrl);
+ rewire_clones_to_cloned_inputs();
+ return _orig_to_new;
+ }
+};
#endif // SHARE_OPTO_LOOPNODE_HPP
diff --git a/src/hotspot/share/opto/loopopts.cpp b/src/hotspot/share/opto/loopopts.cpp
index 99b360143eaf9..76446de510c05 100644
--- a/src/hotspot/share/opto/loopopts.cpp
+++ b/src/hotspot/share/opto/loopopts.cpp
@@ -4495,3 +4495,31 @@ void PhaseIdealLoop::move_unordered_reduction_out_of_loop(IdealLoopTree* loop) {
assert(phi->outcnt() == 1, "accumulator is the only use of phi");
}
}
+
+void DataNodeGraph::clone_data_nodes(Node* new_ctrl) {
+ for (uint i = 0; i < _data_nodes.size(); i++) {
+ clone(_data_nodes[i], new_ctrl);
+ }
+}
+
+// Clone the given node and set it up properly. Set `new_ctrl` as ctrl.
+void DataNodeGraph::clone(Node* node, Node* new_ctrl) {
+ Node* clone = node->clone();
+ _phase->igvn().register_new_node_with_optimizer(clone);
+ _orig_to_new.put(node, clone);
+ _phase->set_ctrl(clone, new_ctrl);
+}
+
+// Rewire the data inputs of all (unprocessed) cloned nodes, whose inputs are still pointing to the same inputs as their
+// corresponding orig nodes, to the newly cloned inputs to create a separate cloned graph.
+void DataNodeGraph::rewire_clones_to_cloned_inputs() {
+ _orig_to_new.iterate_all([&](Node* node, Node* clone) {
+ for (uint i = 1; i < node->req(); i++) {
+ Node** cloned_input = _orig_to_new.get(node->in(i));
+ if (cloned_input != nullptr) {
+ // Input was also cloned -> rewire clone to the cloned input.
+ _phase->igvn().replace_input_of(clone, i, *cloned_input);
+ }
+ }
+ });
+}
diff --git a/src/hotspot/share/opto/node.hpp b/src/hotspot/share/opto/node.hpp
index 1b80458d3c36d..e11278f46ea65 100644
--- a/src/hotspot/share/opto/node.hpp
+++ b/src/hotspot/share/opto/node.hpp
@@ -207,6 +207,8 @@ typedef Node** DUIterator_Fast;
typedef Node** DUIterator_Last;
#endif
+typedef ResizeableResourceHashtable OrigToNewHashtable;
+
// Node Sentinel
#define NodeSentinel (Node*)-1
diff --git a/src/hotspot/share/opto/replacednodes.cpp b/src/hotspot/share/opto/replacednodes.cpp
index 992b7621588b6..3f9c8280a460f 100644
--- a/src/hotspot/share/opto/replacednodes.cpp
+++ b/src/hotspot/share/opto/replacednodes.cpp
@@ -208,7 +208,7 @@ void ReplacedNodes::apply(Compile* C, Node* ctl) {
hash_table_size++;
}
// Map from current node to cloned/replaced node
- ResizeableResourceHashtable clones(hash_table_size, hash_table_size);
+ OrigToNewHashtable clones(hash_table_size, hash_table_size);
// Record mapping from initial to improved nodes
for (int i = 0; i < _replaced_nodes->length(); i++) {
ReplacedNode replaced = _replaced_nodes->at(i);
From 7e05a70301796288cb3bcc6be8fb619b6ce600bc Mon Sep 17 00:00:00 2001
From: Matias Saavedra Silva
Date: Wed, 13 Mar 2024 14:00:59 +0000
Subject: [PATCH 14/58] 8251330: Reorder CDS archived heap to speed up
relocation
Reviewed-by: iklam, ccheung
---
src/hotspot/share/cds/archiveHeapLoader.cpp | 18 ++--
src/hotspot/share/cds/archiveHeapWriter.cpp | 94 +++++++++++++++++++--
src/hotspot/share/cds/archiveHeapWriter.hpp | 7 +-
src/hotspot/share/cds/filemap.cpp | 28 ++++++
src/hotspot/share/cds/filemap.hpp | 9 ++
src/hotspot/share/cds/heapShared.cpp | 51 +++++++++--
src/hotspot/share/cds/heapShared.hpp | 24 ++++--
src/hotspot/share/cds/metaspaceShared.cpp | 1 +
src/hotspot/share/cds/metaspaceShared.hpp | 6 ++
9 files changed, 204 insertions(+), 34 deletions(-)
diff --git a/src/hotspot/share/cds/archiveHeapLoader.cpp b/src/hotspot/share/cds/archiveHeapLoader.cpp
index 535ca9d37a7be..fe30be1642796 100644
--- a/src/hotspot/share/cds/archiveHeapLoader.cpp
+++ b/src/hotspot/share/cds/archiveHeapLoader.cpp
@@ -164,18 +164,19 @@ void ArchiveHeapLoader::patch_compressed_embedded_pointers(BitMapView bm,
// Optimization: if dumptime shift is the same as runtime shift, we can perform a
// quick conversion from "dumptime narrowOop" -> "runtime narrowOop".
+ narrowOop* patching_start = (narrowOop*)region.start() + FileMapInfo::current_info()->heap_oopmap_start_pos();
if (_narrow_oop_shift == CompressedOops::shift()) {
uint32_t quick_delta = (uint32_t)rt_encoded_bottom - (uint32_t)dt_encoded_bottom;
log_info(cds)("CDS heap data relocation quick delta = 0x%x", quick_delta);
if (quick_delta == 0) {
log_info(cds)("CDS heap data relocation unnecessary, quick_delta = 0");
} else {
- PatchCompressedEmbeddedPointersQuick patcher((narrowOop*)region.start(), quick_delta);
+ PatchCompressedEmbeddedPointersQuick patcher(patching_start, quick_delta);
bm.iterate(&patcher);
}
} else {
log_info(cds)("CDS heap data quick relocation not possible");
- PatchCompressedEmbeddedPointers patcher((narrowOop*)region.start());
+ PatchCompressedEmbeddedPointers patcher(patching_start);
bm.iterate(&patcher);
}
}
@@ -186,17 +187,10 @@ void ArchiveHeapLoader::patch_embedded_pointers(FileMapInfo* info,
MemRegion region, address oopmap,
size_t oopmap_size_in_bits) {
BitMapView bm((BitMap::bm_word_t*)oopmap, oopmap_size_in_bits);
-
-#ifndef PRODUCT
- ResourceMark rm;
- ResourceBitMap checkBm = HeapShared::calculate_oopmap(region);
- assert(bm.is_same(checkBm), "sanity");
-#endif
-
if (UseCompressedOops) {
patch_compressed_embedded_pointers(bm, info, region);
} else {
- PatchUncompressedEmbeddedPointers patcher((oop*)region.start());
+ PatchUncompressedEmbeddedPointers patcher((oop*)region.start() + FileMapInfo::current_info()->heap_oopmap_start_pos());
bm.iterate(&patcher);
}
}
@@ -316,7 +310,7 @@ bool ArchiveHeapLoader::load_heap_region_impl(FileMapInfo* mapinfo, LoadedArchiv
uintptr_t oopmap = bitmap_base + r->oopmap_offset();
BitMapView bm((BitMap::bm_word_t*)oopmap, r->oopmap_size_in_bits());
- PatchLoadedRegionPointers patcher((narrowOop*)load_address, loaded_region);
+ PatchLoadedRegionPointers patcher((narrowOop*)load_address + FileMapInfo::current_info()->heap_oopmap_start_pos(), loaded_region);
bm.iterate(&patcher);
return true;
}
@@ -449,7 +443,7 @@ void ArchiveHeapLoader::patch_native_pointers() {
if (r->mapped_base() != nullptr && r->has_ptrmap()) {
log_info(cds, heap)("Patching native pointers in heap region");
BitMapView bm = r->ptrmap_view();
- PatchNativePointers patcher((Metadata**)r->mapped_base());
+ PatchNativePointers patcher((Metadata**)r->mapped_base() + FileMapInfo::current_info()->heap_ptrmap_start_pos());
bm.iterate(&patcher);
}
}
diff --git a/src/hotspot/share/cds/archiveHeapWriter.cpp b/src/hotspot/share/cds/archiveHeapWriter.cpp
index 131b43307d5c6..458993f15d770 100644
--- a/src/hotspot/share/cds/archiveHeapWriter.cpp
+++ b/src/hotspot/share/cds/archiveHeapWriter.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -62,6 +62,7 @@ address ArchiveHeapWriter::_requested_top;
GrowableArrayCHeap* ArchiveHeapWriter::_native_pointers;
GrowableArrayCHeap* ArchiveHeapWriter::_source_objs;
+GrowableArrayCHeap* ArchiveHeapWriter::_source_objs_order;
ArchiveHeapWriter::BufferOffsetToSourceObjectTable*
ArchiveHeapWriter::_buffer_offset_to_source_obj_table = nullptr;
@@ -72,6 +73,7 @@ typedef ResourceHashtable FillersTable;
static FillersTable* _fillers;
+static int _num_native_ptrs = 0;
void ArchiveHeapWriter::init() {
if (HeapShared::can_write()) {
@@ -84,6 +86,7 @@ void ArchiveHeapWriter::init() {
_native_pointers = new GrowableArrayCHeap(2048);
_source_objs = new GrowableArrayCHeap(10000);
+ _source_objs_order = new GrowableArrayCHeap(10000);
guarantee(UseG1GC, "implementation limitation");
guarantee(MIN_GC_REGION_ALIGNMENT <= /*G1*/HeapRegion::min_region_size_in_words() * HeapWordSize, "must be");
@@ -91,6 +94,7 @@ void ArchiveHeapWriter::init() {
}
void ArchiveHeapWriter::add_source_obj(oop src_obj) {
+ _source_objs_order->append(_source_objs->length());
_source_objs->append(src_obj);
}
@@ -226,9 +230,54 @@ void ArchiveHeapWriter::copy_roots_to_buffer(GrowableArrayCHeapat(*a);
+ oop ob = _source_objs->at(*b);
+
+ int rank_a = oop_sorting_rank(oa);
+ int rank_b = oop_sorting_rank(ob);
+
+ if (rank_a != rank_b) {
+ return rank_a - rank_b;
+ } else {
+ // If they are the same rank, sort them by their position in the _source_objs array
+ return *a - *b;
+ }
+}
+
+void ArchiveHeapWriter::sort_source_objs() {
+ _source_objs_order->sort(compare_objs_by_oop_fields);
+}
+
void ArchiveHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeap* roots) {
- for (int i = 0; i < _source_objs->length(); i++) {
- oop src_obj = _source_objs->at(i);
+ sort_source_objs();
+ for (int i = 0; i < _source_objs_order->length(); i++) {
+ int src_obj_index = _source_objs_order->at(i);
+ oop src_obj = _source_objs->at(src_obj_index);
HeapShared::CachedOopInfo* info = HeapShared::archived_object_cache()->get(src_obj);
assert(info != nullptr, "must be");
size_t buffer_offset = copy_one_source_obj_to_buffer(src_obj);
@@ -239,8 +288,8 @@ void ArchiveHeapWriter::copy_source_objs_to_buffer(GrowableArrayCHeaplength() + 1, roots->length());
+ log_info(cds)("Size of heap region = " SIZE_FORMAT " bytes, %d objects, %d roots, %d native ptrs",
+ _buffer_used, _source_objs->length() + 1, roots->length(), _num_native_ptrs);
}
size_t ArchiveHeapWriter::filler_array_byte_size(int length) {
@@ -512,6 +561,17 @@ class ArchiveHeapWriter::EmbeddedOopRelocator: public BasicOopIterateClosure {
}
};
+static void log_bitmap_usage(const char* which, BitMap* bitmap, size_t total_bits) {
+ // The whole heap is covered by total_bits, but there are only non-zero bits within [start ... end).
+ size_t start = bitmap->find_first_set_bit(0);
+ size_t end = bitmap->size();
+ log_info(cds)("%s = " SIZE_FORMAT_W(7) " ... " SIZE_FORMAT_W(7) " (%3zu%% ... %3zu%% = %3zu%%)", which,
+ start, end,
+ start * 100 / total_bits,
+ end * 100 / total_bits,
+ (end - start) * 100 / total_bits);
+}
+
// Update all oop fields embedded in the buffered objects
void ArchiveHeapWriter::relocate_embedded_oops(GrowableArrayCHeap* roots,
ArchiveHeapInfo* heap_info) {
@@ -519,14 +579,17 @@ void ArchiveHeapWriter::relocate_embedded_oops(GrowableArrayCHeapoopmap()->resize(heap_region_byte_size / oopmap_unit);
- auto iterator = [&] (oop src_obj, HeapShared::CachedOopInfo& info) {
- oop requested_obj = requested_obj_from_buffer_offset(info.buffer_offset());
+ for (int i = 0; i < _source_objs_order->length(); i++) {
+ int src_obj_index = _source_objs_order->at(i);
+ oop src_obj = _source_objs->at(src_obj_index);
+ HeapShared::CachedOopInfo* info = HeapShared::archived_object_cache()->get(src_obj);
+ assert(info != nullptr, "must be");
+ oop requested_obj = requested_obj_from_buffer_offset(info->buffer_offset());
update_header_for_requested_obj(requested_obj, src_obj, src_obj->klass());
- address buffered_obj = offset_to_buffered_address(info.buffer_offset());
+ address buffered_obj = offset_to_buffered_address(info->buffer_offset());
EmbeddedOopRelocator relocator(src_obj, buffered_obj, heap_info->oopmap());
src_obj->oop_iterate(&relocator);
};
- HeapShared::archived_object_cache()->iterate_all(iterator);
// Relocate HeapShared::roots(), which is created in copy_roots_to_buffer() and
// doesn't have a corresponding src_obj, so we can't use EmbeddedOopRelocator on it.
@@ -542,6 +605,10 @@ void ArchiveHeapWriter::relocate_embedded_oops(GrowableArrayCHeaplength();
+ log_bitmap_usage("oopmap", heap_info->oopmap(), total_bytes / (UseCompressedOops ? sizeof(narrowOop) : sizeof(oop)));
+ log_bitmap_usage("ptrmap", heap_info->ptrmap(), total_bytes / sizeof(address));
}
void ArchiveHeapWriter::mark_native_pointer(oop src_obj, int field_offset) {
@@ -551,6 +618,8 @@ void ArchiveHeapWriter::mark_native_pointer(oop src_obj, int field_offset) {
info._src_obj = src_obj;
info._field_offset = field_offset;
_native_pointers->append(info);
+ HeapShared::set_has_native_pointers(src_obj);
+ _num_native_ptrs ++;
}
}
@@ -565,6 +634,13 @@ bool ArchiveHeapWriter::is_marked_as_native_pointer(ArchiveHeapInfo* heap_info,
assert((Metadata**)_requested_bottom <= requested_field_addr && requested_field_addr < (Metadata**) _requested_top, "range check");
BitMap::idx_t idx = requested_field_addr - (Metadata**) _requested_bottom;
+ // Leading zeros have been removed so some addresses may not be in the ptrmap
+ size_t start_pos = FileMapInfo::current_info()->heap_ptrmap_start_pos();
+ if (idx < start_pos) {
+ return false;
+ } else {
+ idx -= start_pos;
+ }
return (idx < heap_info->ptrmap()->size()) && (heap_info->ptrmap()->at(idx) == true);
}
diff --git a/src/hotspot/share/cds/archiveHeapWriter.hpp b/src/hotspot/share/cds/archiveHeapWriter.hpp
index 889646b78c8e5..3acb87538771b 100644
--- a/src/hotspot/share/cds/archiveHeapWriter.hpp
+++ b/src/hotspot/share/cds/archiveHeapWriter.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -140,6 +140,7 @@ class ArchiveHeapWriter : AllStatic {
static GrowableArrayCHeap* _native_pointers;
static GrowableArrayCHeap* _source_objs;
+ static GrowableArrayCHeap* _source_objs_order;
typedef ResourceHashtable static void relocate_root_at(oop requested_roots, int index, CHeapBitMap* oopmap);
static void update_header_for_requested_obj(oop requested_obj, oop src_obj, Klass* src_klass);
+
+ static int compare_objs_by_oop_fields(int* a, int* b);
+ static void sort_source_objs();
+
public:
static void init() NOT_CDS_JAVA_HEAP_RETURN;
static void add_source_obj(oop src_obj);
diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp
index 7b9dbd80a6877..97f0e58030a40 100644
--- a/src/hotspot/share/cds/filemap.cpp
+++ b/src/hotspot/share/cds/filemap.cpp
@@ -289,6 +289,8 @@ void FileMapHeader::print(outputStream* st) {
st->print_cr("- requested_base_address: " INTPTR_FORMAT, p2i(_requested_base_address));
st->print_cr("- mapped_base_address: " INTPTR_FORMAT, p2i(_mapped_base_address));
st->print_cr("- heap_roots_offset: " SIZE_FORMAT, _heap_roots_offset);
+ st->print_cr("- _heap_oopmap_start_pos: " SIZE_FORMAT, _heap_oopmap_start_pos);
+ st->print_cr("- _heap_ptrmap_start_pos: " SIZE_FORMAT, _heap_ptrmap_start_pos);
st->print_cr("- allow_archiving_with_java_agent:%d", _allow_archiving_with_java_agent);
st->print_cr("- use_optimized_module_handling: %d", _use_optimized_module_handling);
st->print_cr("- has_full_module_graph %d", _has_full_module_graph);
@@ -1565,11 +1567,37 @@ static size_t write_bitmap(const CHeapBitMap* map, char* output, size_t offset)
return offset + size_in_bytes;
}
+// The start of the archived heap has many primitive arrays (String
+// bodies) that are not marked by the oop/ptr maps. So we must have
+// lots of leading zeros.
+size_t FileMapInfo::remove_bitmap_leading_zeros(CHeapBitMap* map) {
+ size_t old_zeros = map->find_first_set_bit(0);
+ size_t old_size = map->size_in_bytes();
+
+ // Slice and resize bitmap
+ map->truncate(old_zeros, map->size());
+
+ DEBUG_ONLY(
+ size_t new_zeros = map->find_first_set_bit(0);
+ assert(new_zeros == 0, "Should have removed leading zeros");
+ )
+
+ assert(map->size_in_bytes() < old_size, "Map size should have decreased");
+ return old_zeros;
+}
+
char* FileMapInfo::write_bitmap_region(const CHeapBitMap* ptrmap, ArchiveHeapInfo* heap_info,
size_t &size_in_bytes) {
size_in_bytes = ptrmap->size_in_bytes();
if (heap_info->is_used()) {
+ // Remove leading zeros
+ size_t removed_oop_zeros = remove_bitmap_leading_zeros(heap_info->oopmap());
+ size_t removed_ptr_zeros = remove_bitmap_leading_zeros(heap_info->ptrmap());
+
+ header()->set_heap_oopmap_start_pos(removed_oop_zeros);
+ header()->set_heap_ptrmap_start_pos(removed_ptr_zeros);
+
size_in_bytes += heap_info->oopmap()->size_in_bytes();
size_in_bytes += heap_info->ptrmap()->size_in_bytes();
}
diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp
index fd84563008ccf..e7c131ee5bb64 100644
--- a/src/hotspot/share/cds/filemap.hpp
+++ b/src/hotspot/share/cds/filemap.hpp
@@ -228,6 +228,8 @@ class FileMapHeader: private CDSFileMapHeaderBase {
size_t _ptrmap_size_in_bits; // Size of pointer relocation bitmap
size_t _heap_roots_offset; // Offset of the HeapShared::roots() object, from the bottom
// of the archived heap objects, in bytes.
+ size_t _heap_oopmap_start_pos; // The first bit in the oopmap corresponds to this position in the heap.
+ size_t _heap_ptrmap_start_pos; // The first bit in the ptrmap corresponds to this position in the heap.
char* from_mapped_offset(size_t offset) const {
return mapped_base_address() + offset;
}
@@ -269,6 +271,8 @@ class FileMapHeader: private CDSFileMapHeaderBase {
bool compressed_oops() const { return _compressed_oops; }
bool compressed_class_pointers() const { return _compressed_class_ptrs; }
size_t heap_roots_offset() const { return _heap_roots_offset; }
+ size_t heap_oopmap_start_pos() const { return _heap_oopmap_start_pos;}
+ size_t heap_ptrmap_start_pos() const { return _heap_ptrmap_start_pos;}
// FIXME: These should really return int
jshort max_used_path_index() const { return _max_used_path_index; }
jshort app_module_paths_start_index() const { return _app_module_paths_start_index; }
@@ -281,6 +285,8 @@ class FileMapHeader: private CDSFileMapHeaderBase {
void set_ptrmap_size_in_bits(size_t s) { _ptrmap_size_in_bits = s; }
void set_mapped_base_address(char* p) { _mapped_base_address = p; }
void set_heap_roots_offset(size_t n) { _heap_roots_offset = n; }
+ void set_heap_oopmap_start_pos(size_t n) { _heap_oopmap_start_pos = n; }
+ void set_heap_ptrmap_start_pos(size_t n) { _heap_ptrmap_start_pos = n; }
void copy_base_archive_name(const char* name);
void set_shared_path_table(SharedPathTable table) {
@@ -378,6 +384,8 @@ class FileMapInfo : public CHeapObj {
uintx max_heap_size() const { return header()->max_heap_size(); }
size_t heap_roots_offset() const { return header()->heap_roots_offset(); }
size_t core_region_alignment() const { return header()->core_region_alignment(); }
+ size_t heap_oopmap_start_pos() const { return header()->heap_oopmap_start_pos(); }
+ size_t heap_ptrmap_start_pos() const { return header()->heap_ptrmap_start_pos(); }
CompressedOops::Mode narrow_oop_mode() const { return header()->narrow_oop_mode(); }
jshort app_module_paths_start_index() const { return header()->app_module_paths_start_index(); }
@@ -434,6 +442,7 @@ class FileMapInfo : public CHeapObj {
void write_header();
void write_region(int region, char* base, size_t size,
bool read_only, bool allow_exec);
+ size_t remove_bitmap_leading_zeros(CHeapBitMap* map);
char* write_bitmap_region(const CHeapBitMap* ptrmap, ArchiveHeapInfo* heap_info,
size_t &size_in_bytes);
size_t write_heap_region(ArchiveHeapInfo* heap_info);
diff --git a/src/hotspot/share/cds/heapShared.cpp b/src/hotspot/share/cds/heapShared.cpp
index 5160228b27c94..4eaa0a26b1784 100644
--- a/src/hotspot/share/cds/heapShared.cpp
+++ b/src/hotspot/share/cds/heapShared.cpp
@@ -284,7 +284,7 @@ bool HeapShared::archive_object(oop obj) {
// the identity_hash in the object header will have a predictable value,
// making the archive reproducible.
obj->identity_hash();
- CachedOopInfo info = make_cached_oop_info();
+ CachedOopInfo info = make_cached_oop_info(obj);
archived_object_cache()->put(obj, info);
mark_native_pointers(obj);
@@ -437,6 +437,24 @@ void HeapShared::mark_native_pointers(oop orig_obj) {
}
}
+bool HeapShared::has_oop_pointers(oop src_obj) {
+ CachedOopInfo* info = archived_object_cache()->get(src_obj);
+ assert(info != nullptr, "must be");
+ return info->has_oop_pointers();
+}
+
+bool HeapShared::has_native_pointers(oop src_obj) {
+ CachedOopInfo* info = archived_object_cache()->get(src_obj);
+ assert(info != nullptr, "must be");
+ return info->has_native_pointers();
+}
+
+void HeapShared::set_has_native_pointers(oop src_obj) {
+ CachedOopInfo* info = archived_object_cache()->get(src_obj);
+ assert(info != nullptr, "must be");
+ info->set_has_native_pointers();
+}
+
// -- Handling of Enum objects
// Java Enum classes have synthetic methods that look like this
// enum MyEnum {FOO, BAR}
@@ -1138,10 +1156,27 @@ class WalkOopAndArchiveClosure: public BasicOopIterateClosure {
WalkOopAndArchiveClosure* WalkOopAndArchiveClosure::_current = nullptr;
-HeapShared::CachedOopInfo HeapShared::make_cached_oop_info() {
+// Checks if an oop has any non-null oop fields
+class PointsToOopsChecker : public BasicOopIterateClosure {
+ bool _result;
+
+ template void check(T *p) {
+ _result |= (HeapAccess<>::oop_load(p) != nullptr);
+ }
+
+public:
+ PointsToOopsChecker() : _result(false) {}
+ void do_oop(narrowOop *p) { check(p); }
+ void do_oop( oop *p) { check(p); }
+ bool result() { return _result; }
+};
+
+HeapShared::CachedOopInfo HeapShared::make_cached_oop_info(oop obj) {
WalkOopAndArchiveClosure* walker = WalkOopAndArchiveClosure::current();
oop referrer = (walker == nullptr) ? nullptr : walker->referencing_obj();
- return CachedOopInfo(referrer);
+ PointsToOopsChecker points_to_oops_checker;
+ obj->oop_iterate(&points_to_oops_checker);
+ return CachedOopInfo(referrer, points_to_oops_checker.result());
}
// (1) If orig_obj has not been archived yet, archive it.
@@ -1439,12 +1474,14 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
#ifndef PRODUCT
bool is_test_class = (ArchiveHeapTestClass != nullptr) && (strcmp(info->klass_name, ArchiveHeapTestClass) == 0);
+ const char* test_class_name = ArchiveHeapTestClass;
#else
bool is_test_class = false;
+ const char* test_class_name = ""; // avoid C++ printf checks warnings.
#endif
if (is_test_class) {
- log_warning(cds)("Loading ArchiveHeapTestClass %s ...", ArchiveHeapTestClass);
+ log_warning(cds)("Loading ArchiveHeapTestClass %s ...", test_class_name);
}
Klass* k = SystemDictionary::resolve_or_fail(klass_name, true, THREAD);
@@ -1470,14 +1507,14 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
// We don't want ArchiveHeapTestClass to be abused to easily load/initialize arbitrary
// core-lib classes. You need to at least append to the bootclasspath.
stringStream st;
- st.print("ArchiveHeapTestClass %s is not in unnamed module", ArchiveHeapTestClass);
+ st.print("ArchiveHeapTestClass %s is not in unnamed module", test_class_name);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), st.as_string());
}
if (ik->package() != nullptr) {
// This restriction makes HeapShared::is_a_test_class_in_unnamed_module() easy.
stringStream st;
- st.print("ArchiveHeapTestClass %s is not in unnamed package", ArchiveHeapTestClass);
+ st.print("ArchiveHeapTestClass %s is not in unnamed package", test_class_name);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), st.as_string());
}
} else {
@@ -1492,7 +1529,7 @@ void HeapShared::init_subgraph_entry_fields(ArchivableStaticFieldInfo fields[],
}
if (is_test_class) {
- log_warning(cds)("Initializing ArchiveHeapTestClass %s ...", ArchiveHeapTestClass);
+ log_warning(cds)("Initializing ArchiveHeapTestClass %s ...", test_class_name);
}
ik->initialize(CHECK);
diff --git a/src/hotspot/share/cds/heapShared.hpp b/src/hotspot/share/cds/heapShared.hpp
index c41339173cdbd..e1b73eeced77a 100644
--- a/src/hotspot/share/cds/heapShared.hpp
+++ b/src/hotspot/share/cds/heapShared.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -186,18 +186,29 @@ class HeapShared: AllStatic {
}
class CachedOopInfo {
- // See "TEMP notes: What are these?" in archiveHeapWriter.hpp
+ // Used by CDSHeapVerifier.
oop _orig_referrer;
// The location of this object inside ArchiveHeapWriter::_buffer
size_t _buffer_offset;
+
+ // One or more fields in this object are pointing to non-null oops.
+ bool _has_oop_pointers;
+
+ // One or more fields in this object are pointing to MetaspaceObj
+ bool _has_native_pointers;
public:
- CachedOopInfo(oop orig_referrer)
+ CachedOopInfo(oop orig_referrer, bool has_oop_pointers)
: _orig_referrer(orig_referrer),
- _buffer_offset(0) {}
+ _buffer_offset(0),
+ _has_oop_pointers(has_oop_pointers),
+ _has_native_pointers(false) {}
oop orig_referrer() const { return _orig_referrer; }
void set_buffer_offset(size_t offset) { _buffer_offset = offset; }
size_t buffer_offset() const { return _buffer_offset; }
+ bool has_oop_pointers() const { return _has_oop_pointers; }
+ bool has_native_pointers() const { return _has_native_pointers; }
+ void set_has_native_pointers() { _has_native_pointers = true; }
};
private:
@@ -237,7 +248,7 @@ class HeapShared: AllStatic {
static DumpTimeKlassSubGraphInfoTable* _dump_time_subgraph_info_table;
static RunTimeKlassSubGraphInfoTable _run_time_subgraph_info_table;
- static CachedOopInfo make_cached_oop_info();
+ static CachedOopInfo make_cached_oop_info(oop obj);
static void archive_object_subgraphs(ArchivableStaticFieldInfo fields[],
bool is_full_module_graph);
@@ -368,6 +379,9 @@ class HeapShared: AllStatic {
// Scratch objects for archiving Klass::java_mirror()
static void set_scratch_java_mirror(Klass* k, oop mirror);
static void remove_scratch_objects(Klass* k);
+ static bool has_oop_pointers(oop obj);
+ static bool has_native_pointers(oop obj);
+ static void set_has_native_pointers(oop obj);
// We use the HeapShared::roots() array to make sure that objects stored in the
// archived heap region are not prematurely collected. These roots include:
diff --git a/src/hotspot/share/cds/metaspaceShared.cpp b/src/hotspot/share/cds/metaspaceShared.cpp
index ca745671e4015..3e1ae20ac1627 100644
--- a/src/hotspot/share/cds/metaspaceShared.cpp
+++ b/src/hotspot/share/cds/metaspaceShared.cpp
@@ -96,6 +96,7 @@ bool MetaspaceShared::_remapped_readwrite = false;
void* MetaspaceShared::_shared_metaspace_static_top = nullptr;
intx MetaspaceShared::_relocation_delta;
char* MetaspaceShared::_requested_base_address;
+bool MetaspaceShared::_use_optimized_module_handling = true;
// The CDS archive is divided into the following regions:
// rw - read-write metadata
diff --git a/src/hotspot/share/cds/metaspaceShared.hpp b/src/hotspot/share/cds/metaspaceShared.hpp
index 89188a12dcec5..1fb6ae8814210 100644
--- a/src/hotspot/share/cds/metaspaceShared.hpp
+++ b/src/hotspot/share/cds/metaspaceShared.hpp
@@ -52,6 +52,8 @@ class MetaspaceShared : AllStatic {
static void* _shared_metaspace_static_top;
static intx _relocation_delta;
static char* _requested_base_address;
+ static bool _use_optimized_module_handling;
+
public:
enum {
// core archive spaces
@@ -158,6 +160,10 @@ class MetaspaceShared : AllStatic {
return is_windows;
}
+ // Can we skip some expensive operations related to modules?
+ static bool use_optimized_module_handling() { return NOT_CDS(false) CDS_ONLY(_use_optimized_module_handling); }
+ static void disable_optimized_module_handling() { _use_optimized_module_handling = false; }
+
private:
static void read_extra_data(JavaThread* current, const char* filename) NOT_CDS_RETURN;
static FileMapInfo* open_static_archive();
From 4d644674442e491b477bdbb5469a58aa9151d573 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Wed, 13 Mar 2024 14:17:30 +0000
Subject: [PATCH 15/58] 8328079: JDK-8326583 broke ccache compilation
Reviewed-by: erikj, jwaters
---
make/common/NativeCompilation.gmk | 48 +++++++++++++++----------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index 13b0318b4c776..893f417799000 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -303,36 +303,36 @@ endef
# Setup the toolchain variables
define SetupToolchain
ifeq ($$($1_TARGET_TYPE), BUILD)
- $$(call SetIfEmpty, $1_CC, $(BUILD_CC))
- $$(call SetIfEmpty, $1_CXX, $(BUILD_CXX))
- $$(call SetIfEmpty, $1_AR, $(BUILD_AR))
- $$(call SetIfEmpty, $1_LIB, $(BUILD_LIB))
- $$(call SetIfEmpty, $1_AS, $(BUILD_AS))
- $$(call SetIfEmpty, $1_OBJCOPY, $(BUILD_OBJCOPY))
- $$(call SetIfEmpty, $1_STRIP, $(BUILD_STRIP))
- $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(BUILD_SYSROOT_CFLAGS))
- $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(BUILD_SYSROOT_LDFLAGS))
+ $$(call SetIfEmpty, $1_CC, $$(BUILD_CC))
+ $$(call SetIfEmpty, $1_CXX, $$(BUILD_CXX))
+ $$(call SetIfEmpty, $1_AR, $$(BUILD_AR))
+ $$(call SetIfEmpty, $1_LIB, $$(BUILD_LIB))
+ $$(call SetIfEmpty, $1_AS, $$(BUILD_AS))
+ $$(call SetIfEmpty, $1_OBJCOPY, $$(BUILD_OBJCOPY))
+ $$(call SetIfEmpty, $1_STRIP, $$(BUILD_STRIP))
+ $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$(BUILD_SYSROOT_CFLAGS))
+ $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$(BUILD_SYSROOT_LDFLAGS))
ifeq ($$($1_LINK_TYPE), C++)
- $$(call SetIfEmpty, $1_LD, $(BUILD_LDCXX))
+ $$(call SetIfEmpty, $1_LD, $$(BUILD_LDCXX))
else
- $$(call SetIfEmpty, $1_LD, $(BUILD_LD))
+ $$(call SetIfEmpty, $1_LD, $$(BUILD_LD))
endif
else
- $$(call SetIfEmpty, $1_CC, $(CC))
- $$(call SetIfEmpty, $1_CXX, $(CXX))
- $$(call SetIfEmpty, $1_AR, $(AR))
- $$(call SetIfEmpty, $1_LIB, $(LIB))
- $$(call SetIfEmpty, $1_AS, $(AS))
- $$(call SetIfEmpty, $1_MT, $(MT))
- $$(call SetIfEmpty, $1_RC, $(RC))
- $$(call SetIfEmpty, $1_OBJCOPY, $(OBJCOPY))
- $$(call SetIfEmpty, $1_STRIP, $(STRIP))
- $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $(SYSROOT_CFLAGS))
- $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $(SYSROOT_LDFLAGS))
+ $$(call SetIfEmpty, $1_CC, $$(CC))
+ $$(call SetIfEmpty, $1_CXX, $$(CXX))
+ $$(call SetIfEmpty, $1_AR, $$(AR))
+ $$(call SetIfEmpty, $1_LIB, $$(LIB))
+ $$(call SetIfEmpty, $1_AS, $$(AS))
+ $$(call SetIfEmpty, $1_MT, $$(MT))
+ $$(call SetIfEmpty, $1_RC, $$(RC))
+ $$(call SetIfEmpty, $1_OBJCOPY, $$(OBJCOPY))
+ $$(call SetIfEmpty, $1_STRIP, $$(STRIP))
+ $$(call SetIfEmpty, $1_SYSROOT_CFLAGS, $$(SYSROOT_CFLAGS))
+ $$(call SetIfEmpty, $1_SYSROOT_LDFLAGS, $$(SYSROOT_LDFLAGS))
ifeq ($$($1_LINK_TYPE), C++)
- $$(call SetIfEmpty, $1_LD, $(LDCXX))
+ $$(call SetIfEmpty, $1_LD, $$(LDCXX))
else
- $$(call SetIfEmpty, $1_LD, $(LD))
+ $$(call SetIfEmpty, $1_LD, $$(LD))
endif
endif
endef
From 035324503f5e04b53d99573a664fd1367b7ccf30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?=
Date: Wed, 13 Mar 2024 15:13:35 +0000
Subject: [PATCH 16/58] 8325874: Improve checkbox-based interface in summary
pages
Reviewed-by: prappo
---
.../formats/html/DeprecatedListWriter.java | 35 +++++++------------
.../formats/html/NewAPIListWriter.java | 19 ++++------
.../formats/html/PreviewListWriter.java | 24 +++++--------
.../formats/html/SummaryListWriter.java | 23 ++++++++++++
.../internal/doclets/formats/html/Table.java | 19 ++--------
.../formats/html/resources/script.js.template | 27 +++++++-------
.../html/resources/standard.properties | 3 ++
.../doclet/testNewApiList/TestNewApiList.java | 20 +++++++----
.../doclet/testPreview/TestPreview.java | 7 ++--
9 files changed, 90 insertions(+), 87 deletions(-)
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
index bc0f1e52bbd5e..684e198ef1b75 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/DeprecatedListWriter.java
@@ -32,8 +32,6 @@
import com.sun.source.doctree.DeprecatedTree;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
@@ -83,10 +81,19 @@ protected void addContentSelectors(Content target) {
if (releases.size() > 1) {
Content tabs = HtmlTree.DIV(HtmlStyle.checkboxes, contents.getContent(
"doclet.Deprecated_API_Checkbox_Label"));
- for (int i = 0; i < releases.size(); i++) {
- // Table column ids are 1-based
- tabs.add(Text.of(" ")).add(getReleaseCheckbox(releases.get(i), i + 1));
+ // Table column ids are 1-based
+ int index = 1;
+ for (String release : releases) {
+ // Empty string represents other/uncategorized releases. Since we can't make any assumptions
+ // about release names this is arguably the safest way to avoid naming collisions.
+ Content label = !release.isEmpty()
+ ? Text.of(release)
+ : contents.getContent("doclet.Deprecated_API_Checkbox_Other_Releases");
+ String id = release.isEmpty() ? ID_OTHER : String.valueOf(index++);
+ tabs.add(Text.of(" ")).add(getCheckbox(label, id, "release-"));
}
+ tabs.add(Text.of(" ")).add(getCheckbox(
+ contents.getContent("doclet.Deprecated_API_Checkbox_All_Releases"), ID_ALL, "release-"));
target.add(tabs);
}
}
@@ -97,23 +104,6 @@ protected void addExtraSection(Content content) {
TERMINALLY_DEPRECATED_KEY, "doclet.Element", content);
}
- private Content getReleaseCheckbox(String name, int index) {
- // Empty string represents other/uncategorized releases. Since we can't make any assumptions
- // about release names this is arguably the safest way to avoid naming collisions.
- boolean isOtherReleases = name.isEmpty();
- Content releaseLabel = isOtherReleases
- ? contents.getContent("doclet.Deprecated_API_Checkbox_Other_Releases")
- : Text.of(name);
- HtmlId htmlId = HtmlId.of("release-" + index);
- String releaseId = isOtherReleases ? "" : Integer.toString(index);
- return HtmlTree.LABEL(htmlId.name(),
- HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, htmlId)
- .put(HtmlAttr.CHECKED, "")
- .put(HtmlAttr.ONCLICK,
- "toggleGlobal(this, '" + releaseId + "', 3)"))
- .add(HtmlTree.SPAN(releaseLabel));
- }
-
@Override
protected void addExtraIndexLink(Content target) {
if (!builder.getForRemoval().isEmpty()) {
@@ -139,7 +129,6 @@ protected void addTableTabs(Table table, String headingKey) {
}
if (releases.size() > 1) {
table.setDefaultTab(getTableCaption(headingKey))
- .setAlwaysShowDefaultTab(true)
.setRenderTabs(false);
for (String release : releases) {
Content tab = TERMINALLY_DEPRECATED_KEY.equals(headingKey)
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NewAPIListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NewAPIListWriter.java
index d035e0f1d95f0..a976ad21548e5 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NewAPIListWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/NewAPIListWriter.java
@@ -79,21 +79,17 @@ protected String getTitleKey() {
@Override
protected void addContentSelectors(Content content) {
- List releases = configuration.newAPIPageBuilder.releases;
+ List releases = builder.releases;
if (releases.size() > 1) {
Content tabs = HtmlTree.DIV(HtmlStyle.checkboxes,
contents.getContent("doclet.New_API_Checkbox_Label"));
- for (int i = 0; i < releases.size(); i++) {
- int releaseIndex = i + 1;
- String release = releases.get(i);
- HtmlId htmlId = HtmlId.of("release-" + releaseIndex);
- tabs.add(Text.of(" ")).add(HtmlTree.LABEL(htmlId.name(),
- HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, htmlId)
- .put(HtmlAttr.CHECKED, "")
- .put(HtmlAttr.ONCLICK,
- "toggleGlobal(this, '" + releaseIndex + "', 3)"))
- .add(HtmlTree.SPAN(Text.of(release))));
+ // Table column ids are 1-based
+ int index = 1;
+ for (String release : releases) {
+ tabs.add(Text.of(" ")).add(getCheckbox(Text.of(release), String.valueOf(index++), "release-"));
}
+ Content label = contents.getContent("doclet.New_API_Checkbox_All_Releases");
+ tabs.add(Text.of(" ")).add(getCheckbox(label, ID_ALL, "release-"));
content.add(tabs);
}
}
@@ -104,7 +100,6 @@ protected void addTableTabs(Table table, String headingKey) {
List releases = builder.releases;
if (releases.size() > 1) {
table.setDefaultTab(getTableCaption(headingKey))
- .setAlwaysShowDefaultTab(true)
.setRenderTabs(false);
for (String release : releases) {
table.addTab(
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PreviewListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PreviewListWriter.java
index 0f14098a32686..911df132de4c3 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PreviewListWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PreviewListWriter.java
@@ -33,8 +33,7 @@
import com.sun.source.doctree.DocTree;
import jdk.javadoc.internal.doclets.formats.html.Navigation.PageMode;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
-import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
+import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlTree;
import jdk.javadoc.internal.doclets.formats.html.markup.Text;
@@ -80,21 +79,17 @@ protected String getTitleKey() {
protected void addContentSelectors(Content target) {
Set jeps = builder.getJEPs();
if (!jeps.isEmpty()) {
- int index = 0;
+ int index = 1;
target.add(HtmlTree.P(contents.getContent("doclet.Preview_API_Checkbox_Label")));
- Content list = HtmlTree.UL(HtmlStyle.previewFeatureList);
+ Content list = HtmlTree.UL(HtmlStyle.previewFeatureList).addStyle(HtmlStyle.checkboxes);
for (var jep : jeps) {
- index++;
- HtmlId htmlId = HtmlId.of("feature-" + index);
String jepUrl = resources.getText("doclet.Preview_JEP_URL", jep.number());
- list.add(HtmlTree.LI(HtmlTree.LABEL(htmlId.name(),
- HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, htmlId)
- .put(HtmlAttr.CHECKED, "")
- .put(HtmlAttr.ONCLICK,
- "toggleGlobal(this, '" + index + "', 3)"))
- .add(HtmlTree.SPAN(Text.of(jep.number() + ": "))
- .add(HtmlTree.A(jepUrl, Text.of(jep.title() + " (" + jep.status() + ")"))))));
+ Content label = new ContentBuilder(Text.of(jep.number() + ": "))
+ .add(HtmlTree.A(jepUrl, Text.of(jep.title() + " (" + jep.status() + ")")));
+ list.add(HtmlTree.LI(getCheckbox(label, String.valueOf(index++), "feature-")));
}
+ Content label = contents.getContent("doclet.Preview_API_Checkbox_Toggle_All");
+ list.add(HtmlTree.LI(getCheckbox(label, ID_ALL, "feature-")));
target.add(list);
}
}
@@ -113,7 +108,6 @@ protected void addComments(Element e, Content desc) {
protected void addTableTabs(Table table, String headingKey) {
table.setGridStyle(HtmlStyle.threeColumnSummary)
.setDefaultTab(getTableCaption(headingKey))
- .setAlwaysShowDefaultTab(true)
.setRenderTabs(false);
for (PreviewAPIListBuilder.JEP jep : builder.getJEPs()) {
table.addTab(Text.EMPTY, element -> jep == builder.getJEP(element));
@@ -122,7 +116,7 @@ protected void addTableTabs(Table table, String headingKey) {
@Override
protected Content getExtraContent(Element element) {
- PreviewAPIListBuilder.JEP jep = configuration.previewAPIListBuilder.getJEP(element);
+ PreviewAPIListBuilder.JEP jep = builder.getJEP(element);
return jep == null ? Text.EMPTY : Text.of(jep.title());
}
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java
index c478907270c0e..ffe0350678de3 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SummaryListWriter.java
@@ -32,6 +32,7 @@
import javax.lang.model.element.PackageElement;
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder;
+import jdk.javadoc.internal.doclets.formats.html.markup.HtmlAttr;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlId;
import jdk.javadoc.internal.doclets.formats.html.markup.HtmlStyle;
import jdk.javadoc.internal.doclets.formats.html.markup.Script;
@@ -54,6 +55,9 @@
*/
public abstract class SummaryListWriter extends SubWriterHolderWriter {
+ final protected String ID_OTHER = "other";
+ final protected String ID_ALL = "all";
+
protected String getHeadingKey(SummaryElementKind kind) {
return switch (kind) {
case MODULE -> "doclet.Modules";
@@ -294,6 +298,25 @@ protected Content getSummaryLink(Element e) {
return writer.getSummaryLink(e);
}
+ /**
+ * Create a checkbox input element and associated label for selecting content on
+ * a summary page.
+ *
+ * @param label The label
+ * @param id the id of the selected content
+ * @param htmlPrefix the prefix for the HTML id
+ * @return a content object containing the checkbox input
+ */
+ protected Content getCheckbox(Content label, String id, String htmlPrefix) {
+ String htmlId = htmlPrefix + id;
+ return HtmlTree.LABEL(htmlId,
+ HtmlTree.INPUT(HtmlAttr.InputType.CHECKBOX, HtmlId.of(htmlId))
+ .put(HtmlAttr.CHECKED, "")
+ .put(HtmlAttr.ONCLICK,
+ "toggleGlobal(this, '" + id + "', 3)"))
+ .add(HtmlTree.SPAN(label));
+ }
+
/**
* Add an extra optional section to the content.
*
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java
index cd401cbad95d2..339cfbf6f727f 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/Table.java
@@ -84,7 +84,6 @@ public class Table extends Content {
private HtmlStyle gridStyle;
private final List bodyRows;
private HtmlId id;
- private boolean alwaysShowDefaultTab = false;
/**
* A record containing the data for a table tab.
@@ -147,16 +146,6 @@ public Table setDefaultTab(Content label) {
return this;
}
- /**
- * Sets whether to display the default tab even if tabs are empty or only contain a single tab.
- * @param showDefaultTab true if default tab should always be shown
- * @return this object
- */
- public Table setAlwaysShowDefaultTab(boolean showDefaultTab) {
- this.alwaysShowDefaultTab = showDefaultTab;
- return this;
- }
-
/**
* Allows to set whether tabs should be rendered for this table. Some pages use their
* own controls to select table categories, in which case the tabs are omitted.
@@ -385,7 +374,7 @@ private Content toContent() {
}
var table = HtmlTree.DIV(tableStyle).addStyle(gridStyle);
- if ((tabs == null || occurringTabs.size() == 1) && !alwaysShowDefaultTab) {
+ if ((tabs == null || occurringTabs.size() == 1) && renderTabs) {
if (tabs == null) {
main.add(caption);
} else {
@@ -401,15 +390,13 @@ private Content toContent() {
HtmlId defaultTabId = HtmlIds.forTab(id, 0);
if (renderTabs) {
tablist.add(createTab(defaultTabId, HtmlStyle.activeTableTab, true, defaultTab));
- } else {
- tablist.add(getCaption(defaultTab));
- }
- if (renderTabs) {
for (var tab : tabs) {
if (occurringTabs.contains(tab)) {
tablist.add(createTab(HtmlIds.forTab(id, tab.index()), HtmlStyle.tableTab, false, tab.label()));
}
}
+ } else {
+ tablist.add(getCaption(defaultTab));
}
if (id == null) {
throw new IllegalStateException("no id set for table");
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template
index e14a2ef34cbf5..ef09e6df90fd7 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/script.js.template
@@ -97,20 +97,23 @@ function sortTable(header, columnIndex, columns) {
// Toggles the visibility of a table category in all tables in a page
function toggleGlobal(checkbox, selected, columns) {
- var display = checkbox.checked ? '' : 'none';
- document.querySelectorAll("div.table-tabs").forEach(function(t) {
- var id = t.parentElement.getAttribute("id");
- var selectedClass = id + "-tab" + selected;
- // if selected is empty string it selects all uncategorized entries
- var selectUncategorized = !Boolean(selected);
+ const display = checkbox.checked ? '' : 'none';
+ const selectOther = selected === "other";
+ const selectAll = selected === "all";
+ if (selectAll) {
+ document.querySelectorAll('.checkboxes input[type="checkbox"]').forEach(c => {
+ c.checked = checkbox.checked;
+ });
+ }
+ document.querySelectorAll("div.table-tabs").forEach(t => {
+ const id = t.parentElement.getAttribute("id");
+ const selectedClass = id + "-tab" + (selectOther ? "" : selected);
var visible = 0;
- document.querySelectorAll('div.' + id)
+ t.parentElement.querySelectorAll('div.' + id)
.forEach(function(elem) {
- if (selectUncategorized) {
- if (elem.className.indexOf(selectedClass) === -1) {
- elem.style.display = display;
- }
- } else if (elem.classList.contains(selectedClass)) {
+ if (selectAll
+ || (!selectOther && elem.classList.contains(selectedClass))
+ || (selectOther && elem.className.indexOf(selectedClass) < 0)) {
elem.style.display = display;
}
if (elem.style.display === '') {
diff --git a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
index 23bf1f3c194c1..8e224cecb3674 100644
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties
@@ -116,17 +116,20 @@ doclet.tag.invalid_input=invalid input: ''{0}''
doclet.tag.invalid=invalid @{0}
doclet.Deprecated_API=Deprecated API
doclet.Deprecated_API_Checkbox_Label=Show API deprecated in:
+doclet.Deprecated_API_Checkbox_All_Releases=all
doclet.Deprecated_API_Checkbox_Other_Releases=other
doclet.Deprecated_Elements=Deprecated {0}
doclet.Deprecated_Elements_Release_Column_Header=Deprecated in
doclet.Deprecated_In_Release=Deprecated in {0}
doclet.New_API=New API
doclet.New_API_Checkbox_Label=Show API added in:
+doclet.New_API_Checkbox_All_Releases=all
doclet.New_Elements=New {0}
doclet.New_Elements_Release_Column_Header=Added in
doclet.New_Label=New
doclet.Preview_API=Preview API
doclet.Preview_API_Checkbox_Label=Show preview API for:
+doclet.Preview_API_Checkbox_Toggle_All=Toggle all
doclet.Preview_JEP_URL=https://openjdk.org/jeps/{0}
doclet.Preview_Label=Preview
doclet.Preview_Mark=PREVIEW
diff --git a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java
index e757ddc0eed78..bf89f377d2416 100644
--- a/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java
+++ b/test/langtools/jdk/javadoc/doclet/testNewApiList/TestNewApiList.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8263468 8269401 8268422 8287524
+ * @bug 8263468 8269401 8268422 8287524 8325874
* @summary New page for "recent" new API
* @library ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
@@ -115,7 +115,9 @@ private void checkMultiReleaseContents() {
3.2
+ 5
""");
}
}
diff --git a/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/DeepArrays.java b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/DeepArrays.java
new file mode 100644
index 0000000000000..dd58a1d5d59ee
--- /dev/null
+++ b/test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/DeepArrays.java
@@ -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.
+ */
+package typeannos;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+public class DeepArrays {
+ @ArrA String @ArrB [] @ArrC [] array2() { return null; }
+ String @ArrA [] @ArrB [] @ArrC [] @ArrD [] array4() { return null; }
+ @ArrA ArrParameterized<@ArrC String @ArrA [] @ArrB []> @ArrC [] @ArrD [] manyNested() { return null; }
+ void varargs(@ArrA String @ArrB [] @ArrC [] @ArrD ... arg) {}
+ int @ArrA [] mixedStyles(int @ArrB [] @ArrA [] arg) @ArrB [] { return null; } // JLS example 10.2-2
+}
+
+class ArrParameterized {}
+
+@Target(ElementType.TYPE_USE)
+@Documented
+@interface ArrA { }
+@Target(ElementType.TYPE_USE)
+@Documented
+@interface ArrB { }
+@Target(ElementType.TYPE_USE)
+@Documented
+@interface ArrC { }
+@Target(ElementType.TYPE_USE)
+@Documented
+@interface ArrD { }
From 5cae7d20adf9828e05d3cd2823c6b95ee1ab6db4 Mon Sep 17 00:00:00 2001
From: Matias Saavedra Silva
Date: Wed, 13 Mar 2024 16:54:53 +0000
Subject: [PATCH 20/58] 8321299: runtime/logging/ClassLoadUnloadTest.java
doesn't reliably trigger class unloading
Reviewed-by: coleenp, dholmes
---
.../jtreg/runtime/logging/ClassLoadUnloadTest.java | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java
index 4d59cfa89ab5d..7fd4726d9c6ac 100644
--- a/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java
+++ b/test/hotspot/jtreg/runtime/logging/ClassLoadUnloadTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -70,10 +70,13 @@ static void checkAbsent(OutputAnalyzer output, String... outputStrings) throws E
// Use the same command-line heap size setting as ../ClassUnload/UnloadTest.java
static OutputAnalyzer exec(String... args) throws Exception {
+ String classPath = System.getProperty("test.class.path", ".");
+
+ // Sub-process does not get all the properties automatically, so the test class path needs to be passed explicitly
List argsList = new ArrayList<>();
Collections.addAll(argsList, args);
Collections.addAll(argsList, "-Xmn8m", "-Xbootclasspath/a:.", "-XX:+UnlockDiagnosticVMOptions",
- "-XX:+WhiteBoxAPI", "-XX:+ClassUnloading", ClassUnloadTestMain.class.getName());
+ "-XX:+WhiteBoxAPI", "-XX:+ClassUnloading", "-Dtest.class.path=" + classPath, ClassUnloadTestMain.class.getName());
ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(argsList);
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
@@ -86,7 +89,7 @@ public static void main(String... args) throws Exception {
// -Xlog:class+unload=info
output = exec("-Xlog:class+unload=info");
- checkFor(output, "[class,unload]", "unloading class");
+ checkFor(output, "[class,unload]", "unloading class test.Empty");
// -Xlog:class+unload=off
output = exec("-Xlog:class+unload=off");
From eb45d5bd644771887fc31a7abc2851c7dd37b3f4 Mon Sep 17 00:00:00 2001
From: vamsi-parasa
Date: Wed, 13 Mar 2024 18:34:34 +0000
Subject: [PATCH 21/58] 8327999: Remove copy of unused registers for cpu
features check in x86_64 AVX2 Poly1305 implementation
Reviewed-by: jbhateja, sviswanathan
---
src/hotspot/cpu/x86/vm_version_x86.cpp | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp b/src/hotspot/cpu/x86/vm_version_x86.cpp
index 68040b1c0c0fc..1159d0f69a3c9 100644
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp
@@ -309,9 +309,6 @@ class VM_Version_StubGenerator: public StubCodeGenerator {
__ cpuid();
__ lea(rsi, Address(rbp, in_bytes(VM_Version::sef_cpuid7_ecx1_offset())));
__ movl(Address(rsi, 0), rax);
- __ movl(Address(rsi, 4), rbx);
- __ movl(Address(rsi, 8), rcx);
- __ movl(Address(rsi, 12), rdx);
//
// Extended cpuid(0x80000000)
From 8f9899b23ee46ad986bc719d3e2eec722d8d6bf8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Jeli=C5=84ski?=
Date: Wed, 13 Mar 2024 19:09:52 +0000
Subject: [PATCH 22/58] 8325164: Named groups and signature schemes unavailable
with SunPKCS11 in FIPS mode
Reviewed-by: valeriep
---
.../sun/security/ec/ECKeyPairGenerator.java | 13 ++++---
.../classes/sun/security/util/ECUtil.java | 33 +++++++----------
.../classes/sun/security/util/KeyUtil.java | 2 +-
.../sun/security/pkcs11/P11ECKeyFactory.java | 16 ++++-----
.../sun/security/pkcs11/P11KeyStore.java | 6 ++--
.../sun/security/pkcs11/P11PSSSignature.java | 2 +-
.../sun/security/pkcs11/SunPKCS11.java | 14 ++++++++
.../pkcs11/Signature/SigInteropPSS2.java | 9 +++--
.../pkcs11/tls/tls12/FipsModeTLS12.java | 36 +++++++------------
.../sun/security/ec/ECKeyPairGenerator.java | 2 +-
10 files changed, 66 insertions(+), 67 deletions(-)
diff --git a/src/java.base/share/classes/sun/security/ec/ECKeyPairGenerator.java b/src/java.base/share/classes/sun/security/ec/ECKeyPairGenerator.java
index 69c57b95bc4e1..155691d2fda03 100644
--- a/src/java.base/share/classes/sun/security/ec/ECKeyPairGenerator.java
+++ b/src/java.base/share/classes/sun/security/ec/ECKeyPairGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -29,7 +29,6 @@
import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.ECGenParameterSpec;
import java.security.spec.ECParameterSpec;
-import java.security.spec.ECPoint;
import java.security.spec.InvalidParameterSpecException;
import java.util.Arrays;
import java.util.Optional;
@@ -37,7 +36,7 @@
import sun.security.jca.JCAUtil;
import sun.security.util.ECUtil;
import sun.security.util.math.*;
-import sun.security.ec.point.*;
+
import static sun.security.util.SecurityProviderConstants.DEF_EC_KEY_SIZE;
import static sun.security.ec.ECOperations.IntermediateValueException;
@@ -74,7 +73,7 @@ public ECKeyPairGenerator() {
public void initialize(int keySize, SecureRandom random) {
checkKeySize(keySize);
- this.params = ECUtil.getECParameterSpec(null, keySize);
+ this.params = ECUtil.getECParameterSpec(keySize);
if (params == null) {
throw new InvalidParameterException(
"No EC parameters available for key size " + keySize + " bits");
@@ -91,14 +90,14 @@ public void initialize(AlgorithmParameterSpec params, SecureRandom random)
if (params instanceof ECParameterSpec) {
ECParameterSpec ecParams = (ECParameterSpec) params;
- ecSpec = ECUtil.getECParameterSpec(null, ecParams);
+ ecSpec = ECUtil.getECParameterSpec(ecParams);
if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Curve not supported: " + params);
}
} else if (params instanceof ECGenParameterSpec) {
String name = ((ECGenParameterSpec) params).getName();
- ecSpec = ECUtil.getECParameterSpec(null, name);
+ ecSpec = ECUtil.getECParameterSpec(name);
if (ecSpec == null) {
throw new InvalidAlgorithmParameterException(
"Unknown curve name: " + name);
@@ -120,7 +119,7 @@ private static void ensureCurveIsSupported(ECParameterSpec ecSpec)
throws InvalidAlgorithmParameterException {
// Check if ecSpec is a valid curve
- AlgorithmParameters ecParams = ECUtil.getECParameters(null);
+ AlgorithmParameters ecParams = ECUtil.getECParameters();
try {
ecParams.init(ecSpec);
} catch (InvalidParameterSpecException ex) {
diff --git a/src/java.base/share/classes/sun/security/util/ECUtil.java b/src/java.base/share/classes/sun/security/util/ECUtil.java
index 011ab8460485d..966b13beee202 100644
--- a/src/java.base/share/classes/sun/security/util/ECUtil.java
+++ b/src/java.base/share/classes/sun/security/util/ECUtil.java
@@ -140,21 +140,16 @@ public static ECPrivateKey generateECPrivateKey(BigInteger s,
return (ECPrivateKey)keyFactory.generatePrivate(keySpec);
}
- public static AlgorithmParameters getECParameters(Provider p) {
+ public static AlgorithmParameters getECParameters() {
try {
- if (p != null) {
- return AlgorithmParameters.getInstance("EC", p);
- }
-
return AlgorithmParameters.getInstance("EC");
} catch (NoSuchAlgorithmException nsae) {
throw new RuntimeException(nsae);
}
}
- public static byte[] encodeECParameterSpec(Provider p,
- ECParameterSpec spec) {
- AlgorithmParameters parameters = getECParameters(p);
+ public static byte[] encodeECParameterSpec(ECParameterSpec spec) {
+ AlgorithmParameters parameters = getECParameters();
try {
parameters.init(spec);
@@ -170,9 +165,8 @@ public static byte[] encodeECParameterSpec(Provider p,
}
}
- public static ECParameterSpec getECParameterSpec(Provider p,
- ECParameterSpec spec) {
- AlgorithmParameters parameters = getECParameters(p);
+ public static ECParameterSpec getECParameterSpec(ECParameterSpec spec) {
+ AlgorithmParameters parameters = getECParameters();
try {
parameters.init(spec);
@@ -182,10 +176,9 @@ public static ECParameterSpec getECParameterSpec(Provider p,
}
}
- public static ECParameterSpec getECParameterSpec(Provider p,
- byte[] params)
+ public static ECParameterSpec getECParameterSpec(byte[] params)
throws IOException {
- AlgorithmParameters parameters = getECParameters(p);
+ AlgorithmParameters parameters = getECParameters();
parameters.init(params);
@@ -196,8 +189,8 @@ public static ECParameterSpec getECParameterSpec(Provider p,
}
}
- public static ECParameterSpec getECParameterSpec(Provider p, String name) {
- AlgorithmParameters parameters = getECParameters(p);
+ public static ECParameterSpec getECParameterSpec(String name) {
+ AlgorithmParameters parameters = getECParameters();
try {
parameters.init(new ECGenParameterSpec(name));
@@ -207,8 +200,8 @@ public static ECParameterSpec getECParameterSpec(Provider p, String name) {
}
}
- public static ECParameterSpec getECParameterSpec(Provider p, int keySize) {
- AlgorithmParameters parameters = getECParameters(p);
+ public static ECParameterSpec getECParameterSpec(int keySize) {
+ AlgorithmParameters parameters = getECParameters();
try {
parameters.init(new ECKeySizeParameterSpec(keySize));
@@ -219,9 +212,9 @@ public static ECParameterSpec getECParameterSpec(Provider p, int keySize) {
}
- public static String getCurveName(Provider p, ECParameterSpec spec) {
+ public static String getCurveName(ECParameterSpec spec) {
ECGenParameterSpec nameSpec;
- AlgorithmParameters parameters = getECParameters(p);
+ AlgorithmParameters parameters = getECParameters();
try {
parameters.init(spec);
diff --git a/src/java.base/share/classes/sun/security/util/KeyUtil.java b/src/java.base/share/classes/sun/security/util/KeyUtil.java
index c38889ed494aa..6884b9b201a39 100644
--- a/src/java.base/share/classes/sun/security/util/KeyUtil.java
+++ b/src/java.base/share/classes/sun/security/util/KeyUtil.java
@@ -153,7 +153,7 @@ public static final int getKeySize(AlgorithmParameters parameters) {
// Note: the ECGenParameterSpec case should be covered by the
// ECParameterSpec case above.
- // See ECUtil.getECParameterSpec(Provider, String).
+ // See ECUtil.getECParameterSpec(String).
break;
case "DiffieHellman":
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
index 9918503c7fd8a..9896cb738bb32 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11ECKeyFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -64,25 +64,25 @@ private static Provider getSunECProvider() {
}
static ECParameterSpec getECParameterSpec(String name) {
- return ECUtil.getECParameterSpec(getSunECProvider(), name);
+ return ECUtil.getECParameterSpec(name);
}
static ECParameterSpec getECParameterSpec(int keySize) {
- return ECUtil.getECParameterSpec(getSunECProvider(), keySize);
+ return ECUtil.getECParameterSpec(keySize);
}
// Check that spec is a known supported curve and convert it to our
// ECParameterSpec subclass. If not possible, return null.
static ECParameterSpec getECParameterSpec(ECParameterSpec spec) {
- return ECUtil.getECParameterSpec(getSunECProvider(), spec);
+ return ECUtil.getECParameterSpec(spec);
}
static ECParameterSpec decodeParameters(byte[] params) throws IOException {
- return ECUtil.getECParameterSpec(getSunECProvider(), params);
+ return ECUtil.getECParameterSpec(params);
}
static byte[] encodeParameters(ECParameterSpec params) {
- return ECUtil.encodeECParameterSpec(getSunECProvider(), params);
+ return ECUtil.encodeECParameterSpec(params);
}
static ECPoint decodePoint(byte[] encoded, EllipticCurve curve) throws IOException {
@@ -220,7 +220,7 @@ protected PrivateKey engineGeneratePrivate(KeySpec keySpec)
private PublicKey generatePublic(ECPoint point, ECParameterSpec params)
throws PKCS11Exception {
byte[] encodedParams =
- ECUtil.encodeECParameterSpec(getSunECProvider(), params);
+ ECUtil.encodeECParameterSpec(params);
byte[] encodedPoint =
ECUtil.encodePoint(point, params.getCurve());
@@ -254,7 +254,7 @@ private PublicKey generatePublic(ECPoint point, ECParameterSpec params)
private PrivateKey generatePrivate(BigInteger s, ECParameterSpec params)
throws PKCS11Exception {
byte[] encodedParams =
- ECUtil.encodeECParameterSpec(getSunECProvider(), params);
+ ECUtil.encodeECParameterSpec(params);
CK_ATTRIBUTE[] attributes = new CK_ATTRIBUTE[] {
new CK_ATTRIBUTE(CKA_CLASS, CKO_PRIVATE_KEY),
new CK_ATTRIBUTE(CKA_KEY_TYPE, CKK_EC),
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java
index c3383f521902f..d1377b807fedf 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11KeyStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -1378,7 +1378,7 @@ private PrivateKey loadPkey(Session session, long oHandle)
byte[] encodedParams = attrs[0].getByteArray();
try {
ECParameterSpec params =
- ECUtil.getECParameterSpec(null, encodedParams);
+ ECUtil.getECParameterSpec(encodedParams);
keyLength = params.getCurve().getField().getFieldSize();
} catch (IOException e) {
// we do not want to accept key with unsupported parameters
@@ -1776,7 +1776,7 @@ private void storePkey(String alias, KeyStore.PrivateKeyEntry pke)
}
byte[] encodedParams =
- ECUtil.encodeECParameterSpec(null, ecKey.getParams());
+ ECUtil.encodeECParameterSpec(ecKey.getParams());
attrs = new CK_ATTRIBUTE[] {
ATTR_TOKEN_TRUE,
ATTR_CLASS_PKEY,
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java
index cfe6b01a2e5b7..77783870df738 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11PSSSignature.java
@@ -776,7 +776,7 @@ protected Object engineGetParameter(String param)
protected AlgorithmParameters engineGetParameters() {
if (this.sigParams != null) {
try {
- AlgorithmParameters ap = AlgorithmParameters.getInstance("RSASSA-PSS");
+ AlgorithmParameters ap = AlgorithmParameters.getInstance("RSASSA-PSS", token.provider);
ap.init(this.sigParams);
return ap;
} catch (GeneralSecurityException e) {
diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
index e8dc0880d2224..3e112bfe0ede6 100644
--- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
+++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/SunPKCS11.java
@@ -42,7 +42,9 @@
import com.sun.crypto.provider.ChaCha20Poly1305Parameters;
+import com.sun.crypto.provider.DHParameters;
import jdk.internal.misc.InnocuousThread;
+import sun.security.rsa.PSSParameters;
import sun.security.util.Debug;
import sun.security.util.ResourcesMgr;
import static sun.security.util.SecurityConstants.PROVIDER_VER;
@@ -707,6 +709,14 @@ private static void register(Descriptor d) {
"com.sun.crypto.provider.ChaCha20Poly1305Parameters",
m(CKM_CHACHA20_POLY1305));
+ dA(AGP, "RSASSA-PSS",
+ "sun.security.rsa.PSSParameters",
+ m(CKM_RSA_PKCS_PSS));
+
+ dA(AGP, "DiffieHellman",
+ "com.sun.crypto.provider.DHParameters",
+ m(CKM_DH_PKCS_DERIVE));
+
d(KA, "DH", P11KeyAgreement,
dhAlias,
m(CKM_DH_PKCS_DERIVE));
@@ -1496,6 +1506,10 @@ public Object newInstance0(Object param) throws
return new sun.security.util.GCMParameters();
} else if (algorithm == "ChaCha20-Poly1305") {
return new ChaCha20Poly1305Parameters(); // from SunJCE
+ } else if (algorithm == "RSASSA-PSS") {
+ return new PSSParameters(); // from SunRsaSign
+ } else if (algorithm == "DiffieHellman") {
+ return new DHParameters(); // from SunJCE
} else {
throw new NoSuchAlgorithmException("Unsupported algorithm: "
+ algorithm);
diff --git a/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java
index b8ea986332780..c15f10aab3ee6 100644
--- a/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java
+++ b/test/jdk/sun/security/pkcs11/Signature/SigInteropPSS2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -27,7 +27,7 @@
/*
* @test
- * @bug 8080462 8226651 8242332
+ * @bug 8080462 8226651 8242332 8325164
* @summary testing interoperability of PSS signatures of PKCS11 provider
* against SunRsaSign provider
* @library /test/lib ..
@@ -51,9 +51,12 @@ public static void main(String[] args) throws Exception {
@Override
public void main(Provider p) throws Exception {
+ Provider sunRsaSign = Security.getProvider("SunRsaSign");
+ Security.removeProvider("SunRsaSign");
+
Signature sigPkcs11;
Signature sigSunRsaSign =
- Signature.getInstance("RSASSA-PSS", "SunRsaSign");
+ Signature.getInstance("RSASSA-PSS", sunRsaSign);
KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", p);
kpg.initialize(3072);
diff --git a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
index 1f6886f2d692b..e9e4158f20e41 100644
--- a/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
+++ b/test/jdk/sun/security/pkcs11/tls/tls12/FipsModeTLS12.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8029661
+ * @bug 8029661 8325164
* @summary Test TLS 1.2
* @modules java.base/sun.security.internal.spec
* java.base/sun.security.util
@@ -412,6 +412,18 @@ static private SSLEngine createSSLEngine(boolean client)
ssle = sslCtx.createSSLEngine("localhost", 443);
ssle.setUseClientMode(client);
SSLParameters sslParameters = ssle.getSSLParameters();
+ // verify that FFDHE named groups are available
+ boolean ffdheAvailable = Arrays.stream(sslParameters.getNamedGroups())
+ .anyMatch(ng -> ng.startsWith("ffdhe"));
+ if (!ffdheAvailable) {
+ throw new RuntimeException("No FFDHE named groups available");
+ }
+ // verify that ECDHE named groups are available
+ boolean ecdheAvailable = Arrays.stream(sslParameters.getNamedGroups())
+ .anyMatch(ng -> ng.startsWith("secp"));
+ if (!ecdheAvailable) {
+ throw new RuntimeException("No ECDHE named groups available");
+ }
ssle.setSSLParameters(sslParameters);
return ssle;
@@ -426,28 +438,6 @@ private static void initialize() throws Exception {
// 1. SunPKCS11 (with an NSS FIPS mode backend)
// 2. SUN (to handle X.509 certificates)
// 3. SunJSSE (for a TLS engine)
- //
- // RSASSA-PSS algorithm is not currently supported in SunPKCS11
- // but in SUN provider. As a result, it can be negotiated by the
- // TLS engine. The problem is that SunPKCS11 keys are sensitive
- // in FIPS mode and cannot be used in a SUN algorithm (conversion
- // fails as plain values cannot be extracted).
- //
- // To workaround this issue, we disable RSASSA-PSS algorithm for
- // TLS connections. Once JDK-8222937 is fixed, this workaround can
- // (and should) be removed.
- //
- // On a final note, the list of disabled TLS algorithms
- // (jdk.tls.disabledAlgorithms) has to be updated at this point,
- // before it is read in sun.security.ssl.SSLAlgorithmConstraints
- // class initialization.
- String disabledAlgorithms =
- Security.getProperty("jdk.tls.disabledAlgorithms");
- if (disabledAlgorithms.length() > 0) {
- disabledAlgorithms += ", ";
- }
- disabledAlgorithms += "RSASSA-PSS";
- Security.setProperty("jdk.tls.disabledAlgorithms", disabledAlgorithms);
if (initSecmod() == false) {
return;
diff --git a/test/jdk/sun/security/tools/keytool/fakegen/java.base/sun/security/ec/ECKeyPairGenerator.java b/test/jdk/sun/security/tools/keytool/fakegen/java.base/sun/security/ec/ECKeyPairGenerator.java
index 50de12acf0671..5e7429ee616c6 100644
--- a/test/jdk/sun/security/tools/keytool/fakegen/java.base/sun/security/ec/ECKeyPairGenerator.java
+++ b/test/jdk/sun/security/tools/keytool/fakegen/java.base/sun/security/ec/ECKeyPairGenerator.java
@@ -74,7 +74,7 @@ public KeyPair generateKeyPair() {
" has been patched. Key size " + keySize +
" is not supported");
}
- ECParameterSpec ecParams = ECUtil.getECParameterSpec(null, keySize);
+ ECParameterSpec ecParams = ECUtil.getECParameterSpec(keySize);
try {
return new KeyPair(new ECPublicKeyImpl(new ECPoint(x, y), ecParams),
new ECPrivateKeyImpl(s, ecParams));
From 7f6b7ebbcc49d8023e669568c38cd301bb795983 Mon Sep 17 00:00:00 2001
From: Naoto Sato
Date: Wed, 13 Mar 2024 20:27:28 +0000
Subject: [PATCH 23/58] 8327242: Document supported CLDR versions in the
javadoc
Reviewed-by: joehw, iris, jlu
---
.../java/util/spi/LocaleServiceProvider.java | 64 ++++++++++++++++---
1 file changed, 56 insertions(+), 8 deletions(-)
diff --git a/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java b/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java
index 996ef70526964..86aa580b619ed 100644
--- a/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java
+++ b/src/java.base/share/classes/java/util/spi/LocaleServiceProvider.java
@@ -32,9 +32,10 @@
* This is the super class of all the locale sensitive service provider
* interfaces (SPIs).
*
- * Locale sensitive service provider interfaces are interfaces that
+ * Locale sensitive service provider interfaces are interfaces that
* correspond to locale sensitive classes in the {@code java.text}
- * and {@code java.util} packages. The interfaces enable the
+ * and {@code java.util} packages in order to provide the locale
+ * data used for each service. The interfaces enable the
* construction of locale sensitive objects and the retrieval of
* localized names for these packages. Locale sensitive factory methods
* and methods for name retrieval in the {@code java.text} and
@@ -121,13 +122,13 @@
* {@link System#setProperty(String, String)} is discouraged and it may not affect
* the order.
* JDK Reference Implementation provides the following three
- * locale providers:
+ * locale data providers:
*
- *
"CLDR": A provider based on Unicode Consortium's
- * CLDR Project.
+ *
"SPI": represents the locale sensitive services implementing the subclasses of
* this {@code LocaleServiceProvider} class.
- *
"HOST": A provider that reflects the user's custom settings in the
+ *
"HOST": A locale data provider that reflects the user's custom settings in the
* underlying operating system. This provider may not be available, depending
* on the JDK Reference Implementation.
*
@@ -139,11 +140,58 @@
* the locale sensitive services in the SPI providers are looked up first. If the
* desired locale sensitive service is not available, then the runtime looks for CLDR.
*
- * The default value for looking up the preferred locale providers is "CLDR",
- * so specifying "CLDR" is identical to the default behavior. Applications which
+ * The default value for looking up the preferred locale data providers is "CLDR",
+ * so specifying only "CLDR" is identical to the default behavior. Applications which
* require implementations of the locale sensitive services must explicitly specify
* "SPI" in order for the Java runtime to load them from the classpath.
*
+ * @implNote The JDK uses locale data from the Unicode Consortium's
+ * Common Locale Data Repository (CLDR)
+ * to implement locale-sensitive APIs in the {@code java.util} and
+ * {@code java.text} packages. This locale data derives the set of locales
+ * supported by the Java runtime environment. The following table lists the
+ * version of CLDR used in each JDK release. Unless otherwise specified, all
+ * update releases in a given JDK release family use the same CLDR version.
+ *
+ *
JDK releases and supported CLDR versions
+ *
+ *
JDK release
+ *
CLDR version
+ *
+ *
+ *
JDK 22
+ *
CLDR 44
+ *
JDK 21
+ *
CLDR 43
+ *
JDK 20
+ *
CLDR 42
+ *
JDK 19
+ *
CLDR 41
+ *
JDK 18
+ *
CLDR 39
+ *
JDK 17
+ *
CLDR 39
+ *
JDK 16
+ *
CLDR 38
+ *
JDK 15
+ *
CLDR 37
+ *
JDK 14
+ *
CLDR 36
+ *
JDK 13
+ *
CLDR 35.1
+ *
JDK 12
+ *
CLDR 33
+ *
JDK 11
+ *
CLDR 33
+ *
JDK 10
+ *
CLDR 29
+ *
JDK 9
+ *
CLDR 29
+ *
JDK 8
+ *
CLDR 21.0.1
+ *
+ *
+ *
* @since 1.6
*/
public abstract class LocaleServiceProvider {
From 1ad3ebcf11834ec1d119ee95c858d98fb7bc6e68 Mon Sep 17 00:00:00 2001
From: Christoph Langer
Date: Wed, 13 Mar 2024 21:09:00 +0000
Subject: [PATCH 24/58] 8185862: AWT Assertion Failure in ::GetDIBits(hBMDC,
hBM, 0, 1, 0, gpBitmapInfo, 0) 'awt_Win32GraphicsDevice.cpp', at line 185
Reviewed-by: aivanov, prr
---
.../classes/java/awt/GraphicsEnvironment.java | 4 +-
.../classes/sun/awt/PlatformGraphicsInfo.java | 32 ++++++--
.../sun/awt/Win32GraphicsEnvironment.java | 15 +---
.../windows/native/libawt/windows/Devices.cpp | 81 +++++++++++--------
.../windows/native/libawt/windows/Devices.h | 4 +-
.../windows/awt_PlatformGraphicsInfo.cpp | 37 +++++++++
.../windows/awt_Win32GraphicsDevice.cpp | 4 +-
.../libawt/windows/awt_Win32GraphicsEnv.cpp | 4 +-
.../HangDuringStaticInitialization.java | 3 +-
9 files changed, 124 insertions(+), 60 deletions(-)
create mode 100644 src/java.desktop/windows/native/libawt/windows/awt_PlatformGraphicsInfo.cpp
diff --git a/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java b/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java
index 0265142aee3e9..2e89aa6f6723b 100644
--- a/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java
+++ b/src/java.desktop/share/classes/java/awt/GraphicsEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -23,7 +23,6 @@
* questions.
*/
-
package java.awt;
import java.awt.image.BufferedImage;
@@ -36,7 +35,6 @@
import sun.font.FontManagerFactory;
import sun.java2d.HeadlessGraphicsEnvironment;
import sun.java2d.SunGraphicsEnvironment;
-import sun.security.action.GetPropertyAction;
/**
*
diff --git a/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java b/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java
index 02527d4f20797..4644a2e5f46ac 100644
--- a/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java
+++ b/src/java.desktop/windows/classes/sun/awt/PlatformGraphicsInfo.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2019, 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
@@ -28,20 +28,41 @@
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
+import sun.awt.windows.WToolkit;
+
public class PlatformGraphicsInfo {
+ private static final boolean hasDisplays;
+
+ static {
+ loadAWTLibrary();
+ hasDisplays = hasDisplays0();
+ }
+
+ @SuppressWarnings("removal")
+ private static void loadAWTLibrary() {
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Void run() {
+ System.loadLibrary("awt");
+ return null;
+ }
+ });
+ }
+
+ private static native boolean hasDisplays0();
+
public static GraphicsEnvironment createGE() {
return new Win32GraphicsEnvironment();
}
public static Toolkit createToolkit() {
- return new sun.awt.windows.WToolkit();
+ return new WToolkit();
}
public static boolean getDefaultHeadlessProperty() {
- // On Windows, we assume we can always create headful apps.
- // Here is where we can add code that would actually check.
- return false;
+ // If we don't find usable displays, we run headless.
+ return !hasDisplays;
}
/*
@@ -54,5 +75,4 @@ public static String getDefaultHeadlessMessage() {
"\nThe application does not have desktop access,\n" +
"but this program performed an operation which requires it.";
}
-
}
diff --git a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java
index 04b3f7b77d73a..cb7ab363cdfca 100644
--- a/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java
+++ b/src/java.desktop/windows/classes/sun/awt/Win32GraphicsEnvironment.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -60,7 +60,8 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
WToolkit.loadLibraries();
// setup flags before initializing native layer
WindowsFlags.initFlags();
- initDisplayWrapper();
+
+ initDisplay();
// Install correct surface manager factory.
SurfaceManagerFactory.setInstance(new WindowsSurfaceManagerFactory());
@@ -82,20 +83,12 @@ public final class Win32GraphicsEnvironment extends SunGraphicsEnvironment {
}
/**
- * Initializes native components of the graphics environment. This
+ * Initializes native components of the graphics environment. This
* includes everything from the native GraphicsDevice elements to
* the DirectX rendering layer.
*/
private static native void initDisplay();
- private static boolean displayInitialized; // = false;
- public static void initDisplayWrapper() {
- if (!displayInitialized) {
- displayInitialized = true;
- initDisplay();
- }
- }
-
public Win32GraphicsEnvironment() {
}
diff --git a/src/java.desktop/windows/native/libawt/windows/Devices.cpp b/src/java.desktop/windows/native/libawt/windows/Devices.cpp
index f36914e4606c2..e275cb77a577a 100644
--- a/src/java.desktop/windows/native/libawt/windows/Devices.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/Devices.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -85,60 +85,75 @@
#include "Trace.h"
#include "D3DPipelineManager.h"
+typedef struct {
+ int monitorCounter;
+ int monitorLimit;
+ HMONITOR* hmpMonitors;
+} MonitorData;
-/* Some helper functions (from awt_MMStub.h/cpp) */
-int g_nMonitorCounter;
-int g_nMonitorLimit;
-HMONITOR* g_hmpMonitors;
+// Only monitors where CreateDC does not fail are valid
+static BOOL IsValidMonitor(HMONITOR hMon)
+{
+ MONITORINFOEX mieInfo;
+ memset((void*)(&mieInfo), 0, sizeof(MONITORINFOEX));
+ mieInfo.cbSize = sizeof(MONITORINFOEX);
+ if (!::GetMonitorInfo(hMon, (LPMONITORINFOEX)(&mieInfo))) {
+ J2dTraceLn1(J2D_TRACE_INFO, "Devices::IsValidMonitor: GetMonitorInfo failed for monitor with handle %p", hMon);
+ return FALSE;
+ }
+
+ HDC hDC = CreateDC(mieInfo.szDevice, NULL, NULL, NULL);
+ if (NULL == hDC) {
+ J2dTraceLn2(J2D_TRACE_INFO, "Devices::IsValidMonitor: CreateDC failed for monitor with handle %p, device: %S", hMon, mieInfo.szDevice);
+ return FALSE;
+ }
+
+ ::DeleteDC(hDC);
+ return TRUE;
+}
// Callback for CountMonitors below
-BOOL WINAPI clb_fCountMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lP)
+static BOOL WINAPI clb_fCountMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lpMonitorCounter)
{
- g_nMonitorCounter ++;
+ if (IsValidMonitor(hMon)) {
+ (*((int *)lpMonitorCounter))++;
+ }
+
return TRUE;
}
int WINAPI CountMonitors(void)
{
- g_nMonitorCounter = 0;
- ::EnumDisplayMonitors(NULL, NULL, clb_fCountMonitors, 0L);
- return g_nMonitorCounter;
-
+ int monitorCounter = 0;
+ ::EnumDisplayMonitors(NULL, NULL, clb_fCountMonitors, (LPARAM)&monitorCounter);
+ return monitorCounter;
}
// Callback for CollectMonitors below
-BOOL WINAPI clb_fCollectMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lP)
+static BOOL WINAPI clb_fCollectMonitors(HMONITOR hMon, HDC hDC, LPRECT rRect, LPARAM lpMonitorData)
{
-
- if ((g_nMonitorCounter < g_nMonitorLimit) && (NULL != g_hmpMonitors)) {
- g_hmpMonitors[g_nMonitorCounter] = hMon;
- g_nMonitorCounter ++;
+ MonitorData* pMonitorData = (MonitorData *)lpMonitorData;
+ if ((pMonitorData->monitorCounter < pMonitorData->monitorLimit) && (IsValidMonitor(hMon))) {
+ pMonitorData->hmpMonitors[pMonitorData->monitorCounter] = hMon;
+ pMonitorData->monitorCounter++;
}
return TRUE;
}
-int WINAPI CollectMonitors(HMONITOR* hmpMonitors, int nNum)
+static int WINAPI CollectMonitors(HMONITOR* hmpMonitors, int nNum)
{
- int retCode = 0;
-
if (NULL != hmpMonitors) {
-
- g_nMonitorCounter = 0;
- g_nMonitorLimit = nNum;
- g_hmpMonitors = hmpMonitors;
-
- ::EnumDisplayMonitors(NULL, NULL, clb_fCollectMonitors, 0L);
-
- retCode = g_nMonitorCounter;
-
- g_nMonitorCounter = 0;
- g_nMonitorLimit = 0;
- g_hmpMonitors = NULL;
-
+ MonitorData monitorData;
+ monitorData.monitorCounter = 0;
+ monitorData.monitorLimit = nNum;
+ monitorData.hmpMonitors = hmpMonitors;
+ ::EnumDisplayMonitors(NULL, NULL, clb_fCollectMonitors, (LPARAM)&monitorData);
+ return monitorData.monitorCounter;
+ } else {
+ return 0;
}
- return retCode;
}
BOOL WINAPI MonitorBounds(HMONITOR hmMonitor, RECT* rpBounds)
diff --git a/src/java.desktop/windows/native/libawt/windows/Devices.h b/src/java.desktop/windows/native/libawt/windows/Devices.h
index b6fd56a777f61..0972ef1414e5d 100644
--- a/src/java.desktop/windows/native/libawt/windows/Devices.h
+++ b/src/java.desktop/windows/native/libawt/windows/Devices.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -74,4 +74,6 @@ static CriticalSection arrayLock;
BOOL WINAPI MonitorBounds (HMONITOR, RECT*);
+int WINAPI CountMonitors (void);
+
#endif // _DEVICES_H_
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_PlatformGraphicsInfo.cpp b/src/java.desktop/windows/native/libawt/windows/awt_PlatformGraphicsInfo.cpp
new file mode 100644
index 0000000000000..638cd100b1fac
--- /dev/null
+++ b/src/java.desktop/windows/native/libawt/windows/awt_PlatformGraphicsInfo.cpp
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2024 SAP SE. 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. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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.
+ */
+
+#include
+#include "Devices.h"
+
+/*
+ * Class: sun_awt_PlatformGraphicsInfo
+ * Method: hasDisplays0
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_awt_PlatformGraphicsInfo_hasDisplays0(JNIEnv *env, jclass thisClass) {
+ return CountMonitors() > 0 ? JNI_TRUE : JNI_FALSE;
+}
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp
index 74df808ee3015..7712147c43cf2 100644
--- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsDevice.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -179,7 +179,9 @@ void AwtWin32GraphicsDevice::Initialize()
}
gpBitmapInfo->bmiHeader.biBitCount = 0;
HDC hBMDC = this->GetDC();
+ VERIFY(hBMDC != NULL);
HBITMAP hBM = ::CreateCompatibleBitmap(hBMDC, 1, 1);
+ VERIFY(hBM != NULL);
VERIFY(::GetDIBits(hBMDC, hBM, 0, 1, NULL, gpBitmapInfo, DIB_RGB_COLORS));
if (colorData->bitsperpixel > 8) {
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp
index 6c949b564e960..9991427c75edb 100644
--- a/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Win32GraphicsEnv.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -36,10 +36,8 @@
BOOL DWMIsCompositionEnabled();
void initScreens(JNIEnv *env) {
-
if (!Devices::UpdateInstance(env)) {
JNU_ThrowInternalError(env, "Could not update the devices array.");
- return;
}
}
diff --git a/test/jdk/javax/swing/reliability/HangDuringStaticInitialization.java b/test/jdk/javax/swing/reliability/HangDuringStaticInitialization.java
index fc820a32fa143..d6666d2130922 100644
--- a/test/jdk/javax/swing/reliability/HangDuringStaticInitialization.java
+++ b/test/jdk/javax/swing/reliability/HangDuringStaticInitialization.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 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
@@ -33,7 +33,6 @@
/**
* @test
* @bug 8189604 8208702
- * @requires !vm.debug | os.family != "windows"
* @run main/othervm -Djava.awt.headless=false HangDuringStaticInitialization
* @run main/othervm -Djava.awt.headless=true HangDuringStaticInitialization
*/
From 2edf4081af727c197c0f158beb4b392bb4e70318 Mon Sep 17 00:00:00 2001
From: Phil Race
Date: Wed, 13 Mar 2024 23:47:45 +0000
Subject: [PATCH 25/58] 8328004: Minor updates to TrayIcon test
DisposeInActionEventTest.java
Reviewed-by: azvegint
---
.../DisposeInActionEventTest.java | 31 ++++++++++---------
1 file changed, 16 insertions(+), 15 deletions(-)
rename test/jdk/java/awt/TrayIcon/{DisposeInActionEventTest => }/DisposeInActionEventTest.java (76%)
diff --git a/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java b/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest.java
similarity index 76%
rename from test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java
rename to test/jdk/java/awt/TrayIcon/DisposeInActionEventTest.java
index 6f17541cbe5b4..98a473bc64a96 100644
--- a/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest/DisposeInActionEventTest.java
+++ b/test/jdk/java/awt/TrayIcon/DisposeInActionEventTest.java
@@ -39,13 +39,12 @@
* @bug 6299866 8316931
* @summary Tests that no NPE is thrown when the tray icon is disposed from the
* handler of action event caused by clicking on this icon.
- * @library ../../regtesthelpers /test/lib
+ * @library /java/awt/regtesthelpers /test/lib
* @build PassFailJFrame jtreg.SkippedException
* @run main/manual DisposeInActionEventTest
*/
public class DisposeInActionEventTest {
- private static JTextArea textArea;
private static SystemTray systemTray;
private static TrayIcon trayIcon;
@@ -57,24 +56,26 @@ public static void main(String[] args) throws Exception {
String clickInstruction =
(Platform.isOSX()) ? "Right-click" : "Double click (left mouse button)";
- String instructions = "When the test starts, it adds the icon to the tray area. If you\n" +
- " don't see a tray icon, please, make sure that the tray area\n" +
- " (also called Taskbar Status Area on MS Windows, Notification\n" +
- " Area on Gnome or System Tray on KDE) is visible.\n\n" +
- clickInstruction + " the tray icon to trigger the\n" +
- " action event. Brief information about action events is printed\n" +
- " in the frame. After each action event, the tray icon is removed from\n" +
- " the tray and then added back in a second.\n\n" +
+ String instructions = "When the test starts, it adds an icon to the tray area.\n" +
+ "The icon is a red filled square with a white border.\n" +
+ "If you don't see this tray icon, please make sure that the tray area\n" +
+ "(also called Taskbar Status Area on MS Windows, Notification\n" +
+ "Area on Gnome or System Tray on KDE) is visible.\n" +
+ "On macOS the default location is the right of the top system bar.\n\n" +
+ clickInstruction + " the tray icon to trigger the action event.\n" +
+ "Brief information about action events is printed\n" +
+ "in the Event Message Display frame.\n" +
+ "After each action event, the tray icon is removed from\n" +
+ "the tray and then added back in a second.\n\n" +
"The test checks if any exceptions are thrown when removing and\n" +
- " re-adding the icon. If something is wrong, the test will automatically fail.\n" +
- " Repeat clicks several times Then press PASS button.";
+ "re-adding the icon. If something is wrong, the test will automatically fail.\n" +
+ "Repeat clicks several times. Then press PASS button.";
try {
PassFailJFrame.builder()
.title("DisposeInActionEventTest")
.instructions(instructions)
- .testTimeOut(10)
- .rows(15)
+ .rows(18)
.columns(45)
.testUI(DisposeInActionEventTest::showFrameAndIcon)
.build()
@@ -90,7 +91,7 @@ private static JFrame showFrameAndIcon() {
JFrame frame = new JFrame("Event Message Display");
frame.setLayout(new BorderLayout());
- textArea = new JTextArea();
+ JTextArea textArea = new JTextArea();
frame.getContentPane().add(new JScrollPane(textArea));
frame.setSize(400, 200);
From 7858138ad212bb4dec0b30e7235b72fe74cdb960 Mon Sep 17 00:00:00 2001
From: Prasanta Sadhukhan
Date: Thu, 14 Mar 2024 02:32:15 +0000
Subject: [PATCH 26/58] 8327752: Convert
javax/swing/JOptionPane/4174551/bug4174551.java applet to main
Reviewed-by: prr
---
.../swing/JOptionPane/4174551/bug4174551.html | 36 ---------
.../swing/JOptionPane/4174551/bug4174551.java | 52 -------------
.../javax/swing/JOptionPane/bug4174551.java | 78 +++++++++++++++++++
3 files changed, 78 insertions(+), 88 deletions(-)
delete mode 100644 test/jdk/javax/swing/JOptionPane/4174551/bug4174551.html
delete mode 100644 test/jdk/javax/swing/JOptionPane/4174551/bug4174551.java
create mode 100644 test/jdk/javax/swing/JOptionPane/bug4174551.java
diff --git a/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.html b/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.html
deleted file mode 100644
index ca7bac5dac5c8..0000000000000
--- a/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.html
+++ /dev/null
@@ -1,36 +0,0 @@
-
-
-
-
- Message Dialog should pop up
- with a button font size 10
- and message font size 24.
-
- It should be true even on OS X.
- If it is not so press "Fail" else press "Pass".
-
-
-
-
diff --git a/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.java b/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.java
deleted file mode 100644
index fd20840867afe..0000000000000
--- a/test/jdk/javax/swing/JOptionPane/4174551/bug4174551.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2001, 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.
- */
-
-/*
- * @test
- * @bug 4174551
- * @summary JOptionPane should allow custom buttons
- * @author Xhipra Tyagi(xhipra.tyagi@india.sun.com) area=Swing
- * @run applet/manual=yesno bug4174551.html
- */
-import java.awt.Font;
-import javax.swing.JApplet;
-import javax.swing.UIManager;
-import javax.swing.JOptionPane;
-
-public class bug4174551 extends JApplet {
-
- public void init() {
- try {
- java.awt.EventQueue.invokeLater( () -> {
- UIManager.getDefaults().put("OptionPane.buttonFont", new Font("Dialog", Font.PLAIN, 10));
- UIManager.getDefaults().put("OptionPane.messageFont", new Font("Dialog", Font.PLAIN, 24));
- JOptionPane.showMessageDialog(null, "HI 24!");
-
- System.out.println(UIManager.getDefaults().get("OptionPane.buttonFont"));
- System.out.println(UIManager.getDefaults().get("OptionPane.messageFont"));
- });
- }catch(Exception ex) {
- ex.printStackTrace();
- }
- }
-}
diff --git a/test/jdk/javax/swing/JOptionPane/bug4174551.java b/test/jdk/javax/swing/JOptionPane/bug4174551.java
new file mode 100644
index 0000000000000..f65f95192b7e2
--- /dev/null
+++ b/test/jdk/javax/swing/JOptionPane/bug4174551.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2001, 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 4174551
+ * @summary JOptionPane should allow custom buttons
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4174551
+ */
+import java.awt.FlowLayout;
+import java.awt.Font;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.UIManager;
+
+public class bug4174551 {
+ private static final String INSTRUCTIONS = """
+ Two Message Dialog should pop up side-by-side
+ one with a custom message font size 24 with message "HI 24"
+ and another with default optionpane message font size with message "HI default"
+ If custom message font size is not more than default message fontsize
+ AND
+ custom message buttonfont size is more than default message buttonfont size
+ press "Fail" else press "Pass". """;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame.builder()
+ .title("JOptionPane Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(8)
+ .columns(40)
+ .testUI(bug4174551::createTestUI)
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JDialog createTestUI() {
+ JOptionPane defaultPane = new JOptionPane();
+ defaultPane.setMessage("HI default");
+ defaultPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
+ UIManager.getDefaults().put("OptionPane.buttonFont", new Font("Dialog", Font.PLAIN, 10));
+ UIManager.getDefaults().put("OptionPane.messageFont", new Font("Dialog", Font.PLAIN, 24));
+ JOptionPane optionPane = new JOptionPane();
+ optionPane.setMessage("HI 24!");
+ optionPane.setMessageType(JOptionPane.INFORMATION_MESSAGE);
+ JDialog dialog = new JDialog();
+ dialog.setLayout(new FlowLayout());
+ dialog.add(optionPane);
+ dialog.add(defaultPane);
+ dialog.pack();
+
+ System.out.println(UIManager.getDefaults().get("OptionPane.buttonFont"));
+ System.out.println(UIManager.getDefaults().get("OptionPane.messageFont"));
+ return dialog;
+ }
+}
From 092a7343a45297e481f9facb3420b2e91af5699d Mon Sep 17 00:00:00 2001
From: Prasanta Sadhukhan
Date: Thu, 14 Mar 2024 02:38:48 +0000
Subject: [PATCH 27/58] 8327753: Convert
javax/swing/JOptionPane/8024926/bug8024926.java applet to main
Reviewed-by: prr
---
.../swing/JOptionPane/8024926/bug8024926.html | 32 ---
.../swing/JOptionPane/8024926/bug8024926.java | 212 ------------------
.../javax/swing/JOptionPane/bug8024926.java | 71 ++++++
3 files changed, 71 insertions(+), 244 deletions(-)
delete mode 100644 test/jdk/javax/swing/JOptionPane/8024926/bug8024926.html
delete mode 100644 test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java
create mode 100644 test/jdk/javax/swing/JOptionPane/bug8024926.java
diff --git a/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.html b/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.html
deleted file mode 100644
index e63e0ea768be7..0000000000000
--- a/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
- High resolution icon test, bug ID 8024926
-
-
-
-
See the dialog box (usually in upper left corner) for instructions
-
-
diff --git a/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java b/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java
deleted file mode 100644
index 89aa754be884b..0000000000000
--- a/test/jdk/javax/swing/JOptionPane/8024926/bug8024926.java
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2013, 2018, 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.
- */
-import java.awt.BorderLayout;
-import java.awt.Dialog;
-import java.awt.EventQueue;
-import java.awt.Frame;
-import java.awt.TextArea;
-import javax.swing.JApplet;
-import javax.swing.JOptionPane;
-
-import jdk.test.lib.Platform;
-
-/**
- * @test
- * @bug 8024926 8040279
- * @summary [macosx] AquaIcon HiDPI support
- * @author Alexander Scherbatiy
- * @library /test/lib
- * @build jdk.test.lib.Platform
- * @run applet/manual=yesno bug8024926.html
- */
-public class bug8024926 extends JApplet {
- //Declare things used in the test, like buttons and labels here
-
- public void init() {
- //Create instructions for the user here, as well as set up
- // the environment -- set the layout manager, add buttons,
- // etc.
- this.setLayout(new BorderLayout());
-
-
- if (Platform.isOSX()) {
- String[] instructions = {
- "Verify that high resolution system icons are used"
- + " in JOptionPane on HiDPI displays.",
- "1) Run the test on Retina display or enable the Quartz Debug"
- + " and select the screen resolution with (HiDPI) label",
- "2) Check that the error icon on the JOptionPane is smooth",
- "If so, press PASS, else press FAIL."
- };
- Sysout.createDialogWithInstructions(instructions);
-
- } else {
- String[] instructions = {
- "This test is not applicable to the current platform. Press PASS."
- };
- Sysout.createDialogWithInstructions(instructions);
- }
-
-
- }//End init()
-
- public void start() {
- //Get things going. Request focus, set size, et cetera
- setSize(200, 200);
- setVisible(true);
- validate();
- EventQueue.invokeLater(new Runnable() {
-
- public void run() {
- createAndShowGUI();
- }
- });
- }// start()
-
- //The rest of this class is the actions which perform the test...
- //Use Sysout.println to communicate with the user NOT System.out!!
- //Sysout.println ("Something Happened!");
- private static void createAndShowGUI() {
- JOptionPane.showMessageDialog(null,
- "Icons should have high resolution.",
- "High resolution icon test.",
- JOptionPane.ERROR_MESSAGE);
- }
-}// class BlockedWindowTest
-
-/* Place other classes related to the test after this line */
-/**
- * **************************************************
- * Standard Test Machinery DO NOT modify anything below -- it's a standard chunk
- * of code whose purpose is to make user interaction uniform, and thereby make
- * it simpler to read and understand someone else's test.
- * **************************************************
- */
-/**
- * This is part of the standard test machinery. It creates a dialog (with the
- * instructions), and is the interface for sending text messages to the user. To
- * print the instructions, send an array of strings to Sysout.createDialog
- * WithInstructions method. Put one line of instructions per array entry. To
- * display a message for the tester to see, simply call Sysout.println with the
- * string to be displayed. This mimics System.out.println but works within the
- * test harness as well as standalone.
- */
-class Sysout {
-
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions(String[] instructions) {
- dialog = new TestDialog(new Frame(), "Instructions");
- dialog.printInstructions(instructions);
- dialog.setVisible(true);
- println("Any messages for the tester will display here.");
- }
-
- public static void createDialog() {
- dialog = new TestDialog(new Frame(), "Instructions");
- String[] defInstr = {"Instructions will appear here. ", ""};
- dialog.printInstructions(defInstr);
- dialog.setVisible(true);
- println("Any messages for the tester will display here.");
- }
-
- public static void printInstructions(String[] instructions) {
- dialog.printInstructions(instructions);
- }
-
- public static void println(String messageIn) {
- dialog.displayMessage(messageIn);
- }
-}// Sysout class
-
-/**
- * This is part of the standard test machinery. It provides a place for the test
- * instructions to be displayed, and a place for interactive messages to the
- * user to be displayed. To have the test instructions displayed, see Sysout. To
- * have a message to the user be displayed, see Sysout. Do not call anything in
- * this dialog directly.
- */
-class TestDialog extends Dialog {
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 80;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog(Frame frame, String name) {
- super(frame, name);
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea("", 15, maxStringLength, scrollBoth);
- add("North", instructionsText);
-
- messageText = new TextArea("", 5, maxStringLength, scrollBoth);
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions(String[] instructions) {
- //Clear out any current instructions
- instructionsText.setText("");
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for (int i = 0; i < instructions.length; i++) {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i];
- while (remainingStr.length() > 0) {
- //if longer than max then chop off first max chars to print
- if (remainingStr.length() >= maxStringLength) {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.lastIndexOf(' ', maxStringLength - 1);
-
- if (posOfSpace <= 0) {
- posOfSpace = maxStringLength - 1;
- }
-
- printStr = remainingStr.substring(0, posOfSpace + 1);
- remainingStr = remainingStr.substring(posOfSpace + 1);
- } //else just print
- else {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append(printStr + "\n");
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage(String messageIn) {
- messageText.append(messageIn + "\n");
- System.out.println(messageIn);
- }
-}// TestDialog class
diff --git a/test/jdk/javax/swing/JOptionPane/bug8024926.java b/test/jdk/javax/swing/JOptionPane/bug8024926.java
new file mode 100644
index 0000000000000..667e21f39f5b4
--- /dev/null
+++ b/test/jdk/javax/swing/JOptionPane/bug8024926.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+import java.awt.BorderLayout;
+import java.awt.Dialog;
+import java.awt.EventQueue;
+import java.awt.Frame;
+import java.awt.TextArea;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.SwingUtilities;
+
+/**
+ * @test
+ * @bug 8024926 8040279
+ * @requires (os.family == "mac")
+ * @summary [macosx] AquaIcon HiDPI support
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug8024926
+ */
+public class bug8024926 {
+
+ private static final String INSTRUCTIONS = """
+ Verify that high resolution system icons are used
+ in JOptionPane on HiDPI displays.
+ 1) Run the test on Retina display or enable the Quartz Debug
+ and select the screen resolution with (HiDPI) label.
+ "2) Check that the error icon on the JOptionPane is smooth.
+ "If so, press PASS, else press FAIL.""";
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame.builder()
+ .title("AquaIcon HIDPI Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(10)
+ .columns(35)
+ .testUI(bug8024926::createTestUI)
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JDialog createTestUI() {
+ JOptionPane optionPane = new JOptionPane("High resolution icon test");
+ optionPane.setMessage("Icons should have high resolutions");
+ optionPane.setMessageType(JOptionPane.ERROR_MESSAGE);
+ JDialog dialog = new JDialog();
+ dialog.setContentPane(optionPane);
+ dialog.pack();
+ return dialog;
+ }
+}
From 628e7702746ed4cc899d9727432b64c701533eb3 Mon Sep 17 00:00:00 2001
From: Prasanta Sadhukhan
Date: Thu, 14 Mar 2024 02:50:32 +0000
Subject: [PATCH 28/58] 8327754: Convert
javax/swing/JPopupMenu/7160604/bug7160604.java applet to main
Reviewed-by: prr
---
.../swing/JPopupMenu/7160604/bug7160604.html | 30 -----
.../swing/JPopupMenu/7160604/bug7160604.java | 95 ---------------
.../javax/swing/JPopupMenu/bug7160604.java | 112 ++++++++++++++++++
3 files changed, 112 insertions(+), 125 deletions(-)
delete mode 100644 test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.html
delete mode 100644 test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.java
create mode 100644 test/jdk/javax/swing/JPopupMenu/bug7160604.java
diff --git a/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.html b/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.html
deleted file mode 100644
index d1356c3f6d59c..0000000000000
--- a/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-Click on the top-bar and combo-box more than once.
-Make sure popup menu and drop-down list have a border and their items are drawn properly.
-
-
diff --git a/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.java b/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.java
deleted file mode 100644
index cf73ba608f7cf..0000000000000
--- a/test/jdk/javax/swing/JPopupMenu/7160604/bug7160604.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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 7160604
- @summary Using non-opaque windows - popups are initially not painted correctly
- @author Oleg Pekhovskiy
- @run applet/manual=yesno bug7160604.html
-*/
-
-import javax.swing.AbstractAction;
-import javax.swing.BorderFactory;
-import javax.swing.JApplet;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JWindow;
-import javax.swing.SwingUtilities;
-import java.awt.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.MouseAdapter;
-import java.awt.event.MouseEvent;
-import static java.awt.GraphicsDevice.WindowTranslucency.*;
-
-public class bug7160604 extends JApplet {
-
- public void init() {
- SwingUtilities.invokeLater(() -> {
- if (!GraphicsEnvironment
- .getLocalGraphicsEnvironment()
- .getDefaultScreenDevice()
- .isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
- // Tested translucency is not supported. Test passed
- return;
- }
-
- final JWindow window = new JWindow();
- window.setLocation(200, 200);
- window.setSize(300, 300);
-
- final JLabel label = new JLabel("...click to invoke JPopupMenu");
- label.setOpaque(true);
- final JPanel contentPane = new JPanel(new BorderLayout());
- contentPane.setBorder(BorderFactory.createLineBorder(Color.RED));
- window.setContentPane(contentPane);
- contentPane.add(label, BorderLayout.NORTH);
-
- final JComboBox comboBox = new JComboBox(new Object[]{"1", "2", "3", "4"});
- contentPane.add(comboBox, BorderLayout.SOUTH);
-
- final JPopupMenu jPopupMenu = new JPopupMenu();
-
- jPopupMenu.add("string");
- jPopupMenu.add(new AbstractAction("action") {
- @Override
- public void actionPerformed(final ActionEvent e) {
- }
- });
- jPopupMenu.add(new JLabel("label"));
- jPopupMenu.add(new JMenuItem("MenuItem"));
- label.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseReleased(final MouseEvent e) {
- jPopupMenu.show(label, 0, 0);
- }
- });
-
- window.setBackground(new Color(0, 0, 0, 0));
-
- window.setVisible(true);
- });
- }
-}
diff --git a/test/jdk/javax/swing/JPopupMenu/bug7160604.java b/test/jdk/javax/swing/JPopupMenu/bug7160604.java
new file mode 100644
index 0000000000000..591817b75c909
--- /dev/null
+++ b/test/jdk/javax/swing/JPopupMenu/bug7160604.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2013, 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 7160604
+ * @summary Using non-opaque windows - popups are initially not painted correctly
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug7160604
+*/
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.GraphicsEnvironment;
+import java.awt.event.ActionEvent;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import static java.awt.GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSLUCENT;
+import javax.swing.AbstractAction;
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JPopupMenu;
+import javax.swing.JWindow;
+import javax.swing.SwingUtilities;
+
+public class bug7160604 {
+
+ private static final String INSTRUCTIONS = """
+ Click on the top-bar and combo-box at the bottom more than once.
+ Check top-bar popup menu and combo-box drop-down list have a border
+ and their items are drawn properly.
+ If yes, Click Pass else click Fail.""";
+
+ public static void main(String[] args) throws Exception {
+ if (!GraphicsEnvironment
+ .getLocalGraphicsEnvironment()
+ .getDefaultScreenDevice()
+ .isWindowTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
+ // Tested translucency is not supported. Test passed
+ return;
+ }
+ PassFailJFrame.builder()
+ .title("PopupMenu Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(5)
+ .columns(35)
+ .testUI(bug7160604::createTestUI)
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JWindow createTestUI() {
+
+ final JWindow window = new JWindow();
+ window.setLocation(200, 200);
+ window.setSize(300, 300);
+
+ final JLabel label = new JLabel("...click to invoke JPopupMenu");
+ label.setOpaque(true);
+ final JPanel contentPane = new JPanel(new BorderLayout());
+ contentPane.setBorder(BorderFactory.createLineBorder(Color.RED));
+ window.setContentPane(contentPane);
+ contentPane.add(label, BorderLayout.NORTH);
+
+ final JComboBox comboBox = new JComboBox(new Object[]{"1", "2", "3", "4"});
+ contentPane.add(comboBox, BorderLayout.SOUTH);
+
+ final JPopupMenu jPopupMenu = new JPopupMenu();
+
+ jPopupMenu.add("string");
+ jPopupMenu.add(new AbstractAction("action") {
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ }
+ });
+ jPopupMenu.add(new JLabel("label"));
+ jPopupMenu.add(new JMenuItem("MenuItem"));
+ label.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseReleased(final MouseEvent e) {
+ jPopupMenu.show(label, 0, 0);
+ }
+ });
+
+ window.setBackground(new Color(0, 0, 0, 0));
+
+ return window;
+ }
+}
From 98e4b753e8d7fbbf651c866901734d4f6a7d1680 Mon Sep 17 00:00:00 2001
From: Prasanta Sadhukhan
Date: Thu, 14 Mar 2024 02:51:37 +0000
Subject: [PATCH 29/58] 8327755: Convert
javax/swing/JScrollBar/8039464/Test8039464.java applet to main
Reviewed-by: prr
---
.../swing/JScrollBar/8039464/Test8039464.html | 32 -------------
.../JScrollBar/{8039464 => }/Test8039464.java | 45 ++++++++++---------
2 files changed, 24 insertions(+), 53 deletions(-)
delete mode 100644 test/jdk/javax/swing/JScrollBar/8039464/Test8039464.html
rename test/jdk/javax/swing/JScrollBar/{8039464 => }/Test8039464.java (74%)
diff --git a/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.html b/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.html
deleted file mode 100644
index a473b819d1c3a..0000000000000
--- a/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-Choose the variable applet size and try to resize the applet.
-The test passes the thumb is painted correctly.
-
-
-
-
diff --git a/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.java b/test/jdk/javax/swing/JScrollBar/Test8039464.java
similarity index 74%
rename from test/jdk/javax/swing/JScrollBar/8039464/Test8039464.java
rename to test/jdk/javax/swing/JScrollBar/Test8039464.java
index 44bb33abd948c..780d5e9db7740 100644
--- a/test/jdk/javax/swing/JScrollBar/8039464/Test8039464.java
+++ b/test/jdk/javax/swing/JScrollBar/Test8039464.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -26,7 +26,6 @@
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
-import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollBar;
@@ -37,11 +36,16 @@
* @test
* @bug 8039464
* @summary Tests enabling/disabling of titled border's caption
- * @author Sergey Malenkov
- * @run applet/manual=yesno Test8039464.html
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test8039464
*/
-public class Test8039464 extends JApplet {
+public class Test8039464 {
+ private static final String INSTRUCTIONS = """
+ If the scrollbar thumb is painted correctly in system lookandfeel
+ click Pass else click Fail. """;
+
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
@@ -50,11 +54,6 @@ public class Test8039464 extends JApplet {
}
}
- @Override
- public void init() {
- init(this);
- }
-
private static void init(Container container) {
container.setLayout(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
@@ -77,16 +76,20 @@ private static void init(Container container) {
}
public static void main(String[] args) throws Exception {
- SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- JFrame frame = new JFrame("8039464");
- init(frame);
- frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- frame.pack();
- frame.setLocationRelativeTo(null);
- frame.setVisible(true);
- }
- });
+ PassFailJFrame.builder()
+ .title("JScrollBar Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(5)
+ .columns(35)
+ .testUI(Test8039464::createTestUI)
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JFrame createTestUI() {
+ JFrame frame = new JFrame("8039464");
+ init(frame);
+ frame.pack();
+ return frame;
}
}
From 357c912be51aadf7cc23eb4c2bc4279eac8b2b4b Mon Sep 17 00:00:00 2001
From: Guoxiong Li
Date: Thu, 14 Mar 2024 03:24:50 +0000
Subject: [PATCH 30/58] 8325897: Parallel: Remove PSYoungGen::is_maximal_no_gc
Reviewed-by: ayang
---
src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp | 5 +++--
src/hotspot/share/gc/parallel/psYoungGen.hpp | 6 +-----
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
index 961451e5b5959..4a74e2d838dac 100644
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -208,7 +208,8 @@ size_t ParallelScavengeHeap::used() const {
}
bool ParallelScavengeHeap::is_maximal_no_gc() const {
- return old_gen()->is_maximal_no_gc() && young_gen()->is_maximal_no_gc();
+ // We don't expand young-gen except at a GC.
+ return old_gen()->is_maximal_no_gc();
}
diff --git a/src/hotspot/share/gc/parallel/psYoungGen.hpp b/src/hotspot/share/gc/parallel/psYoungGen.hpp
index 49742c29e033d..fb0bf6cd43e47 100644
--- a/src/hotspot/share/gc/parallel/psYoungGen.hpp
+++ b/src/hotspot/share/gc/parallel/psYoungGen.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -123,10 +123,6 @@ class PSYoungGen : public CHeapObj {
size_t min_gen_size() const { return _min_gen_size; }
size_t max_gen_size() const { return _max_gen_size; }
- bool is_maximal_no_gc() const {
- return true; // Never expands except at a GC
- }
-
// Allocation
HeapWord* allocate(size_t word_size) {
HeapWord* result = eden_space()->cas_allocate(word_size);
From 7502dc99bf23109ef16fb99de25b09bab51e4978 Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 05:10:42 +0000
Subject: [PATCH 31/58] 8328030: Convert
javax/swing/text/GlyphView/4984669/bug4984669.java applet test to main
Reviewed-by: azvegint, prr
---
.../text/GlyphView/4984669/bug4984669.html | 30 -----------
...g4984669.java => htmlUnderliningTest.java} | 51 ++++++++++++++-----
2 files changed, 38 insertions(+), 43 deletions(-)
delete mode 100644 test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.html
rename test/jdk/javax/swing/text/GlyphView/{4984669/bug4984669.java => htmlUnderliningTest.java} (54%)
diff --git a/test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.html b/test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.html
deleted file mode 100644
index f9991a231c1a5..0000000000000
--- a/test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.html
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-The four lines printed above in a bold typeface should all be underlined.
-It is a bug if any of these lines is underlined only partially.
-The very first line should not be underlined at all.
-
-
diff --git a/test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.java b/test/jdk/javax/swing/text/GlyphView/htmlUnderliningTest.java
similarity index 54%
rename from test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.java
rename to test/jdk/javax/swing/text/GlyphView/htmlUnderliningTest.java
index ba590f9472a5f..b12a129dfa291 100644
--- a/test/jdk/javax/swing/text/GlyphView/4984669/bug4984669.java
+++ b/test/jdk/javax/swing/text/GlyphView/htmlUnderliningTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 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
@@ -21,24 +21,48 @@
* questions.
*/
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.text.MutableAttributeSet;
+import javax.swing.text.SimpleAttributeSet;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.StyledEditorKit;
+
/* @test
- @bug 4984669 8002148
- @summary Tests HTML underlining
- @author Peter Zhelezniakov
- @run applet/manual=yesno bug4984669.html
-*/
-import javax.swing.*;
-import javax.swing.text.*;
+ * @bug 4984669 8002148
+ * @summary Tests HTML underlining
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual htmlUnderliningTest
+ */
+
+public class htmlUnderliningTest {
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ The four lines printed in a bold typeface should all be underlined.
+ It is a bug if any of these lines is underlined only partially.
+ The very first line should not be underlined at all.
+ """;
+
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(4)
+ .columns(35)
+ .splitUI(htmlUnderliningTest::initializeTest)
+ .build()
+ .awaitAndCheck();
+ }
-public class bug4984669 extends JApplet
-{
- public void init() {
+ public static JPanel initializeTest() {
+ JPanel panel = new JPanel();
JEditorPane pane = new JEditorPane();
- this.getContentPane().add(new JScrollPane(pane));
+ panel.add(new JScrollPane(pane));
pane.setEditorKit(new StyledEditorKit());
try {
- pane.getDocument().insertString(0,"12 \n",null);
+ pane.getDocument().insertString(0, "12 \n", null);
MutableAttributeSet attrs = new SimpleAttributeSet();
StyleConstants.setFontSize(attrs, 36);
@@ -51,5 +75,6 @@ public void init() {
} catch (Exception e) {
throw new Error("Failed: Unexpected Exception", e);
}
+ return panel;
}
}
From 6f2676dc5f09d350c359f906b07f6f6d0d17f030 Mon Sep 17 00:00:00 2001
From: Yude Lin
Date: Thu, 14 Mar 2024 06:20:49 +0000
Subject: [PATCH 32/58] 8328064: Remove obsolete comments in constantPool and
metadataFactory
Reviewed-by: coleenp
---
src/hotspot/share/memory/metadataFactory.hpp | 2 --
src/hotspot/share/oops/constantPool.cpp | 2 +-
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/hotspot/share/memory/metadataFactory.hpp b/src/hotspot/share/memory/metadataFactory.hpp
index 5930d80656244..14cac8dc191a7 100644
--- a/src/hotspot/share/memory/metadataFactory.hpp
+++ b/src/hotspot/share/memory/metadataFactory.hpp
@@ -36,8 +36,6 @@ class MetadataFactory : AllStatic {
public:
template
static Array* new_array(ClassLoaderData* loader_data, int length, TRAPS) {
- // The "true" argument is because all metadata arrays are read only when
- // dumped to the shared archive
return new (loader_data, length, THREAD) Array(length);
}
diff --git a/src/hotspot/share/oops/constantPool.cpp b/src/hotspot/share/oops/constantPool.cpp
index 623d8e326b01e..1649b843cc8d7 100644
--- a/src/hotspot/share/oops/constantPool.cpp
+++ b/src/hotspot/share/oops/constantPool.cpp
@@ -155,7 +155,7 @@ void ConstantPool::metaspace_pointers_do(MetaspaceClosure* it) {
for (int i = 0; i < length(); i++) {
// The only MSO's embedded in the CP entries are Symbols:
- // JVM_CONSTANT_String (normal and pseudo)
+ // JVM_CONSTANT_String
// JVM_CONSTANT_Utf8
constantTag ctag = tag_at(i);
if (ctag.is_string() || ctag.is_utf8()) {
From cff0747d7f62efc3dafcd259ef2b15cd13bafbeb Mon Sep 17 00:00:00 2001
From: Aggelos Biboudis
Date: Thu, 14 Mar 2024 07:01:32 +0000
Subject: [PATCH 33/58] 8326204: yield statements doesn't allow cast
expressions with more than 1 type arguments
Reviewed-by: jlahoda
---
.../sun/tools/javac/parser/JavacParser.java | 5 +-
test/langtools/tools/javac/T8326204a.java | 59 +++++++++++++++++++
test/langtools/tools/javac/T8326204b.java | 13 ++++
test/langtools/tools/javac/T8326204b.out | 2 +
4 files changed, 78 insertions(+), 1 deletion(-)
create mode 100644 test/langtools/tools/javac/T8326204a.java
create mode 100644 test/langtools/tools/javac/T8326204b.java
create mode 100644 test/langtools/tools/javac/T8326204b.out
diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index e1a6d08303c5a..2c0f95b5432ff 100644
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -2894,12 +2894,15 @@ List blockStatement() {
int lookahead = 2;
int balance = 1;
boolean hasComma = false;
+ boolean inTypeArgs = false;
Token l;
while ((l = S.token(lookahead)).kind != EOF && balance != 0) {
switch (l.kind) {
case LPAREN: balance++; break;
case RPAREN: balance--; break;
- case COMMA: if (balance == 1) hasComma = true; break;
+ case COMMA: if (balance == 1 && !inTypeArgs) hasComma = true; break;
+ case LT: inTypeArgs = true; break;
+ case GT: inTypeArgs = false;
}
lookahead++;
}
diff --git a/test/langtools/tools/javac/T8326204a.java b/test/langtools/tools/javac/T8326204a.java
new file mode 100644
index 0000000000000..962fd60ee077e
--- /dev/null
+++ b/test/langtools/tools/javac/T8326204a.java
@@ -0,0 +1,59 @@
+/*
+ * 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 8326204
+ * @summary yield statements doesn't allow cast expressions with more than 1 type arguments
+ * @compile T8326204a.java
+ */
+import java.util.*;
+
+public class T8326204a {
+ void testOneParam() {
+ Object value = new ArrayList();
+ Object returnedValue = switch (1) {
+ default -> {
+ yield (List) value;
+ }
+ };
+ }
+
+ void testTwoParams() {
+ Object value = new HashMap();
+ Object returnedValue = switch (1) {
+ default -> {
+ yield (Map) value;
+ }
+ };
+ }
+
+ void testTwoParamsInParens() {
+ Object value = new HashMap();
+ Object returnedValue = switch (1) {
+ default -> {
+ yield ((Map) value);
+ }
+ };
+ }
+}
diff --git a/test/langtools/tools/javac/T8326204b.java b/test/langtools/tools/javac/T8326204b.java
new file mode 100644
index 0000000000000..e29090b73a347
--- /dev/null
+++ b/test/langtools/tools/javac/T8326204b.java
@@ -0,0 +1,13 @@
+import java.util.Map;
+
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8326204
+ * @summary yield statements doesn't allow cast expressions with more than 1 type arguments
+ * @compile/fail/ref=T8326204b.out -XDrawDiagnostics --should-stop=at=FLOW -XDdev T8326204b.java
+ */
+public class T8326204b {
+ private static void t(int i) { yield((Map) null, 2); }
+
+ private static void yield(Map m, int j) { }
+}
diff --git a/test/langtools/tools/javac/T8326204b.out b/test/langtools/tools/javac/T8326204b.out
new file mode 100644
index 0000000000000..17864700bda92
--- /dev/null
+++ b/test/langtools/tools/javac/T8326204b.out
@@ -0,0 +1,2 @@
+T8326204b.java:10:36: compiler.err.invalid.yield
+1 error
From fadc4b197e927cfa1814fe6cb65ee04b3bd4b0c2 Mon Sep 17 00:00:00 2001
From: Emanuel Peter
Date: Thu, 14 Mar 2024 07:12:16 +0000
Subject: [PATCH 34/58] 8327423: C2 remove_main_post_loops: check if main-loop
belongs to pre-loop, not just assert
Reviewed-by: kvn, chagedorn, roland
---
src/hotspot/share/opto/loopTransform.cpp | 8 ++-
.../TestEmptyPreLoopForDifferentMainLoop.java | 57 +++++++++++++++++++
2 files changed, 62 insertions(+), 3 deletions(-)
create mode 100644 test/hotspot/jtreg/compiler/loopopts/TestEmptyPreLoopForDifferentMainLoop.java
diff --git a/src/hotspot/share/opto/loopTransform.cpp b/src/hotspot/share/opto/loopTransform.cpp
index b9e14f595c2fd..31ef298d3af97 100644
--- a/src/hotspot/share/opto/loopTransform.cpp
+++ b/src/hotspot/share/opto/loopTransform.cpp
@@ -3260,7 +3260,6 @@ void IdealLoopTree::adjust_loop_exit_prob(PhaseIdealLoop *phase) {
}
}
-#ifdef ASSERT
static CountedLoopNode* locate_pre_from_main(CountedLoopNode* main_loop) {
assert(!main_loop->is_main_no_pre_loop(), "Does not have a pre loop");
Node* ctrl = main_loop->skip_assertion_predicates_with_halt();
@@ -3273,7 +3272,6 @@ static CountedLoopNode* locate_pre_from_main(CountedLoopNode* main_loop) {
assert(pre_loop->is_pre_loop(), "No pre loop found");
return pre_loop;
}
-#endif
// Remove the main and post loops and make the pre loop execute all
// iterations. Useful when the pre loop is found empty.
@@ -3301,7 +3299,11 @@ void IdealLoopTree::remove_main_post_loops(CountedLoopNode *cl, PhaseIdealLoop *
return;
}
- assert(locate_pre_from_main(main_head) == cl, "bad main loop");
+ // We found a main-loop after this pre-loop, but they might not belong together.
+ if (locate_pre_from_main(main_head) != cl) {
+ return;
+ }
+
Node* main_iff = main_head->skip_assertion_predicates_with_halt()->in(0);
// Remove the Opaque1Node of the pre loop and make it execute all iterations
diff --git a/test/hotspot/jtreg/compiler/loopopts/TestEmptyPreLoopForDifferentMainLoop.java b/test/hotspot/jtreg/compiler/loopopts/TestEmptyPreLoopForDifferentMainLoop.java
new file mode 100644
index 0000000000000..1843742da2610
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/loopopts/TestEmptyPreLoopForDifferentMainLoop.java
@@ -0,0 +1,57 @@
+/*
+ * 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 8327423
+ * @summary Test empty loop removal of pre-loop, with different main-loop after it.
+ * @run main/othervm -Xcomp
+ * -XX:CompileCommand=compileonly,compiler.loopopts.TestEmptyPreLoopForDifferentMainLoop::test
+ * compiler.loopopts.TestEmptyPreLoopForDifferentMainLoop
+ * @run main compiler.loopopts.TestEmptyPreLoopForDifferentMainLoop
+ */
+
+package compiler.loopopts;
+
+public class TestEmptyPreLoopForDifferentMainLoop {
+ static int sink;
+
+ public static void main(String args[]) {
+ test(false);
+ }
+
+ static void test(boolean flag) {
+ int x = 8;
+ for (int j = 0; j < 100; j++) {
+ for (int k = 0; k < 100; k++) {
+ if (flag) {
+ x += k;
+ sink = 42;
+ }
+ }
+ if (flag) {
+ break;
+ }
+ }
+ }
+}
From fcf746dede159905f7038d82d67806aa8afe0705 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 14 Mar 2024 07:30:42 +0000
Subject: [PATCH 35/58] 8328106: COMPARE_BUILD improvements
Reviewed-by: erikj
---
make/Images.gmk | 10 +++-
make/InitSupport.gmk | 4 +-
make/autoconf/compare.sh.template | 4 +-
make/scripts/compare.sh | 79 +++++++++++++++++--------
make/scripts/compare_exceptions.sh.incl | 0
5 files changed, 68 insertions(+), 29 deletions(-)
delete mode 100644 make/scripts/compare_exceptions.sh.incl
diff --git a/make/Images.gmk b/make/Images.gmk
index adf53a83c4f4c..3048eb3eda9f0 100644
--- a/make/Images.gmk
+++ b/make/Images.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2023, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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
@@ -144,6 +144,14 @@ define CreateCDSArchive
$1_$2_CDS_ARCHIVE := lib/$1/classes$2.jsa
endif
+ ifneq ($(COMPARE_BUILD), )
+ DEBUG_CDS_ARCHIVE := true
+ endif
+
+ ifeq ($(DEBUG_CDS_ARCHIVE), true)
+ $1_$2_CDS_DUMP_FLAGS += -Xlog:cds+map*=trace:file=$$(JDK_IMAGE_DIR)/$$($1_$2_CDS_ARCHIVE).cdsmap:none:filesize=0
+ endif
+
$$(eval $$(call SetupExecute, $1_$2_gen_cds_archive_jdk, \
WARN := Creating CDS$$($1_$2_DUMP_TYPE) archive for jdk image for $1, \
INFO := Using CDS flags for $1: $$($1_$2_CDS_DUMP_FLAGS), \
diff --git a/make/InitSupport.gmk b/make/InitSupport.gmk
index 4b14c4f9ad951..2bdab7f907d80 100644
--- a/make/InitSupport.gmk
+++ b/make/InitSupport.gmk
@@ -442,10 +442,10 @@ else # $(HAS_SPEC)=true
# Compare first and second build. Ignore any error code from compare.sh.
$(ECHO) "Comparing between comparison rebuild (this/new) and baseline (other/old)"
$(if $(COMPARE_BUILD_COMP_DIR), \
- +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh -vv $(COMPARE_BUILD_COMP_OPTS) \
+ +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh --diffs $(COMPARE_BUILD_COMP_OPTS) \
-2dirs $(COMPARE_BUILD_OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) \
$(OUTPUTDIR)/$(COMPARE_BUILD_COMP_DIR) $(COMPARE_BUILD_IGNORE_RESULT)), \
- +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh -vv $(COMPARE_BUILD_COMP_OPTS) \
+ +(cd $(COMPARE_BUILD_OUTPUTDIR) && ./compare.sh --diffs $(COMPARE_BUILD_COMP_OPTS) \
-o $(OUTPUTDIR) $(COMPARE_BUILD_IGNORE_RESULT)) \
)
endef
diff --git a/make/autoconf/compare.sh.template b/make/autoconf/compare.sh.template
index dfb35582021ba..ad53a44dc0e80 100644
--- a/make/autoconf/compare.sh.template
+++ b/make/autoconf/compare.sh.template
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 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
@@ -45,11 +45,13 @@ export CP="@CP@"
export CUT="@CUT@"
export DIFF="@DIFF@"
export DUMPBIN="@DUMPBIN@"
+export ECHO="@ECHO@"
export EXPR="@EXPR@"
export FILE="@FILE@"
export FIND="@FIND@"
export GREP="@GREP@"
export GUNZIP="@GUNZIP@"
+export HEAD="@HEAD@"
export LDD="@LDD@"
export LN="@LN@"
export MKDIR="@MKDIR@"
diff --git a/make/scripts/compare.sh b/make/scripts/compare.sh
index 44c700c48957e..e81c460225c5b 100644
--- a/make/scripts/compare.sh
+++ b/make/scripts/compare.sh
@@ -38,7 +38,7 @@ fi
export LC_ALL=C
if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
- FULLDUMP_CMD="$OTOOL -v -V -h -X -d"
+ FULLDUMP_CMD="$OTOOL -a -C -d -f -G -h -H -I -j -l -L -m -M -o -P -r -R -S -t -T -v -V -X -dyld_info -dyld_opcodes"
LDD_CMD="$OTOOL -L"
DIS_CMD="$OTOOL -v -V -t"
STAT_PRINT_SIZE="-f %z"
@@ -117,7 +117,7 @@ diff_text() {
SUFFIX="${THIS_FILE##*.}"
NAME="${THIS_FILE##*/}"
- TMP=$($DIFF $THIS_FILE $OTHER_FILE)
+ TMP=$($DIFF -u $THIS_FILE $OTHER_FILE)
if test -n "$TMP"; then
@@ -438,7 +438,7 @@ compare_zip_file() {
$RM -f $WORK_DIR/$ZIP_FILE.diffs
for file in $DIFFING_TEXT_FILES; do
- if [[ "$ACCEPTED_JARZIP_CONTENTS $EXCEPTIONS" != *"$file"* ]]; then
+ if [[ "$ACCEPTED_JARZIP_CONTENTS" != *"$file"* ]]; then
diff_text $OTHER_UNZIPDIR/$file $THIS_UNZIPDIR/$file >> $WORK_DIR/$ZIP_FILE.diffs
fi
done
@@ -454,11 +454,11 @@ compare_zip_file() {
if [ -n "$SHOW_DIFFS" ]; then
for i in $(cat $WORK_DIR/$ZIP_FILE.difflist) ; do
if [ -f "${OTHER_UNZIPDIR}/$i.javap" ]; then
- $DIFF ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
+ $DIFF -u ${OTHER_UNZIPDIR}/$i.javap ${THIS_UNZIPDIR}/$i.javap
elif [ -f "${OTHER_UNZIPDIR}/$i.cleaned" ]; then
- $DIFF ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
+ $DIFF -u ${OTHER_UNZIPDIR}/$i.cleaned ${THIS_UNZIPDIR}/$i
else
- $DIFF ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
+ $DIFF -u ${OTHER_UNZIPDIR}/$i ${THIS_UNZIPDIR}/$i
fi
done
fi
@@ -788,7 +788,7 @@ compare_bin_file() {
> $WORK_FILE_BASE.symbols.this
fi
- $DIFF $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
+ $DIFF -u $WORK_FILE_BASE.symbols.other $WORK_FILE_BASE.symbols.this > $WORK_FILE_BASE.symbols.diff
if [ -s $WORK_FILE_BASE.symbols.diff ]; then
SYM_MSG=" diff "
if [[ "$ACCEPTED_SYM_DIFF" != *"$BIN_FILE"* ]]; then
@@ -828,9 +828,9 @@ compare_bin_file() {
| $UNIQ > $WORK_FILE_BASE.deps.this.uniq)
(cd $FILE_WORK_DIR && $RM -f $NAME)
- $DIFF $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
+ $DIFF -u $WORK_FILE_BASE.deps.other $WORK_FILE_BASE.deps.this \
> $WORK_FILE_BASE.deps.diff
- $DIFF $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
+ $DIFF -u $WORK_FILE_BASE.deps.other.uniq $WORK_FILE_BASE.deps.this.uniq \
> $WORK_FILE_BASE.deps.diff.uniq
if [ -s $WORK_FILE_BASE.deps.diff ]; then
@@ -880,7 +880,7 @@ compare_bin_file() {
> $WORK_FILE_BASE.fulldump.this 2>&1 &
wait
- $DIFF $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
+ $DIFF -u $WORK_FILE_BASE.fulldump.other $WORK_FILE_BASE.fulldump.this \
> $WORK_FILE_BASE.fulldump.diff
if [ -s $WORK_FILE_BASE.fulldump.diff ]; then
@@ -927,7 +927,7 @@ compare_bin_file() {
| eval "$this_DIS_DIFF_FILTER" > $WORK_FILE_BASE.dis.this 2>&1 &
wait
- $DIFF $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
+ $DIFF -u $WORK_FILE_BASE.dis.other $WORK_FILE_BASE.dis.this > $WORK_FILE_BASE.dis.diff
if [ -s $WORK_FILE_BASE.dis.diff ]; then
DIS_DIFF_SIZE=$(ls -n $WORK_FILE_BASE.dis.diff | awk '{print $5}')
@@ -968,20 +968,20 @@ compare_bin_file() {
echo " $BIN_FILE"
if [ "$SHOW_DIFFS" = "true" ]; then
if [ -s "$WORK_FILE_BASE.symbols.diff" ]; then
- echo "Symbols diff:"
- $CAT $WORK_FILE_BASE.symbols.diff
+ echo "Symbols diff $SHOW_DIFF_INFO:"
+ $SHOW_DIFF_CMD $WORK_FILE_BASE.symbols.diff
fi
if [ -s "$WORK_FILE_BASE.deps.diff" ]; then
- echo "Deps diff:"
- $CAT $WORK_FILE_BASE.deps.diff
+ echo "Deps diff $SHOW_DIFF_INFO:"
+ $SHOW_DIFF_CMD $WORK_FILE_BASE.deps.diff
fi
if [ -s "$WORK_FILE_BASE.fulldump.diff" ]; then
- echo "Fulldump diff:"
- $CAT $WORK_FILE_BASE.fulldump.diff
+ echo "Fulldump diff $SHOW_DIFF_INFO:"
+ $SHOW_DIFF_CMD $WORK_FILE_BASE.fulldump.diff
fi
if [ -s "$WORK_FILE_BASE.dis.diff" ]; then
- echo "Disassembly diff:"
- $CAT $WORK_FILE_BASE.dis.diff
+ echo "Disassembly diff $SHOW_DIFF_INFO:"
+ $SHOW_DIFF_CMD $WORK_FILE_BASE.dis.diff
fi
fi
return 1
@@ -1077,7 +1077,7 @@ compare_all_debug_files() {
else
OTHER_FILE=$OTHER_DIR/$f
THIS_FILE=$THIS_DIR/$f
- DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1)
+ DIFF_OUT=$($DIFF -u $OTHER_FILE $THIS_FILE 2>&1)
fi
if [ -n "$DIFF_OUT" ]; then
@@ -1108,6 +1108,16 @@ compare_all_other_files() {
if [[ "$f" == */native/* ]]; then
continue
fi
+
+ NAME=$(basename $f)
+ WORK_FILE_BASE=$WORK_DIR/$f
+ FILE_WORK_DIR=$(dirname $WORK_FILE_BASE)
+ $MKDIR -p $FILE_WORK_DIR
+
+ # Make soft links to original files from work dir to facilitate debugging
+ $LN -f -s $THIS_FILE $WORK_FILE_BASE.this
+ $LN -f -s $OTHER_FILE $WORK_FILE_BASE.other
+
if [ -e $OTHER_DIR/$f ]; then
SUFFIX="${f##*.}"
if [ "$(basename $f)" = "release" ]; then
@@ -1133,12 +1143,14 @@ compare_all_other_files() {
OTHER_FILE=$OTHER_DIR/$f
THIS_FILE=$THIS_DIR/$f
fi
- DIFF_OUT=$($DIFF $OTHER_FILE $THIS_FILE 2>&1)
- if [ -n "$DIFF_OUT" ]; then
- echo $f
+
+ $DIFF -u $OTHER_FILE $THIS_FILE > $WORK_FILE_BASE.diff 2>&1
+ if [ -s $WORK_FILE_BASE.diff ]; then
+ echo "$f (diff size $(ls -n $WORK_FILE_BASE.diff | awk '{print $5}'))"
REGRESSIONS=true
if [ "$SHOW_DIFFS" = "true" ]; then
- echo "$DIFF_OUT"
+ echo SHOW DIFF $SHOW_DIFF_INFO: $WORK_FILE_BASE.diff
+ $SHOW_DIFF_CMD "$WORK_FILE_BASE.diff"
fi
fi
fi
@@ -1166,8 +1178,10 @@ if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "-?" ] || [ "$1" = "/h" ] || [ "$1
echo "-jmods Compare the listings of all jmod files"
echo "-libs Compare all native libraries"
echo "-execs Compare all executables"
+ echo "--diffs Shows abridged diff output of all comparisons"
+ echo "--diffs=full Shows full diff output of all comparisons (Warning! Log can be huge)"
echo "-v Verbose output, does not hide known differences"
- echo "-vv More verbose output, shows diff output of all comparisons"
+ echo "-vv Alias for -v --diffs"
echo "-o [OTHER] Compare with build in other directory. Will default to the old build directory"
echo ""
echo "--sort-symbols Sort all symbols before comparing"
@@ -1205,6 +1219,13 @@ while [ -n "$1" ]; do
VERBOSE=true
SHOW_DIFFS=true
;;
+ --diffs)
+ SHOW_DIFFS=true
+ ;;
+ --diffs=full)
+ SHOW_DIFFS=true
+ SHOW_FULL_DIFFS=true
+ ;;
-o)
OTHER="$2"
shift
@@ -1366,6 +1387,14 @@ if [ "$CMP_NAMES" = "false" ] \
CMP_EXECS=true
fi
+if [ "$SHOW_FULL_DIFFS" = "true" ]; then
+ SHOW_DIFF_CMD="$CAT"
+ SHOW_DIFF_INFO="(full diff)"
+else
+ SHOW_DIFF_CMD="$HEAD -n 500"
+ SHOW_DIFF_INFO="(first 500 lines)"
+fi
+
if [ -z "$FILTER" ]; then
FILTER="$CAT"
fi
diff --git a/make/scripts/compare_exceptions.sh.incl b/make/scripts/compare_exceptions.sh.incl
deleted file mode 100644
index e69de29bb2d1d..0000000000000
From 44aef386238977a960093027d9784c667550aae4 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie
Date: Thu, 14 Mar 2024 07:30:51 +0000
Subject: [PATCH 36/58] 8327045: Consolidate -fvisibility=hidden as a basic
flag for all compilation
Reviewed-by: erikj
---
make/autoconf/flags-cflags.m4 | 3 ++-
make/autoconf/flags-ldflags.m4 | 5 ++++-
make/common/TestFilesCompilation.gmk | 13 ++-----------
make/common/modules/LauncherCommon.gmk | 13 -------------
make/common/modules/LibCommon.gmk | 15 ---------------
make/hotspot/lib/CompileJvm.gmk | 2 +-
6 files changed, 9 insertions(+), 42 deletions(-)
diff --git a/make/autoconf/flags-cflags.m4 b/make/autoconf/flags-cflags.m4
index 78bca110357b8..658d6299b4d56 100644
--- a/make/autoconf/flags-cflags.m4
+++ b/make/autoconf/flags-cflags.m4
@@ -537,7 +537,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
if test "x$TOOLCHAIN_TYPE" = xgcc; then
TOOLCHAIN_CFLAGS_JVM="$TOOLCHAIN_CFLAGS_JVM -fstack-protector"
- TOOLCHAIN_CFLAGS_JDK="-pipe -fstack-protector"
+ TOOLCHAIN_CFLAGS_JDK="-fvisibility=hidden -pipe -fstack-protector"
# reduce lib size on linux in link step, this needs also special compile flags
# do this on s390x also for libjvm (where serviceability agent is not supported)
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
@@ -572,6 +572,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS_JDK="-pipe"
TOOLCHAIN_CFLAGS_JDK_CONLY="-fno-strict-aliasing" # technically NOT for CXX
fi
+ TOOLCHAIN_CFLAGS_JDK="$TOOLCHAIN_CFLAGS_JDK -fvisibility=hidden"
elif test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
# The -utf-8 option sets source and execution character sets to UTF-8 to enable correct
diff --git a/make/autoconf/flags-ldflags.m4 b/make/autoconf/flags-ldflags.m4
index b0f56a53a3dea..bf9b817ee72ed 100644
--- a/make/autoconf/flags-ldflags.m4
+++ b/make/autoconf/flags-ldflags.m4
@@ -61,7 +61,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
# add -z,relro (mark relocations read only) for all libs
# add -z,now ("full relro" - more of the Global Offset Table GOT is marked read only)
# add --no-as-needed to disable default --as-needed link flag on some GCC toolchains
- BASIC_LDFLAGS="-Wl,-z,defs -Wl,-z,relro -Wl,-z,now -Wl,--no-as-needed"
+ BASIC_LDFLAGS="-Wl,-z,defs -Wl,-z,relro -Wl,-z,now -Wl,--no-as-needed -Wl,--exclude-libs,ALL"
# Linux : remove unused code+data in link step
if test "x$ENABLE_LINKTIME_GC" = xtrue; then
if test "x$OPENJDK_TARGET_CPU" = xs390x; then
@@ -81,6 +81,9 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
LDFLAGS_CXX_PARTIAL_LINKING="$MACHINE_FLAG -r"
+ if test "x$OPENJDK_TARGET_OS" = xlinux; then
+ BASIC_LDFLAGS="-Wl,--exclude-libs,ALL"
+ fi
if test "x$OPENJDK_TARGET_OS" = xaix; then
BASIC_LDFLAGS="-Wl,-b64 -Wl,-brtl -Wl,-bnorwexec -Wl,-bnolibpath -Wl,-bnoexpall \
-Wl,-bernotok -Wl,-bdatapsize:64k -Wl,-btextpsize:64k -Wl,-bstackpsize:64k"
diff --git a/make/common/TestFilesCompilation.gmk b/make/common/TestFilesCompilation.gmk
index 85e01b0a521d2..fd2954cbec678 100644
--- a/make/common/TestFilesCompilation.gmk
+++ b/make/common/TestFilesCompilation.gmk
@@ -59,15 +59,6 @@ define SetupTestFilesCompilationBody
# Always include common test functionality
TEST_CFLAGS := -I$(TOPDIR)/test/lib/native
- ifeq ($(TOOLCHAIN_TYPE), gcc)
- TEST_CFLAGS += -fvisibility=hidden
- TEST_LDFLAGS += -Wl,--exclude-libs,ALL
- else ifeq ($(TOOLCHAIN_TYPE), clang)
- TEST_CFLAGS += -fvisibility=hidden
- else ifeq ($(TOOLCHAIN_TYPE), xlc)
- TEST_CFLAGS += -qvisibility=hidden
- endif
-
# The list to depend on starts out empty
$1 :=
ifeq ($$($1_TYPE), LIBRARY)
@@ -75,7 +66,7 @@ define SetupTestFilesCompilationBody
$1_OUTPUT_SUBDIR := lib
$1_BASE_CFLAGS := $(CFLAGS_JDKLIB) $$(TEST_CFLAGS)
$1_BASE_CXXFLAGS := $(CXXFLAGS_JDKLIB) $$(TEST_CFLAGS)
- $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(TEST_LDFLAGS) $$(call SET_SHARED_LIBRARY_ORIGIN)
+ $1_LDFLAGS := $(LDFLAGS_JDKLIB) $$(call SET_SHARED_LIBRARY_ORIGIN)
$1_COMPILATION_TYPE := LIBRARY
$1_LOG_TYPE := library
else ifeq ($$($1_TYPE), PROGRAM)
@@ -83,7 +74,7 @@ define SetupTestFilesCompilationBody
$1_OUTPUT_SUBDIR := bin
$1_BASE_CFLAGS := $(CFLAGS_JDKEXE) $$(TEST_CFLAGS)
$1_BASE_CXXFLAGS := $(CXXFLAGS_JDKEXE) $$(TEST_CFLAGS)
- $1_LDFLAGS := $(LDFLAGS_JDKEXE) $$(TEST_LDFLAGS) $(LDFLAGS_TESTEXE)
+ $1_LDFLAGS := $(LDFLAGS_JDKEXE) $(LDFLAGS_TESTEXE)
$1_COMPILATION_TYPE := EXECUTABLE
$1_LOG_TYPE := executable
else
diff --git a/make/common/modules/LauncherCommon.gmk b/make/common/modules/LauncherCommon.gmk
index 95d8474f04522..1d5dac600fadd 100644
--- a/make/common/modules/LauncherCommon.gmk
+++ b/make/common/modules/LauncherCommon.gmk
@@ -28,19 +28,6 @@ include Modules.gmk
include ProcessMarkdown.gmk
include ToolsJdk.gmk
-# Tell the compiler not to export any functions unless declared so in
-# the source code. On Windows, this is the default and cannot be changed.
-# On Mac, we have always exported all symbols, probably due to oversight
-# and/or misunderstanding. To emulate this, don't hide any symbols
-# by default.
-# Also provide an override for non-conformant libraries.
-ifeq ($(TOOLCHAIN_TYPE), gcc)
- LAUNCHER_CFLAGS += -fvisibility=hidden
- LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
-else ifeq ($(TOOLCHAIN_TYPE), clang)
- LAUNCHER_CFLAGS += -fvisibility=hidden
-endif
-
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
-I$(TOPDIR)/src/java.base/share/native/libjli \
diff --git a/make/common/modules/LibCommon.gmk b/make/common/modules/LibCommon.gmk
index 67d0ff1435fd3..bb23ca125f69f 100644
--- a/make/common/modules/LibCommon.gmk
+++ b/make/common/modules/LibCommon.gmk
@@ -31,21 +31,6 @@ include JdkNativeCompilation.gmk
# elegant solution to this.
WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
-# Tell the compiler not to export any functions unless declared so in
-# the source code. On Windows, this is the default and cannot be changed.
-# On Mac, we have always exported all symbols, probably due to oversight
-# and/or misunderstanding. To emulate this, don't hide any symbols
-# by default.
-# Also provide an override for non-conformant libraries.
-ifeq ($(TOOLCHAIN_TYPE), gcc)
- CFLAGS_JDKLIB += -fvisibility=hidden
- CXXFLAGS_JDKLIB += -fvisibility=hidden
- LDFLAGS_JDKLIB += -Wl,--exclude-libs,ALL
-else ifeq ($(TOOLCHAIN_TYPE), clang)
- CFLAGS_JDKLIB += -fvisibility=hidden
- CXXFLAGS_JDKLIB += -fvisibility=hidden
-endif
-
# Put the libraries here.
INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
diff --git a/make/hotspot/lib/CompileJvm.gmk b/make/hotspot/lib/CompileJvm.gmk
index 859e75cfc9fa4..fb7fe9b0eeed2 100644
--- a/make/hotspot/lib/CompileJvm.gmk
+++ b/make/hotspot/lib/CompileJvm.gmk
@@ -155,7 +155,7 @@ endif
ifeq ($(call isTargetOs, linux), true)
HOTSPOT_VERSION_SCRIPT := $(TOPDIR)/make/data/hotspot-symbols/version-script.txt
- JVM_LDFLAGS += -Wl,--exclude-libs,ALL -Wl,-version-script=$(HOTSPOT_VERSION_SCRIPT)
+ JVM_LDFLAGS += -Wl,-version-script=$(HOTSPOT_VERSION_SCRIPT)
endif
################################################################################
From 481c866df87c693a90a1da20e131e5654b084ddd Mon Sep 17 00:00:00 2001
From: Matthias Baesken
Date: Thu, 14 Mar 2024 08:01:39 +0000
Subject: [PATCH 37/58] 8327468: Do not restart close if errno is EINTR
[macOS/linux]
Reviewed-by: dholmes, sspitsyn
---
src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c | 3 +--
src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c | 6 ++----
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c b/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c
index 3aec395a1ba2c..fc9af9018352b 100644
--- a/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c
+++ b/src/jdk.attach/linux/native/libattach/VirtualMachineImpl.c
@@ -192,9 +192,8 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd)
{
- int res;
shutdown(fd, SHUT_RDWR);
- RESTARTABLE(close(fd), res);
+ close(fd);
}
/*
diff --git a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c
index 4e5b2aad6952a..d77d9e416f2f3 100644
--- a/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c
+++ b/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c
@@ -194,9 +194,8 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_checkPermissions
JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_close
(JNIEnv *env, jclass cls, jint fd)
{
- int res;
shutdown(fd, SHUT_RDWR);
- RESTARTABLE(close(fd), res);
+ close(fd);
}
/*
@@ -288,8 +287,7 @@ JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile
}
RESTARTABLE(chown(_path, geteuid(), getegid()), rc);
-
- RESTARTABLE(close(fd), rc);
+ close(fd);
/* release p here */
if (isCopy) {
From 49ce85fae9f06d05367c94615532f6ff87952c79 Mon Sep 17 00:00:00 2001
From: Abhishek Kumar
Date: Thu, 14 Mar 2024 09:07:32 +0000
Subject: [PATCH 38/58] 8327874: Convert
javax/swing/JTree/4314199/bug4314199.java applet test to main
Reviewed-by: prr, tr
---
.../javax/swing/JTree/4314199/bug4314199.html | 31 ---------
.../swing/JTree/{4314199 => }/bug4314199.java | 69 ++++++++++---------
2 files changed, 38 insertions(+), 62 deletions(-)
delete mode 100644 test/jdk/javax/swing/JTree/4314199/bug4314199.html
rename test/jdk/javax/swing/JTree/{4314199 => }/bug4314199.java (58%)
diff --git a/test/jdk/javax/swing/JTree/4314199/bug4314199.html b/test/jdk/javax/swing/JTree/4314199/bug4314199.html
deleted file mode 100644
index 1ce22cbeac303..0000000000000
--- a/test/jdk/javax/swing/JTree/4314199/bug4314199.html
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-Select the last tree node (marked "Here") and click on the menu.
-Look at the vertical line connecting nodes "Bug" and "Here". If
-this line disappears when the menu drops down, test fails.
-
-
-
diff --git a/test/jdk/javax/swing/JTree/4314199/bug4314199.java b/test/jdk/javax/swing/JTree/bug4314199.java
similarity index 58%
rename from test/jdk/javax/swing/JTree/4314199/bug4314199.java
rename to test/jdk/javax/swing/JTree/bug4314199.java
index ecf0dabb3429a..8dd38830d0f68 100644
--- a/test/jdk/javax/swing/JTree/4314199/bug4314199.java
+++ b/test/jdk/javax/swing/JTree/bug4314199.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -26,42 +26,44 @@
* @test
* @bug 4314199
* @summary Tests that JTree repaints correctly in a container with a JMenu
- * @author Peter Zhelezniakov
- * @run applet/manual=yesno bug4314199.html
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual bug4314199
*/
-import javax.swing.*;
-import javax.swing.tree.*;
+import java.awt.BorderLayout;
+import javax.swing.Box;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.JMenuItem;
+import javax.swing.JPanel;
+import javax.swing.JTree;
+import javax.swing.UIManager;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.DefaultTreeModel;
+import javax.swing.tree.TreePath;
-public class bug4314199 extends JApplet {
+public class bug4314199 {
- public void init() {
+ private static final String INSTRUCTIONS = """
+ Select the last tree node (marked "Here") and click on the "Menu".
+ Look at the vertical line connecting nodes "Bug" and "Here".
+ If the connecting line does not disappear when the "Menu" drops down,
+ press 'Pass' else 'Fail'. """;
- try {
- UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
- SwingUtilities.invokeAndWait(new Runnable() {
-
- public void run() {
- createAndShowGUI();
- }
- });
- } catch (final Exception e) {
- SwingUtilities.invokeLater(new Runnable() {
-
- public void run() {
- createAndShowMessage("Test fails because of exception: "
- + e.getMessage());
- }
- });
- }
+ public static void main(String[] args) throws Exception {
+ UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
+ PassFailJFrame.builder()
+ .title("JTree Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(6)
+ .splitUI(bug4314199::createAndShowGUI)
+ .build()
+ .awaitAndCheck();
}
- private void createAndShowMessage(String message) {
- getContentPane().add(new JLabel(message));
- }
-
- private void createAndShowGUI() {
+ private static JPanel createAndShowGUI() {
JMenuBar mb = new JMenuBar();
// needed to exactly align left edge of menu and angled line of tree
@@ -71,7 +73,6 @@ private void createAndShowGUI() {
JMenuItem mi = new JMenuItem("MenuItem");
mn.add(mi);
mb.add(mn);
- setJMenuBar(mb);
DefaultMutableTreeNode n1 = new DefaultMutableTreeNode("Root");
DefaultMutableTreeNode n2 = new DefaultMutableTreeNode("Duke");
@@ -87,6 +88,12 @@ private void createAndShowGUI() {
JTree tree = new JTree(new DefaultTreeModel(n1));
tree.putClientProperty("JTree.lineStyle", "Angled");
tree.expandPath(new TreePath(new Object[]{n1, n2, n3}));
- setContentPane(tree);
+
+ JPanel p = new JPanel();
+ p.setLayout(new BorderLayout());
+ p.setSize(200, 200);
+ p.add(mb, BorderLayout.NORTH);
+ p.add(tree);
+ return p;
}
}
From 1281e18f1447848d7eb5e3bde508ac002b4c390d Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev
Date: Thu, 14 Mar 2024 10:26:49 +0000
Subject: [PATCH 39/58] 8325613: CTW: Stale method cleanup requires GC after
Sweeper removal
Reviewed-by: roland, chagedorn
---
.../src/sun/hotspot/tools/ctw/Compiler.java | 23 ++++++++++++++++++-
.../src/sun/hotspot/tools/ctw/CtwRunner.java | 4 +++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
index 961090c1d4035..7b495e46e3385 100644
--- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
+++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java
@@ -41,9 +41,15 @@
*/
public class Compiler {
+ // Call GC after compiling as many methods. This would remove the stale methods.
+ // This threshold should balance the GC overhead and the cost of keeping lots
+ // of stale methods around.
+ private static final long GC_METHOD_THRESHOLD = Long.getLong("gcMethodThreshold", 100);
+
private static final Unsafe UNSAFE = Unsafe.getUnsafe();
private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
- private static final AtomicLong METHOD_COUNT = new AtomicLong(0L);
+ private static final AtomicLong METHOD_COUNT = new AtomicLong();
+ private static final AtomicLong METHODS_SINCE_LAST_GC = new AtomicLong();
private Compiler() { }
@@ -83,6 +89,21 @@ public static void compileClass(Class> aClass, long id, Executor executor) {
executor.execute(new CompileMethodCommand(id, e));
}
METHOD_COUNT.addAndGet(methodCount);
+
+ // See if we need to schedule a GC
+ while (true) {
+ long current = METHODS_SINCE_LAST_GC.get();
+ long update = current + methodCount;
+ if (update >= GC_METHOD_THRESHOLD) {
+ update = 0;
+ }
+ if (METHODS_SINCE_LAST_GC.compareAndSet(current, update)) {
+ if (update == 0) {
+ executor.execute(() -> System.gc());
+ }
+ break;
+ }
+ }
}
private static void preloadClasses(String className, long id,
diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
index b8332a5e5a58c..df4f9063586f4 100644
--- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
+++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
@@ -293,8 +293,10 @@ private String[] cmd(long classStart, long classStop) {
String.format("-XX:ReplayDataFile=replay_%s_%%p.log", phase),
// MethodHandle MUST NOT be compiled
"-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*",
- // Stress* are c2-specific stress flags, so IgnoreUnrecognizedVMOptions is needed
"-XX:+IgnoreUnrecognizedVMOptions",
+ // Do not pay extra zapping cost for explicit GC invocations
+ "-XX:-ZapUnusedHeapArea",
+ // Stress* are c2-specific stress flags, so IgnoreUnrecognizedVMOptions is needed
"-XX:+StressLCM",
"-XX:+StressGCM",
"-XX:+StressIGVN",
From 11a3673d42edbefef70228b4d14595aab11fdac4 Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev
Date: Thu, 14 Mar 2024 10:41:43 +0000
Subject: [PATCH 40/58] 8328110: Allow simultaneous use of PassFailJFrame with
split UI and additional windows
Reviewed-by: aivanov, honkar
---
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java | 8 --------
1 file changed, 8 deletions(-)
diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
index f8bd913dab29e..68cb22fecdd07 100644
--- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
@@ -1333,14 +1333,6 @@ private void validate() {
position = Position.HORIZONTAL;
}
- if (panelCreator != null) {
- if (splitUI && (testWindows != null || windowListCreator != null)) {
- // TODO Is it required? We can support both
- throw new IllegalStateException("Split UI is not allowed "
- + "with additional windows");
- }
- }
-
if (positionWindows != null) {
if (testWindows == null && windowListCreator == null) {
throw new IllegalStateException("To position windows, "
From a43c3cc3476f18c048809bcd08f81fc4288ca399 Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 10:50:06 +0000
Subject: [PATCH 41/58] 8327826: Convert javax/swing/border/Test4243289.java
applet test to main
Reviewed-by: aivanov, abhiscxk
---
test/jdk/javax/swing/border/Test4243289.html | 32 -------------
test/jdk/javax/swing/border/Test4243289.java | 49 ++++++++++++++------
2 files changed, 36 insertions(+), 45 deletions(-)
delete mode 100644 test/jdk/javax/swing/border/Test4243289.html
diff --git a/test/jdk/javax/swing/border/Test4243289.html b/test/jdk/javax/swing/border/Test4243289.html
deleted file mode 100644
index 5616bd835ac12..0000000000000
--- a/test/jdk/javax/swing/border/Test4243289.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-When applet starts, you'll see a panel with a TitledBorder with title "Panel Title".
-If this title is overstriken with the border line, test fails, otherwise it passes.
-
-
-
-
diff --git a/test/jdk/javax/swing/border/Test4243289.java b/test/jdk/javax/swing/border/Test4243289.java
index ae535a1e517e0..4b89239bc19bb 100644
--- a/test/jdk/javax/swing/border/Test4243289.java
+++ b/test/jdk/javax/swing/border/Test4243289.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -21,32 +21,55 @@
* questions.
*/
+import java.awt.Dimension;
+import java.awt.Font;
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.border.TitledBorder;
+
/*
* @test
* @bug 4243289
* @summary Tests that TitledBorder do not draw line through its caption
- * @author Peter Zhelezniakov
- * @run applet/manual=yesno Test4243289.html
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test4243289
*/
-import java.awt.Font;
-import javax.swing.BorderFactory;
-import javax.swing.JApplet;
-import javax.swing.JPanel;
-import javax.swing.border.TitledBorder;
+public class Test4243289 {
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ If TitledBorder with title "Panel Title" is overstruck with
+ the border line, test fails, otherwise it passes.
+ """;
+
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(3)
+ .columns(35)
+ .splitUI(Test4243289::init)
+ .build()
+ .awaitAndCheck();
+ }
-public class Test4243289 extends JApplet {
- public void init() {
- Font font = new Font("Dialog", Font.PLAIN, 12); // NON-NLS: the font name
+ public static JComponent init() {
+ Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
TitledBorder border = BorderFactory.createTitledBorder(
BorderFactory.createEtchedBorder(),
- "Panel Title", // NON-NLS: the title of the border
+ "Panel Title",
TitledBorder.DEFAULT_JUSTIFICATION,
TitledBorder.DEFAULT_POSITION,
font);
JPanel panel = new JPanel();
panel.setBorder(border);
- getContentPane().add(panel);
+ panel.setPreferredSize(new Dimension(100, 100));
+ Box main = Box.createVerticalBox();
+ main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+ main.add(panel);
+ return main;
}
}
From ad0f329493a73020899640b0815e33ee6d3ea78d Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 10:54:41 +0000
Subject: [PATCH 42/58] 8327787: Convert javax/swing/border/Test4129681.java
applet test to main
Reviewed-by: aivanov, abhiscxk
---
test/jdk/javax/swing/border/Test4129681.html | 33 ----------
test/jdk/javax/swing/border/Test4129681.java | 65 ++++++++++++--------
2 files changed, 39 insertions(+), 59 deletions(-)
delete mode 100644 test/jdk/javax/swing/border/Test4129681.html
diff --git a/test/jdk/javax/swing/border/Test4129681.html b/test/jdk/javax/swing/border/Test4129681.html
deleted file mode 100644
index c80b417075a4d..0000000000000
--- a/test/jdk/javax/swing/border/Test4129681.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-When applet starts, you'll see a checkbox and a label with a titled border.
-Turn on the checkbox to disable the label.
-The test passes if the title of the border is disabled as well as the label.
-
-
-
-
diff --git a/test/jdk/javax/swing/border/Test4129681.java b/test/jdk/javax/swing/border/Test4129681.java
index 330126d3f3f85..c629f1ac95158 100644
--- a/test/jdk/javax/swing/border/Test4129681.java
+++ b/test/jdk/javax/swing/border/Test4129681.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -21,39 +21,52 @@
* questions.
*/
-/*
- * @test
- * @bug 4129681
- * @summary Tests enabling/disabling of titled border's caption
- * @author Sergey Malenkov
- * @run applet/manual=yesno Test4129681.html
- */
-
-import java.awt.BorderLayout;
import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
import javax.swing.BorderFactory;
-import javax.swing.JApplet;
+import javax.swing.Box;
import javax.swing.JCheckBox;
+import javax.swing.JComponent;
import javax.swing.JLabel;
-public class Test4129681 extends JApplet implements ItemListener {
- private JLabel label;
-
- @Override
- public void init() {
- JCheckBox check = new JCheckBox("disable");
- check.addItemListener(this);
+/*
+ * @test
+ * @bug 4129681
+ * @summary Tests disabling of titled border's caption
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test4129681
+ */
- this.label = new JLabel("message");
- this.label.setBorder(BorderFactory.createTitledBorder("label"));
- this.label.setEnabled(!check.isSelected());
+public class Test4129681 {
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ Click the checkbox to disable the label.
+ The test passes if the title of the border
+ is disabled as well as the label.
+ """;
- add(BorderLayout.NORTH, check);
- add(BorderLayout.CENTER, this.label);
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(4)
+ .columns(25)
+ .splitUI(Test4129681::init)
+ .build()
+ .awaitAndCheck();
}
- public void itemStateChanged(ItemEvent event) {
- this.label.setEnabled(ItemEvent.DESELECTED == event.getStateChange());
+ public static JComponent init() {
+ JLabel label = new JLabel("message");
+ JCheckBox check = new JCheckBox("Enable/Disable");
+ check.addItemListener(event ->
+ label.setEnabled(ItemEvent.DESELECTED == event.getStateChange()));
+ label.setBorder(BorderFactory.createTitledBorder("label"));
+ label.setEnabled(!check.isSelected());
+
+ Box main = Box.createVerticalBox();
+ main.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
+ main.add(check);
+ main.add(label);
+ return main;
}
}
From 3b9255eb663b4c90aa5cec89f0d9380ef8eba49e Mon Sep 17 00:00:00 2001
From: Alexey Ivanov
Date: Thu, 14 Mar 2024 10:57:30 +0000
Subject: [PATCH 43/58] 8325851: Hide PassFailJFrame.Builder constructor
Reviewed-by: honkar, prr
---
test/jdk/java/awt/Frame/DefaultSizeTest.java | 21 ++-------
test/jdk/java/awt/Frame/FrameRepackTest.java | 20 ++------
.../FrameResizeTest/FrameResizeTest_1.java | 21 ++-------
.../FrameResizeTest/FrameResizeTest_2.java | 21 ++-------
.../LightweightCliprect.java | 33 ++++++-------
.../AddRemoveMenuBarTest_1.java | 21 ++-------
.../AddRemoveMenuBarTest_2.java | 21 ++-------
.../AddRemoveMenuBarTest_3.java | 21 ++-------
.../AddRemoveMenuBarTest_4.java | 21 ++-------
.../awt/TrayIcon/TrayIconScalingTest.java | 4 +-
.../AcceleratorTest/AcceleratorTest.java | 4 +-
.../java/awt/geom/HitTest/PathHitTest.java | 4 +-
.../awt/print/PageFormat/CustomPaper.java | 4 +-
.../awt/regtesthelpers/PassFailJFrame.java | 8 ++++
.../TestJComboBoxScreenMagnifier.java | 4 +-
.../javax/swing/JComboBox/ComboPopupBug.java | 46 ++++++++-----------
.../swing/JFrame/DefaultCloseOperation.java | 34 ++++++--------
.../TestJTabbedPaneArrowDirection.java | 6 +--
test/jdk/javax/swing/JToolBar/bug4203039.java | 4 +-
.../swing/MultiMonitor/MultimonVImage.java | 30 +++++-------
test/jdk/sun/awt/PaletteTester.java | 4 +-
21 files changed, 124 insertions(+), 228 deletions(-)
diff --git a/test/jdk/java/awt/Frame/DefaultSizeTest.java b/test/jdk/java/awt/Frame/DefaultSizeTest.java
index dff1ff147c5fa..40d213b0d8412 100644
--- a/test/jdk/java/awt/Frame/DefaultSizeTest.java
+++ b/test/jdk/java/awt/Frame/DefaultSizeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -21,7 +21,6 @@
* questions.
*/
-import java.awt.EventQueue;
import java.awt.Frame;
/*
@@ -44,25 +43,15 @@ public class DefaultSizeTest {
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("DefaultSizeTest Instructions Frame")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
+ .testUI(() -> new Frame("DefaultSize"))
.screenCapture()
- .build();
-
- EventQueue.invokeAndWait(() -> {
- Frame frame = new Frame("DefaultSize");
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame
- .positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/Frame/FrameRepackTest.java b/test/jdk/java/awt/Frame/FrameRepackTest.java
index 4f77d195ca622..6fdc14dffd65d 100644
--- a/test/jdk/java/awt/Frame/FrameRepackTest.java
+++ b/test/jdk/java/awt/Frame/FrameRepackTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -77,25 +77,15 @@ repacks the frame, thereby adjusting its size tightly to its panel(s).
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("FrameRepackTest Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(30)
.columns(45)
- .build();
-
- EventQueue.invokeAndWait(() -> {
- FrameRepack frame = new FrameRepack();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(FrameRepack::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java
index 7503672fccda9..d1621edc670ef 100644
--- a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java
+++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_1.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -24,7 +24,6 @@
import java.awt.BorderLayout;
import java.awt.Canvas;
import java.awt.Color;
-import java.awt.EventQueue;
import java.awt.Frame;
/*
@@ -53,25 +52,15 @@ public class FrameResizeTest_1 {
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("FrameResizeTest_1 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(12)
.columns(45)
- .build();
-
- EventQueue.invokeAndWait(() -> {
- FrameResize_1 frame = new FrameResize_1();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(FrameResize_1::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java
index e8fdd52522b22..a7a3a7e16f12c 100644
--- a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java
+++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,7 +26,6 @@
import java.awt.Color;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.EventQueue;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.GridBagConstraints;
@@ -57,25 +56,15 @@ There is a frame (size 300x300).
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("FrameResizeTest_2 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
- .build();
-
- EventQueue.invokeAndWait(() -> {
- FrameResize_2 frame = new FrameResize_2();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(FrameResize_2::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java b/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java
index a6b1e3bc95c5b..6bd2fb70f1061 100644
--- a/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java
+++ b/test/jdk/java/awt/LightweightComponent/LightweightCliprect.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -25,7 +25,6 @@
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
-import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.Frame;
import java.awt.Graphics;
@@ -49,32 +48,28 @@ public class LightweightCliprect {
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("LightweightCliprect Instructions Frame")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(10)
.columns(45)
- .build();
-
- EventQueue.invokeAndWait(() -> {
- Frame frame = new Frame("DefaultSize");
-
- Container panel = new MyContainer();
- MyComponent c = new MyComponent();
- panel.add(c);
+ .testUI(LightweightCliprect::createUI)
+ .build()
+ .awaitAndCheck();
+ }
- frame.add(panel);
- frame.setSize(400, 300);
+ private static Frame createUI() {
+ Frame frame = new Frame("DefaultSize");
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame
- .positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
+ Container panel = new MyContainer();
+ MyComponent c = new MyComponent();
+ panel.add(c);
- frame.setVisible(true);
- });
+ frame.add(panel);
+ frame.setSize(400, 300);
- passFailJFrame.awaitAndCheck();
+ return frame;
}
}
diff --git a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_1.java b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_1.java
index 808bb598cecfb..4008a0f4683ae 100644
--- a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_1.java
+++ b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_1.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,7 +26,6 @@
import java.awt.MenuBar;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import javax.swing.SwingUtilities;
/*
* @test
@@ -58,25 +57,15 @@ Each menu bar has one (empty) menu, labelled with the
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_1 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(18)
.columns(45)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- AddRemoveMenuBar_1 frame = new AddRemoveMenuBar_1();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(AddRemoveMenuBar_1::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_2.java b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_2.java
index c0c98a5ca9534..9513cd68b0956 100644
--- a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_2.java
+++ b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_2.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -26,7 +26,6 @@
import java.awt.MenuBar;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
-import javax.swing.SwingUtilities;
/*
* @test
@@ -54,25 +53,15 @@ Each menu bar has one (empty) menu, 'foo'.
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_2 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(15)
.columns(45)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- AddRemoveMenuBar_2 frame = new AddRemoveMenuBar_2();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(AddRemoveMenuBar_2::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_3.java b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_3.java
index a01ddd9925b37..70fd274c4d798 100644
--- a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_3.java
+++ b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_3.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -34,7 +34,6 @@
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
-import javax.swing.SwingUtilities;
/*
* @test
@@ -76,25 +75,15 @@ and remove a menu bar containing an (empty) 'Help' menu.
Upon test completion, click Pass or Fail appropriately.
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_3 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(30)
.columns(38)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- AddRemoveMenuBar_3 frame = new AddRemoveMenuBar_3();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(null,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(AddRemoveMenuBar_3::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_4.java b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_4.java
index 571fce7fba5dd..da18968d74844 100644
--- a/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_4.java
+++ b/test/jdk/java/awt/MenuBar/AddRemoveMenuBarTests/AddRemoveMenuBarTest_4.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -27,7 +27,6 @@
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
-import javax.swing.SwingUtilities;
/*
* @test
@@ -61,25 +60,15 @@ public class AddRemoveMenuBarTest_4 {
""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("AddRemoveMenuBarTest_4 Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(18)
.columns(45)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- AddRemoveMenuBar_4 frame = new AddRemoveMenuBar_4();
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
-
- frame.setVisible(true);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(AddRemoveMenuBar_4::new)
+ .build()
+ .awaitAndCheck();
}
}
diff --git a/test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java b/test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java
index ec878c10c2095..075137ff091a1 100644
--- a/test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java
+++ b/test/jdk/java/awt/TrayIcon/TrayIconScalingTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2022, 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
@@ -85,7 +85,7 @@ public static void main(String[] args)
System.out.println("SystemTray is not supported");
return;
}
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("TrayIcon Test Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(8)
diff --git a/test/jdk/java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java b/test/jdk/java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java
index 1d9635d58caa1..b269cf53a95cd 100644
--- a/test/jdk/java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java
+++ b/test/jdk/java/awt/event/KeyEvent/AcceleratorTest/AcceleratorTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 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
@@ -79,7 +79,7 @@ public static void main(String[] args) throws Exception {
cmdHash.put(CMD[i], 0);
}
- PassFailJFrame testFrame = new PassFailJFrame.Builder()
+ PassFailJFrame testFrame = PassFailJFrame.builder()
.title("Test Instructions Frame")
.instructions(instructions)
.testTimeOut(10)
diff --git a/test/jdk/java/awt/geom/HitTest/PathHitTest.java b/test/jdk/java/awt/geom/HitTest/PathHitTest.java
index 930e7f764a604..7557a79020255 100644
--- a/test/jdk/java/awt/geom/HitTest/PathHitTest.java
+++ b/test/jdk/java/awt/geom/HitTest/PathHitTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -372,7 +372,7 @@ private static void createAndShowGUI() {
}
public static void doManual() throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("PathHitTestManual Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
diff --git a/test/jdk/java/awt/print/PageFormat/CustomPaper.java b/test/jdk/java/awt/print/PageFormat/CustomPaper.java
index 7af689176d86a..d6698a63ddce2 100644
--- a/test/jdk/java/awt/print/PageFormat/CustomPaper.java
+++ b/test/jdk/java/awt/print/PageFormat/CustomPaper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -167,7 +167,7 @@ public static void main(String[] args) throws Exception {
+ "Valid values: 4355514 or 4385157");
};
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("CustomPaper Test Instructions")
.instructions(instructions)
.testTimeOut(5)
diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
index 68cb22fecdd07..55a219564a335 100644
--- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
@@ -1059,6 +1059,14 @@ public static final class Builder {
private Position position;
+ /**
+ * A private constructor for the builder,
+ * it should not be created directly.
+ * Use {@code PassFailJFrame.builder()} method instead.
+ */
+ private Builder() {
+ }
+
public Builder title(String title) {
this.title = title;
return this;
diff --git a/test/jdk/javax/accessibility/JComboBox/TestJComboBoxScreenMagnifier.java b/test/jdk/javax/accessibility/JComboBox/TestJComboBoxScreenMagnifier.java
index 8d2bb2415dc1b..d0330eded44b2 100644
--- a/test/jdk/javax/accessibility/JComboBox/TestJComboBoxScreenMagnifier.java
+++ b/test/jdk/javax/accessibility/JComboBox/TestJComboBoxScreenMagnifier.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -54,7 +54,7 @@ public class TestJComboBoxScreenMagnifier {
public static void main(String[] args) throws InterruptedException,
InvocationTargetException {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("JComboBox Screen Magnifier Test Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
diff --git a/test/jdk/javax/swing/JComboBox/ComboPopupBug.java b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
index 3a4fb4b8bc78f..8c9dcde7d6579 100644
--- a/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
+++ b/test/jdk/javax/swing/JComboBox/ComboPopupBug.java
@@ -24,7 +24,6 @@
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
-import javax.swing.SwingUtilities;
/*
* @test
@@ -45,48 +44,43 @@ public class ComboPopupBug {
Click on Close and then click on JComboBox arrow button
to try to show combobox popup.
If IllegalStateException is thrown, test will automatically Fail
- otherwise click Pass. """;
+ otherwise click Pass.""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("ComboPopup Instructions")
.instructions(instructionsText)
.testTimeOut(5)
.rows(10)
.columns(35)
- .build();
+ .testUI(ComboPopupBug::createUI)
+ .build()
+ .awaitAndCheck();
+ }
- SwingUtilities.invokeAndWait(() -> {
- JFrame frame = new JFrame("ComboPopup");
+ private static JFrame createUI() {
+ JFrame frame = new JFrame("ComboPopup");
- JComboBox cb = new JComboBox();
- cb.setEditable(true);
- cb.addItem("test");
- cb.addItem("test2");
- cb.addItem("test3");
- frame.getContentPane().add(cb, "North");
+ JComboBox cb = new JComboBox<>();
+ cb.setEditable(true);
+ cb.addItem("test");
+ cb.addItem("test2");
+ cb.addItem("test3");
- JButton b = new JButton("Close");
- b.addActionListener(
+ JButton b = new JButton("Close");
+ b.addActionListener(
(e)->{
try {
Thread.sleep(3000);
- }
- catch (Exception ex) {
+ } catch (Exception ignored) {
}
frame.setVisible(false);
-
});
- frame.getContentPane().add(b, "South");
- frame.setSize(200, 200);
-
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame.positionTestWindow(frame,
- PassFailJFrame.Position.HORIZONTAL);
- frame.setVisible(true);
- });
+ frame.getContentPane().add(cb, "North");
+ frame.getContentPane().add(b, "South");
+ frame.setSize(200, 200);
- passFailJFrame.awaitAndCheck();
+ return frame;
}
}
diff --git a/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java b/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java
index 098000a8bab68..e08efdb885460 100644
--- a/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java
+++ b/test/jdk/javax/swing/JFrame/DefaultCloseOperation.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
@@ -32,7 +32,6 @@
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
-import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
/*
@@ -73,31 +72,26 @@ public class DefaultCloseOperation extends JPanel {
JComboBox dialogCloseOp;
public static void main(String[] args) throws Exception {
-
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("DefaultCloseOperation Manual Test")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
.rows(20)
- .columns(70)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- DefaultCloseOperation dco = new DefaultCloseOperation();
- dco.init();
-
- JFrame frame = new JFrame("DefaultCloseOperation");
- frame.add(dco);
- frame.setSize(500,200);
+ .columns(50)
+ .testUI(DefaultCloseOperation::createUI)
+ .build()
+ .awaitAndCheck();
+ }
- PassFailJFrame.addTestWindow(frame);
- PassFailJFrame
- .positionTestWindow(frame, PassFailJFrame.Position.HORIZONTAL);
+ private static JFrame createUI() {
+ DefaultCloseOperation dco = new DefaultCloseOperation();
+ dco.init();
- frame.setVisible(true);
- });
+ JFrame frame = new JFrame("DefaultCloseOperation");
+ frame.add(dco);
+ frame.setSize(500,200);
- passFailJFrame.awaitAndCheck();
+ return frame;
}
public void init() {
diff --git a/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneArrowDirection.java b/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneArrowDirection.java
index 50df3933f36e7..a53e2f2c59e3d 100644
--- a/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneArrowDirection.java
+++ b/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneArrowDirection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 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
@@ -49,7 +49,7 @@ public class TestJTabbedPaneArrowDirection {
private static JFrame frame;
private static JTabbedPane tabPane;
private static final String INSTRUCTIONS =
- "1. Observe the arrows are ponting to left and right direction\n" +
+ "1. Observe the arrows are pointing to left and right direction\n" +
" for tab placement set to TOP. Default tab placement is TOP.\n\n" +
"2. Press BOTTOM to change the tab placement to bottom.\n\n" +
"3. Observe arrows are pointing to the left and right direction.\n\n" +
@@ -57,7 +57,7 @@ public class TestJTabbedPaneArrowDirection {
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("JTabbedPane Arrow Direction Test Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
diff --git a/test/jdk/javax/swing/JToolBar/bug4203039.java b/test/jdk/javax/swing/JToolBar/bug4203039.java
index af8b1f122c0fd..9f9c717e5470c 100644
--- a/test/jdk/javax/swing/JToolBar/bug4203039.java
+++ b/test/jdk/javax/swing/JToolBar/bug4203039.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -49,7 +49,7 @@ public class bug4203039 {
locations but can dock on the NORTH and WEST""";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("bug4203039 Instructions")
.instructions(instructionsText)
.testTimeOut(5)
diff --git a/test/jdk/javax/swing/MultiMonitor/MultimonVImage.java b/test/jdk/javax/swing/MultiMonitor/MultimonVImage.java
index 42cb9c96da588..8b5298deb0f2d 100644
--- a/test/jdk/javax/swing/MultiMonitor/MultimonVImage.java
+++ b/test/jdk/javax/swing/MultiMonitor/MultimonVImage.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -38,9 +38,8 @@
import java.awt.Graphics;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
-import javax.swing.JViewport;
import javax.swing.JFrame;
-import javax.swing.SwingUtilities;
+import javax.swing.JViewport;
public class MultimonVImage {
private static final String instructionsText =
@@ -64,25 +63,20 @@ public class MultimonVImage {
" issue, try to use the same or similar video cards for each monitor.";
public static void main(String[] args) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame.builder()
.title("MultimonVImage Instructions")
.instructions(instructionsText)
.testTimeOut(5)
.rows(25)
.columns(50)
- .build();
-
- SwingUtilities.invokeAndWait(() -> {
- AnimatingFrame af = new AnimatingFrame();
- af.test();
- af.run();
-
- PassFailJFrame.addTestWindow(af);
- PassFailJFrame.positionTestWindow(af,
- PassFailJFrame.Position.HORIZONTAL);
- });
-
- passFailJFrame.awaitAndCheck();
+ .testUI(() -> {
+ AnimatingFrame af = new AnimatingFrame();
+ af.test();
+ af.run();
+ return af;
+ })
+ .build()
+ .awaitAndCheck();
}
}
@@ -164,9 +158,7 @@ public void windowClosing(WindowEvent e) {
setContentPane(component);
component.setVisible(true);
- setLocationRelativeTo(null);
pack();
- setVisible(true);
}
public void test() {
diff --git a/test/jdk/sun/awt/PaletteTester.java b/test/jdk/sun/awt/PaletteTester.java
index 7fb0d6b26ad75..3e1a81f5efede 100644
--- a/test/jdk/sun/awt/PaletteTester.java
+++ b/test/jdk/sun/awt/PaletteTester.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -90,7 +90,7 @@ public void windowClosing(WindowEvent e) {}
public static void main( String args[] ) throws Exception {
- PassFailJFrame passFailJFrame = new PassFailJFrame.Builder()
+ PassFailJFrame passFailJFrame = PassFailJFrame.builder()
.title("PaletteTester Instructions")
.instructions(INSTRUCTIONS)
.testTimeOut(5)
From 1d34b74a64fba8d0d58dcbccc416379a4c915738 Mon Sep 17 00:00:00 2001
From: Hamlin Li
Date: Thu, 14 Mar 2024 11:23:00 +0000
Subject: [PATCH 44/58] 8321021: RISC-V: C2 VectorUCastB2X 8321023: RISC-V: C2
VectorUCastS2X 8321024: RISC-V: C2 VectorUCastI2X
Reviewed-by: fyang
---
.../cpu/riscv/c2_MacroAssembler_riscv.cpp | 66 ++-
.../cpu/riscv/c2_MacroAssembler_riscv.hpp | 2 +-
src/hotspot/cpu/riscv/riscv_v.ad | 73 ++-
.../vectorapi/reshape/TestVectorCastRVV.java | 49 ++
.../reshape/utils/TestCastMethods.java | 472 +++++++++++++++++-
5 files changed, 628 insertions(+), 34 deletions(-)
create mode 100644 test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastRVV.java
diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
index 18ab55474a6a7..89d69102d47bd 100644
--- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
+++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.cpp
@@ -2791,7 +2791,7 @@ void C2_MacroAssembler::compare_fp_v(VectorRegister vd, VectorRegister src1, Vec
}
void C2_MacroAssembler::integer_extend_v(VectorRegister dst, BasicType dst_bt, uint vector_length,
- VectorRegister src, BasicType src_bt) {
+ VectorRegister src, BasicType src_bt, bool is_signed) {
assert(type2aelembytes(dst_bt) > type2aelembytes(src_bt) && type2aelembytes(dst_bt) <= 8 && type2aelembytes(src_bt) <= 4, "invalid element size");
assert(dst_bt != T_FLOAT && dst_bt != T_DOUBLE && src_bt != T_FLOAT && src_bt != T_DOUBLE, "unsupported element type");
// https://github.com/riscv/riscv-v-spec/blob/master/v-spec.adoc#52-vector-operands
@@ -2801,28 +2801,54 @@ void C2_MacroAssembler::integer_extend_v(VectorRegister dst, BasicType dst_bt, u
assert_different_registers(dst, src);
vsetvli_helper(dst_bt, vector_length);
- if (src_bt == T_BYTE) {
- switch (dst_bt) {
- case T_SHORT:
+ if (is_signed) {
+ if (src_bt == T_BYTE) {
+ switch (dst_bt) {
+ case T_SHORT:
+ vsext_vf2(dst, src);
+ break;
+ case T_INT:
+ vsext_vf4(dst, src);
+ break;
+ case T_LONG:
+ vsext_vf8(dst, src);
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ } else if (src_bt == T_SHORT) {
+ if (dst_bt == T_INT) {
+ vsext_vf2(dst, src);
+ } else {
+ vsext_vf4(dst, src);
+ }
+ } else if (src_bt == T_INT) {
vsext_vf2(dst, src);
- break;
- case T_INT:
- vsext_vf4(dst, src);
- break;
- case T_LONG:
- vsext_vf8(dst, src);
- break;
- default:
- ShouldNotReachHere();
}
- } else if (src_bt == T_SHORT) {
- if (dst_bt == T_INT) {
- vsext_vf2(dst, src);
- } else {
- vsext_vf4(dst, src);
+ } else {
+ if (src_bt == T_BYTE) {
+ switch (dst_bt) {
+ case T_SHORT:
+ vzext_vf2(dst, src);
+ break;
+ case T_INT:
+ vzext_vf4(dst, src);
+ break;
+ case T_LONG:
+ vzext_vf8(dst, src);
+ break;
+ default:
+ ShouldNotReachHere();
+ }
+ } else if (src_bt == T_SHORT) {
+ if (dst_bt == T_INT) {
+ vzext_vf2(dst, src);
+ } else {
+ vzext_vf4(dst, src);
+ }
+ } else if (src_bt == T_INT) {
+ vzext_vf2(dst, src);
}
- } else if (src_bt == T_INT) {
- vsext_vf2(dst, src);
}
}
diff --git a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
index e1eb23d7c6808..150a8e4f8bc50 100644
--- a/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
+++ b/src/hotspot/cpu/riscv/c2_MacroAssembler_riscv.hpp
@@ -276,7 +276,7 @@
}
void integer_extend_v(VectorRegister dst, BasicType dst_bt, uint vector_length,
- VectorRegister src, BasicType src_bt);
+ VectorRegister src, BasicType src_bt, bool is_signed);
void integer_narrow_v(VectorRegister dst, BasicType dst_bt, uint vector_length,
VectorRegister src, BasicType src_bt);
diff --git a/src/hotspot/cpu/riscv/riscv_v.ad b/src/hotspot/cpu/riscv/riscv_v.ad
index a21a42fe4ae7f..25ad0ba39ea22 100644
--- a/src/hotspot/cpu/riscv/riscv_v.ad
+++ b/src/hotspot/cpu/riscv/riscv_v.ad
@@ -3189,7 +3189,7 @@ instruct vblend(vReg dst, vReg src1, vReg src2, vRegMask_V0 v0) %{
// ------------------------------ Vector cast ----------------------------------
-// VectorCastB2X
+// VectorCastB2X, VectorUCastB2X
instruct vcvtBtoX(vReg dst, vReg src) %{
match(Set dst (VectorCastB2X src));
@@ -3199,18 +3199,36 @@ instruct vcvtBtoX(vReg dst, vReg src) %{
BasicType bt = Matcher::vector_element_basic_type(this);
if (is_floating_point_type(bt)) {
__ integer_extend_v(as_VectorRegister($dst$$reg), bt == T_FLOAT ? T_INT : T_LONG,
- Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE);
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE,
+ true /* is_signed */);
__ csrwi(CSR_FRM, C2_MacroAssembler::rne);
__ vfcvt_f_x_v(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg));
} else {
__ integer_extend_v(as_VectorRegister($dst$$reg), bt,
- Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE);
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE,
+ true /* is_signed */);
}
%}
ins_pipe(pipe_slow);
%}
-// VectorCastS2X
+instruct vcvtUBtoX(vReg dst, vReg src) %{
+ predicate(Matcher::vector_element_basic_type(n) == T_SHORT ||
+ Matcher::vector_element_basic_type(n) == T_INT ||
+ Matcher::vector_element_basic_type(n) == T_LONG);
+ match(Set dst (VectorUCastB2X src));
+ effect(TEMP_DEF dst);
+ format %{ "vcvtUBtoX $dst, $src" %}
+ ins_encode %{
+ BasicType bt = Matcher::vector_element_basic_type(this);
+ __ integer_extend_v(as_VectorRegister($dst$$reg), bt,
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_BYTE,
+ false /* is_signed */);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+// VectorCastS2X, VectorUCastS2X
instruct vcvtStoB(vReg dst, vReg src) %{
predicate(Matcher::vector_element_basic_type(n) == T_BYTE);
@@ -3223,29 +3241,31 @@ instruct vcvtStoB(vReg dst, vReg src) %{
ins_pipe(pipe_slow);
%}
-instruct vcvtStoX_extend(vReg dst, vReg src) %{
+instruct vcvtStoX(vReg dst, vReg src) %{
predicate((Matcher::vector_element_basic_type(n) == T_INT ||
Matcher::vector_element_basic_type(n) == T_LONG));
match(Set dst (VectorCastS2X src));
effect(TEMP_DEF dst);
- format %{ "vcvtStoX_extend $dst, $src" %}
+ format %{ "vcvtStoX $dst, $src" %}
ins_encode %{
__ integer_extend_v(as_VectorRegister($dst$$reg), Matcher::vector_element_basic_type(this),
- Matcher::vector_length(this), as_VectorRegister($src$$reg), T_SHORT);
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_SHORT,
+ true /* is_signed */);
%}
ins_pipe(pipe_slow);
%}
-instruct vcvtStoX_fp_extend(vReg dst, vReg src) %{
+instruct vcvtStoX_fp(vReg dst, vReg src) %{
predicate((Matcher::vector_element_basic_type(n) == T_FLOAT ||
Matcher::vector_element_basic_type(n) == T_DOUBLE));
match(Set dst (VectorCastS2X src));
effect(TEMP_DEF dst);
- format %{ "vcvtStoX_fp_extend $dst, $src" %}
+ format %{ "vcvtStoX_fp $dst, $src" %}
ins_encode %{
BasicType bt = Matcher::vector_element_basic_type(this);
__ integer_extend_v(as_VectorRegister($dst$$reg), (bt == T_FLOAT ? T_INT : T_LONG),
- Matcher::vector_length(this), as_VectorRegister($src$$reg), T_SHORT);
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_SHORT,
+ true /* is_signed */);
__ vsetvli_helper(bt, Matcher::vector_length(this));
__ csrwi(CSR_FRM, C2_MacroAssembler::rne);
__ vfcvt_f_x_v(as_VectorRegister($dst$$reg), as_VectorRegister($dst$$reg));
@@ -3253,7 +3273,22 @@ instruct vcvtStoX_fp_extend(vReg dst, vReg src) %{
ins_pipe(pipe_slow);
%}
-// VectorCastI2X
+
+instruct vcvtUStoX(vReg dst, vReg src) %{
+ predicate(Matcher::vector_element_basic_type(n) == T_INT ||
+ Matcher::vector_element_basic_type(n) == T_LONG);
+ match(Set dst (VectorUCastS2X src));
+ effect(TEMP_DEF dst);
+ format %{ "vcvtUStoX $dst, $src" %}
+ ins_encode %{
+ __ integer_extend_v(as_VectorRegister($dst$$reg), Matcher::vector_element_basic_type(this),
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_SHORT,
+ false /* is_signed */);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+// VectorCastI2X, VectorUCastI2X
instruct vcvtItoX_narrow(vReg dst, vReg src) %{
predicate((Matcher::vector_element_basic_type(n) == T_BYTE ||
@@ -3275,7 +3310,21 @@ instruct vcvtItoL(vReg dst, vReg src) %{
format %{ "vcvtItoL $dst, $src" %}
ins_encode %{
__ integer_extend_v(as_VectorRegister($dst$$reg), T_LONG,
- Matcher::vector_length(this), as_VectorRegister($src$$reg), T_INT);
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_INT,
+ true /* is_signed */);
+ %}
+ ins_pipe(pipe_slow);
+%}
+
+instruct vcvtUItoL(vReg dst, vReg src) %{
+ predicate(Matcher::vector_element_basic_type(n) == T_LONG);
+ match(Set dst (VectorUCastI2X src));
+ effect(TEMP_DEF dst);
+ format %{ "vcvtUItoL $dst, $src" %}
+ ins_encode %{
+ __ integer_extend_v(as_VectorRegister($dst$$reg), T_LONG,
+ Matcher::vector_length(this), as_VectorRegister($src$$reg), T_INT,
+ false /* is_signed */);
%}
ins_pipe(pipe_slow);
%}
diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastRVV.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastRVV.java
new file mode 100644
index 0000000000000..ebcd4a727f0e2
--- /dev/null
+++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/TestVectorCastRVV.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package compiler.vectorapi.reshape;
+
+import compiler.vectorapi.reshape.tests.TestVectorCast;
+import compiler.vectorapi.reshape.utils.TestCastMethods;
+import compiler.vectorapi.reshape.utils.VectorReshapeHelper;
+
+/*
+ * @test
+ * @bug 8321021 8321023 8321024
+ * @key randomness
+ * @modules jdk.incubator.vector
+ * @modules java.base/jdk.internal.misc
+ * @summary Test that vector cast intrinsics work as intended on riscv (rvv).
+ * @requires os.arch == "riscv64" & vm.cpu.features ~= ".*v,.*"
+ * @library /test/lib /
+ * @run main/timeout=300 compiler.vectorapi.reshape.TestVectorCastRVV
+ */
+public class TestVectorCastRVV {
+ public static void main(String[] args) {
+ VectorReshapeHelper.runMainHelper(
+ TestVectorCast.class,
+ TestCastMethods.RVV_CAST_TESTS.stream(),
+ "-XX:+UseRVV");
+ }
+}
+
diff --git a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
index ce27fe1306289..6cdd3754c09e2 100644
--- a/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
+++ b/test/hotspot/jtreg/compiler/vectorapi/reshape/utils/TestCastMethods.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021, 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
@@ -33,6 +33,476 @@
* The cast intrinsics implemented on each platform.
*/
public class TestCastMethods {
+ public static final List RVV_CAST_TESTS = List.of(
+ // ====== from B ======
+ // from B 64
+ // to X 64
+ makePair(BSPEC64, SSPEC64),
+ makePair(BSPEC64, SSPEC64, true),
+ // to X 128
+ makePair(BSPEC64, SSPEC128),
+ makePair(BSPEC64, SSPEC128, true),
+ makePair(BSPEC64, ISPEC128),
+ makePair(BSPEC64, ISPEC128, true),
+ makePair(BSPEC64, FSPEC128),
+ // to X 256
+ makePair(BSPEC64, SSPEC256),
+ makePair(BSPEC64, SSPEC256, true),
+ makePair(BSPEC64, ISPEC256),
+ makePair(BSPEC64, ISPEC256, true),
+ makePair(BSPEC64, LSPEC256),
+ makePair(BSPEC64, LSPEC256, true),
+ makePair(BSPEC64, FSPEC256),
+ makePair(BSPEC64, DSPEC256),
+ // to X 512
+ makePair(BSPEC64, SSPEC512),
+ makePair(BSPEC64, SSPEC512, true),
+ makePair(BSPEC64, ISPEC512),
+ makePair(BSPEC64, ISPEC512, true),
+ makePair(BSPEC64, LSPEC512),
+ makePair(BSPEC64, LSPEC512, true),
+ makePair(BSPEC64, FSPEC512),
+ makePair(BSPEC64, DSPEC512),
+
+ // from B 128
+ // to X 64
+ makePair(BSPEC128, SSPEC64),
+ makePair(BSPEC128, SSPEC64, true),
+ // to X 128
+ makePair(BSPEC128, SSPEC128),
+ makePair(BSPEC128, SSPEC128, true),
+ makePair(BSPEC128, ISPEC128),
+ makePair(BSPEC128, ISPEC128, true),
+ makePair(BSPEC128, FSPEC128),
+ // to X 256
+ makePair(BSPEC128, SSPEC256),
+ makePair(BSPEC128, SSPEC256, true),
+ makePair(BSPEC128, ISPEC256),
+ makePair(BSPEC128, ISPEC256, true),
+ makePair(BSPEC128, LSPEC256),
+ makePair(BSPEC128, LSPEC256, true),
+ makePair(BSPEC128, FSPEC256),
+ makePair(BSPEC128, DSPEC256),
+ // to X 512
+ makePair(BSPEC128, SSPEC512),
+ makePair(BSPEC128, SSPEC512, true),
+ makePair(BSPEC128, ISPEC512),
+ makePair(BSPEC128, ISPEC512, true),
+ makePair(BSPEC128, LSPEC512),
+ makePair(BSPEC128, LSPEC512, true),
+ makePair(BSPEC128, FSPEC512),
+ makePair(BSPEC128, DSPEC512),
+
+ // from B 256
+ // to X 64
+ makePair(BSPEC256, SSPEC64),
+ makePair(BSPEC256, SSPEC64, true),
+ // to X 128
+ makePair(BSPEC256, SSPEC128),
+ makePair(BSPEC256, SSPEC128, true),
+ makePair(BSPEC256, ISPEC128),
+ makePair(BSPEC256, ISPEC128, true),
+ makePair(BSPEC256, FSPEC128),
+ // to X 256
+ makePair(BSPEC256, SSPEC256),
+ makePair(BSPEC256, SSPEC256, true),
+ makePair(BSPEC256, ISPEC256),
+ makePair(BSPEC256, ISPEC256, true),
+ makePair(BSPEC256, LSPEC256),
+ makePair(BSPEC256, LSPEC256, true),
+ makePair(BSPEC256, FSPEC256),
+ makePair(BSPEC256, DSPEC256),
+ // to X 512
+ makePair(BSPEC256, SSPEC512),
+ makePair(BSPEC256, SSPEC512, true),
+ makePair(BSPEC256, ISPEC512),
+ makePair(BSPEC256, ISPEC512, true),
+ makePair(BSPEC256, LSPEC512),
+ makePair(BSPEC256, LSPEC512, true),
+ makePair(BSPEC256, FSPEC512),
+ makePair(BSPEC256, DSPEC512),
+
+
+ // ====== from S ======
+ // from S 64
+ // to X 64
+ makePair(SSPEC64, BSPEC64),
+ // to X 128
+ makePair(SSPEC64, BSPEC128),
+ makePair(SSPEC64, ISPEC128),
+ makePair(SSPEC64, ISPEC128, true),
+ makePair(SSPEC64, FSPEC128),
+ // to X 256
+ makePair(SSPEC64, BSPEC256),
+ makePair(SSPEC64, ISPEC256),
+ makePair(SSPEC64, ISPEC256, true),
+ makePair(SSPEC64, LSPEC256),
+ makePair(SSPEC64, LSPEC256, true),
+ makePair(SSPEC64, FSPEC256),
+ makePair(SSPEC64, DSPEC256),
+ // to X 512
+ makePair(SSPEC64, BSPEC512),
+ makePair(SSPEC64, ISPEC512),
+ makePair(SSPEC64, ISPEC512, true),
+ makePair(SSPEC64, LSPEC512),
+ makePair(SSPEC64, LSPEC512, true),
+ makePair(SSPEC64, FSPEC512),
+ makePair(SSPEC64, DSPEC512),
+
+ // from S 128
+ // to X 64
+ makePair(SSPEC128, BSPEC64),
+ // to X 128
+ makePair(SSPEC128, BSPEC128),
+ makePair(SSPEC128, ISPEC128),
+ makePair(SSPEC128, ISPEC128, true),
+ makePair(SSPEC128, FSPEC128),
+ // to X 256
+ makePair(SSPEC128, BSPEC256),
+ makePair(SSPEC128, ISPEC256),
+ makePair(SSPEC128, ISPEC256, true),
+ makePair(SSPEC128, LSPEC256),
+ makePair(SSPEC128, LSPEC256, true),
+ makePair(SSPEC128, FSPEC256),
+ makePair(SSPEC128, DSPEC256),
+ // to X 512
+ makePair(SSPEC128, BSPEC512),
+ makePair(SSPEC128, ISPEC512),
+ makePair(SSPEC128, ISPEC512, true),
+ makePair(SSPEC128, LSPEC512),
+ makePair(SSPEC128, LSPEC512, true),
+ makePair(SSPEC128, FSPEC512),
+ makePair(SSPEC128, DSPEC512),
+
+ // from S 256
+ // to X 64
+ makePair(SSPEC256, BSPEC64),
+ // to X 128
+ makePair(SSPEC256, BSPEC128),
+ makePair(SSPEC256, ISPEC128),
+ makePair(SSPEC256, ISPEC128, true),
+ makePair(SSPEC256, FSPEC128),
+ // to X 256
+ makePair(SSPEC256, BSPEC256),
+ makePair(SSPEC256, ISPEC256),
+ makePair(SSPEC256, ISPEC256, true),
+ makePair(SSPEC256, LSPEC256),
+ makePair(SSPEC256, LSPEC256, true),
+ makePair(SSPEC256, FSPEC256),
+ makePair(SSPEC256, DSPEC256),
+ // to X 512
+ makePair(SSPEC256, BSPEC512),
+ makePair(SSPEC256, ISPEC512),
+ makePair(SSPEC256, ISPEC512, true),
+ makePair(SSPEC256, LSPEC512),
+ makePair(SSPEC256, LSPEC512, true),
+ makePair(SSPEC256, FSPEC512),
+ makePair(SSPEC256, DSPEC512),
+
+ // from S 512
+ // to X 64
+ makePair(SSPEC512, BSPEC64),
+ // to X 128
+ makePair(SSPEC512, BSPEC128),
+ makePair(SSPEC512, ISPEC128),
+ makePair(SSPEC512, ISPEC128, true),
+ makePair(SSPEC512, FSPEC128),
+ // to X 256
+ makePair(SSPEC512, BSPEC256),
+ makePair(SSPEC512, ISPEC256),
+ makePair(SSPEC512, ISPEC256, true),
+ makePair(SSPEC512, LSPEC256),
+ makePair(SSPEC512, LSPEC256, true),
+ makePair(SSPEC512, FSPEC256),
+ makePair(SSPEC512, DSPEC256),
+ // to X 512
+ makePair(SSPEC512, BSPEC512),
+ makePair(SSPEC512, ISPEC512),
+ makePair(SSPEC512, ISPEC512, true),
+ makePair(SSPEC512, LSPEC512),
+ makePair(SSPEC512, LSPEC512, true),
+ makePair(SSPEC512, FSPEC512),
+ makePair(SSPEC512, DSPEC512),
+
+
+ // ====== from I ======
+ // from I 64
+ // to X 64
+ makePair(ISPEC64, FSPEC64),
+ // to X 128
+ makePair(ISPEC64, LSPEC128),
+ makePair(ISPEC64, LSPEC128, true),
+ makePair(ISPEC64, FSPEC128),
+ makePair(ISPEC64, DSPEC128),
+
+ // from I 128
+ // to X 64
+ makePair(ISPEC128, BSPEC64),
+ makePair(ISPEC128, SSPEC64),
+ makePair(ISPEC128, FSPEC64),
+ // to X 128
+ makePair(ISPEC128, BSPEC128),
+ makePair(ISPEC128, SSPEC128),
+ makePair(ISPEC128, LSPEC128),
+ makePair(ISPEC128, LSPEC128, true),
+ makePair(ISPEC128, FSPEC128),
+ makePair(ISPEC128, DSPEC128),
+ // to X 256
+ makePair(ISPEC128, BSPEC256),
+ makePair(ISPEC128, SSPEC256),
+ makePair(ISPEC128, LSPEC256),
+ makePair(ISPEC128, LSPEC256, true),
+ makePair(ISPEC128, FSPEC256),
+ makePair(ISPEC128, DSPEC256),
+
+ // from I 256
+ // to X 64
+ makePair(ISPEC256, BSPEC64),
+ makePair(ISPEC256, SSPEC64),
+ makePair(ISPEC256, FSPEC64),
+ // to X 128
+ makePair(ISPEC256, BSPEC128),
+ makePair(ISPEC256, SSPEC128),
+ makePair(ISPEC256, LSPEC128),
+ makePair(ISPEC256, LSPEC128, true),
+ makePair(ISPEC256, FSPEC128),
+ makePair(ISPEC256, DSPEC128),
+ // to X 256
+ makePair(ISPEC256, BSPEC256),
+ makePair(ISPEC256, SSPEC256),
+ makePair(ISPEC256, LSPEC256),
+ makePair(ISPEC256, LSPEC256, true),
+ makePair(ISPEC256, FSPEC256),
+ makePair(ISPEC256, DSPEC256),
+
+ // from I 512
+ // to X 64
+ makePair(ISPEC512, BSPEC64),
+ makePair(ISPEC512, SSPEC64),
+ makePair(ISPEC512, FSPEC64),
+ // to X 128
+ makePair(ISPEC512, BSPEC128),
+ makePair(ISPEC512, SSPEC128),
+ makePair(ISPEC512, LSPEC128),
+ makePair(ISPEC512, LSPEC128, true),
+ makePair(ISPEC512, FSPEC128),
+ makePair(ISPEC512, DSPEC128),
+ // to X 256
+ makePair(ISPEC512, BSPEC256),
+ makePair(ISPEC512, SSPEC256),
+ makePair(ISPEC512, LSPEC256),
+ makePair(ISPEC512, LSPEC256, true),
+ makePair(ISPEC512, FSPEC256),
+ makePair(ISPEC512, DSPEC256),
+
+
+ // ====== from L ======
+ // from L 128
+ // to X 64
+ makePair(LSPEC128, ISPEC64),
+ makePair(LSPEC128, FSPEC64),
+ makePair(LSPEC128, DSPEC64),
+ // to X 128
+ makePair(LSPEC128, ISPEC128),
+ makePair(LSPEC128, FSPEC128),
+ makePair(LSPEC128, DSPEC128),
+ // to X 256
+ makePair(LSPEC128, ISPEC256),
+ makePair(LSPEC128, FSPEC256),
+ makePair(LSPEC128, DSPEC256),
+ // to X 512
+ makePair(LSPEC128, ISPEC512),
+ makePair(LSPEC128, FSPEC512),
+ makePair(LSPEC128, DSPEC512),
+
+ // from L 256
+ // to X 64
+ makePair(LSPEC256, BSPEC64),
+ makePair(LSPEC256, SSPEC64),
+ makePair(LSPEC256, ISPEC64),
+ makePair(LSPEC256, FSPEC64),
+ // to X 128
+ makePair(LSPEC256, BSPEC128),
+ makePair(LSPEC256, SSPEC128),
+ makePair(LSPEC256, ISPEC128),
+ makePair(LSPEC256, FSPEC128),
+ makePair(LSPEC256, DSPEC128),
+ // to X 256
+ makePair(LSPEC256, BSPEC256),
+ makePair(LSPEC256, SSPEC256),
+ makePair(LSPEC256, ISPEC256),
+ makePair(LSPEC256, FSPEC256),
+ makePair(LSPEC256, DSPEC256),
+ // to X 512
+ makePair(LSPEC256, BSPEC512),
+ makePair(LSPEC256, SSPEC512),
+ makePair(LSPEC256, ISPEC512),
+ makePair(LSPEC256, FSPEC512),
+ makePair(LSPEC256, DSPEC512),
+
+ // from L 512
+ // to X 64
+ makePair(LSPEC512, BSPEC64),
+ makePair(LSPEC512, SSPEC64),
+ makePair(LSPEC512, ISPEC64),
+ makePair(LSPEC512, FSPEC64),
+ // to X 128
+ makePair(LSPEC512, BSPEC128),
+ makePair(LSPEC512, SSPEC128),
+ makePair(LSPEC512, ISPEC128),
+ makePair(LSPEC512, FSPEC128),
+ makePair(LSPEC512, DSPEC128),
+ // to X 256
+ makePair(LSPEC512, BSPEC256),
+ makePair(LSPEC512, SSPEC256),
+ makePair(LSPEC512, ISPEC256),
+ makePair(LSPEC512, FSPEC256),
+ makePair(LSPEC512, DSPEC256),
+ // to X 512
+ makePair(LSPEC512, BSPEC512),
+ makePair(LSPEC512, SSPEC512),
+ makePair(LSPEC512, ISPEC512),
+ makePair(LSPEC512, FSPEC512),
+ makePair(LSPEC512, DSPEC512),
+
+
+ // ====== from F ======
+ // from F 64
+ // to X 64
+ makePair(FSPEC64, ISPEC64),
+ // to X 128
+ makePair(FSPEC64, ISPEC128),
+ makePair(FSPEC64, LSPEC128),
+ makePair(FSPEC64, DSPEC128),
+
+ // from F 128
+ // to X 64
+ makePair(FSPEC128, BSPEC64),
+ makePair(FSPEC128, SSPEC64),
+ makePair(FSPEC128, ISPEC64),
+ // to X 128
+ makePair(FSPEC128, BSPEC128),
+ makePair(FSPEC128, SSPEC128),
+ makePair(FSPEC128, ISPEC128),
+ makePair(FSPEC128, LSPEC128),
+ makePair(FSPEC128, DSPEC128),
+ // to X 256
+ makePair(FSPEC128, BSPEC256),
+ makePair(FSPEC128, SSPEC256),
+ makePair(FSPEC128, ISPEC256),
+ makePair(FSPEC128, LSPEC256),
+ makePair(FSPEC128, DSPEC256),
+
+ // from F 256
+ // to X 64
+ makePair(FSPEC256, BSPEC64),
+ makePair(FSPEC256, SSPEC64),
+ makePair(FSPEC256, ISPEC64),
+ // to X 128
+ makePair(FSPEC256, BSPEC128),
+ makePair(FSPEC256, SSPEC128),
+ makePair(FSPEC256, ISPEC128),
+ makePair(FSPEC256, LSPEC128),
+ makePair(FSPEC256, DSPEC128),
+ // to X 256
+ makePair(FSPEC256, BSPEC256),
+ makePair(FSPEC256, SSPEC256),
+ makePair(FSPEC256, ISPEC256),
+ makePair(FSPEC256, LSPEC256),
+ makePair(FSPEC256, DSPEC256),
+
+ // from F 512
+ // to X 64
+ makePair(FSPEC512, BSPEC64),
+ makePair(FSPEC512, SSPEC64),
+ makePair(FSPEC512, ISPEC64),
+ // to X 128
+ makePair(FSPEC512, BSPEC128),
+ makePair(FSPEC512, SSPEC128),
+ makePair(FSPEC512, ISPEC128),
+ makePair(FSPEC512, LSPEC128),
+ makePair(FSPEC512, DSPEC128),
+ // to X 256
+ makePair(FSPEC512, BSPEC256),
+ makePair(FSPEC512, SSPEC256),
+ makePair(FSPEC512, ISPEC256),
+ makePair(FSPEC512, LSPEC256),
+ makePair(FSPEC512, DSPEC256),
+
+
+ // ====== from D ======
+ // from D 128
+ // to X 64
+ makePair(DSPEC128, ISPEC64),
+ makePair(DSPEC128, LSPEC64),
+ makePair(DSPEC128, FSPEC64),
+ // to X 128
+ makePair(DSPEC128, ISPEC128),
+ makePair(DSPEC128, LSPEC128),
+ makePair(DSPEC128, FSPEC128),
+ // to X 256
+ makePair(DSPEC128, ISPEC256),
+ makePair(DSPEC128, LSPEC256),
+ makePair(DSPEC128, FSPEC256),
+ // to X 512
+ makePair(DSPEC128, ISPEC512),
+ makePair(DSPEC128, LSPEC512),
+ makePair(DSPEC128, FSPEC512),
+
+ // from D 256
+ // to X 64
+ makePair(DSPEC256, BSPEC64),
+ makePair(DSPEC256, SSPEC64),
+ makePair(DSPEC256, ISPEC64),
+ makePair(DSPEC256, LSPEC64),
+ makePair(DSPEC256, FSPEC64),
+ // to X 128
+ makePair(DSPEC256, BSPEC128),
+ makePair(DSPEC256, SSPEC128),
+ makePair(DSPEC256, ISPEC128),
+ makePair(DSPEC256, LSPEC128),
+ makePair(DSPEC256, FSPEC128),
+ // to X 256
+ makePair(DSPEC256, BSPEC256),
+ makePair(DSPEC256, SSPEC256),
+ makePair(DSPEC256, ISPEC256),
+ makePair(DSPEC256, LSPEC256),
+ makePair(DSPEC256, FSPEC256),
+ // to X 512
+ makePair(DSPEC256, BSPEC512),
+ makePair(DSPEC256, SSPEC512),
+ makePair(DSPEC256, ISPEC512),
+ makePair(DSPEC256, LSPEC512),
+ makePair(DSPEC256, FSPEC512),
+
+ // from D 512
+ // to X 64
+ makePair(DSPEC512, BSPEC64),
+ makePair(DSPEC512, SSPEC64),
+ makePair(DSPEC512, ISPEC64),
+ makePair(DSPEC512, LSPEC64),
+ makePair(DSPEC512, FSPEC64),
+ // to X 128
+ makePair(DSPEC512, BSPEC128),
+ makePair(DSPEC512, SSPEC128),
+ makePair(DSPEC512, ISPEC128),
+ makePair(DSPEC512, LSPEC128),
+ makePair(DSPEC512, FSPEC128),
+ // to X 256
+ makePair(DSPEC512, BSPEC256),
+ makePair(DSPEC512, SSPEC256),
+ makePair(DSPEC512, ISPEC256),
+ makePair(DSPEC512, LSPEC256),
+ makePair(DSPEC512, FSPEC256),
+ // to X 512
+ makePair(DSPEC512, BSPEC512),
+ makePair(DSPEC512, SSPEC512),
+ makePair(DSPEC512, ISPEC512),
+ makePair(DSPEC512, LSPEC512),
+ makePair(DSPEC512, FSPEC512)
+
+ );
+
public static final List AVX1_CAST_TESTS = List.of(
makePair(BSPEC64, SSPEC64),
makePair(BSPEC64, SSPEC128),
From 6f8b0a33fa15f1dfc8b0c116375df0f90d9d8759 Mon Sep 17 00:00:00 2001
From: Long Yang
Date: Thu, 14 Mar 2024 11:25:06 +0000
Subject: [PATCH 45/58] 8327799: JFR view: the "Park Until" field of
jdk.ThreadPark is invalid if the parking method is not absolute
Reviewed-by: egahlin
---
.../share/classes/jdk/jfr/internal/util/ValueFormatter.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/ValueFormatter.java b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/ValueFormatter.java
index 84b108b3d70fb..8fd47dbf5b3c7 100644
--- a/src/jdk.jfr/share/classes/jdk/jfr/internal/util/ValueFormatter.java
+++ b/src/jdk.jfr/share/classes/jdk/jfr/internal/util/ValueFormatter.java
@@ -343,6 +343,9 @@ public static List decodeDescriptors(String descriptor, String arraySize
}
public static String formatTimestamp(Instant instant) {
+ if (Instant.MIN.equals(instant)) {
+ return "N/A";
+ }
return LocalTime.ofInstant(instant, ZoneId.systemDefault()).format(DATE_FORMAT);
}
}
From 954c50ed88f5daa13d6c7d3cb5910e813c30315c Mon Sep 17 00:00:00 2001
From: Albert Mingkun Yang
Date: Thu, 14 Mar 2024 11:44:24 +0000
Subject: [PATCH 46/58] 8327997: G1: Move
G1ScanClosureBase::reference_iteration_mode to subclass
Reviewed-by: gli, tschatzl, sjohanss
---
src/hotspot/share/gc/g1/g1OopClosures.hpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/hotspot/share/gc/g1/g1OopClosures.hpp b/src/hotspot/share/gc/g1/g1OopClosures.hpp
index f585dbdeb2dd1..16e086e982a77 100644
--- a/src/hotspot/share/gc/g1/g1OopClosures.hpp
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp
@@ -54,8 +54,6 @@ class G1ScanClosureBase : public BasicOopIterateClosure {
template
inline void handle_non_cset_obj_common(G1HeapRegionAttr const region_attr, T* p, oop const obj);
public:
- virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
-
inline void trim_queue_partially();
};
@@ -68,6 +66,8 @@ class G1ScanCardClosure : public G1ScanClosureBase {
size_t& heap_roots_found) :
G1ScanClosureBase(g1h, pss), _heap_roots_found(heap_roots_found) { }
+ virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
+
template void do_oop_work(T* p);
virtual void do_oop(narrowOop* p) { do_oop_work(p); }
virtual void do_oop(oop* p) { do_oop_work(p); }
From c879627dbd7e9295d44f19ef237edb5de10805d5 Mon Sep 17 00:00:00 2001
From: Dmitry Chuyko
Date: Thu, 14 Mar 2024 12:38:48 +0000
Subject: [PATCH 47/58] 8309271: A way to align already compiled methods with
compiler directives
Reviewed-by: apangin, sspitsyn, tholenstein
---
src/hotspot/share/ci/ciEnv.cpp | 20 ++-
src/hotspot/share/code/codeCache.cpp | 62 ++++++++
src/hotspot/share/code/codeCache.hpp | 3 +
src/hotspot/share/compiler/compileBroker.cpp | 27 ++--
src/hotspot/share/compiler/compileTask.hpp | 4 +-
.../share/compiler/compilerDirectives.cpp | 19 +++
.../share/compiler/compilerDirectives.hpp | 1 +
src/hotspot/share/oops/method.hpp | 8 +
src/hotspot/share/oops/methodFlags.hpp | 1 +
src/hotspot/share/runtime/mutexLocker.cpp | 2 +-
.../share/services/diagnosticCommand.cpp | 67 ++++++++-
.../share/services/diagnosticCommand.hpp | 41 +++++-
.../compiler/CompilerDirectivesDCMDTest.java | 10 +-
.../dcmd/compiler/DirectivesRefreshTest.java | 138 ++++++++++++++++++
.../dcmd/compiler/refresh_control.txt | 8 +
15 files changed, 378 insertions(+), 33 deletions(-)
create mode 100644 test/hotspot/jtreg/serviceability/dcmd/compiler/DirectivesRefreshTest.java
create mode 100644 test/hotspot/jtreg/serviceability/dcmd/compiler/refresh_control.txt
diff --git a/src/hotspot/share/ci/ciEnv.cpp b/src/hotspot/share/ci/ciEnv.cpp
index b7db2a6860f4f..caf92cd0bfcba 100644
--- a/src/hotspot/share/ci/ciEnv.cpp
+++ b/src/hotspot/share/ci/ciEnv.cpp
@@ -1141,17 +1141,15 @@ void ciEnv::register_method(ciMethod* target,
#endif
if (entry_bci == InvocationEntryBci) {
- if (TieredCompilation) {
- // If there is an old version we're done with it
- CompiledMethod* old = method->code();
- if (TraceMethodReplacement && old != nullptr) {
- ResourceMark rm;
- char *method_name = method->name_and_sig_as_C_string();
- tty->print_cr("Replacing method %s", method_name);
- }
- if (old != nullptr) {
- old->make_not_used();
- }
+ // If there is an old version we're done with it
+ CompiledMethod* old = method->code();
+ if (TraceMethodReplacement && old != nullptr) {
+ ResourceMark rm;
+ char *method_name = method->name_and_sig_as_C_string();
+ tty->print_cr("Replacing method %s", method_name);
+ }
+ if (old != nullptr) {
+ old->make_not_used();
}
LogTarget(Info, nmethod, install) lt;
diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp
index d56de671a1352..9c0fa80cab53d 100644
--- a/src/hotspot/share/code/codeCache.cpp
+++ b/src/hotspot/share/code/codeCache.cpp
@@ -34,6 +34,7 @@
#include "compiler/compilationPolicy.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/compilerDefinitions.inline.hpp"
+#include "compiler/compilerDirectives.hpp"
#include "compiler/oopMap.hpp"
#include "gc/shared/barrierSetNMethod.hpp"
#include "gc/shared/classUnloadingContext.hpp"
@@ -1359,6 +1360,67 @@ void CodeCache::mark_all_nmethods_for_evol_deoptimization(DeoptimizationScope* d
#endif // INCLUDE_JVMTI
+void CodeCache::mark_directives_matches(bool top_only) {
+ MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+ Thread *thread = Thread::current();
+ HandleMark hm(thread);
+
+ CompiledMethodIterator iter(CompiledMethodIterator::only_not_unloading);
+ while(iter.next()) {
+ CompiledMethod* nm = iter.method();
+ methodHandle mh(thread, nm->method());
+ if (DirectivesStack::hasMatchingDirectives(mh, top_only)) {
+ ResourceMark rm;
+ log_trace(codecache)("Mark because of matching directives %s", mh->external_name());
+ mh->set_has_matching_directives();
+ }
+ }
+}
+
+void CodeCache::recompile_marked_directives_matches() {
+ Thread *thread = Thread::current();
+ HandleMark hm(thread);
+
+ // Try the max level and let the directives be applied during the compilation.
+ int comp_level = CompilationPolicy::highest_compile_level();
+ RelaxedCompiledMethodIterator iter(RelaxedCompiledMethodIterator::only_not_unloading);
+ while(iter.next()) {
+ CompiledMethod* nm = iter.method();
+ methodHandle mh(thread, nm->method());
+ if (mh->has_matching_directives()) {
+ ResourceMark rm;
+ mh->clear_directive_flags();
+ bool deopt = false;
+
+ if (!nm->is_osr_method()) {
+ log_trace(codecache)("Recompile to level %d because of matching directives %s",
+ comp_level, mh->external_name());
+ nmethod * comp_nm = CompileBroker::compile_method(mh, InvocationEntryBci, comp_level,
+ methodHandle(), 0,
+ CompileTask::Reason_DirectivesChanged,
+ (JavaThread*)thread);
+ if (comp_nm == nullptr) {
+ log_trace(codecache)("Recompilation to level %d failed, deoptimize %s",
+ comp_level, mh->external_name());
+ deopt = true;
+ }
+ } else {
+ log_trace(codecache)("Deoptimize OSR %s", mh->external_name());
+ deopt = true;
+ }
+ // For some reason the method cannot be compiled by C2, e.g. the new directives forbid it.
+ // Deoptimize the method and let the usual hotspot logic do the rest.
+ if (deopt) {
+ if (!nm->has_been_deoptimized() && nm->can_be_deoptimized()) {
+ nm->make_not_entrant();
+ nm->make_deoptimized();
+ }
+ }
+ gc_on_allocation(); // Flush unused methods from CodeCache if required.
+ }
+ }
+}
+
// Mark methods for deopt (if safe or possible).
void CodeCache::mark_all_nmethods_for_deoptimization(DeoptimizationScope* deopt_scope) {
MutexLocker mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
diff --git a/src/hotspot/share/code/codeCache.hpp b/src/hotspot/share/code/codeCache.hpp
index d1c91727bf124..eb4759d7ea469 100644
--- a/src/hotspot/share/code/codeCache.hpp
+++ b/src/hotspot/share/code/codeCache.hpp
@@ -304,6 +304,9 @@ class CodeCache : AllStatic {
static void mark_for_deoptimization(DeoptimizationScope* deopt_scope, Method* dependee);
static void make_marked_nmethods_deoptimized();
+ static void mark_directives_matches(bool top_only = false);
+ static void recompile_marked_directives_matches();
+
// Marks dependents during classloading
static void mark_dependents_on(DeoptimizationScope* deopt_scope, InstanceKlass* dependee);
diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp
index 112a15233bde3..7adb4dfc587e1 100644
--- a/src/hotspot/share/compiler/compileBroker.cpp
+++ b/src/hotspot/share/compiler/compileBroker.cpp
@@ -1171,11 +1171,13 @@ void CompileBroker::compile_method_base(const methodHandle& method,
tty->cr();
}
- // A request has been made for compilation. Before we do any
- // real work, check to see if the method has been compiled
- // in the meantime with a definitive result.
- if (compilation_is_complete(method, osr_bci, comp_level)) {
- return;
+ if (compile_reason != CompileTask::Reason_DirectivesChanged) {
+ // A request has been made for compilation. Before we do any
+ // real work, check to see if the method has been compiled
+ // in the meantime with a definitive result.
+ if (compilation_is_complete(method, osr_bci, comp_level)) {
+ return;
+ }
}
#ifndef PRODUCT
@@ -1220,11 +1222,13 @@ void CompileBroker::compile_method_base(const methodHandle& method,
return;
}
- // We need to check again to see if the compilation has
- // completed. A previous compilation may have registered
- // some result.
- if (compilation_is_complete(method, osr_bci, comp_level)) {
- return;
+ if (compile_reason != CompileTask::Reason_DirectivesChanged) {
+ // We need to check again to see if the compilation has
+ // completed. A previous compilation may have registered
+ // some result.
+ if (compilation_is_complete(method, osr_bci, comp_level)) {
+ return;
+ }
}
// We now know that this compilation is not pending, complete,
@@ -1373,7 +1377,8 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
if (osr_bci == InvocationEntryBci) {
// standard compilation
CompiledMethod* method_code = method->code();
- if (method_code != nullptr && method_code->is_nmethod()) {
+ if (method_code != nullptr && method_code->is_nmethod()
+ && (compile_reason != CompileTask::Reason_DirectivesChanged)) {
if (compilation_is_complete(method, osr_bci, comp_level)) {
return (nmethod*) method_code;
}
diff --git a/src/hotspot/share/compiler/compileTask.hpp b/src/hotspot/share/compiler/compileTask.hpp
index 43beacb03d2c6..fabfb8e04877e 100644
--- a/src/hotspot/share/compiler/compileTask.hpp
+++ b/src/hotspot/share/compiler/compileTask.hpp
@@ -62,6 +62,7 @@ class CompileTask : public CHeapObj {
Reason_Whitebox, // Whitebox API
Reason_MustBeCompiled, // Used for -Xcomp or AlwaysCompileLoopMethods (see CompilationPolicy::must_be_compiled())
Reason_Bootstrap, // JVMCI bootstrap
+ Reason_DirectivesChanged, // Changed CompilerDirectivesStack
Reason_Count
};
@@ -74,7 +75,8 @@ class CompileTask : public CHeapObj {
"replay",
"whitebox",
"must_be_compiled",
- "bootstrap"
+ "bootstrap",
+ "directives_changed"
};
return reason_names[compile_reason];
}
diff --git a/src/hotspot/share/compiler/compilerDirectives.cpp b/src/hotspot/share/compiler/compilerDirectives.cpp
index a16e5f23ed954..74a1076cc49bc 100644
--- a/src/hotspot/share/compiler/compilerDirectives.cpp
+++ b/src/hotspot/share/compiler/compilerDirectives.cpp
@@ -747,6 +747,25 @@ void DirectivesStack::release(CompilerDirectives* dir) {
}
}
+bool DirectivesStack::hasMatchingDirectives(const methodHandle& method, bool top_only) {
+ assert(_depth > 0, "Must never be empty");
+ MutexLocker locker(DirectivesStack_lock, Mutex::_no_safepoint_check_flag);
+
+ CompilerDirectives* dir = _top;
+ assert(dir != nullptr, "Must be initialized");
+
+ while (dir != nullptr) {
+ if (!dir->is_default_directive() && dir->match(method)) {
+ return true;
+ }
+ if (top_only) {
+ break;
+ }
+ dir = dir->next();
+ }
+ return false;
+}
+
DirectiveSet* DirectivesStack::getMatchingDirective(const methodHandle& method, AbstractCompiler *comp) {
assert(_depth > 0, "Must never be empty");
diff --git a/src/hotspot/share/compiler/compilerDirectives.hpp b/src/hotspot/share/compiler/compilerDirectives.hpp
index 747c878181751..6cd831c8d72a6 100644
--- a/src/hotspot/share/compiler/compilerDirectives.hpp
+++ b/src/hotspot/share/compiler/compilerDirectives.hpp
@@ -115,6 +115,7 @@ class DirectivesStack : AllStatic {
public:
static void init();
static DirectiveSet* getMatchingDirective(const methodHandle& mh, AbstractCompiler* comp);
+ static bool hasMatchingDirectives(const methodHandle& method, bool top_only = false);
static DirectiveSet* getDefaultDirective(AbstractCompiler* comp);
static void push(CompilerDirectives* directive);
static void pop(int count);
diff --git a/src/hotspot/share/oops/method.hpp b/src/hotspot/share/oops/method.hpp
index e4bff45750464..2a247ea5bb896 100644
--- a/src/hotspot/share/oops/method.hpp
+++ b/src/hotspot/share/oops/method.hpp
@@ -816,6 +816,14 @@ class Method : public Metadata {
return _method_counters;
}
+ // Clear the flags related to compiler directives that were set by the compilerBroker,
+ // because the directives can be updated.
+ void clear_directive_flags() {
+ set_has_matching_directives(false);
+ clear_is_not_c1_compilable();
+ clear_is_not_c2_compilable();
+ }
+
void clear_is_not_c1_compilable() { set_is_not_c1_compilable(false); }
void clear_is_not_c2_compilable() { set_is_not_c2_compilable(false); }
void clear_is_not_c2_osr_compilable() { set_is_not_c2_osr_compilable(false); }
diff --git a/src/hotspot/share/oops/methodFlags.hpp b/src/hotspot/share/oops/methodFlags.hpp
index 25d597b06efa8..0a5ce56599acf 100644
--- a/src/hotspot/share/oops/methodFlags.hpp
+++ b/src/hotspot/share/oops/methodFlags.hpp
@@ -58,6 +58,7 @@ class MethodFlags {
status(has_loops_flag , 1 << 13) /* Method has loops */ \
status(has_loops_flag_init , 1 << 14) /* The loop flag has been initialized */ \
status(on_stack_flag , 1 << 15) /* RedefineClasses support to keep Metadata from being cleaned */ \
+ status(has_matching_directives , 1 << 16) /* Temporary mark, used only when methods are to be refreshed to reflect a compiler directives update */ \
/* end of list */
#define M_STATUS_ENUM_NAME(name, value) _misc_##name = value,
diff --git a/src/hotspot/share/runtime/mutexLocker.cpp b/src/hotspot/share/runtime/mutexLocker.cpp
index 09976493fe9d5..1bf821fa5f694 100644
--- a/src/hotspot/share/runtime/mutexLocker.cpp
+++ b/src/hotspot/share/runtime/mutexLocker.cpp
@@ -269,7 +269,6 @@ void mutex_init() {
MUTEX_DEFN(CompiledIC_lock , PaddedMutex , nosafepoint); // locks VtableStubs_lock, InlineCacheBuffer_lock
MUTEX_DEFN(MethodCompileQueue_lock , PaddedMonitor, safepoint);
MUTEX_DEFN(CompileStatistics_lock , PaddedMutex , safepoint);
- MUTEX_DEFN(DirectivesStack_lock , PaddedMutex , nosafepoint);
MUTEX_DEFN(JvmtiThreadState_lock , PaddedMutex , safepoint); // Used by JvmtiThreadState/JvmtiEventController
MUTEX_DEFN(EscapeBarrier_lock , PaddedMonitor, nosafepoint); // Used to synchronize object reallocation/relocking triggered by JVMTI
@@ -327,6 +326,7 @@ void mutex_init() {
MUTEX_DEFL(InlineCacheBuffer_lock , PaddedMutex , CompiledIC_lock);
MUTEX_DEFL(VtableStubs_lock , PaddedMutex , CompiledIC_lock); // Also holds DumpTimeTable_lock
MUTEX_DEFL(CodeCache_lock , PaddedMonitor, VtableStubs_lock);
+ MUTEX_DEFL(DirectivesStack_lock , PaddedMutex , CodeCache_lock);
MUTEX_DEFL(CompiledMethod_lock , PaddedMutex , CodeCache_lock);
MUTEX_DEFL(Threads_lock , PaddedMonitor, CompileThread_lock, true);
diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp
index 6e6a71722901c..06fcad88d06ec 100644
--- a/src/hotspot/share/services/diagnosticCommand.cpp
+++ b/src/hotspot/share/services/diagnosticCommand.cpp
@@ -144,6 +144,7 @@ void DCmd::register_dcmds(){
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
+ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false));
@@ -923,21 +924,81 @@ void CompilerDirectivesPrintDCmd::execute(DCmdSource source, TRAPS) {
CompilerDirectivesAddDCmd::CompilerDirectivesAddDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
- _filename("filename","Name of the directives file", "STRING",true) {
+ _filename("filename", "Name of the directives file", "STRING", true),
+ _refresh("-r", "Refresh affected methods", "BOOLEAN", false, "false") {
+
_dcmdparser.add_dcmd_argument(&_filename);
+ _dcmdparser.add_dcmd_option(&_refresh);
}
void CompilerDirectivesAddDCmd::execute(DCmdSource source, TRAPS) {
DirectivesParser::parse_from_file(_filename.value(), output(), true);
+ if (_refresh.value()) {
+ CodeCache::mark_directives_matches(true);
+ CodeCache::recompile_marked_directives_matches();
+ }
+}
+
+CompilerDirectivesReplaceDCmd::CompilerDirectivesReplaceDCmd(outputStream* output, bool heap) :
+ DCmdWithParser(output, heap),
+ _filename("filename", "Name of the directives file", "STRING", true),
+ _refresh("-r", "Refresh affected methods", "BOOLEAN", false, "false") {
+
+ _dcmdparser.add_dcmd_argument(&_filename);
+ _dcmdparser.add_dcmd_option(&_refresh);
+}
+
+void CompilerDirectivesReplaceDCmd::execute(DCmdSource source, TRAPS) {
+ // Need to mark the methods twice, to account for the method that doesn't match
+ // the directives anymore
+ if (_refresh.value()) {
+ CodeCache::mark_directives_matches();
+
+ DirectivesStack::clear();
+ DirectivesParser::parse_from_file(_filename.value(), output(), true);
+
+ CodeCache::mark_directives_matches();
+ CodeCache::recompile_marked_directives_matches();
+ } else {
+ DirectivesStack::clear();
+ DirectivesParser::parse_from_file(_filename.value(), output(), true);
+ }
+}
+
+CompilerDirectivesRemoveDCmd::CompilerDirectivesRemoveDCmd(outputStream* output, bool heap) :
+ DCmdWithParser(output, heap),
+ _refresh("-r", "Refresh affected methods", "BOOLEAN", false, "false") {
+
+ _dcmdparser.add_dcmd_option(&_refresh);
}
void CompilerDirectivesRemoveDCmd::execute(DCmdSource source, TRAPS) {
- DirectivesStack::pop(1);
+ if (_refresh.value()) {
+ CodeCache::mark_directives_matches(true);
+ DirectivesStack::pop(1);
+ CodeCache::recompile_marked_directives_matches();
+ } else {
+ DirectivesStack::pop(1);
+ }
+}
+
+CompilerDirectivesClearDCmd::CompilerDirectivesClearDCmd(outputStream* output, bool heap) :
+ DCmdWithParser(output, heap),
+ _refresh("-r", "Refresh affected methods", "BOOLEAN", false, "false") {
+
+ _dcmdparser.add_dcmd_option(&_refresh);
}
void CompilerDirectivesClearDCmd::execute(DCmdSource source, TRAPS) {
- DirectivesStack::clear();
+ if (_refresh.value()) {
+ CodeCache::mark_directives_matches();
+ DirectivesStack::clear();
+ CodeCache::recompile_marked_directives_matches();
+ } else {
+ DirectivesStack::clear();
+ }
}
+
#if INCLUDE_SERVICES
ClassHierarchyDCmd::ClassHierarchyDCmd(outputStream* output, bool heap) :
DCmdWithParser(output, heap),
diff --git a/src/hotspot/share/services/diagnosticCommand.hpp b/src/hotspot/share/services/diagnosticCommand.hpp
index 88a4897081091..f87d6d277da39 100644
--- a/src/hotspot/share/services/diagnosticCommand.hpp
+++ b/src/hotspot/share/services/diagnosticCommand.hpp
@@ -688,9 +688,12 @@ class CompilerDirectivesPrintDCmd : public DCmd {
virtual void execute(DCmdSource source, TRAPS);
};
-class CompilerDirectivesRemoveDCmd : public DCmd {
+class CompilerDirectivesRemoveDCmd : public DCmdWithParser {
+protected:
+ DCmdArgument _refresh; // true if update should be forced after directives changes.
public:
- CompilerDirectivesRemoveDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
+ static int num_arguments() { return 1; }
+ CompilerDirectivesRemoveDCmd(outputStream* output, bool heap);
static const char* name() {
return "Compiler.directives_remove";
}
@@ -711,8 +714,9 @@ class CompilerDirectivesRemoveDCmd : public DCmd {
class CompilerDirectivesAddDCmd : public DCmdWithParser {
protected:
DCmdArgument _filename;
+ DCmdArgument _refresh; // true if update should be forced after directives changes.
public:
- static int num_arguments() { return 1; }
+ static int num_arguments() { return 2; }
CompilerDirectivesAddDCmd(outputStream* output, bool heap);
static const char* name() {
return "Compiler.directives_add";
@@ -731,9 +735,36 @@ class CompilerDirectivesAddDCmd : public DCmdWithParser {
virtual void execute(DCmdSource source, TRAPS);
};
-class CompilerDirectivesClearDCmd : public DCmd {
+class CompilerDirectivesReplaceDCmd : public DCmdWithParser {
+protected:
+ DCmdArgument _filename;
+ DCmdArgument _refresh; // true if update should be forced after directives changes.
+public:
+ static int num_arguments() { return 2; }
+ CompilerDirectivesReplaceDCmd(outputStream* output, bool heap);
+ static const char* name() {
+ return "Compiler.directives_replace";
+ }
+ static const char* description() {
+ return "Clear directives stack, and load new compiler directives from file.";
+ }
+ static const char* impact() {
+ return "Low";
+ }
+ static const JavaPermission permission() {
+ JavaPermission p = {"java.lang.management.ManagementPermission",
+ "monitor", NULL};
+ return p;
+ }
+ virtual void execute(DCmdSource source, TRAPS);
+};
+
+class CompilerDirectivesClearDCmd : public DCmdWithParser {
+protected:
+ DCmdArgument _refresh; // true if update should be forced after directives changes.
public:
- CompilerDirectivesClearDCmd(outputStream* output, bool heap) : DCmd(output, heap) {}
+ static int num_arguments() { return 1; }
+ CompilerDirectivesClearDCmd(outputStream* output, bool heap);
static const char* name() {
return "Compiler.directives_clear";
}
diff --git a/test/hotspot/jtreg/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java b/test/hotspot/jtreg/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java
index 8d40423b5e8c1..ee9a07f0adce2 100644
--- a/test/hotspot/jtreg/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java
+++ b/test/hotspot/jtreg/serviceability/dcmd/compiler/CompilerDirectivesDCMDTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2023, 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
@@ -96,6 +96,14 @@ public static void testAddAndRemoveCommand(CommandExecutor executor) {
Assert.fail("Expected three directives - found " + count);
}
+ // Test replacement with some directives from file
+ output = executor.execute("Compiler.directives_replace " + filename);
+ output = executor.execute("Compiler.directives_print");
+ count = find(output, "Directive:");
+ if (count != 3) {
+ Assert.fail("Expected three directives - found " + count);
+ }
+
// Test remove one directive
output = executor.execute("Compiler.directives_remove");
output = executor.execute("Compiler.directives_print");
diff --git a/test/hotspot/jtreg/serviceability/dcmd/compiler/DirectivesRefreshTest.java b/test/hotspot/jtreg/serviceability/dcmd/compiler/DirectivesRefreshTest.java
new file mode 100644
index 0000000000000..2e6882b4ac20d
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/dcmd/compiler/DirectivesRefreshTest.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2023, BELLSOFT. All rights reserved.
+ * Copyright (c) 2023, 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 DirectivesRefreshTest
+ * @summary Test of forced recompile after compiler directives changes by diagnostic command
+ * @requires vm.compiler1.enabled & vm.compiler2.enabled
+ * @library /test/lib /
+ * @modules java.base/jdk.internal.misc
+ *
+ * @build jdk.test.whitebox.WhiteBox
+ * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox
+ *
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
+ * -XX:-BackgroundCompilation
+ * serviceability.dcmd.compiler.DirectivesRefreshTest
+ */
+
+package serviceability.dcmd.compiler;
+
+import jdk.test.whitebox.WhiteBox;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.dcmd.CommandExecutor;
+import jdk.test.lib.dcmd.JMXExecutor;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.lang.reflect.Method;
+import java.util.Random;
+
+import static jdk.test.lib.Asserts.assertEQ;
+
+import static compiler.whitebox.CompilerWhiteBoxTest.COMP_LEVEL_NONE;
+import static compiler.whitebox.CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE;
+import static compiler.whitebox.CompilerWhiteBoxTest.COMP_LEVEL_FULL_OPTIMIZATION;
+
+public class DirectivesRefreshTest {
+
+ static Path cmdPath = Paths.get(System.getProperty("test.src", "."), "refresh_control.txt");
+ static WhiteBox wb = WhiteBox.getWhiteBox();
+ static Random random = new Random();
+
+ static Method method;
+ static CommandExecutor executor;
+
+ static int callable() {
+ int result = 0;
+ for (int i = 0; i < 100; i++) {
+ result += random.nextInt(100);
+ }
+ return result;
+ }
+
+ static void checkCompilationLevel(Method method, int level) {
+ assertEQ(wb.getMethodCompilationLevel(method), level, "Compilation level");
+ }
+
+ static void setup() throws Exception {
+ method = DirectivesRefreshTest.class.getDeclaredMethod("callable");
+ executor = new JMXExecutor();
+
+ System.out.println("Compilation with C2");
+
+ // Happens with fairly hot methods.
+ wb.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_OPTIMIZATION);
+ checkCompilationLevel(method, COMP_LEVEL_FULL_OPTIMIZATION);
+ }
+
+ static void testDirectivesAddRefresh() {
+ System.out.println("Force forbid C2 via directive, method deoptimized");
+
+ var output = executor.execute("Compiler.directives_add -r " + cmdPath.toString());
+ output.stderrShouldBeEmpty().shouldContain("1 compiler directives added");
+ // Current handling of 'Exclude' for '-r' clears flags.
+ checkCompilationLevel(method, COMP_LEVEL_NONE);
+
+ System.out.println("C2 is excluded, re-compilation with C1");
+
+ // Sanity check for the directive.
+ wb.enqueueMethodForCompilation(method, COMP_LEVEL_FULL_OPTIMIZATION);
+ checkCompilationLevel(method, COMP_LEVEL_NONE);
+
+ // Happens with fairly hot methods.
+ wb.enqueueMethodForCompilation(method, COMP_LEVEL_SIMPLE);
+ checkCompilationLevel(method, COMP_LEVEL_SIMPLE);
+ }
+
+ static void testDirectivesClearRefresh() {
+ System.out.println("Re-compilation with C2 due to removed restriction");
+
+ var output = executor.execute("Compiler.directives_clear -r");
+ output.stderrShouldBeEmpty().stdoutShouldBeEmpty();
+
+ // No need to enqueue the method, "immediate" effect of '-r' without deoptimization.
+ checkCompilationLevel(method, COMP_LEVEL_FULL_OPTIMIZATION);
+ }
+
+ static void testDirectivesAddRegular() {
+ System.out.println("No changes if the restriction is not forced");
+
+ // According to original JEP 165, the directive will be handled
+ // "when a method is submitted for a compilation".
+ var output = executor.execute("Compiler.directives_add " + cmdPath.toString());
+ output.stderrShouldBeEmpty().shouldContain("1 compiler directives added");
+
+ // In this program the method is not called, and here it is not enqueued.
+ checkCompilationLevel(method, COMP_LEVEL_FULL_OPTIMIZATION);
+ }
+
+ public static void main(String[] args) throws Exception {
+ setup();
+ testDirectivesAddRefresh();
+ testDirectivesClearRefresh();
+ testDirectivesAddRegular();
+ }
+}
diff --git a/test/hotspot/jtreg/serviceability/dcmd/compiler/refresh_control.txt b/test/hotspot/jtreg/serviceability/dcmd/compiler/refresh_control.txt
new file mode 100644
index 0000000000000..d6bcb91a11a4c
--- /dev/null
+++ b/test/hotspot/jtreg/serviceability/dcmd/compiler/refresh_control.txt
@@ -0,0 +1,8 @@
+[
+ {
+ match: "serviceability.dcmd.compiler.DirectivesRefreshTest::callable",
+ c2: {
+ Exclude: true
+ }
+ }
+]
From a232e8fb4e6e9e2e9a5285bf01c93b8d1d995f04 Mon Sep 17 00:00:00 2001
From: Chad Rakoczy
Date: Thu, 14 Mar 2024 13:26:03 +0000
Subject: [PATCH 48/58] 8325621: Improve jspawnhelper version checks
Reviewed-by: erikj, shade, rriggs, ihse
---
make/modules/java.base/Launcher.gmk | 3 +-
make/modules/java.base/lib/CoreLibraries.gmk | 1 +
.../unix/native/jspawnhelper/jspawnhelper.c | 28 +++++++++++++++----
.../unix/native/libjava/ProcessImpl_md.c | 14 +++++++---
.../ProcessBuilder/JspawnhelperWarnings.java | 21 +++++++++++++-
5 files changed, 55 insertions(+), 12 deletions(-)
diff --git a/make/modules/java.base/Launcher.gmk b/make/modules/java.base/Launcher.gmk
index a559322f9d307..f6a68affb613d 100644
--- a/make/modules/java.base/Launcher.gmk
+++ b/make/modules/java.base/Launcher.gmk
@@ -78,7 +78,8 @@ ifeq ($(call isTargetOsType, unix), true)
NAME := jspawnhelper, \
SRC := $(TOPDIR)/src/$(MODULE)/unix/native/jspawnhelper, \
OPTIMIZATION := LOW, \
- CFLAGS := $(CFLAGS_JDKEXE) -I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \
+ CFLAGS := $(CFLAGS_JDKEXE) $(VERSION_CFLAGS) \
+ -I$(TOPDIR)/src/$(MODULE)/unix/native/libjava, \
EXTRA_OBJECT_FILES := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc$(OBJ_SUFFIX), \
LDFLAGS := $(LDFLAGS_JDKEXE), \
OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
diff --git a/make/modules/java.base/lib/CoreLibraries.gmk b/make/modules/java.base/lib/CoreLibraries.gmk
index 48d568952972b..a3c62d1eb1609 100644
--- a/make/modules/java.base/lib/CoreLibraries.gmk
+++ b/make/modules/java.base/lib/CoreLibraries.gmk
@@ -59,6 +59,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
+ ProcessImpl_md.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_gcc_ProcessImpl_md.c := unused-result, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
diff --git a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
index 974329a2857b6..1b4236b2150b3 100644
--- a/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
+++ b/src/java.base/unix/native/jspawnhelper/jspawnhelper.c
@@ -29,6 +29,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -50,6 +51,10 @@ extern int errno;
#define ERR_PIPE 2
#define ERR_ARGS 3
+#ifndef VERSION_STRING
+#error VERSION_STRING must be defined
+#endif
+
void error (int fd, int err) {
if (write (fd, &err, sizeof(err)) != sizeof(err)) {
/* Not sure what to do here. I have no one to speak to. */
@@ -59,6 +64,7 @@ void error (int fd, int err) {
}
void shutItDown() {
+ fprintf(stdout, "jspawnhelper version %s\n", VERSION_STRING);
fprintf(stdout, "This command is not for general use and should ");
fprintf(stdout, "only be run as the result of a call to\n");
fprintf(stdout, "ProcessBuilder.start() or Runtime.exec() in a java ");
@@ -141,19 +147,29 @@ int main(int argc, char *argv[]) {
int r, fdinr, fdinw, fdout;
sigset_t unblock_signals;
- if (argc != 2) {
- shutItDown();
- }
-
#ifdef DEBUG
jtregSimulateCrash(0, 4);
#endif
- r = sscanf (argv[1], "%d:%d:%d", &fdinr, &fdinw, &fdout);
+
+ if (argc != 3) {
+ fprintf(stdout, "Incorrect number of arguments: %d\n", argc);
+ shutItDown();
+ }
+
+ if (strcmp(argv[1], VERSION_STRING) != 0) {
+ fprintf(stdout, "Incorrect Java version: %s\n", argv[1]);
+ shutItDown();
+ }
+
+ r = sscanf (argv[2], "%d:%d:%d", &fdinr, &fdinw, &fdout);
if (r == 3 && fcntl(fdinr, F_GETFD) != -1 && fcntl(fdinw, F_GETFD) != -1) {
fstat(fdinr, &buf);
- if (!S_ISFIFO(buf.st_mode))
+ if (!S_ISFIFO(buf.st_mode)) {
+ fprintf(stdout, "Incorrect input pipe\n");
shutItDown();
+ }
} else {
+ fprintf(stdout, "Incorrect FD array data: %s\n", argv[2]);
shutItDown();
}
diff --git a/src/java.base/unix/native/libjava/ProcessImpl_md.c b/src/java.base/unix/native/libjava/ProcessImpl_md.c
index 9ed0ed30959a6..558882f61e11a 100644
--- a/src/java.base/unix/native/libjava/ProcessImpl_md.c
+++ b/src/java.base/unix/native/libjava/ProcessImpl_md.c
@@ -300,6 +300,10 @@ Java_java_lang_ProcessImpl_init(JNIEnv *env, jclass clazz)
#define WTERMSIG(status) ((status)&0x7F)
#endif
+#ifndef VERSION_STRING
+#error VERSION_STRING must be defined
+#endif
+
static const char *
getBytes(JNIEnv *env, jbyteArray arr)
{
@@ -488,7 +492,7 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
pid_t resultPid;
int i, offset, rval, bufsize, magic;
char *buf, buf1[(3 * 11) + 3]; // "%d:%d:%d\0"
- char *hlpargs[3];
+ char *hlpargs[4];
SpawnInfo sp;
/* need to tell helper which fd is for receiving the childstuff
@@ -497,11 +501,13 @@ spawnChild(JNIEnv *env, jobject process, ChildStuff *c, const char *helperpath)
snprintf(buf1, sizeof(buf1), "%d:%d:%d", c->childenv[0], c->childenv[1], c->fail[1]);
/* NULL-terminated argv array.
* argv[0] contains path to jspawnhelper, to follow conventions.
- * argv[1] contains the fd string as argument to jspawnhelper
+ * argv[1] contains the version string as argument to jspawnhelper
+ * argv[2] contains the fd string as argument to jspawnhelper
*/
hlpargs[0] = (char*)helperpath;
- hlpargs[1] = buf1;
- hlpargs[2] = NULL;
+ hlpargs[1] = VERSION_STRING;
+ hlpargs[2] = buf1;
+ hlpargs[3] = NULL;
/* Following items are sent down the pipe to the helper
* after it is spawned.
diff --git a/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java b/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java
index 0ff6818650250..daffb4b8c84ff 100644
--- a/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java
+++ b/test/jdk/java/lang/ProcessBuilder/JspawnhelperWarnings.java
@@ -25,7 +25,7 @@
/*
* @test
- * @bug 8325567
+ * @bug 8325567 8325621
* @requires (os.family == "linux") | (os.family == "aix") | (os.family == "mac")
* @library /test/lib
* @run driver JspawnhelperWarnings
@@ -47,11 +47,30 @@ private static void tryWithNArgs(int nArgs) throws Exception {
OutputAnalyzer oa = new OutputAnalyzer(p);
oa.shouldHaveExitValue(1);
oa.shouldContain("This command is not for general use");
+ if (nArgs != 2) {
+ oa.shouldContain("Incorrect number of arguments");
+ } else {
+ oa.shouldContain("Incorrect Java version");
+ }
+ }
+
+ private static void testVersion() throws Exception {
+ String[] args = new String[3];
+ args[0] = Paths.get(System.getProperty("java.home"), "lib", "jspawnhelper").toString();
+ args[1] = "wrongVersion";
+ args[2] = "1:1:1";
+ Process p = ProcessTools.startProcess("jspawnhelper", new ProcessBuilder(args));
+ OutputAnalyzer oa = new OutputAnalyzer(p);
+ oa.shouldHaveExitValue(1);
+ oa.shouldContain("This command is not for general use");
+ oa.shouldContain("Incorrect Java version: wrongVersion");
}
public static void main(String[] args) throws Exception {
for (int nArgs = 0; nArgs < 10; nArgs++) {
tryWithNArgs(nArgs);
}
+
+ testVersion();
}
}
From 792fc9d114977664da0b3bebf0f1d82360d375b6 Mon Sep 17 00:00:00 2001
From: Alexey Ivanov
Date: Thu, 14 Mar 2024 14:01:33 +0000
Subject: [PATCH 49/58] 8320079: The ArabicBox.java test has no control buttons
Reviewed-by: prr, honkar, dmarkov
---
.../java/awt/font/TextLayout/ArabicBox.java | 103 ++++++++++++++++++
1 file changed, 103 insertions(+)
create mode 100644 test/jdk/java/awt/font/TextLayout/ArabicBox.java
diff --git a/test/jdk/java/awt/font/TextLayout/ArabicBox.java b/test/jdk/java/awt/font/TextLayout/ArabicBox.java
new file mode 100644
index 0000000000000..e03c4cf918e42
--- /dev/null
+++ b/test/jdk/java/awt/font/TextLayout/ArabicBox.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2001, 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.
+ */
+
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.font.FontRenderContext;
+import java.awt.font.TextLayout;
+
+import javax.swing.JPanel;
+
+/*
+ * @test
+ * @bug 4427483
+ * @summary Arabic text followed by newline should have no missing glyphs
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual ArabicBox
+ */
+public final class ArabicBox {
+
+ private static final String TEXT =
+ "\u0627\u0644\u0639\u0631\u0628\u064A\u0629\n";
+
+ private static final String FONT_NAME = Font.DIALOG;
+
+ private static final String INSTRUCTIONS = """
+ In the below panel, you should see the following text:
+
+ """
+ + TEXT + """
+ (It's \u2018Arabic\u2019 in Arabic.)
+
+ If there are no 'box glyphs' for missing glyphs,
+ press Pass; otherwise, press Fail.""";
+
+ public static void main(String[] args) throws Exception {
+ final Font font = new Font(FONT_NAME, Font.PLAIN, 24);
+ System.out.println("asked for " + FONT_NAME + " and got: " + font.getFontName());
+
+ PassFailJFrame.builder()
+ .title("Arabic Box")
+ .instructions(INSTRUCTIONS)
+ .rows(7)
+ .columns(40)
+ .splitUIBottom(() -> createPanel(font))
+ .build()
+ .awaitAndCheck();
+ }
+
+ private static JPanel createPanel(Font font) {
+ return new TextPanel(font);
+ }
+
+ private static final class TextPanel extends JPanel {
+ private TextLayout layout;
+
+ private TextPanel(Font font) {
+ setForeground(Color.black);
+ setBackground(Color.white);
+ setFont(font);
+ setPreferredSize(new Dimension(300, 150));
+ }
+
+ @Override
+ public void paint(Graphics g) {
+ super.paint(g);
+ Graphics2D g2d = (Graphics2D)g;
+ if (layout == null) {
+ Font font = g2d.getFont();
+ FontRenderContext frc = g2d.getFontRenderContext();
+
+ layout = new TextLayout(TEXT, font, frc);
+ System.out.println(layout.getBounds());
+ }
+
+ layout.draw(g2d, 10, 50);
+ g2d.drawString(TEXT, 10, 100);
+ }
+ }
+}
From 51381bb13c80916d0a0c431f3c30ba11c9ad60d1 Mon Sep 17 00:00:00 2001
From: Guoxiong Li
Date: Thu, 14 Mar 2024 15:01:44 +0000
Subject: [PATCH 50/58] 8328139: Prefer 'override' to 'virtual' in subclasses
of 'GCInitLogger'
Reviewed-by: kbarrett, jsjolen
---
src/hotspot/share/gc/epsilon/epsilonInitLogger.hpp | 3 ++-
src/hotspot/share/gc/g1/g1InitLogger.hpp | 8 ++++----
src/hotspot/share/gc/parallel/parallelInitLogger.hpp | 4 ++--
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/hotspot/share/gc/epsilon/epsilonInitLogger.hpp b/src/hotspot/share/gc/epsilon/epsilonInitLogger.hpp
index 0030a32f0db95..ba254e93c22dc 100644
--- a/src/hotspot/share/gc/epsilon/epsilonInitLogger.hpp
+++ b/src/hotspot/share/gc/epsilon/epsilonInitLogger.hpp
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -29,7 +30,7 @@
class EpsilonInitLogger : public GCInitLogger {
protected:
- virtual void print_gc_specific();
+ void print_gc_specific() override;
public:
static void print();
diff --git a/src/hotspot/share/gc/g1/g1InitLogger.hpp b/src/hotspot/share/gc/g1/g1InitLogger.hpp
index 9c4057988d66f..f1412c674d00c 100644
--- a/src/hotspot/share/gc/g1/g1InitLogger.hpp
+++ b/src/hotspot/share/gc/g1/g1InitLogger.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -29,9 +29,9 @@
class G1InitLogger : public GCInitLogger {
protected:
- virtual void print_heap();
- virtual void print_workers();
- virtual void print_gc_specific();
+ void print_heap() override;
+ void print_workers() override;
+ void print_gc_specific() override;
public:
static void print();
};
diff --git a/src/hotspot/share/gc/parallel/parallelInitLogger.hpp b/src/hotspot/share/gc/parallel/parallelInitLogger.hpp
index 2a3b6349964d6..fa8c3503ded0a 100644
--- a/src/hotspot/share/gc/parallel/parallelInitLogger.hpp
+++ b/src/hotspot/share/gc/parallel/parallelInitLogger.hpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2020, 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
@@ -29,7 +29,7 @@
class ParallelInitLogger : public GCInitLogger {
protected:
- virtual void print_heap();
+ void print_heap() override;
public:
static void print();
};
From 759cc675915c551cc1d6899eedb95900752f2703 Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 15:40:22 +0000
Subject: [PATCH 51/58] 8327969: Convert javax/swing/border/Test6910490.java
applet test to main
Reviewed-by: dnguyen, honkar
---
test/jdk/javax/swing/border/Test6910490.html | 32 -----------------
test/jdk/javax/swing/border/Test6910490.java | 36 +++++++++++++++-----
2 files changed, 27 insertions(+), 41 deletions(-)
delete mode 100644 test/jdk/javax/swing/border/Test6910490.html
diff --git a/test/jdk/javax/swing/border/Test6910490.html b/test/jdk/javax/swing/border/Test6910490.html
deleted file mode 100644
index 5cc40cefc397c..0000000000000
--- a/test/jdk/javax/swing/border/Test6910490.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-If the border is painted over scroll bars then test fails.
-Otherwise test passes.
-
-
-
-
diff --git a/test/jdk/javax/swing/border/Test6910490.java b/test/jdk/javax/swing/border/Test6910490.java
index 78dd3dfb872f3..f42e4fe0dd23a 100644
--- a/test/jdk/javax/swing/border/Test6910490.java
+++ b/test/jdk/javax/swing/border/Test6910490.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -27,8 +27,8 @@
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.Icon;
-import javax.swing.JApplet;
import javax.swing.JButton;
+import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.border.MatteBorder;
@@ -37,22 +37,40 @@
* @test
* @bug 6910490
* @summary Tests a matte border around a component inside a scroll pane.
- * @author Sergey Malenkov
- * @run applet/manual=yesno Test6910490.html
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test6910490
*/
-public class Test6910490 extends JApplet implements Icon {
+public class Test6910490 implements Icon {
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ If the border is painted over scroll bars then test fails.
+ Otherwise test passes.""";
+ Test6910490 obj = new Test6910490();
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(3)
+ .columns(35)
+ .testUI(obj.initializeTest())
+ .build()
+ .awaitAndCheck();
+ }
- @Override
- public void init() {
+ public JFrame initializeTest() {
Insets insets = new Insets(10, 10, 10, 10);
- Dimension size = new Dimension(getWidth() / 2, getHeight());
+ JFrame frame = new JFrame("Matte Border Test");
+ frame.setSize(600, 300);
+ Dimension size = new Dimension(frame.getWidth() / 2, frame.getHeight());
JSplitPane pane = new JSplitPane(
JSplitPane.HORIZONTAL_SPLIT,
create("Color", size, new MatteBorder(insets, RED)),
create("Icon", size, new MatteBorder(insets, this)));
+
pane.setDividerLocation(size.width - pane.getDividerSize() / 2);
- add(pane);
+ frame.add(pane);
+ return frame;
}
private JScrollPane create(String name, Dimension size, MatteBorder border) {
From d25c452f0c4a2106a1fa06b56039f0f0b5d6e952 Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev
Date: Thu, 14 Mar 2024 15:45:22 +0000
Subject: [PATCH 52/58] 8327835: Convert
java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest applet test to main
Reviewed-by: aivanov, abhiscxk
---
test/jdk/ProblemList.txt | 1 -
.../java/awt/FileDialog/RegexpFilterTest.java | 74 ++++++
.../RegexpFilterTest/RegexpFilterTest.html | 43 ----
.../RegexpFilterTest/RegexpFilterTest.java | 226 ------------------
4 files changed, 74 insertions(+), 270 deletions(-)
create mode 100644 test/jdk/java/awt/FileDialog/RegexpFilterTest.java
delete mode 100644 test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
delete mode 100644 test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.java
diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt
index 9aa6449ead6ef..c4b552b7c1ecf 100644
--- a/test/jdk/ProblemList.txt
+++ b/test/jdk/ProblemList.txt
@@ -796,7 +796,6 @@ java/awt/print/PrinterJob/ScaledText/ScaledText.java 8231226 macosx-all
java/awt/font/TextLayout/TestJustification.html 8250791 macosx-all
java/awt/TrayIcon/DragEventSource/DragEventSource.java 8252242 macosx-all
java/awt/FileDialog/DefaultFocusOwner/DefaultFocusOwner.java 7187728 macosx-all,linux-all
-java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html 7187728 macosx-all,linux-all
java/awt/print/PageFormat/Orient.java 8016055 macosx-all
java/awt/TextArea/TextAreaCursorTest/HoveringAndDraggingTest.java 8024986 macosx-all,linux-all
java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter.java 8254841 macosx-all
diff --git a/test/jdk/java/awt/FileDialog/RegexpFilterTest.java b/test/jdk/java/awt/FileDialog/RegexpFilterTest.java
new file mode 100644
index 0000000000000..af539735b7764
--- /dev/null
+++ b/test/jdk/java/awt/FileDialog/RegexpFilterTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+
+import javax.swing.JButton;
+import java.awt.Frame;
+import java.awt.FileDialog;
+
+/*
+ * Motif file dialogs let the user specify a filter that controls the files that
+ * are displayed in the dialog. This filter is generally specified as a regular
+ * expression. The test verifies that Motif-like filtering works fine using
+ * XAWT-toolkit also.
+ */
+
+/*
+ * @test
+ * @bug 4934185
+ * @summary JCK1.5-runtime-interactive: XToolkit FileDialog does not work as expected
+ * @requires (os.family == "linux")
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/othervm/manual -Dsun.awt.disableGtkFileDialogs=true RegexpFilterTest
+*/
+public class RegexpFilterTest {
+
+ private static final String INSTRUCTIONS =
+ """
+ 0. The test is only for X platforms
+ 1. Press the 'Show' button and a file dialog will appear,
+ 2. Input any string into the 'Filter' text field,
+ This filter is generally specified as a regular expression
+ (e.g., * matches all files, while *.c matches all files that end in .c)
+ 3. Press 'Enter' to refresh the displayed files with the filter,
+ 4. If the list of the files contains all actual files matched the filter,
+ then the test passed; otherwise it failed.
+ """;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame
+ .builder()
+ .title("RegexpFilterTest Instructions")
+ .instructions(INSTRUCTIONS)
+ .splitUIRight(() -> {
+ JButton show = new JButton("show");
+ show.addActionListener(e ->
+ new FileDialog((Frame) null).setVisible(true));
+ return show;
+ })
+ .rows(15)
+ .columns(40)
+ .build()
+ .awaitAndCheck();
+ }
+}
diff --git a/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html b/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
deleted file mode 100644
index 9b1adabfa9b87..0000000000000
--- a/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
- RegexpFilterTest
-
-
-
-
Bug ID:
-
-
See the dialog box (usually in upper left corner) for instructions
-
-
-
-
diff --git a/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.java b/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.java
deleted file mode 100644
index 01b726bac8850..0000000000000
--- a/test/jdk/java/awt/FileDialog/RegexpFilterTest/RegexpFilterTest.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (c) 2007, 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 4934185
- @summary JCK1.5-runtime-interactive: XToolkit FileDialog does not work as expected
- @author Dmitry.Cherepanov area=awt.filedialog
- @run applet/manual=yesno RegexpFilterTest.html
-*/
-
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
-
-/*
- * Motif file dialogs let the user specify a filter that controls the files that
- * are displayed in the dialog. This filter is generally specified as a regular
- * expression. The test verifies that Motif-like filtering works fine using
- * XAWT-toolkit also.
- */
-public class RegexpFilterTest extends Applet
-{
-
- public static void main(String[] args) {
- Applet a = new RegexpFilterTest();
- a.init();
- a.start();
- }
-
- public void init()
- {
- this.setLayout (new BorderLayout ());
-
- String[] instructions =
- {
- " 0. The test is only for X platforms",
- " 1. Press the 'Show' button and a file dialog will appear, ",
- " 2. Input any string into the 'Filter' text field, ",
- " This filter is generally specified as a regular expression ",
- " (e.g., * matches all files, while *.c matches all files that end in .c) ",
- " 3. Press 'Enter' to refresh the displayed files with the filter, ",
- " 4. If the list of the files contains all actual files matched the filter, ",
- " then the test passed; otherwise it failed. "
- };
- Sysout.createDialogWithInstructions( instructions );
-
- }//End init()
-
- public void start ()
- {
- setLayout(new FlowLayout());
- Button button = new Button("Show");
- add(button);
-
- button.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- FileDialog fd = new FileDialog(new Frame());
- fd.setVisible(true);
- }
- });
-
- setSize (200,200);
- setVisible(true);
- validate();
- }
-
-}
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
-{
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- }
-
-}// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
-{
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 100;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- System.out.println(messageIn);
- }
-
-}// TestDialog class
From 0c3998d2c6dd735d356bfe26662c93d97364b2ad Mon Sep 17 00:00:00 2001
From: Alexey Ivanov
Date: Thu, 14 Mar 2024 15:46:37 +0000
Subject: [PATCH 53/58] 8286759: TextComponentPrintable: consequent ->
consecutive positions
Reviewed-by: gli, prr
---
.../classes/sun/swing/text/TextComponentPrintable.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java b/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
index 3a2495b89571f..28d57b02b634b 100644
--- a/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
+++ b/src/java.desktop/share/classes/sun/swing/text/TextComponentPrintable.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -780,9 +780,9 @@ private void calculateRowsMetrics() {
if (height != 0
&& (y != previousY || height != previousHeight)) {
/*
- * we do not store the same value as previous. in our
- * documents it is often for consequent positions to have
- * the same modelToView y and height.
+ * We do not store the same value as previous.
+ * In our documents, it is common for consecutive
+ * positions to have the same modelToView y and height.
*/
previousY = y;
previousHeight = height;
From acfefc6c7aea6903bd575c2cb6edddbd88b112bf Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 15:47:54 +0000
Subject: [PATCH 54/58] 8327876: Convert javax/swing/border/Test4252164.java
applet test to main
Reviewed-by: prr, abhiscxk
---
test/jdk/javax/swing/border/Test4252164.html | 33 ---------
test/jdk/javax/swing/border/Test4252164.java | 71 ++++++++++----------
2 files changed, 37 insertions(+), 67 deletions(-)
delete mode 100644 test/jdk/javax/swing/border/Test4252164.html
diff --git a/test/jdk/javax/swing/border/Test4252164.html b/test/jdk/javax/swing/border/Test4252164.html
deleted file mode 100644
index 442be90fcc8d4..0000000000000
--- a/test/jdk/javax/swing/border/Test4252164.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-Please, ensure that rounded border is filled completely.
-It should not contain white points inside.
-Use Mouse Wheel to change thickness of the border.
-
-
-
-
diff --git a/test/jdk/javax/swing/border/Test4252164.java b/test/jdk/javax/swing/border/Test4252164.java
index 923df7150546d..8d7eace7deacc 100644
--- a/test/jdk/javax/swing/border/Test4252164.java
+++ b/test/jdk/javax/swing/border/Test4252164.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -21,53 +21,56 @@
* questions.
*/
+import java.awt.Color;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.border.LineBorder;
+
/*
* @test
* @bug 4252164 8041917
* @summary Tests rounded LineBorder for components
- * @author Sergey Malenkov
- * @run applet/manual=yesno Test4252164.html
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test4252164
*/
-import java.awt.Color;
-import java.awt.event.MouseWheelEvent;
-import java.awt.event.MouseWheelListener;
-import javax.swing.JApplet;
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.border.LineBorder;
-
-public class Test4252164 extends JApplet implements MouseWheelListener {
- private int thickness;
- private JLabel rounded;
- private JLabel straight;
+public class Test4252164 {
+ private static int thickness;
+ private static JLabel rounded;
+ private static JLabel straight;
- public void mouseWheelMoved(MouseWheelEvent event) {
- update(event.getWheelRotation());
- }
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ Please, ensure that rounded border is filled completely.
+ It should not contain white points inside.
+ Use Mouse Wheel to change thickness of the border.
+ """;
- public void init() {
- add(createUI());
- addMouseWheelListener(this);
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(4)
+ .columns(35)
+ .splitUI(Test4252164::createUI)
+ .build()
+ .awaitAndCheck();
}
- private JPanel createUI() {
- this.rounded = new JLabel("ROUNDED"); // NON-NLS: the label for rounded border
- this.straight = new JLabel("STRAIGHT"); // NON-NLS: the label for straight border
-
+ private static JPanel createUI() {
+ rounded = new JLabel("ROUNDED"); // NON-NLS: the label for rounded border
+ straight = new JLabel("STRAIGHT"); // NON-NLS: the label for straight border
JPanel panel = new JPanel();
- panel.add(this.rounded);
- panel.add(this.straight);
-
+ panel.add(rounded);
+ panel.add(straight);
update(10);
-
+ panel.addMouseWheelListener(e -> update(e.getWheelRotation()));
return panel;
}
- private void update(int thickness) {
- this.thickness += thickness;
-
- this.rounded.setBorder(new LineBorder(Color.RED, this.thickness, true));
- this.straight.setBorder(new LineBorder(Color.RED, this.thickness, false));
+ private static void update(int thicknessValue) {
+ thickness += thicknessValue;
+ rounded.setBorder(new LineBorder(Color.RED, thickness, true));
+ straight.setBorder(new LineBorder(Color.RED, thickness, false));
}
}
From debd59732de2b865bbe81710debcae237e3f135b Mon Sep 17 00:00:00 2001
From: Brian Burkhalter
Date: Thu, 14 Mar 2024 15:50:43 +0000
Subject: [PATCH 55/58] 8327095: (ch)
java/nio/channels/AsyncCloseAndInterrupt.java: improve error message when
mkfifo fails
Reviewed-by: alanb
---
.../nio/channels/AsyncCloseAndInterrupt.java | 44 ++++++++++++++++---
1 file changed, 38 insertions(+), 6 deletions(-)
diff --git a/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java b/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java
index e88a874b82bb0..0543cd04334d2 100644
--- a/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java
+++ b/test/jdk/java/nio/channels/AsyncCloseAndInterrupt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -24,7 +24,8 @@
/* @test
* @bug 4460583 4470470 4840199 6419424 6710579 6596323 6824135 6395224 7142919
* 8151582 8068693 8153209
- * @run main/othervm AsyncCloseAndInterrupt
+ * @library /test/lib
+ * @run main/othervm --enable-native-access=ALL-UNNAMED AsyncCloseAndInterrupt
* @key intermittent
* @summary Comprehensive test of asynchronous closing and interruption
* @author Mark Reinhold
@@ -43,6 +44,14 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
+import java.lang.foreign.Arena;
+import java.lang.foreign.FunctionDescriptor;
+import java.lang.foreign.Linker;
+import java.lang.foreign.MemorySegment;
+import java.lang.foreign.SymbolLookup;
+import java.lang.foreign.ValueLayout;
+import java.lang.invoke.MethodHandle;
+
public class AsyncCloseAndInterrupt {
static PrintStream log = System.err;
@@ -53,6 +62,23 @@ static void sleep(int ms) {
} catch (InterruptedException x) { }
}
+ private static int mkfifo(String path) throws Throwable {
+ Linker linker = Linker.nativeLinker();
+ SymbolLookup stdlib = linker.defaultLookup();
+ MethodHandle mkfifo = linker.downcallHandle(
+ stdlib.find("mkfifo").orElseThrow(),
+ FunctionDescriptor.of(ValueLayout.JAVA_INT,
+ ValueLayout.ADDRESS, ValueLayout.JAVA_INT)
+ );
+
+ try (Arena arena = Arena.ofConfined()) {
+ MemorySegment cString = arena.allocateFrom(path);
+ int mode = 0666;
+ int returnValue = (int)mkfifo.invokeExact(cString, mode);
+ return returnValue;
+ }
+ }
+
// Wildcard address localized to this machine -- Windoze doesn't allow
// connecting to a server socket that was previously bound to a true
// wildcard, namely new InetSocketAddress((InetAddress)null, 0).
@@ -133,11 +159,17 @@ private static void initFile() throws Exception {
if (!fifoFile.delete())
throw new IOException("Cannot delete existing fifo " + fifoFile);
}
- Process p = Runtime.getRuntime().exec("mkfifo " + fifoFile);
- if (p.waitFor() != 0)
- throw new IOException("Error creating fifo");
- new RandomAccessFile(fifoFile, "rw").close();
+ try {
+ if (mkfifo(fifoFile.toString()) != 0) {
+ fifoFile = null;
+ log.println("WARNING: mkfifo failed - cannot completely test FileChannels");
+ return;
+ }
+ } catch (Throwable cause) {
+ throw new IOException(cause);
+ }
+ new RandomAccessFile(fifoFile, "rw").close();
}
From d4ec783108828efd158c749f37e4220bb1df86fc Mon Sep 17 00:00:00 2001
From: Tejesh R
Date: Thu, 14 Mar 2024 15:54:42 +0000
Subject: [PATCH 56/58] 8327873: Convert javax/swing/border/Test4247606.java
applet test to main
Reviewed-by: prr, abhiscxk
---
test/jdk/javax/swing/border/Test4247606.html | 33 -------------
test/jdk/javax/swing/border/Test4247606.java | 49 ++++++++++++++------
2 files changed, 34 insertions(+), 48 deletions(-)
delete mode 100644 test/jdk/javax/swing/border/Test4247606.html
diff --git a/test/jdk/javax/swing/border/Test4247606.html b/test/jdk/javax/swing/border/Test4247606.html
deleted file mode 100644
index 5a4553382e01f..0000000000000
--- a/test/jdk/javax/swing/border/Test4247606.html
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-If the button do not fit into the titled border bounds
-and cover the bottom border's line then test fails.
-Otherwise test passes.
-
-
-
-
diff --git a/test/jdk/javax/swing/border/Test4247606.java b/test/jdk/javax/swing/border/Test4247606.java
index 03806508567b7..71ebef2e2b05e 100644
--- a/test/jdk/javax/swing/border/Test4247606.java
+++ b/test/jdk/javax/swing/border/Test4247606.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -21,36 +21,55 @@
* questions.
*/
-/*
- * @test
- * @bug 4247606
- * @summary BorderedPane appears wrong with Title Position Below Bottom
- * @author Andrey Pikalev
- * @run applet/manual=yesno Test4247606.html
- */
-
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Dimension;
import javax.swing.BorderFactory;
-import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.border.Border;
import javax.swing.border.TitledBorder;
-public class Test4247606 extends JApplet {
- public void init() {
- JButton button = new JButton("Button"); // NON-NLS: the button text
+/*
+ * @test
+ * @bug 4247606
+ * @summary BorderedPane appears wrong with title position below bottom
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual Test4247606
+ */
+
+public class Test4247606 {
+ public static void main(String[] args) throws Exception {
+ String testInstructions = """
+ If the button does not fit into the titled border bounds
+ and cover the bottom border's line then test fails.
+ Otherwise test passes
+ """;
+
+ PassFailJFrame.builder()
+ .title("Test Instructions")
+ .instructions(testInstructions)
+ .rows(4)
+ .columns(35)
+ .splitUI(Test4247606::initializeTest)
+ .build()
+ .awaitAndCheck();
+ }
+
+ public static JComponent initializeTest() {
+ JButton button = new JButton("Button");
button.setBorder(BorderFactory.createLineBorder(Color.red, 1));
- TitledBorder border = new TitledBorder("Bordered Pane"); // NON-NLS: the panel title
+ TitledBorder border = new TitledBorder("Bordered Pane");
border.setTitlePosition(TitledBorder.BELOW_BOTTOM);
JPanel panel = create(button, border);
panel.setBackground(Color.green);
+ panel.setPreferredSize(new Dimension(200, 150));
- getContentPane().add(create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10)));
+ return create(panel, BorderFactory.createEmptyBorder(10, 10, 10, 10));
}
private static JPanel create(JComponent component, Border border) {
From 7cc1965a252347f37dca69859d5ecaf2b55020c6 Mon Sep 17 00:00:00 2001
From: Alexander Zvegintsev
Date: Thu, 14 Mar 2024 16:03:13 +0000
Subject: [PATCH 57/58] 8328124: Convert
java/awt/Frame/ShownOnPack/ShownOnPack.html applet test to main
Reviewed-by: honkar, abhiscxk
---
.../awt/Frame/ShownOnPack/ShownOnPack.html | 43 ---
.../awt/Frame/ShownOnPack/ShownOnPack.java | 244 +++---------------
2 files changed, 42 insertions(+), 245 deletions(-)
delete mode 100644 test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.html
diff --git a/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.html b/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.html
deleted file mode 100644
index 6dd732fcf6cdc..0000000000000
--- a/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
- ShownOnPack
-
-
-
-
ShownOnPack Bug ID: 6525850
-
-
See the dialog box (usually in upper left corner) for instructions
-
-
-
-
diff --git a/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.java b/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.java
index a5763d0bed260..5e591bfe0a6b5 100644
--- a/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.java
+++ b/test/jdk/java/awt/Frame/ShownOnPack/ShownOnPack.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 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
@@ -21,208 +21,48 @@
* questions.
*/
+import java.awt.EventQueue;
+import java.awt.Frame;
+
/*
- test
- @bug 6525850
- @summary Iconified frame gets shown after pack()
- @author anthony.petrov@...: area=awt.toplevel
- @run applet/manual=yesno ShownOnPack.html
+ * @test
+ * @bug 6525850
+ * @summary Iconified frame gets shown after pack()
+ * @library /java/awt/regtesthelpers
+ * @build PassFailJFrame
+ * @run main/manual ShownOnPack
*/
-
-/**
- * ShownOnPack.java
- *
- * summary:
- */
-
-import java.applet.Applet;
-import java.awt.*;
-
-public class ShownOnPack extends Applet
-{
- //Declare things used in the test, like buttons and labels here
- Frame f;
-
- public void init()
- {
- //Create instructions for the user here, as well as set up
- // the environment -- set the layout manager, add buttons,
- // etc.
- this.setLayout (new BorderLayout ());
-
- String[] instructions =
- {
- "This test creates an invisible and iconified frame that should not become visible.",
- "If you observe the window titled 'Should NOT BE SHOWN' in the taskbar, press FAIL,",
- "else press PASS"
- };
- Sysout.createDialogWithInstructions( instructions );
-
- }//End init()
-
- public void start ()
- {
- //Get things going. Request focus, set size, et cetera
- setSize (200,200);
- setVisible(true);
- validate();
-
- //What would normally go into main() will probably go here.
- //Use System.out.println for diagnostic messages that you want
- // to read after the test is done.
- //Use Sysout.println for messages you want the tester to read.
- f = new Frame("Should NOT BE SHOWN");
- f.setExtendedState(Frame.ICONIFIED);
- f.pack();
- }// start()
-
- //The rest of this class is the actions which perform the test...
-
- //Use Sysout.println to communicate with the user NOT System.out!!
- //Sysout.println ("Something Happened!");
-
-}// class ShownOnPack
-
-/* Place other classes related to the test after this line */
-
-
-
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
- chunk of code whose purpose is to make user
- interaction uniform, and thereby make it simpler
- to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
- for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
- WithInstructions method. Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
- with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
- as standalone.
- */
-
-class Sysout
-{
- private static TestDialog dialog;
-
- public static void createDialogWithInstructions( String[] instructions )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- dialog.printInstructions( instructions );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
- }
-
- public static void createDialog( )
- {
- dialog = new TestDialog( new Frame(), "Instructions" );
- String[] defInstr = { "Instructions will appear here. ", "" } ;
- dialog.printInstructions( defInstr );
- dialog.setVisible(true);
- println( "Any messages for the tester will display here." );
+public class ShownOnPack {
+
+ private static final String INSTRUCTIONS = """
+ This test creates an invisible and iconified frame that should not become visible.
+
+ If you observe the window titled 'Should NOT BE SHOWN' in the taskbar,
+ press FAIL, otherwise press PASS
+ """;
+
+ static Frame frame;
+
+ public static void main(String[] args) throws Exception {
+ PassFailJFrame shownOnPackInstructions = PassFailJFrame
+ .builder()
+ .title("ShownOnPack Instructions")
+ .instructions(INSTRUCTIONS)
+ .rows(5)
+ .columns(50)
+ .build();
+
+ EventQueue.invokeAndWait(() -> {
+ frame = new Frame("Should NOT BE SHOWN");
+ frame.setExtendedState(Frame.ICONIFIED);
+ frame.pack();
+ });
+
+ try {
+ shownOnPackInstructions.awaitAndCheck();
+ } finally {
+ EventQueue.invokeAndWait(() -> frame.dispose());
+ }
}
-
-
- public static void printInstructions( String[] instructions )
- {
- dialog.printInstructions( instructions );
- }
-
-
- public static void println( String messageIn )
- {
- dialog.displayMessage( messageIn );
- }
-
-}// Sysout class
-
-/**
- This is part of the standard test machinery. It provides a place for the
- test instructions to be displayed, and a place for interactive messages
- to the user to be displayed.
- To have the test instructions displayed, see Sysout.
- To have a message to the user be displayed, see Sysout.
- Do not call anything in this dialog directly.
- */
-class TestDialog extends Dialog
-{
-
- TextArea instructionsText;
- TextArea messageText;
- int maxStringLength = 80;
-
- //DO NOT call this directly, go through Sysout
- public TestDialog( Frame frame, String name )
- {
- super( frame, name );
- int scrollBoth = TextArea.SCROLLBARS_BOTH;
- instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
- add( "North", instructionsText );
-
- messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
- add("Center", messageText);
-
- pack();
-
- setVisible(true);
- }// TestDialog()
-
- //DO NOT call this directly, go through Sysout
- public void printInstructions( String[] instructions )
- {
- //Clear out any current instructions
- instructionsText.setText( "" );
-
- //Go down array of instruction strings
-
- String printStr, remainingStr;
- for( int i=0; i < instructions.length; i++ )
- {
- //chop up each into pieces maxSringLength long
- remainingStr = instructions[ i ];
- while( remainingStr.length() > 0 )
- {
- //if longer than max then chop off first max chars to print
- if( remainingStr.length() >= maxStringLength )
- {
- //Try to chop on a word boundary
- int posOfSpace = remainingStr.
- lastIndexOf( ' ', maxStringLength - 1 );
-
- if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
- printStr = remainingStr.substring( 0, posOfSpace + 1 );
- remainingStr = remainingStr.substring( posOfSpace + 1 );
- }
- //else just print
- else
- {
- printStr = remainingStr;
- remainingStr = "";
- }
-
- instructionsText.append( printStr + "\n" );
-
- }// while
-
- }// for
-
- }//printInstructions()
-
- //DO NOT call this directly, go through Sysout
- public void displayMessage( String messageIn )
- {
- messageText.append( messageIn + "\n" );
- System.out.println(messageIn);
- }
-
-}// TestDialog class
+}
From e6a8fdd82c2b97f7ae74dfe8fbd3402718c9161c Mon Sep 17 00:00:00 2001
From: Doug Simon
Date: Thu, 14 Mar 2024 16:11:29 +0000
Subject: [PATCH 58/58] 8328135:
javax/management/remote/mandatory/loading/MissingClassTest.java fails on
libgraal
Reviewed-by: kevinw, never
---
.../management/remote/mandatory/loading/MissingClassTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/jdk/javax/management/remote/mandatory/loading/MissingClassTest.java b/test/jdk/javax/management/remote/mandatory/loading/MissingClassTest.java
index 9df5aee12b6a7..516c30c60a85c 100644
--- a/test/jdk/javax/management/remote/mandatory/loading/MissingClassTest.java
+++ b/test/jdk/javax/management/remote/mandatory/loading/MissingClassTest.java
@@ -484,7 +484,7 @@ private static boolean notifyTest(JMXConnector client,
// wait for the listeners to receive all their notifs
// or to fail
- long deadline = System.currentTimeMillis() + 60000;
+ long deadline = System.currentTimeMillis() + 90000;
long remain;
while ((remain = deadline - System.currentTimeMillis()) >= 0) {
synchronized (result) {