Skip to content

Commit

Permalink
Merge upstream-jdk
Browse files Browse the repository at this point in the history
  • Loading branch information
corretto-github-robot committed Jul 11, 2023
2 parents 75bb033 + 4b1403d commit 2237c7d
Show file tree
Hide file tree
Showing 26 changed files with 143 additions and 142 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/FileChooserDemo

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/nbproject/jfc/Font2DTest/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/Font2DTest

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/nbproject/jfc/Metalworks/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/Metalworks

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/nbproject/jfc/Notepad/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/Notepad

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/nbproject/jfc/SampleTree/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/SampleTree

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/demo/share/nbproject/jfc/TableExample/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/TableExample

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
main.dir=${basedir}/../../../jfc/TransparentRuler

src.dir=${main.dir}/src
src.dir=${main.dir}/

build.dir=build
classes.dir=${build.dir}/classes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<!--
Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -41,10 +41,7 @@
</nbjpdastart>
<java classname="${main.class}" failonerror="true" fork="true">
<classpath path="${run.cp}"/>
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xnoagent"/>
<jvmarg value="-Djava.compiler=none"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
<jvmarg value="-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=${jpda.address}"/>
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/aarch64/stubRoutines_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enum platform_dependent_constants {
_initial_stubs_code_size = 10000,
_continuation_stubs_code_size = 2000,
_compiler_stubs_code_size = 30000 ZGC_ONLY(+10000),
_final_stubs_code_size = 20000 ZGC_ONLY(+60000)
_final_stubs_code_size = 20000 ZGC_ONLY(+100000)
};

class aarch64 {
Expand Down
4 changes: 1 addition & 3 deletions src/hotspot/share/runtime/java.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,7 @@ void before_exit(JavaThread* thread, bool halt) {

// Stop the WatcherThread. We do this before disenrolling various
// PeriodicTasks to reduce the likelihood of races.
if (PeriodicTask::num_tasks() > 0) {
WatcherThread::stop();
}
WatcherThread::stop();

// shut down the StatSampler task
StatSampler::disengage();
Expand Down
30 changes: 18 additions & 12 deletions src/hotspot/share/runtime/nonJavaThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void NamedThread::print_on(outputStream* st) const {
// timer interrupts exists on the platform.

WatcherThread* WatcherThread::_watcher_thread = nullptr;
bool WatcherThread::_startable = false;
bool WatcherThread::_run_all_tasks = false;
volatile bool WatcherThread::_should_terminate = false;

WatcherThread::WatcherThread() : NonJavaThread() {
Expand Down Expand Up @@ -185,6 +185,11 @@ int WatcherThread::sleep() const {
return 0; // we did not sleep.
}

if (!_run_all_tasks) {
ml.wait(100);
return 0;
}

// remaining will be zero if there are no tasks,
// causing the WatcherThread to sleep until a task is
// enrolled
Expand Down Expand Up @@ -280,7 +285,10 @@ void WatcherThread::run() {
break;
}

PeriodicTask::real_time_tick(time_waited);
// Don't process enrolled tasks until VM is fully initialized.
if (_run_all_tasks) {
PeriodicTask::real_time_tick(time_waited);
}
}

// Signal that it is terminated
Expand All @@ -293,18 +301,16 @@ void WatcherThread::run() {
}

void WatcherThread::start() {
assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");

if (watcher_thread() == nullptr && _startable) {
_should_terminate = false;
// Create the single instance of WatcherThread
new WatcherThread();
}
MonitorLocker ml(PeriodicTask_lock);
_should_terminate = false;
// Create the single instance of WatcherThread
new WatcherThread();
}

void WatcherThread::make_startable() {
assert(PeriodicTask_lock->owned_by_self(), "PeriodicTask_lock required");
_startable = true;
void WatcherThread::run_all_tasks() {
MonitorLocker ml(PeriodicTask_lock);
_run_all_tasks = true;
ml.notify();
}

void WatcherThread::stop() {
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/runtime/nonJavaThread.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class WatcherThread: public NonJavaThread {
private:
static WatcherThread* _watcher_thread;

static bool _startable;
static bool _run_all_tasks;
// volatile due to at least one lock-free read
volatile static bool _should_terminate;
public:
Expand All @@ -137,9 +137,9 @@ class WatcherThread: public NonJavaThread {
// Create and start the single instance of WatcherThread, or stop it on shutdown
static void start();
static void stop();
// Only allow start once the VM is sufficiently initialized
// Otherwise the first task to enroll will trigger the start
static void make_startable();
// Allow executing registered tasks once the VM is sufficiently
// initialized. Meanwhile only error reporting will be checked.
static void run_all_tasks();
private:
int sleep() const;
};
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/runtime/task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "runtime/mutexLocker.hpp"
#include "runtime/nonJavaThread.hpp"
#include "runtime/task.hpp"
#include "runtime/threads.hpp"
#include "runtime/timer.hpp"

int PeriodicTask::_num_tasks = 0;
Expand Down Expand Up @@ -95,10 +96,9 @@ void PeriodicTask::enroll() {
}

WatcherThread* thread = WatcherThread::watcher_thread();
assert(thread != nullptr || !Threads::is_vm_complete(), "vm created but no WatcherThread");
if (thread != nullptr) {
thread->unpark();
} else {
WatcherThread::start();
}
}

Expand Down
22 changes: 9 additions & 13 deletions src/hotspot/share/runtime/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,10 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
return status;
}

// Create WatcherThread as soon as we can since we need it in case
// of hangs during error reporting.
WatcherThread::start();

// Add main_thread to threads list to finish barrier setup with
// on_thread_attach. Should be before starting to build Java objects in
// init_globals2, which invokes barriers.
Expand Down Expand Up @@ -792,19 +796,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
CLEAR_PENDING_EXCEPTION;
}

{
MutexLocker ml(PeriodicTask_lock);
// Make sure the WatcherThread can be started by WatcherThread::start()
// or by dynamic enrollment.
WatcherThread::make_startable();
// Start up the WatcherThread if there are any periodic tasks
// NOTE: All PeriodicTasks should be registered by now. If they
// aren't, late joiners might appear to start slowly (we might
// take a while to process their first tick).
if (PeriodicTask::num_tasks() > 0) {
WatcherThread::start();
}
}
// Let WatcherThread run all registered periodic tasks now.
// NOTE: All PeriodicTasks should be registered by now. If they
// aren't, late joiners might appear to start slowly (we might
// take a while to process their first tick).
WatcherThread::run_all_tasks();

create_vm_timer.end();
#ifdef ASSERT
Expand Down
Loading

0 comments on commit 2237c7d

Please sign in to comment.