# HG changeset patch
# User henryjen
# Date 1571175234 0
# Node ID e0bb6b38a6f6d8cd44e21061ebbe83ebf94f1ced
# Parent 7be56b2ac50d12e915f294b857bb1f5d5181c875# Parent fbfc72ec8e6bf13311c0f39338331ef81dad1bf5
Merge
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/os/aix/os_aix.cpp
--- a/src/hotspot/os/aix/os_aix.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/os/aix/os_aix.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -2643,8 +2643,24 @@
60 // 11 CriticalPriority
};
+static int prio_init() {
+ if (ThreadPriorityPolicy == 1) {
+ if (geteuid() != 0) {
+ if (!FLAG_IS_DEFAULT(ThreadPriorityPolicy)) {
+ warning("-XX:ThreadPriorityPolicy=1 may require system level permission, " \
+ "e.g., being the root user. If the necessary permission is not " \
+ "possessed, changes to priority will be silently ignored.");
+ }
+ }
+ }
+ if (UseCriticalJavaThreadPriority) {
+ os::java_to_os_priority[MaxPriority] = os::java_to_os_priority[CriticalPriority];
+ }
+ return 0;
+}
+
OSReturn os::set_native_priority(Thread* thread, int newpri) {
- if (!UseThreadPriorities) return OS_OK;
+ if (!UseThreadPriorities || ThreadPriorityPolicy == 0) return OS_OK;
pthread_t thr = thread->osthread()->pthread_id();
int policy = SCHED_OTHER;
struct sched_param param;
@@ -2659,7 +2675,7 @@
}
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) {
- if (!UseThreadPriorities) {
+ if (!UseThreadPriorities || ThreadPriorityPolicy == 0) {
*priority_ptr = java_to_os_priority[NormPriority];
return OS_OK;
}
@@ -3569,6 +3585,9 @@
}
}
+ // initialize thread priority policy
+ prio_init();
+
return JNI_OK;
}
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/c1/c1_ValueStack.cpp
--- a/src/hotspot/share/c1/c1_ValueStack.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/c1/c1_ValueStack.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -42,31 +42,21 @@
verify();
}
-
ValueStack::ValueStack(ValueStack* copy_from, Kind kind, int bci)
: _scope(copy_from->scope())
, _caller_state(copy_from->caller_state())
, _bci(bci)
, _kind(kind)
- , _locals()
- , _stack()
+ , _locals(copy_from->locals_size_for_copy(kind))
+ , _stack(copy_from->stack_size_for_copy(kind))
, _locks(copy_from->locks_size() == 0 ? NULL : new Values(copy_from->locks_size()))
{
assert(kind != EmptyExceptionState || !Compilation::current()->env()->should_retain_local_variables(), "need locals");
if (kind != EmptyExceptionState) {
- // only allocate space if we need to copy the locals-array
- _locals = Values(copy_from->locals_size());
_locals.appendAll(©_from->_locals);
}
if (kind != ExceptionState && kind != EmptyExceptionState) {
- if (kind == Parsing) {
- // stack will be modified, so reserve enough space to avoid resizing
- _stack = Values(scope()->method()->max_stack());
- } else {
- // stack will not be modified, so do not waste space
- _stack = Values(copy_from->stack_size());
- }
_stack.appendAll(©_from->_stack);
}
@@ -77,6 +67,25 @@
verify();
}
+int ValueStack::locals_size_for_copy(Kind kind) const {
+ if (kind != EmptyExceptionState) {
+ return locals_size();
+ }
+ return 0;
+}
+
+int ValueStack::stack_size_for_copy(Kind kind) const {
+ if (kind != ExceptionState && kind != EmptyExceptionState) {
+ if (kind == Parsing) {
+ // stack will be modified, so reserve enough space to avoid resizing
+ return scope()->method()->max_stack();
+ } else {
+ // stack will not be modified, so do not waste space
+ return stack_size();
+ }
+ }
+ return 0;
+}
bool ValueStack::is_same(ValueStack* s) {
if (scope() != s->scope()) return false;
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/c1/c1_ValueStack.hpp
--- a/src/hotspot/share/c1/c1_ValueStack.hpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/c1/c1_ValueStack.hpp Tue Oct 15 21:33:54 2019 +0000
@@ -65,6 +65,8 @@
// for simplified copying
ValueStack(ValueStack* copy_from, Kind kind, int bci);
+ int locals_size_for_copy(Kind kind) const;
+ int stack_size_for_copy(Kind kind) const;
public:
// creation
ValueStack(IRScope* scope, ValueStack* caller_state);
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/ci/ciMetadata.hpp
--- a/src/hotspot/share/ci/ciMetadata.hpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/ci/ciMetadata.hpp Tue Oct 15 21:33:54 2019 +0000
@@ -51,7 +51,6 @@
virtual bool is_metadata() const { return true; }
virtual bool is_type() const { return false; }
- virtual bool is_cpcache() const { return false; }
virtual bool is_return_address() const { return false; }
virtual bool is_method() const { return false; }
virtual bool is_method_data() const { return false; }
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/gc/epsilon/epsilonArguments.cpp
--- a/src/hotspot/share/gc/epsilon/epsilonArguments.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/gc/epsilon/epsilonArguments.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -45,13 +45,25 @@
FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true);
}
+ // Warn users that non-resizable heap might be better for some configurations.
+ // We are not adjusting the heap size by ourselves, because it affects startup time.
+ if (InitialHeapSize != MaxHeapSize) {
+ log_warning(gc)("Consider setting -Xms equal to -Xmx to avoid resizing hiccups");
+ }
+
+ // Warn users that AlwaysPreTouch might be better for some configurations.
+ // We are not turning this on by ourselves, because it affects startup time.
+ if (FLAG_IS_DEFAULT(AlwaysPreTouch) && !AlwaysPreTouch) {
+ log_warning(gc)("Consider enabling -XX:+AlwaysPreTouch to avoid memory commit hiccups");
+ }
+
if (EpsilonMaxTLABSize < MinTLABSize) {
- warning("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
+ log_warning(gc)("EpsilonMaxTLABSize < MinTLABSize, adjusting it to " SIZE_FORMAT, MinTLABSize);
EpsilonMaxTLABSize = MinTLABSize;
}
if (!EpsilonElasticTLAB && EpsilonElasticTLABDecay) {
- warning("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled");
+ log_warning(gc)("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled");
FLAG_SET_DEFAULT(EpsilonElasticTLABDecay, false);
}
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -319,13 +319,20 @@
};
void ShenandoahConcurrentMark::update_thread_roots(ShenandoahPhaseTimings::Phase root_phase) {
- WorkGang* workers = _heap->workers();
- bool is_par = workers->active_workers() > 1;
+ assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
+
+ ShenandoahGCPhase phase(root_phase);
+
#if COMPILER2_OR_JVMCI
DerivedPointerTable::clear();
#endif
+
+ WorkGang* workers = _heap->workers();
+ bool is_par = workers->active_workers() > 1;
+
ShenandoahUpdateThreadRootsTask task(is_par, root_phase);
workers->run_task(&task);
+
#if COMPILER2_OR_JVMCI
DerivedPointerTable::update_pointers();
#endif
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -964,7 +964,6 @@
ShenandoahHeapRegion* r;
while ((r =_cs->claim_next()) != NULL) {
assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->region_number());
- assert(r->is_conc_move_allowed(), "Region " SIZE_FORMAT " should be movable", r->region_number());
_sh->marked_object_iterate(r, &cl);
if (ShenandoahPacing) {
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.hpp Tue Oct 15 21:33:54 2019 +0000
@@ -198,8 +198,7 @@
// Macro-properties:
bool is_alloc_allowed() const { return is_empty() || is_regular() || _state == _pinned; }
- bool is_conc_move_allowed() const { return is_regular() || _state == _cset; }
- bool is_stw_move_allowed() const { return is_conc_move_allowed() || (ShenandoahHumongousMoves && _state == _humongous_start); }
+ bool is_stw_move_allowed() const { return is_regular() || _state == _cset || (ShenandoahHumongousMoves && _state == _humongous_start); }
RegionState state() const { return _state; }
int state_ordinal() const { return region_state_to_ordinal(_state); }
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/opto/loopTransform.cpp
--- a/src/hotspot/share/opto/loopTransform.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/opto/loopTransform.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -3129,6 +3129,13 @@
// We also need to replace the original limit to collapse loop exit.
Node* cmp = cl->loopexit()->cmp_node();
assert(cl->limit() == cmp->in(2), "sanity");
+ // Duplicate cmp node if it has other users
+ if (cmp->outcnt() > 1) {
+ cmp = cmp->clone();
+ cmp = phase->_igvn.register_new_node_with_optimizer(cmp);
+ BoolNode *bol = cl->loopexit()->in(CountedLoopEndNode::TestValue)->as_Bool();
+ phase->_igvn.replace_input_of(bol, 1, cmp); // put bol on worklist
+ }
phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist
phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist
}
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/runtime/threadSMR.cpp
--- a/src/hotspot/share/runtime/threadSMR.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/runtime/threadSMR.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -528,6 +528,22 @@
return;
}
+ if ( _thread == VM_Exit::shutdown_thread()) {
+ // The shutdown thread has removed itself from the Threads
+ // list and is safe to have a waiver from this check because
+ // VM_Exit::_shutdown_thread is not set until after the VMThread
+ // has started the final safepoint which holds the Threads_lock
+ // for the remainder of the VM's life.
+ return;
+ }
+
+ if (VMError::is_error_reported() &&
+ VMError::get_first_error_tid() == os::current_thread_id()) {
+ // If there is an error reported by this thread it may use ThreadsList even
+ // if it's unsafe.
+ return;
+ }
+
// The closure will attempt to verify that the calling thread can
// be found by threads_do() on the specified ThreadsList. If it
// is successful, then the specified ThreadsList was acquired as
@@ -540,12 +556,6 @@
// ThreadsList is not a stable hazard ptr and can be freed by
// another thread from the to-be-deleted list at any time.
//
- // Note: The shutdown thread has removed itself from the Threads
- // list and is safe to have a waiver from this check because
- // VM_Exit::_shutdown_thread is not set until after the VMThread
- // has started the final safepoint which holds the Threads_lock
- // for the remainder of the VM's life.
- //
VerifyHazardPtrThreadClosure cl(_thread);
ThreadsSMRSupport::threads_do(&cl, _list);
@@ -555,7 +565,7 @@
// In either case, we won't get past this point with a badly placed
// ThreadsListHandle.
- assert(cl.found() || _thread == VM_Exit::shutdown_thread(), "Acquired a ThreadsList snapshot from a thread not recognized by the Thread-SMR protocol.");
+ assert(cl.found(), "Acquired a ThreadsList snapshot from a thread not recognized by the Thread-SMR protocol.");
#endif
}
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/utilities/decoder.cpp
--- a/src/hotspot/share/utilities/decoder.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/utilities/decoder.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -84,7 +84,7 @@
}
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
- bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
+ bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid();
if (error_handling_thread) {
return get_error_handler_instance()->decode(addr, buf, buflen, offset, modulepath, demangle);
} else {
@@ -95,7 +95,7 @@
}
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
- bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
+ bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid();
if (error_handling_thread) {
return get_error_handler_instance()->decode(addr, buf, buflen, offset, base);
} else {
@@ -106,7 +106,7 @@
bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
- bool error_handling_thread = os::current_thread_id() == VMError::first_error_tid;
+ bool error_handling_thread = os::current_thread_id() == VMError::get_first_error_tid();
if (error_handling_thread) {
return get_error_handler_instance()->demangle(symbol, buf, buflen);
} else {
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/utilities/vmError.cpp
--- a/src/hotspot/share/utilities/vmError.cpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/utilities/vmError.cpp Tue Oct 15 21:33:54 2019 +0000
@@ -1205,7 +1205,7 @@
st->print_cr("END.");
}
-volatile intptr_t VMError::first_error_tid = -1;
+volatile intptr_t VMError::_first_error_tid = -1;
/** Expand a pattern into a buffer starting at pos and open a file using constructed path */
static int expand_and_open(const char* pattern, bool overwrite_existing, char* buf, size_t buflen, size_t pos) {
@@ -1355,8 +1355,8 @@
os::abort(CreateCoredumpOnCrash);
}
intptr_t mytid = os::current_thread_id();
- if (first_error_tid == -1 &&
- Atomic::cmpxchg(mytid, &first_error_tid, (intptr_t)-1) == -1) {
+ if (_first_error_tid == -1 &&
+ Atomic::cmpxchg(mytid, &_first_error_tid, (intptr_t)-1) == -1) {
// Initialize time stamps to use the same base.
out.time_stamp().update_to(1);
@@ -1416,7 +1416,7 @@
// This is not the first error, see if it happened in a different thread
// or in the same thread during error reporting.
- if (first_error_tid != mytid) {
+ if (_first_error_tid != mytid) {
char msgbuf[64];
jio_snprintf(msgbuf, sizeof(msgbuf),
"[thread " INTX_FORMAT " also had an error]",
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/hotspot/share/utilities/vmError.hpp
--- a/src/hotspot/share/utilities/vmError.hpp Mon Oct 14 21:01:25 2019 +0000
+++ b/src/hotspot/share/utilities/vmError.hpp Tue Oct 15 21:33:54 2019 +0000
@@ -32,8 +32,6 @@
class VM_ReportJavaOutOfMemory;
class VMError : public AllStatic {
- friend class VM_ReportJavaOutOfMemory;
- friend class Decoder;
friend class VMStructs;
static int _id; // Solaris/Linux signals: 0 - SIGRTMAX
@@ -65,7 +63,7 @@
// Thread id of the first error. We must be able to handle native thread,
// so use thread id instead of Thread* to identify thread.
- static volatile intptr_t first_error_tid;
+ static volatile intptr_t _first_error_tid;
// Core dump status, false if we have been unable to write a core/minidump for some reason
static bool coredump_status;
@@ -177,9 +175,9 @@
static address get_resetted_sighandler(int sig);
// check to see if fatal error reporting is in progress
- static bool fatal_error_in_progress() { return first_error_tid != -1; }
+ static bool fatal_error_in_progress() { return _first_error_tid != -1; }
- static intptr_t get_first_error_tid() { return first_error_tid; }
+ static intptr_t get_first_error_tid() { return _first_error_tid; }
// Called by the WatcherThread to check if error reporting has timed-out.
// Returns true if error reporting has not completed within the ErrorLogTimeout limit.
diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.base/share/classes/java/text/DecimalFormat.java
--- a/src/java.base/share/classes/java/text/DecimalFormat.java Mon Oct 14 21:01:25 2019 +0000
+++ b/src/java.base/share/classes/java/text/DecimalFormat.java Tue Oct 15 21:33:54 2019 +0000
@@ -2756,7 +2756,10 @@
/**
* Return the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example,
- * in the number "123,456.78", the grouping size is 3.
+ * in the number "123,456.78", the grouping size is 3. Grouping size of
+ * zero designates that grouping is not used, which provides the same
+ * formatting as if calling {@link #setGroupingUsed(boolean)
+ * setGroupingUsed(false)}.
*
* @return the grouping size
* @see #setGroupingSize
@@ -2770,16 +2773,28 @@
/**
* Set the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example,
- * in the number "123,456.78", the grouping size is 3.
- *
+ * in the number "123,456.78", the grouping size is 3. Grouping size of
+ * zero designates that grouping is not used, which provides the same
+ * formatting as if calling {@link #setGroupingUsed(boolean)
+ * setGroupingUsed(false)}.
+ *
* The value passed in is converted to a byte, which may lose information. + * Values that are negative or greater than + * {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE}, will throw an + * {@code IllegalArgumentException}. * * @param newValue the new grouping size * @see #getGroupingSize * @see java.text.NumberFormat#setGroupingUsed * @see java.text.DecimalFormatSymbols#setGroupingSeparator + * @throws IllegalArgumentException if {@code newValue} is negative or + * greater than {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE} */ public void setGroupingSize (int newValue) { + if (newValue < 0 || newValue > Byte.MAX_VALUE) { + throw new IllegalArgumentException( + "newValue is out of valid range. value: " + newValue); + } groupingSize = (byte)newValue; fastPathCheckNeeded = true; } @@ -3906,6 +3921,12 @@ // Didn't have exponential fields useExponentialNotation = false; } + + // Restore the invariant value if groupingSize is invalid. + if (groupingSize < 0) { + groupingSize = 3; + } + serialVersionOnStream = currentSerialVersion; } @@ -4009,14 +4030,15 @@ /** * The number of digits between grouping separators in the integer - * portion of a number. Must be greater than 0 if + * portion of a number. Must be non-negative and less than or equal to + * {@link java.lang.Byte#MAX_VALUE Byte.MAX_VALUE} if * {@code NumberFormat.groupingUsed} is true. * * @serial * @see #getGroupingSize * @see java.text.NumberFormat#isGroupingUsed */ - private byte groupingSize = 3; // invariant, > 0 if useThousands + private byte groupingSize = 3; // invariant, 0 - 127, if groupingUsed /** * If true, forces the decimal separator to always appear in a formatted diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java --- a/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/macosx/classes/sun/awt/CGraphicsDevice.java Tue Oct 15 21:33:54 2019 +0000 @@ -61,6 +61,10 @@ public CGraphicsDevice(final int displayID) { this.displayID = displayID; config = CGLGraphicsConfig.getConfig(this, displayID, 0); + // initializes default device state, might be redundant step since we + // call "displayChanged()" later anyway, but we do not want to leave the + // device in an inconsistent state after construction + displayChanged(); } /** diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java --- a/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/macosx/classes/sun/java2d/opengl/CGLSurfaceData.java Tue Oct 15 21:33:54 2019 +0000 @@ -25,7 +25,6 @@ package sun.java2d.opengl; -import java.awt.Graphics; import java.awt.GraphicsConfiguration; import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; @@ -33,9 +32,7 @@ import java.awt.Rectangle; import java.awt.image.ColorModel; -import sun.java2d.SunGraphics2D; import sun.java2d.SurfaceData; - import sun.lwawt.macosx.CPlatformView; public abstract class CGLSurfaceData extends OGLSurfaceData { @@ -342,43 +339,4 @@ return offscreenImage; } } - - // Mac OS X specific APIs for JOGL/Java2D bridge... - - // given a surface create and attach GL context, then return it - private static native long createCGLContextOnSurface(CGLSurfaceData sd, - long sharedContext); - - public static long createOGLContextOnSurface(Graphics g, long sharedContext) { - SurfaceData sd = ((SunGraphics2D) g).surfaceData; - if ((sd instanceof CGLSurfaceData) == true) { - CGLSurfaceData cglsd = (CGLSurfaceData) sd; - return createCGLContextOnSurface(cglsd, sharedContext); - } else { - return 0L; - } - } - - // returns whether or not the makeCurrent operation succeeded - static native boolean makeCGLContextCurrentOnSurface(CGLSurfaceData sd, - long ctx); - - public static boolean makeOGLContextCurrentOnSurface(Graphics g, long ctx) { - SurfaceData sd = ((SunGraphics2D) g).surfaceData; - if ((ctx != 0L) && ((sd instanceof CGLSurfaceData) == true)) { - CGLSurfaceData cglsd = (CGLSurfaceData) sd; - return makeCGLContextCurrentOnSurface(cglsd, ctx); - } else { - return false; - } - } - - // additional cleanup - private static native void destroyCGLContext(long ctx); - - public static void destroyOGLContext(long ctx) { - if (ctx != 0L) { - destroyCGLContext(ctx); - } - } } diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/LWCToolkit.java Tue Oct 15 21:33:54 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -444,6 +444,7 @@ fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints); desktopProperties.put("awt.mouse.numButtons", BUTTONS); + desktopProperties.put("awt.multiClickInterval", getMultiClickTime()); // These DnD properties must be set, otherwise Swing ends up spewing NPEs // all over the place. The values came straight off of MToolkit. @@ -538,6 +539,11 @@ return BUTTONS; } + /** + * Returns the double-click time interval in ms. + */ + private static native int getMultiClickTime(); + @Override public boolean isTraySupported() { return true; diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/LWCToolkit.m Tue Oct 15 21:33:54 2019 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 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 @@ -831,3 +831,19 @@ } return JNI_FALSE; } + +/* + * Class: sun_lwawt_macosx_LWCToolkit + * Method: getMultiClickTime + * Signature: ()I + */ +JNIEXPORT jint JNICALL +Java_sun_lwawt_macosx_LWCToolkit_getMultiClickTime(JNIEnv *env, jclass klass) { + __block jint multiClickTime = 0; + JNF_COCOA_ENTER(env); + [JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){ + multiClickTime = (jint)([NSEvent doubleClickInterval] * 1000); + }]; + JNF_COCOA_EXIT(env); + return multiClickTime; +} diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m --- a/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl/CGLGraphicsConfig.m Tue Oct 15 21:33:54 2019 +0000 @@ -152,7 +152,6 @@ AWT_ASSERT_APPKIT_THREAD; jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue]; - jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue]; jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue]; JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; [argValue removeAllObjects]; @@ -161,11 +160,7 @@ NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; - CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt; if (sharedContext == NULL) { - if (glMask == 0) { - glMask = CGDisplayIDToOpenGLDisplayMask(displayID); - } NSOpenGLPixelFormatAttribute attrs[] = { NSOpenGLPFAAllowOfflineRenderers, @@ -176,16 +171,17 @@ NSOpenGLPFAColorSize, 32, NSOpenGLPFAAlphaSize, 8, NSOpenGLPFADepthSize, 16, - NSOpenGLPFAScreenMask, glMask, 0 }; sharedPixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; if (sharedPixelFormat == nil) { - J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL"); - [argValue addObject: [NSNumber numberWithLong: 0L]]; - return; + J2dRlsTraceLn(J2D_TRACE_ERROR, + "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL"); + + [argValue addObject: [NSNumber numberWithLong: 0L]]; + return; } sharedContext = diff -r 7be56b2ac50d -r e0bb6b38a6f6 src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html --- a/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Mon Oct 14 21:01:25 2019 +0000 +++ b/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html Tue Oct 15 21:33:54 2019 +0000 @@ -5,7 +5,7 @@