Merge
This commit is contained in:
commit
1b8e41bf5b
1
.hgtags
1
.hgtags
@ -567,4 +567,5 @@ b034d2dee5fc93d42a81b65e58ce3f91e42586ff jdk-13+23
|
||||
2f4e214781a1d597ed36bf5a36f20928c6c82996 jdk-14+1
|
||||
0692b67f54621991ba7afbf23e55b788f3555e69 jdk-13+26
|
||||
43627549a488b7d0b4df8fad436e36233df89877 jdk-14+2
|
||||
b7f68ddec66f996ae3aad03291d129ca9f02482d jdk-13+27
|
||||
e64383344f144217c36196c3c8a2df8f588a2af3 jdk-14+3
|
||||
|
@ -81,13 +81,13 @@ ciMethodData::ciMethodData() : ciMetadata(NULL) {
|
||||
// Check for entries that reference an unloaded method
|
||||
class PrepareExtraDataClosure : public CleanExtraDataClosure {
|
||||
MethodData* _mdo;
|
||||
uint64_t _safepoint_counter;
|
||||
SafepointStateTracker _safepoint_tracker;
|
||||
GrowableArray<Method*> _uncached_methods;
|
||||
|
||||
public:
|
||||
PrepareExtraDataClosure(MethodData* mdo)
|
||||
: _mdo(mdo),
|
||||
_safepoint_counter(SafepointSynchronize::safepoint_counter()),
|
||||
_safepoint_tracker(SafepointSynchronize::safepoint_state_tracker()),
|
||||
_uncached_methods()
|
||||
{ }
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
}
|
||||
|
||||
bool has_safepointed() {
|
||||
return SafepointSynchronize::safepoint_counter() != _safepoint_counter;
|
||||
return _safepoint_tracker.safepoint_state_changed();
|
||||
}
|
||||
|
||||
bool finish() {
|
||||
|
@ -99,15 +99,15 @@ class DependencyContext : public StackObj {
|
||||
// Safepoints are forbidden during DC lifetime. GC can invalidate
|
||||
// _dependency_context_addr if it relocates the holder
|
||||
// (e.g. CallSiteContext Java object).
|
||||
uint64_t _safepoint_counter;
|
||||
SafepointStateTracker _safepoint_tracker;
|
||||
|
||||
DependencyContext(nmethodBucket* volatile* bucket_addr, volatile uint64_t* last_cleanup_addr)
|
||||
: _dependency_context_addr(bucket_addr),
|
||||
_last_cleanup_addr(last_cleanup_addr),
|
||||
_safepoint_counter(SafepointSynchronize::safepoint_counter()) {}
|
||||
_safepoint_tracker(SafepointSynchronize::safepoint_state_tracker()) {}
|
||||
|
||||
~DependencyContext() {
|
||||
assert(SafepointSynchronize::is_same_safepoint(_safepoint_counter), "must be the same safepoint");
|
||||
assert(!_safepoint_tracker.safepoint_state_changed(), "must be the same safepoint");
|
||||
}
|
||||
#else
|
||||
DependencyContext(nmethodBucket* volatile* bucket_addr, volatile uint64_t* last_cleanup_addr)
|
||||
|
@ -548,7 +548,7 @@ public:
|
||||
if (biased_locker != NULL) {
|
||||
_biased_locker_id = JFR_THREAD_ID(biased_locker);
|
||||
}
|
||||
_safepoint_id = SafepointSynchronize::safepoint_counter();
|
||||
_safepoint_id = SafepointSynchronize::safepoint_id();
|
||||
clean_up_cached_monitor_info();
|
||||
return;
|
||||
} else {
|
||||
@ -589,7 +589,7 @@ public:
|
||||
|
||||
virtual void doit() {
|
||||
_status_code = bulk_revoke_or_rebias_at_safepoint((*_obj)(), _bulk_rebias, _attempt_rebias_of_object, _requesting_thread);
|
||||
_safepoint_id = SafepointSynchronize::safepoint_counter();
|
||||
_safepoint_id = SafepointSynchronize::safepoint_id();
|
||||
clean_up_cached_monitor_info();
|
||||
}
|
||||
|
||||
|
@ -118,12 +118,22 @@ static void post_safepoint_end_event(EventSafepointEnd& event, uint64_t safepoin
|
||||
}
|
||||
}
|
||||
|
||||
// SafepointCheck
|
||||
SafepointStateTracker::SafepointStateTracker(uint64_t safepoint_id, bool at_safepoint)
|
||||
: _safepoint_id(safepoint_id), _at_safepoint(at_safepoint) {}
|
||||
|
||||
bool SafepointStateTracker::safepoint_state_changed() {
|
||||
return _safepoint_id != SafepointSynchronize::safepoint_id() ||
|
||||
_at_safepoint != SafepointSynchronize::is_at_safepoint();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------------------
|
||||
// Implementation of Safepoint begin/end
|
||||
|
||||
SafepointSynchronize::SynchronizeState volatile SafepointSynchronize::_state = SafepointSynchronize::_not_synchronized;
|
||||
int SafepointSynchronize::_waiting_to_block = 0;
|
||||
volatile uint64_t SafepointSynchronize::_safepoint_counter = 0;
|
||||
uint64_t SafepointSynchronize::_safepoint_id = 0;
|
||||
const uint64_t SafepointSynchronize::InactiveSafepointCounter = 0;
|
||||
int SafepointSynchronize::_current_jni_active_count = 0;
|
||||
|
||||
@ -154,7 +164,7 @@ void SafepointSynchronize::decrement_waiting_to_block() {
|
||||
--_waiting_to_block;
|
||||
}
|
||||
|
||||
static bool thread_not_running(ThreadSafepointState *cur_state) {
|
||||
bool SafepointSynchronize::thread_not_running(ThreadSafepointState *cur_state) {
|
||||
if (!cur_state->is_running()) {
|
||||
return true;
|
||||
}
|
||||
@ -408,6 +418,9 @@ void SafepointSynchronize::begin() {
|
||||
|
||||
OrderAccess::fence();
|
||||
|
||||
// Set the new id
|
||||
++_safepoint_id;
|
||||
|
||||
#ifdef ASSERT
|
||||
// Make sure all the threads were visited.
|
||||
for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
|
||||
@ -419,7 +432,7 @@ void SafepointSynchronize::begin() {
|
||||
GCLocker::set_jni_lock_count(_current_jni_active_count);
|
||||
|
||||
post_safepoint_synchronize_event(sync_event,
|
||||
_safepoint_counter,
|
||||
_safepoint_id,
|
||||
initial_running,
|
||||
_waiting_to_block, iterations);
|
||||
|
||||
@ -429,14 +442,14 @@ void SafepointSynchronize::begin() {
|
||||
// needs cleanup to be completed before running the GC op.
|
||||
EventSafepointCleanup cleanup_event;
|
||||
do_cleanup_tasks();
|
||||
post_safepoint_cleanup_event(cleanup_event, _safepoint_counter);
|
||||
post_safepoint_cleanup_event(cleanup_event, _safepoint_id);
|
||||
|
||||
post_safepoint_begin_event(begin_event, _safepoint_counter, nof_threads, _current_jni_active_count);
|
||||
post_safepoint_begin_event(begin_event, _safepoint_id, nof_threads, _current_jni_active_count);
|
||||
SafepointTracing::cleanup();
|
||||
}
|
||||
|
||||
void SafepointSynchronize::disarm_safepoint() {
|
||||
uint64_t safepoint_id = _safepoint_counter;
|
||||
uint64_t active_safepoint_counter = _safepoint_counter;
|
||||
{
|
||||
JavaThreadIteratorWithHandle jtiwh;
|
||||
#ifdef ASSERT
|
||||
@ -475,7 +488,7 @@ void SafepointSynchronize::disarm_safepoint() {
|
||||
jtiwh.rewind();
|
||||
for (; JavaThread *current = jtiwh.next(); ) {
|
||||
// Clear the visited flag to ensure that the critical counts are collected properly.
|
||||
DEBUG_ONLY(current->reset_visited_for_critical_count(safepoint_id);)
|
||||
DEBUG_ONLY(current->reset_visited_for_critical_count(active_safepoint_counter);)
|
||||
ThreadSafepointState* cur_state = current->safepoint_state();
|
||||
assert(!cur_state->is_running(), "Thread not suspended at safepoint");
|
||||
cur_state->restart(); // TSS _running
|
||||
@ -497,7 +510,6 @@ void SafepointSynchronize::disarm_safepoint() {
|
||||
void SafepointSynchronize::end() {
|
||||
assert(Threads_lock->owned_by_self(), "must hold Threads_lock");
|
||||
EventSafepointEnd event;
|
||||
uint64_t safepoint_id = _safepoint_counter;
|
||||
assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint");
|
||||
|
||||
disarm_safepoint();
|
||||
@ -506,7 +518,7 @@ void SafepointSynchronize::end() {
|
||||
|
||||
SafepointTracing::end();
|
||||
|
||||
post_safepoint_end_event(event, safepoint_id);
|
||||
post_safepoint_end_event(event, safepoint_id());
|
||||
}
|
||||
|
||||
bool SafepointSynchronize::is_cleanup_needed() {
|
||||
@ -554,7 +566,7 @@ public:
|
||||
_counters(counters) {}
|
||||
|
||||
void work(uint worker_id) {
|
||||
uint64_t safepoint_id = SafepointSynchronize::safepoint_counter();
|
||||
uint64_t safepoint_id = SafepointSynchronize::safepoint_id();
|
||||
// All threads deflate monitors and mark nmethods (if necessary).
|
||||
Threads::possibly_parallel_threads_do(true, &_cleanup_threads_cl);
|
||||
|
||||
|
@ -48,6 +48,14 @@
|
||||
|
||||
class ThreadSafepointState;
|
||||
|
||||
class SafepointStateTracker {
|
||||
uint64_t _safepoint_id;
|
||||
bool _at_safepoint;
|
||||
public:
|
||||
SafepointStateTracker(uint64_t safepoint_id, bool at_safepoint);
|
||||
bool safepoint_state_changed();
|
||||
};
|
||||
|
||||
//
|
||||
// Implements roll-forward to safepoint (safepoint synchronization)
|
||||
//
|
||||
@ -77,6 +85,7 @@ class SafepointSynchronize : AllStatic {
|
||||
friend class SafepointMechanism;
|
||||
friend class ThreadSafepointState;
|
||||
friend class HandshakeState;
|
||||
friend class SafepointStateTracker;
|
||||
|
||||
// Threads might read this flag directly, without acquiring the Threads_lock:
|
||||
static volatile SynchronizeState _state;
|
||||
@ -91,6 +100,11 @@ class SafepointSynchronize : AllStatic {
|
||||
// safepoint.
|
||||
static volatile uint64_t _safepoint_counter;
|
||||
|
||||
// A change in this counter or a change in the result of
|
||||
// is_at_safepoint() are used by SafepointStateTracker::
|
||||
// safepoint_state_changed() to determine its answer.
|
||||
static uint64_t _safepoint_id;
|
||||
|
||||
// JavaThreads that need to block for the safepoint will stop on the
|
||||
// _wait_barrier, where they can quickly be started again.
|
||||
static WaitBarrier* _wait_barrier;
|
||||
@ -114,6 +128,7 @@ class SafepointSynchronize : AllStatic {
|
||||
static void disarm_safepoint();
|
||||
static void increment_jni_active_count();
|
||||
static void decrement_waiting_to_block();
|
||||
static bool thread_not_running(ThreadSafepointState *cur_state);
|
||||
|
||||
// Used in safepoint_safe to do a stable load of the thread state.
|
||||
static bool try_stable_load_state(JavaThreadState *state,
|
||||
@ -127,6 +142,8 @@ class SafepointSynchronize : AllStatic {
|
||||
// If true the VMThread may safely process the handshake operation for the JavaThread.
|
||||
static bool handshake_safe(JavaThread *thread);
|
||||
|
||||
static uint64_t safepoint_counter() { return _safepoint_counter; }
|
||||
|
||||
public:
|
||||
|
||||
static void init(Thread* vmthread);
|
||||
@ -141,8 +158,15 @@ public:
|
||||
// Query
|
||||
static bool is_at_safepoint() { return _state == _synchronized; }
|
||||
static bool is_synchronizing() { return _state == _synchronizing; }
|
||||
static uint64_t safepoint_counter() { return _safepoint_counter; }
|
||||
static bool is_same_safepoint(uint64_t counter) { return (SafepointSynchronize::safepoint_counter() - counter) < 2; }
|
||||
|
||||
static uint64_t safepoint_id() {
|
||||
return _safepoint_id;
|
||||
}
|
||||
|
||||
static SafepointStateTracker safepoint_state_tracker() {
|
||||
return SafepointStateTracker(safepoint_id(), is_at_safepoint());
|
||||
}
|
||||
|
||||
// Exception handling for page polling
|
||||
static void handle_polling_page_exception(JavaThread *thread);
|
||||
|
||||
|
@ -388,7 +388,7 @@ static void post_vm_operation_event(EventExecuteVMOperation* event, VM_Operation
|
||||
// For concurrent vm operations, the thread id is set to 0 indicating thread is unknown.
|
||||
// This is because the caller thread could have exited already.
|
||||
event->set_caller(is_concurrent ? 0 : JFR_THREAD_ID(op->calling_thread()));
|
||||
event->set_safepointId(evaluate_at_safepoint ? SafepointSynchronize::safepoint_counter() : 0);
|
||||
event->set_safepointId(evaluate_at_safepoint ? SafepointSynchronize::safepoint_id() : 0);
|
||||
event->commit();
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ void DCmdRegistrant::register_dcmds(){
|
||||
|
||||
// Debug on cmd (only makes sense with JVMTI since the agentlib needs it).
|
||||
#if INCLUDE_JVMTI
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, false));
|
||||
DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<DebugOnCmdStartDCmd>(full_export, true, true));
|
||||
#endif // INCLUDE_JVMTI
|
||||
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ public abstract class UNIXToolkit extends SunToolkit
|
||||
public String getDesktop() {
|
||||
String gsi = AccessController.doPrivileged(
|
||||
(PrivilegedAction<String>) ()
|
||||
-> System.getenv("GNOME_SESSION_ID"));
|
||||
-> System.getenv("GNOME_DESKTOP_SESSION_ID"));
|
||||
return (gsi != null) ? "gnome" : null;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1998, 2019, 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
|
||||
@ -873,7 +873,6 @@ printUsage(void)
|
||||
"launch=<command line> run debugger on event none\n"
|
||||
"onthrow=<exception name> debug on throw none\n"
|
||||
"onuncaught=y|n debug on any uncaught? n\n"
|
||||
"onjcmd=y|n start debug via jcmd? n\n"
|
||||
"timeout=<timeout value> for listen/attach in milliseconds n\n"
|
||||
"mutf8=y|n output modified utf-8 n\n"
|
||||
"quiet=y|n control over terminal messages n\n"));
|
||||
|
@ -0,0 +1,83 @@
|
||||
/*
|
||||
* Copyright (c) 2019, 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 8226783
|
||||
* @key headful
|
||||
* @summary Verify System L&F
|
||||
*/
|
||||
|
||||
/*
|
||||
* Verify the System LAF is what we expect based on platform and,
|
||||
* in at least one case, the desktop environment.
|
||||
* Since changes to the system LAF are a once in a blue moon event,
|
||||
* this test is useful to tell us of unexpected problems.
|
||||
* Note: this test must be run in a headful environment
|
||||
* since otherwise a system LAF may not be available.
|
||||
*/
|
||||
|
||||
public class SystemLookAndFeelTest {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String laf = javax.swing.UIManager.getSystemLookAndFeelClassName();
|
||||
String os = System.getProperty("os.name").toLowerCase();
|
||||
System.out.println("OS is " + os);
|
||||
System.out.println("Reported System LAF is " + laf);
|
||||
|
||||
String expLAF = null;
|
||||
if (os.contains("windows")) {
|
||||
expLAF = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
|
||||
} else if (os.contains("macos")) {
|
||||
expLAF = "com.apple.laf.AquaLookAndFeel";
|
||||
} else if (os.contains("linux") || os.contains("sunos")) {
|
||||
/*
|
||||
* The implementation keys off the following desktop setting to
|
||||
* decide if GTK is an appropriate system L&F.
|
||||
* In its absence, there probably isn't support for the GTK L&F
|
||||
* anyway. It does not tell us if the GTK libraries are available
|
||||
* but they really should be if this is a gnome session.
|
||||
* If it proves necessary the test can perhaps be updated to see
|
||||
* if the GTK LAF is listed as installed and can be instantiated.
|
||||
*/
|
||||
String gnome = System.getenv("GNOME_DESKTOP_SESSION_ID");
|
||||
System.out.println("Gnome desktop session ID is " + gnome);
|
||||
if (gnome != null) {
|
||||
expLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
|
||||
} else if (os.contains("linux")) {
|
||||
expLAF = "javax.swing.plaf.metal.MetalLookAndFeel";
|
||||
} else if (os.contains("sunos")) {
|
||||
expLAF = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
|
||||
}
|
||||
}
|
||||
System.out.println("Expected System LAF is " + expLAF);
|
||||
if (expLAF == null) {
|
||||
System.out.println("No match for expected LAF, unknown OS ?");
|
||||
return;
|
||||
}
|
||||
if (!(laf.equals(expLAF))) {
|
||||
throw new RuntimeException("LAF not as expected");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user