This commit is contained in:
Henry Jen 2019-10-15 21:33:54 +00:00
commit 9dd506f713
54 changed files with 426 additions and 635 deletions

View File

@ -2643,8 +2643,24 @@ int os::java_to_os_priority[CriticalPriority + 1] = {
60 // 11 CriticalPriority 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) { 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(); pthread_t thr = thread->osthread()->pthread_id();
int policy = SCHED_OTHER; int policy = SCHED_OTHER;
struct sched_param param; struct sched_param param;
@ -2659,7 +2675,7 @@ OSReturn os::set_native_priority(Thread* thread, int newpri) {
} }
OSReturn os::get_native_priority(const Thread* const thread, int *priority_ptr) { 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]; *priority_ptr = java_to_os_priority[NormPriority];
return OS_OK; return OS_OK;
} }
@ -3569,6 +3585,9 @@ jint os::init_2(void) {
} }
} }
// initialize thread priority policy
prio_init();
return JNI_OK; return JNI_OK;
} }

View File

@ -42,31 +42,21 @@ ValueStack::ValueStack(IRScope* scope, ValueStack* caller_state)
verify(); verify();
} }
ValueStack::ValueStack(ValueStack* copy_from, Kind kind, int bci) ValueStack::ValueStack(ValueStack* copy_from, Kind kind, int bci)
: _scope(copy_from->scope()) : _scope(copy_from->scope())
, _caller_state(copy_from->caller_state()) , _caller_state(copy_from->caller_state())
, _bci(bci) , _bci(bci)
, _kind(kind) , _kind(kind)
, _locals() , _locals(copy_from->locals_size_for_copy(kind))
, _stack() , _stack(copy_from->stack_size_for_copy(kind))
, _locks(copy_from->locks_size() == 0 ? NULL : new Values(copy_from->locks_size())) , _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"); assert(kind != EmptyExceptionState || !Compilation::current()->env()->should_retain_local_variables(), "need locals");
if (kind != EmptyExceptionState) { if (kind != EmptyExceptionState) {
// only allocate space if we need to copy the locals-array
_locals = Values(copy_from->locals_size());
_locals.appendAll(&copy_from->_locals); _locals.appendAll(&copy_from->_locals);
} }
if (kind != ExceptionState && kind != EmptyExceptionState) { 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(&copy_from->_stack); _stack.appendAll(&copy_from->_stack);
} }
@ -77,6 +67,25 @@ ValueStack::ValueStack(ValueStack* copy_from, Kind kind, int bci)
verify(); 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) { bool ValueStack::is_same(ValueStack* s) {
if (scope() != s->scope()) return false; if (scope() != s->scope()) return false;

View File

@ -65,6 +65,8 @@ class ValueStack: public CompilationResourceObj {
// for simplified copying // for simplified copying
ValueStack(ValueStack* copy_from, Kind kind, int bci); 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: public:
// creation // creation
ValueStack(IRScope* scope, ValueStack* caller_state); ValueStack(IRScope* scope, ValueStack* caller_state);

View File

@ -51,7 +51,6 @@ class ciMetadata: public ciBaseObject {
virtual bool is_metadata() const { return true; } virtual bool is_metadata() const { return true; }
virtual bool is_type() const { return false; } 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_return_address() const { return false; }
virtual bool is_method() const { return false; } virtual bool is_method() const { return false; }
virtual bool is_method_data() const { return false; } virtual bool is_method_data() const { return false; }

View File

@ -45,13 +45,25 @@ void EpsilonArguments::initialize() {
FLAG_SET_DEFAULT(ExitOnOutOfMemoryError, true); 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) { 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; EpsilonMaxTLABSize = MinTLABSize;
} }
if (!EpsilonElasticTLAB && EpsilonElasticTLABDecay) { if (!EpsilonElasticTLAB && EpsilonElasticTLABDecay) {
warning("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled"); log_warning(gc)("Disabling EpsilonElasticTLABDecay because EpsilonElasticTLAB is disabled");
FLAG_SET_DEFAULT(EpsilonElasticTLABDecay, false); FLAG_SET_DEFAULT(EpsilonElasticTLABDecay, false);
} }

View File

@ -319,13 +319,20 @@ public:
}; };
void ShenandoahConcurrentMark::update_thread_roots(ShenandoahPhaseTimings::Phase root_phase) { void ShenandoahConcurrentMark::update_thread_roots(ShenandoahPhaseTimings::Phase root_phase) {
WorkGang* workers = _heap->workers(); assert(ShenandoahSafepoint::is_at_shenandoah_safepoint(), "Must be at a safepoint");
bool is_par = workers->active_workers() > 1;
ShenandoahGCPhase phase(root_phase);
#if COMPILER2_OR_JVMCI #if COMPILER2_OR_JVMCI
DerivedPointerTable::clear(); DerivedPointerTable::clear();
#endif #endif
WorkGang* workers = _heap->workers();
bool is_par = workers->active_workers() > 1;
ShenandoahUpdateThreadRootsTask task(is_par, root_phase); ShenandoahUpdateThreadRootsTask task(is_par, root_phase);
workers->run_task(&task); workers->run_task(&task);
#if COMPILER2_OR_JVMCI #if COMPILER2_OR_JVMCI
DerivedPointerTable::update_pointers(); DerivedPointerTable::update_pointers();
#endif #endif

View File

@ -964,7 +964,6 @@ private:
ShenandoahHeapRegion* r; ShenandoahHeapRegion* r;
while ((r =_cs->claim_next()) != NULL) { while ((r =_cs->claim_next()) != NULL) {
assert(r->has_live(), "Region " SIZE_FORMAT " should have been reclaimed early", r->region_number()); 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); _sh->marked_object_iterate(r, &cl);
if (ShenandoahPacing) { if (ShenandoahPacing) {

View File

@ -198,8 +198,7 @@ public:
// Macro-properties: // Macro-properties:
bool is_alloc_allowed() const { return is_empty() || is_regular() || _state == _pinned; } 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_regular() || _state == _cset || (ShenandoahHumongousMoves && _state == _humongous_start); }
bool is_stw_move_allowed() const { return is_conc_move_allowed() || (ShenandoahHumongousMoves && _state == _humongous_start); }
RegionState state() const { return _state; } RegionState state() const { return _state; }
int state_ordinal() const { return region_state_to_ordinal(_state); } int state_ordinal() const { return region_state_to_ordinal(_state); }

View File

@ -3129,6 +3129,13 @@ bool IdealLoopTree::do_remove_empty_loop(PhaseIdealLoop *phase) {
// We also need to replace the original limit to collapse loop exit. // We also need to replace the original limit to collapse loop exit.
Node* cmp = cl->loopexit()->cmp_node(); Node* cmp = cl->loopexit()->cmp_node();
assert(cl->limit() == cmp->in(2), "sanity"); 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._worklist.push(cmp->in(2)); // put limit on worklist
phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist
} }

View File

@ -528,6 +528,22 @@ void SafeThreadsListPtr::verify_hazard_ptr_scanned() {
return; 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 // The closure will attempt to verify that the calling thread can
// be found by threads_do() on the specified ThreadsList. If it // be found by threads_do() on the specified ThreadsList. If it
// is successful, then the specified ThreadsList was acquired as // is successful, then the specified ThreadsList was acquired as
@ -540,12 +556,6 @@ void SafeThreadsListPtr::verify_hazard_ptr_scanned() {
// ThreadsList is not a stable hazard ptr and can be freed by // ThreadsList is not a stable hazard ptr and can be freed by
// another thread from the to-be-deleted list at any time. // 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); VerifyHazardPtrThreadClosure cl(_thread);
ThreadsSMRSupport::threads_do(&cl, _list); ThreadsSMRSupport::threads_do(&cl, _list);
@ -555,7 +565,7 @@ void SafeThreadsListPtr::verify_hazard_ptr_scanned() {
// In either case, we won't get past this point with a badly placed // In either case, we won't get past this point with a badly placed
// ThreadsListHandle. // 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 #endif
} }

View File

@ -84,7 +84,7 @@ Mutex* Decoder::shared_decoder_lock() {
} }
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) { 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) { if (error_handling_thread) {
return get_error_handler_instance()->decode(addr, buf, buflen, offset, modulepath, demangle); return get_error_handler_instance()->decode(addr, buf, buflen, offset, modulepath, demangle);
} else { } else {
@ -95,7 +95,7 @@ bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const cha
} }
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) { 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) { if (error_handling_thread) {
return get_error_handler_instance()->decode(addr, buf, buflen, offset, base); return get_error_handler_instance()->decode(addr, buf, buflen, offset, base);
} else { } else {
@ -106,7 +106,7 @@ bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const voi
bool Decoder::demangle(const char* symbol, char* buf, int buflen) { 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) { if (error_handling_thread) {
return get_error_handler_instance()->demangle(symbol, buf, buflen); return get_error_handler_instance()->demangle(symbol, buf, buflen);
} else { } else {

View File

@ -1205,7 +1205,7 @@ void VMError::print_vm_info(outputStream* st) {
st->print_cr("END."); 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 */ /** 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) { static int expand_and_open(const char* pattern, bool overwrite_existing, char* buf, size_t buflen, size_t pos) {
@ -1355,8 +1355,8 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
os::abort(CreateCoredumpOnCrash); os::abort(CreateCoredumpOnCrash);
} }
intptr_t mytid = os::current_thread_id(); intptr_t mytid = os::current_thread_id();
if (first_error_tid == -1 && if (_first_error_tid == -1 &&
Atomic::cmpxchg(mytid, &first_error_tid, (intptr_t)-1) == -1) { Atomic::cmpxchg(mytid, &_first_error_tid, (intptr_t)-1) == -1) {
// Initialize time stamps to use the same base. // Initialize time stamps to use the same base.
out.time_stamp().update_to(1); out.time_stamp().update_to(1);
@ -1416,7 +1416,7 @@ void VMError::report_and_die(int id, const char* message, const char* detail_fmt
// This is not the first error, see if it happened in a different thread // This is not the first error, see if it happened in a different thread
// or in the same thread during error reporting. // or in the same thread during error reporting.
if (first_error_tid != mytid) { if (_first_error_tid != mytid) {
char msgbuf[64]; char msgbuf[64];
jio_snprintf(msgbuf, sizeof(msgbuf), jio_snprintf(msgbuf, sizeof(msgbuf),
"[thread " INTX_FORMAT " also had an error]", "[thread " INTX_FORMAT " also had an error]",

View File

@ -32,8 +32,6 @@ class frame;
class VM_ReportJavaOutOfMemory; class VM_ReportJavaOutOfMemory;
class VMError : public AllStatic { class VMError : public AllStatic {
friend class VM_ReportJavaOutOfMemory;
friend class Decoder;
friend class VMStructs; friend class VMStructs;
static int _id; // Solaris/Linux signals: 0 - SIGRTMAX static int _id; // Solaris/Linux signals: 0 - SIGRTMAX
@ -65,7 +63,7 @@ class VMError : public AllStatic {
// Thread id of the first error. We must be able to handle native thread, // Thread id of the first error. We must be able to handle native thread,
// so use thread id instead of Thread* to identify 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 // Core dump status, false if we have been unable to write a core/minidump for some reason
static bool coredump_status; static bool coredump_status;
@ -177,9 +175,9 @@ public:
static address get_resetted_sighandler(int sig); static address get_resetted_sighandler(int sig);
// check to see if fatal error reporting is in progress // 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. // Called by the WatcherThread to check if error reporting has timed-out.
// Returns true if error reporting has not completed within the ErrorLogTimeout limit. // Returns true if error reporting has not completed within the ErrorLogTimeout limit.

View File

@ -2756,7 +2756,10 @@ public class DecimalFormat extends NumberFormat {
/** /**
* Return the grouping size. Grouping size is the number of digits between * Return the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example, * 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 * @return the grouping size
* @see #setGroupingSize * @see #setGroupingSize
@ -2770,16 +2773,28 @@ public class DecimalFormat extends NumberFormat {
/** /**
* Set the grouping size. Grouping size is the number of digits between * Set the grouping size. Grouping size is the number of digits between
* grouping separators in the integer portion of a number. For example, * 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
* <br> * zero designates that grouping is not used, which provides the same
* formatting as if calling {@link #setGroupingUsed(boolean)
* setGroupingUsed(false)}.
* <p>
* The value passed in is converted to a byte, which may lose information. * 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 * @param newValue the new grouping size
* @see #getGroupingSize * @see #getGroupingSize
* @see java.text.NumberFormat#setGroupingUsed * @see java.text.NumberFormat#setGroupingUsed
* @see java.text.DecimalFormatSymbols#setGroupingSeparator * @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) { 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; groupingSize = (byte)newValue;
fastPathCheckNeeded = true; fastPathCheckNeeded = true;
} }
@ -3906,6 +3921,12 @@ public class DecimalFormat extends NumberFormat {
// Didn't have exponential fields // Didn't have exponential fields
useExponentialNotation = false; useExponentialNotation = false;
} }
// Restore the invariant value if groupingSize is invalid.
if (groupingSize < 0) {
groupingSize = 3;
}
serialVersionOnStream = currentSerialVersion; serialVersionOnStream = currentSerialVersion;
} }
@ -4009,14 +4030,15 @@ public class DecimalFormat extends NumberFormat {
/** /**
* The number of digits between grouping separators in the integer * 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. * {@code NumberFormat.groupingUsed} is true.
* *
* @serial * @serial
* @see #getGroupingSize * @see #getGroupingSize
* @see java.text.NumberFormat#isGroupingUsed * @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 * If true, forces the decimal separator to always appear in a formatted

View File

@ -61,6 +61,10 @@ public final class CGraphicsDevice extends GraphicsDevice
public CGraphicsDevice(final int displayID) { public CGraphicsDevice(final int displayID) {
this.displayID = displayID; this.displayID = displayID;
config = CGLGraphicsConfig.getConfig(this, displayID, 0); 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();
} }
/** /**

View File

@ -25,7 +25,6 @@
package sun.java2d.opengl; package sun.java2d.opengl;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration; import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice; import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment; import java.awt.GraphicsEnvironment;
@ -33,9 +32,7 @@ import java.awt.Image;
import java.awt.Rectangle; import java.awt.Rectangle;
import java.awt.image.ColorModel; import java.awt.image.ColorModel;
import sun.java2d.SunGraphics2D;
import sun.java2d.SurfaceData; import sun.java2d.SurfaceData;
import sun.lwawt.macosx.CPlatformView; import sun.lwawt.macosx.CPlatformView;
public abstract class CGLSurfaceData extends OGLSurfaceData { public abstract class CGLSurfaceData extends OGLSurfaceData {
@ -342,43 +339,4 @@ public abstract class CGLSurfaceData extends OGLSurfaceData {
return offscreenImage; 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);
}
}
} }

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -444,6 +444,7 @@ public final class LWCToolkit extends LWToolkit {
fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB); fontHints.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);
desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints); desktopProperties.put(SunToolkit.DESKTOPFONTHINTS, fontHints);
desktopProperties.put("awt.mouse.numButtons", BUTTONS); desktopProperties.put("awt.mouse.numButtons", BUTTONS);
desktopProperties.put("awt.multiClickInterval", getMultiClickTime());
// These DnD properties must be set, otherwise Swing ends up spewing NPEs // These DnD properties must be set, otherwise Swing ends up spewing NPEs
// all over the place. The values came straight off of MToolkit. // all over the place. The values came straight off of MToolkit.
@ -538,6 +539,11 @@ public final class LWCToolkit extends LWToolkit {
return BUTTONS; return BUTTONS;
} }
/**
* Returns the double-click time interval in ms.
*/
private static native int getMultiClickTime();
@Override @Override
public boolean isTraySupported() { public boolean isTraySupported() {
return true; return true;

View File

@ -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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -831,3 +831,19 @@ Java_sun_awt_PlatformGraphicsInfo_isInAquaSession
} }
return JNI_FALSE; 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;
}

View File

@ -152,7 +152,6 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
AWT_ASSERT_APPKIT_THREAD; AWT_ASSERT_APPKIT_THREAD;
jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue]; jint displayID = (jint)[(NSNumber *)[argValue objectAtIndex: 0] intValue];
jint pixfmt = (jint)[(NSNumber *)[argValue objectAtIndex: 1] intValue];
jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue]; jint swapInterval = (jint)[(NSNumber *)[argValue objectAtIndex: 2] intValue];
JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; JNIEnv *env = [ThreadUtilities getJNIEnvUncached];
[argValue removeAllObjects]; [argValue removeAllObjects];
@ -161,11 +160,7 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
CGOpenGLDisplayMask glMask = (CGOpenGLDisplayMask)pixfmt;
if (sharedContext == NULL) { if (sharedContext == NULL) {
if (glMask == 0) {
glMask = CGDisplayIDToOpenGLDisplayMask(displayID);
}
NSOpenGLPixelFormatAttribute attrs[] = { NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFAAllowOfflineRenderers,
@ -176,16 +171,17 @@ Java_sun_java2d_opengl_CGLGraphicsConfig_getCGLConfigInfo
NSOpenGLPFAColorSize, 32, NSOpenGLPFAColorSize, 32,
NSOpenGLPFAAlphaSize, 8, NSOpenGLPFAAlphaSize, 8,
NSOpenGLPFADepthSize, 16, NSOpenGLPFADepthSize, 16,
NSOpenGLPFAScreenMask, glMask,
0 0
}; };
sharedPixelFormat = sharedPixelFormat =
[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]; [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
if (sharedPixelFormat == nil) { if (sharedPixelFormat == nil) {
J2dRlsTraceLn(J2D_TRACE_ERROR, "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL"); J2dRlsTraceLn(J2D_TRACE_ERROR,
[argValue addObject: [NSNumber numberWithLong: 0L]]; "CGLGraphicsConfig_getCGLConfigInfo: shared NSOpenGLPixelFormat is NULL");
return;
[argValue addObject: [NSNumber numberWithLong: 0L]];
return;
} }
sharedContext = sharedContext =

View File

@ -5,7 +5,7 @@
<title>AWT Threading Issues</title> <title>AWT Threading Issues</title>
</head> </head>
<!-- <!--
Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>AWT Threading Issues</h1> <h1>AWT Threading Issues</h1>
<a id="ListenersThreads"></a> <a id="ListenersThreads"></a>
@ -192,6 +193,7 @@ non-daemon thread that blocks forever.
<cite>The Java&trade; Virtual Machine Specification</cite> <cite>The Java&trade; Virtual Machine Specification</cite>
guarantees guarantees
that the JVM doesn't exit until this thread terminates. that the JVM doesn't exit until this thread terminates.
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -31,6 +31,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>AWT Desktop Properties</h1> <h1>AWT Desktop Properties</h1>
The following refers to standard AWT desktop properties that The following refers to standard AWT desktop properties that
@ -277,6 +278,7 @@ only: {@code NOBUTTON}, {@code BUTTON1}, {@code BUTTON2} and
This property should be used when there is no need in listening mouse events fired as a result of This property should be used when there is no need in listening mouse events fired as a result of
activity with extra mouse button. activity with extra mouse button.
By default this property is set to {@code true}. By default this property is set to {@code true}.
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
<title>The AWT Focus Subsystem</title> <title>The AWT Focus Subsystem</title>
</head> </head>
<!-- <!--
Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>The AWT Focus Subsystem</h1> <h1>The AWT Focus Subsystem</h1>
<p> <p>
@ -1362,6 +1363,7 @@ and VetoableChangeListener</a>.
change requests in all cases. Previously, requests were granted change requests in all cases. Previously, requests were granted
for heavyweights, but denied for lightweights. for heavyweights, but denied for lightweights.
</ol> </ol>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -35,6 +35,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>The AWT Modality</h1> <h1>The AWT Modality</h1>
<p> <p>
@ -440,5 +441,6 @@
<img src="modal-example4.gif" alt="Example 4"> <img src="modal-example4.gif" alt="Example 4">
</p> </p>
<br style="clear:both;"> <br style="clear:both;">
</div>
</main> </main>
</body></html> </body></html>

View File

@ -5,7 +5,7 @@
<title>BMP Metadata Format Specification</title> <title>BMP Metadata Format Specification</title>
</head> </head>
<!-- <!--
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>BMP Metadata Format Specification</h1> <h1>BMP Metadata Format Specification</h1>
The XML schema for the native image metadata format is as follows: The XML schema for the native image metadata format is as follows:
@ -161,5 +162,6 @@ The XML schema for the native image metadata format is as follows:
</pre> </pre>
@since 1.5 @since 1.5
</div>
</main> </main>
</body> </body>

View File

@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>GIF Metadata Format Specification</h1> <h1>GIF Metadata Format Specification</h1>
<a id="gif_stream_metadata_format"></a> <a id="gif_stream_metadata_format"></a>
<h2>GIF Stream Metadata Format Specification</h2> <h2>GIF Stream Metadata Format Specification</h2>
@ -462,6 +463,7 @@ advanced only on user input.
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
<title>JPEG Metadata Format Specification and Usage Notes</title> <title>JPEG Metadata Format Specification and Usage Notes</title>
</head> </head>
<!-- <!--
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>JPEG Metadata Format Specification and Usage Notes</h1> <h1>JPEG Metadata Format Specification and Usage Notes</h1>
<p> <p>
@ -1159,6 +1160,7 @@ format, performs a <code>reset</code> followed by a merge of the new tree.
&lt;!-- All elements are as defined above for image metadata --&gt; &lt;!-- All elements are as defined above for image metadata --&gt;
]&gt; ]&gt;
</pre> </pre>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
<title>PNG Metadata Format Specification</title> <title>PNG Metadata Format Specification</title>
</head> </head>
<!-- <!--
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>PNG Metadata Format Specification</h1> <h1>PNG Metadata Format Specification</h1>
<p> <p>
@ -561,6 +562,7 @@ written, or to determine the order of the chunks in a file being read.
&lt;!-- Data type: String --&gt; &lt;!-- Data type: String --&gt;
]&gt; ]&gt;
</pre> </pre>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
<title>Standard Metadata Format Specification</title> <title>Standard Metadata Format Specification</title>
</head> </head>
<!-- <!--
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>Standard (Plug-in Neutral) Metadata Format Specification</h1> <h1>Standard (Plug-in Neutral) Metadata Format Specification</h1>
<p> The plug-in neutral "javax_imageio_1.0" format consists <p> The plug-in neutral "javax_imageio_1.0" format consists
@ -394,6 +395,7 @@ following DTD:
&lt;!-- Data type: Integer --&gt; &lt;!-- Data type: Integer --&gt;
]&gt; ]&gt;
</pre> </pre>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>TIFF Metadata Format Specification and Usage Notes</h1> <h1>TIFF Metadata Format Specification and Usage Notes</h1>
<a href="#Reading">Reading Images</a> <a href="#Reading">Reading Images</a>
@ -1235,6 +1236,7 @@ The DTD for the TIFF native image metadata format is as follows:
</pre> </pre>
@since 9 @since 9
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -5,7 +5,7 @@
<title>WBMP Metadata Format Specification</title> <title>WBMP Metadata Format Specification</title>
</head> </head>
<!-- <!--
Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>WBMP Metadata Format Specification</h1> <h1>WBMP Metadata Format Specification</h1>
The XML schema for the native image metadata format is as follows: The XML schema for the native image metadata format is as follows:
@ -63,5 +64,6 @@ The XML schema for the native image metadata format is as follows:
</pre> </pre>
@since 1.5 @since 1.5
</div>
</main> </main>
</body> </body>

View File

@ -5,7 +5,7 @@
<title>Using the Multiplexing Look and Feel</title> <title>Using the Multiplexing Look and Feel</title>
</head> </head>
<!-- <!--
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. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
This code is free software; you can redistribute it and/or modify it This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>Using the Multiplexing Look and Feel</h1> <h1>Using the Multiplexing Look and Feel</h1>
<blockquote> <blockquote>
@ -495,6 +496,7 @@ if you use this kind of statement, be careful, because the suppliers
of auxiliary look and feels will most likely have developed and of auxiliary look and feels will most likely have developed and
tested against our Multiplexing look and feel. tested against our Multiplexing look and feel.
</p> </p>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -31,6 +31,7 @@
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>Colors Used in Nimbus Look and Feel</h1> <h1>Colors Used in Nimbus Look and Feel</h1>
<h2 id="primaryColors">Primary Colors</h2> <h2 id="primaryColors">Primary Colors</h2>
<table> <table>
@ -236,6 +237,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -32,6 +32,7 @@ questions.
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1>Component Specific Properties</h1> <h1>Component Specific Properties</h1>
<p> The look, and to some degree the feel of Synth <p> The look, and to some degree the feel of Synth
can be customized by way of component specific properties. can be customized by way of component specific properties.
@ -1345,6 +1346,7 @@ the blink rate fo the caret.<br>
<p><code>Prefix</code> is one of: EditorPane, FormattedTextField, <p><code>Prefix</code> is one of: EditorPane, FormattedTextField,
PasswordField, TextArea, TextField or TextPane.<br> PasswordField, TextArea, TextField or TextPane.<br>
</p> </p>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -46,6 +46,7 @@ div.example {
<body> <body>
<main role="main"> <main role="main">
<div class="contentContainer">
<h1><a id="file">File Format</a></h1> <h1><a id="file">File Format</a></h1>
<p> <p>
Synth's file format (<a href="synth.dtd">dtd</a>) Synth's file format (<a href="synth.dtd">dtd</a>)
@ -1030,6 +1031,7 @@ div.example {
&lt;/synth> &lt;/synth>
</pre> </pre>
</div> </div>
</div>
</main> </main>
</body> </body>
</html> </html>

View File

@ -25,7 +25,6 @@
package sun.font; package sun.font;
import java.awt.Font;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -45,11 +44,9 @@ import sun.awt.FontConfiguration;
import sun.awt.FontDescriptor; import sun.awt.FontDescriptor;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.font.CompositeFontDescriptor; import sun.font.CompositeFontDescriptor;
import sun.font.FontManager;
import sun.font.FontConfigManager.FontConfigInfo; import sun.font.FontConfigManager.FontConfigInfo;
import sun.font.FontConfigManager.FcCompFont; import sun.font.FontConfigManager.FcCompFont;
import sun.font.FontConfigManager.FontConfigFont; import sun.font.FontConfigManager.FontConfigFont;
import sun.java2d.SunGraphicsEnvironment;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
public class FcFontConfiguration extends FontConfiguration { public class FcFontConfiguration extends FontConfiguration {
@ -289,12 +286,10 @@ public class FcFontConfiguration extends FontConfiguration {
/** /**
* Gets the OS version string from a Linux release-specific file. * Gets the OS version string from a Linux release-specific file.
*/ */
private String getVersionString(File f){ private String getVersionString(File f) {
try { try (Scanner sc = new Scanner(f)) {
Scanner sc = new Scanner(f);
return sc.findInLine("(\\d)+((\\.)(\\d)+)*"); return sc.findInLine("(\\d)+((\\.)(\\d)+)*");
} } catch (Exception e) {
catch (Exception e){
} }
return null; return null;
} }
@ -429,23 +424,26 @@ public class FcFontConfiguration extends FontConfiguration {
private void readFcInfo() { private void readFcInfo() {
File fcFile = getFcInfoFile(); File fcFile = getFcInfoFile();
if (!fcFile.exists()) { if (!fcFile.exists()) {
if (FontUtilities.debugFonts()) {
warning("fontconfig info file " + fcFile.toString() + " does not exist");
}
return; return;
} }
Properties props = new Properties(); Properties props = new Properties();
FcFontManager fm = (FcFontManager) fontManager; try (FileInputStream fis = new FileInputStream(fcFile)) {
FontConfigManager fcm = fm.getFontConfigManager();
try {
FileInputStream fis = new FileInputStream(fcFile);
props.load(fis); props.load(fis);
fis.close();
} catch (IOException e) { } catch (IOException e) {
if (FontUtilities.debugFonts()) { if (FontUtilities.debugFonts()) {
warning("IOException reading from "+fcFile.toString()); warning("IOException (" + e.getCause() + ") reading from " + fcFile.toString());
} }
return; return;
} }
String version = (String)props.get("version"); String version = (String)props.get("version");
if (version == null || !version.equals(fileVersion)) { if (version == null || !version.equals(fileVersion)) {
if (FontUtilities.debugFonts()) {
warning("fontconfig info file version mismatch (found: " + version +
", expected: " + fileVersion + ")");
}
return; return;
} }
@ -458,6 +456,9 @@ public class FcFontConfiguration extends FontConfiguration {
fcVersion = Integer.parseInt(fcVersionStr); fcVersion = Integer.parseInt(fcVersionStr);
if (fcVersion != 0 && if (fcVersion != 0 &&
fcVersion != FontConfigManager.getFontConfigVersion()) { fcVersion != FontConfigManager.getFontConfigVersion()) {
if (FontUtilities.debugFonts()) {
warning("new, different fontconfig detected");
}
return; return;
} }
} catch (Exception e) { } catch (Exception e) {
@ -480,6 +481,9 @@ public class FcFontConfiguration extends FontConfiguration {
} }
File dirFile = new File(dir); File dirFile = new File(dir);
if (dirFile.exists() && dirFile.lastModified() > lastModified) { if (dirFile.exists() && dirFile.lastModified() > lastModified) {
if (FontUtilities.debugFonts()) {
warning("out of date cache directories detected");
}
return; return;
} }
cacheDirIndex++; cacheDirIndex++;
@ -503,6 +507,9 @@ public class FcFontConfiguration extends FontConfiguration {
String lenStr = (String)props.get(key+".length"); String lenStr = (String)props.get(key+".length");
int nfonts = Integer.parseInt(lenStr); int nfonts = Integer.parseInt(lenStr);
if (nfonts <= 0) { if (nfonts <= 0) {
if (FontUtilities.debugFonts()) {
warning("bad non-positive .length entry in fontconfig file " + fcFile.toString());
}
return; // bad file return; // bad file
} }
fci[index].allFonts = new FontConfigFont[nfonts]; fci[index].allFonts = new FontConfigFont[nfonts];
@ -514,6 +521,9 @@ public class FcFontConfiguration extends FontConfiguration {
fkey = key+"."+f+".file"; fkey = key+"."+f+".file";
String file = (String)props.get(fkey); String file = (String)props.get(fkey);
if (file == null) { if (file == null) {
if (FontUtilities.debugFonts()) {
warning("missing file value for key " + fkey + " in fontconfig file " + fcFile.toString());
}
return; // bad file return; // bad file
} }
fci[index].allFonts[f].fontFile = file; fci[index].allFonts[f].fontFile = file;
@ -528,6 +538,11 @@ public class FcFontConfiguration extends FontConfiguration {
warning(t.toString()); warning(t.toString());
} }
} }
if (FontUtilities.debugFonts()) {
PlatformLogger logger = FontUtilities.getLogger();
logger.info("successfully parsed the fontconfig file at " + fcFile.toString());
}
} }
private static void warning(String msg) { private static void warning(String msg) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -336,19 +336,6 @@ alloc_col(Display *dpy, Colormap cm, int r, int g, int b, int pixel,
return awt_color_match(r, g, b, awt_data); return awt_color_match(r, g, b, awt_data);
} }
void
awt_allocate_systemcolors(XColor *colorsPtr, int num_pixels, AwtGraphicsConfigDataPtr awtData) {
int i;
int r, g, b, pixel;
for (i=0; i < num_pixels; i++) {
r = colorsPtr[i].red >> 8;
g = colorsPtr[i].green >> 8;
b = colorsPtr[i].blue >> 8;
pixel = alloc_col(awt_display, awtData->awt_cmap, r, g, b, -1, awtData);
}
}
#endif /* !HEADLESS */ #endif /* !HEADLESS */
void void
@ -1276,12 +1263,6 @@ jobject awtJNI_GetColorModel(JNIEnv *env, AwtGraphicsConfigDataPtr aData)
extern jfieldID colorValueID; extern jfieldID colorValueID;
#ifndef HEADLESS #ifndef HEADLESS
int awtJNI_GetColor(JNIEnv *env,jobject this)
{
/* REMIND: should not be defaultConfig. */
return awtJNI_GetColorForVis (env, this, getDefaultConfig(DefaultScreen(awt_display)));
}
int awtJNI_GetColorForVis (JNIEnv *env,jobject this, AwtGraphicsConfigDataPtr awt_data) int awtJNI_GetColorForVis (JNIEnv *env,jobject this, AwtGraphicsConfigDataPtr awt_data)
{ {
int col; int col;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,51 +23,10 @@
* questions. * questions.
*/ */
#ifndef HEADLESS
#include "awt_p.h"
#include <string.h>
#include "java_awt_Component.h"
#include "java_awt_Font.h" #include "java_awt_Font.h"
#include "java_awt_FontMetrics.h" #include "sun_awt_FontDescriptor.h"
#include "sun_awt_X11GraphicsEnvironment.h" #include "sun_awt_PlatformFont.h"
#include "awt_Font.h"
#include "java_awt_Dimension.h"
#include "Disposer.h"
#endif /* !HEADLESS */
#include <jni.h>
#ifndef HEADLESS
#include <jni_util.h>
#define defaultXLFD "-*-helvetica-*-*-*-*-12-*-*-*-*-*-iso8859-1"
struct FontIDs fontIDs;
struct PlatformFontIDs platformFontIDs;
static void pDataDisposeMethod(JNIEnv *env, jlong pData);
/* #define FONT_DEBUG 2 */
/* 1- print failures, 2- print all, 3- terminate on failure */
#if FONT_DEBUG
static XFontStruct *XLoadQueryFontX(Display *display, char *name)
{
XFontStruct *result = NULL;
result = XLoadQueryFont(display, name);
#if FONT_DEBUG < 2
if (result == NULL)
#endif
fprintf(stderr, "XLoadQueryFont(\"%s\") -> 0x%x.\n", name, result);
#if FONT_DEBUG >= 3
if (result == NULL)
exit(-1);
#endif
return result;
}
#define XLoadQueryFont XLoadQueryFontX
#endif
#endif /* !HEADLESS */
/* /*
* Class: java_awt_Font * Class: java_awt_Font
@ -79,28 +38,9 @@ static XFontStruct *XLoadQueryFontX(Display *display, char *name)
to initialize the fieldIDs for fields that may be accessed from C */ to initialize the fieldIDs for fields that may be accessed from C */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_java_awt_Font_initIDs Java_java_awt_Font_initIDs(JNIEnv *env, jclass cls) {
(JNIEnv *env, jclass cls)
{
#ifndef HEADLESS
CHECK_NULL(fontIDs.pData = (*env)->GetFieldID(env, cls, "pData", "J"));
CHECK_NULL(fontIDs.style = (*env)->GetFieldID(env, cls, "style", "I"));
CHECK_NULL(fontIDs.size = (*env)->GetFieldID(env, cls, "size", "I"));
CHECK_NULL(fontIDs.getPeer = (*env)->GetMethodID(env, cls, "getFontPeer",
"()Ljava/awt/peer/FontPeer;"));
CHECK_NULL(fontIDs.getFamily = (*env)->GetMethodID(env, cls, "getFamily_NoClientCode",
"()Ljava/lang/String;"));
#endif /* !HEADLESS */
} }
#ifndef HEADLESS
/* fieldIDs for FontDescriptor fields that may be accessed from C */
static struct FontDescriptorIDs {
jfieldID nativeName;
jfieldID charsetName;
} fontDescriptorIDs;
#endif /* !HEADLESS */
/* /*
* Class: sun_awt_FontDescriptor * Class: sun_awt_FontDescriptor
* Method: initIDs * Method: initIDs
@ -112,15 +52,7 @@ static struct FontDescriptorIDs {
that may be accessed from C */ that may be accessed from C */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_awt_FontDescriptor_initIDs Java_sun_awt_FontDescriptor_initIDs(JNIEnv *env, jclass cls) {
(JNIEnv *env, jclass cls)
{
#ifndef HEADLESS
CHECK_NULL(fontDescriptorIDs.nativeName =
(*env)->GetFieldID(env, cls, "nativeName", "Ljava/lang/String;"));
CHECK_NULL(fontDescriptorIDs.charsetName =
(*env)->GetFieldID(env, cls, "charsetName", "Ljava/lang/String;"));
#endif /* !HEADLESS */
} }
/* /*
@ -134,354 +66,5 @@ Java_sun_awt_FontDescriptor_initIDs
that may be accessed from C */ that may be accessed from C */
JNIEXPORT void JNICALL JNIEXPORT void JNICALL
Java_sun_awt_PlatformFont_initIDs Java_sun_awt_PlatformFont_initIDs(JNIEnv *env, jclass cls) {
(JNIEnv *env, jclass cls)
{
#ifndef HEADLESS
CHECK_NULL(platformFontIDs.componentFonts =
(*env)->GetFieldID(env, cls, "componentFonts",
"[Lsun/awt/FontDescriptor;"));
CHECK_NULL(platformFontIDs.fontConfig =
(*env)->GetFieldID(env,cls, "fontConfig",
"Lsun/awt/FontConfiguration;"));
CHECK_NULL(platformFontIDs.makeConvertedMultiFontString =
(*env)->GetMethodID(env, cls, "makeConvertedMultiFontString",
"(Ljava/lang/String;)[Ljava/lang/Object;"));
CHECK_NULL(platformFontIDs.makeConvertedMultiFontChars =
(*env)->GetMethodID(env, cls, "makeConvertedMultiFontChars",
"([CII)[Ljava/lang/Object;"));
#endif /* !HEADLESS */
} }
#ifndef HEADLESS
XFontStruct *
loadFont(Display * display, char *name, int32_t pointSize)
{
XFontStruct *f = NULL;
/* try the exact xlfd name in font configuration file */
f = XLoadQueryFont(display, name);
if (f != NULL) {
return f;
}
/*
* try nearly font
*
* 1. specify FAMILY_NAME, WEIGHT_NAME, SLANT, POINT_SIZE,
* CHARSET_REGISTRY and CHARSET_ENCODING.
* 2. change POINT_SIZE to PIXEL_SIZE
* 3. change FAMILY_NAME to *
* 4. specify only PIXEL_SIZE and CHARSET_REGISTRY/ENCODING
* 5. change PIXEL_SIZE +1/-1/+2/-2...+4/-4
* 6. default font pattern
*/
{
/*
* This code assumes the name contains exactly 14 '-' delimiter.
* If not use default pattern.
*/
int32_t i, length, pixelSize;
Boolean useDefault = FALSE;
char buffer[BUFSIZ], buffer2[BUFSIZ];
char *family = NULL, *style = NULL, *slant = NULL, *encoding = NULL;
char *start = NULL, *end = NULL;
if (strlen(name) > BUFSIZ - 1) {
useDefault = TRUE;
} else {
strcpy(buffer, name);
}
#define NEXT_HYPHEN\
start = end + 1;\
end = strchr(start, '-');\
if (end == NULL) {\
useDefault = TRUE;\
break;\
}\
*end = '\0'
do {
end = buffer;
/* skip FOUNDRY */
NEXT_HYPHEN;
/* set FAMILY_NAME */
NEXT_HYPHEN;
family = start;
/* set STYLE_NAME */
NEXT_HYPHEN;
style = start;
/* set SLANT */
NEXT_HYPHEN;
slant = start;
/* skip SETWIDTH_NAME, ADD_STYLE_NAME, PIXEL_SIZE
POINT_SIZE, RESOLUTION_X, RESOLUTION_Y, SPACING
and AVERAGE_WIDTH */
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
NEXT_HYPHEN;
/* set CHARSET_REGISTRY and CHARSET_ENCODING */
encoding = end + 1;
}
while (0);
#define TRY_LOAD\
f = XLoadQueryFont(display, buffer2);\
if (f != NULL) {\
strcpy(name, buffer2);\
return f;\
}
if (!useDefault) {
char *altstyle = NULL;
/* Regular is the style for TrueType fonts -- Type1, F3 use roman */
if (strcmp(style, "regular") == 0) {
altstyle = "roman";
}
#if defined(__linux__) || defined(MACOSX)
if (!strcmp(family, "lucidasans")) {
family = "lucida";
}
#endif
/* try 1. */
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-*-%d-*-*-*-*-%s",
family, style, slant, pointSize, encoding);
TRY_LOAD;
if (altstyle != NULL) {
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-*-%d-*-*-*-*-%s",
family, altstyle, slant, pointSize, encoding);
TRY_LOAD;
}
/* search bitmap font */
pixelSize = pointSize / 10;
/* try 2. */
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
family, style, slant, pixelSize, encoding);
TRY_LOAD;
if (altstyle != NULL) {
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
family, altstyle, slant, pixelSize, encoding);
TRY_LOAD;
}
/* try 3 */
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-%s-%s-*-*-%d-*-*-*-*-*-%s",
style, slant, pixelSize, encoding);
TRY_LOAD;
if (altstyle != NULL) {
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-%s-%s-*-*-%d-*-*-*-*-*-%s",
altstyle, slant, pixelSize, encoding);
TRY_LOAD;
}
/* try 4 */
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-*-%s-*-*-%d-*-*-*-*-*-%s",
slant, pixelSize, encoding);
TRY_LOAD;
/* try 5. */
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
pixelSize, encoding);
TRY_LOAD;
/* try 6. */
for (i = 1; i < 4; i++) {
if (pixelSize < i)
break;
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
family, style, slant, pixelSize + i, encoding);
TRY_LOAD;
jio_snprintf(buffer2, sizeof(buffer2),
"-*-%s-%s-%s-*-*-%d-*-*-*-*-*-%s",
family, style, slant, pixelSize - i, encoding);
TRY_LOAD;
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
pixelSize + i, encoding);
TRY_LOAD;
jio_snprintf(buffer2, sizeof(buffer2),
"-*-*-*-*-*-*-%d-*-*-*-*-*-%s",
pixelSize - i, encoding);
TRY_LOAD;
}
}
}
strcpy(name, defaultXLFD);
return XLoadQueryFont(display, defaultXLFD);
}
/*
* Hardwired list of mappings for generic font names "Helvetica",
* "TimesRoman", "Courier", "Dialog", and "DialogInput".
*/
static char *defaultfontname = "fixed";
static char *defaultfoundry = "misc";
static char *anyfoundry = "*";
static char *anystyle = "*-*";
static char *isolatin1 = "iso8859-1";
static char *
Style(int32_t s)
{
switch (s) {
case java_awt_Font_ITALIC:
return "medium-i";
case java_awt_Font_BOLD:
return "bold-r";
case java_awt_Font_BOLD + java_awt_Font_ITALIC:
return "bold-i";
case java_awt_Font_PLAIN:
default:
return "medium-r";
}
}
static int32_t
awtJNI_FontName(JNIEnv * env, jstring name, char **foundry, char **facename, char **encoding)
{
char *cname = NULL;
if (JNU_IsNull(env, name)) {
return 0;
}
cname = (char *) JNU_GetStringPlatformChars(env, name, NULL);
if (cname == NULL) {
(*env)->ExceptionClear(env);
JNU_ThrowOutOfMemoryError(env, "Could not create font name");
return 0;
}
/* additional default font names */
if (strcmp(cname, "serif") == 0) {
*foundry = "adobe";
*facename = "times";
*encoding = isolatin1;
} else if (strcmp(cname, "sansserif") == 0) {
*foundry = "adobe";
*facename = "helvetica";
*encoding = isolatin1;
} else if (strcmp(cname, "monospaced") == 0) {
*foundry = "adobe";
*facename = "courier";
*encoding = isolatin1;
} else if (strcmp(cname, "helvetica") == 0) {
*foundry = "adobe";
*facename = "helvetica";
*encoding = isolatin1;
} else if (strcmp(cname, "timesroman") == 0) {
*foundry = "adobe";
*facename = "times";
*encoding = isolatin1;
} else if (strcmp(cname, "courier") == 0) {
*foundry = "adobe";
*facename = "courier";
*encoding = isolatin1;
} else if (strcmp(cname, "dialog") == 0) {
*foundry = "b&h";
*facename = "lucida";
*encoding = isolatin1;
} else if (strcmp(cname, "dialoginput") == 0) {
*foundry = "b&h";
*facename = "lucidatypewriter";
*encoding = isolatin1;
} else if (strcmp(cname, "zapfdingbats") == 0) {
*foundry = "itc";
*facename = "zapfdingbats";
*encoding = "*-*";
} else {
#ifdef DEBUG
jio_fprintf(stderr, "Unknown font: %s\n", cname);
#endif
*foundry = defaultfoundry;
*facename = defaultfontname;
*encoding = isolatin1;
}
if (cname != NULL)
JNU_ReleaseStringPlatformChars(env, name, (const char *) cname);
return 1;
}
/*
* Registered with the 2D disposer to be called after the Font is GC'd.
*/
static void pDataDisposeMethod(JNIEnv *env, jlong pData)
{
struct FontData *fdata = NULL;
int32_t i = 0;
Display *display = XDISPLAY;
AWT_LOCK();
fdata = (struct FontData *)pData;
if (fdata == NULL) {
AWT_UNLOCK();
return;
}
if (fdata->xfs != NULL) {
XFreeFontSet(display, fdata->xfs);
}
/* AWT fonts are always "multifonts" and probably have been in
* all post 1.0 releases, so this test for multi fonts is
* probably not needed, and the singleton xfont is probably never used.
*/
if (fdata->charset_num > 0) {
for (i = 0; i < fdata->charset_num; i++) {
free((void *)fdata->flist[i].xlfd);
JNU_ReleaseStringPlatformChars(env, NULL,
fdata->flist[i].charset_name);
if (fdata->flist[i].load) {
XFreeFont(display, fdata->flist[i].xfont);
}
}
free((void *)fdata->flist);
/* Don't free fdata->xfont because it is equal to fdata->flist[i].xfont
for some 'i' */
} else {
if (fdata->xfont != NULL) {
XFreeFont(display, fdata->xfont);
}
}
free((void *)fdata);
AWT_UNLOCK();
}
#endif /* !HEADLESS */

View File

@ -30,11 +30,6 @@
#ifndef _AWT_P_H_ #ifndef _AWT_P_H_
#define _AWT_P_H_ #define _AWT_P_H_
/* turn on to do event filtering */
#define NEW_EVENT_MODEL
/* turn on to only filter keyboard events */
#define KEYBOARD_ONLY_EVENTS
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -58,9 +53,6 @@
#endif #endif
#endif /* !HEADLESS */ #endif /* !HEADLESS */
#define RepaintPending_NONE 0
#define RepaintPending_REPAINT (1 << 0)
#define RepaintPending_EXPOSE (1 << 1)
#define LOOKUPSIZE 32 #define LOOKUPSIZE 32
#ifndef HEADLESS #ifndef HEADLESS
@ -101,24 +93,6 @@ typedef struct _AwtScreenData {
typedef AwtScreenData* AwtScreenDataPtr; typedef AwtScreenData* AwtScreenDataPtr;
#define W_GRAVITY_INITIALIZED 1
#define W_IS_EMBEDDED 2
typedef struct awtFontList {
char *xlfd;
int index_length;
int load;
char *charset_name;
XFontStruct *xfont;
} awtFontList;
struct FontData {
int charset_num;
awtFontList *flist;
XFontSet xfs; /* for TextField & TextArea */
XFontStruct *xfont; /* Latin1 font */
};
extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen); extern AwtGraphicsConfigDataPtr getDefaultConfig(int screen);
extern AwtScreenDataPtr getScreenData(int screen); extern AwtScreenDataPtr getScreenData(int screen);
#endif /* !HEADLESS */ #endif /* !HEADLESS */
@ -127,13 +101,10 @@ extern AwtScreenDataPtr getScreenData(int screen);
#define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T))) #define ZALLOC(T) ((struct T *)calloc(1, sizeof(struct T)))
#ifndef HEADLESS #ifndef HEADLESS
#define XDISPLAY awt_display;
extern int awt_allocate_colors(AwtGraphicsConfigDataPtr); extern int awt_allocate_colors(AwtGraphicsConfigDataPtr);
extern void awt_allocate_systemcolors(XColor *, int, AwtGraphicsConfigDataPtr);
extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr); extern void awt_allocate_systemrgbcolors(jint *, int, AwtGraphicsConfigDataPtr);
extern int awtJNI_GetColor(JNIEnv *, jobject);
extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr); extern int awtJNI_GetColorForVis (JNIEnv *, jobject, AwtGraphicsConfigDataPtr);
extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr); extern jobject awtJNI_GetColorModel(JNIEnv *, AwtGraphicsConfigDataPtr);
extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock); extern void awtJNI_CreateColorData (JNIEnv *, AwtGraphicsConfigDataPtr, int lock);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -39,7 +39,6 @@
#include "awt_p.h" #include "awt_p.h"
#include "awt_Component.h" #include "awt_Component.h"
#include "awt_MenuComponent.h" #include "awt_MenuComponent.h"
#include "awt_Font.h"
#include "awt_util.h" #include "awt_util.h"
#include "sun_awt_X11_XToolkit.h" #include "sun_awt_X11_XToolkit.h"

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -107,6 +107,7 @@ public abstract class ActivationGroup
/** /**
* @serial the group's monitor * @serial the group's monitor
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private ActivationMonitor monitor; private ActivationMonitor monitor;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -49,6 +49,7 @@ public class ActivationGroupID implements java.io.Serializable {
/** /**
* @serial The group's activation system. * @serial The group's activation system.
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private ActivationSystem system; private ActivationSystem system;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -189,12 +189,14 @@ public class UnicastRemoteObject extends RemoteServer {
/** /**
* @serial client-side socket factory (if any) * @serial client-side socket factory (if any)
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private RMIClientSocketFactory csf = null; private RMIClientSocketFactory csf = null;
/** /**
* @serial server-side socket factory (if any) to use when * @serial server-side socket factory (if any) to use when
* exporting object * exporting object
*/ */
@SuppressWarnings("serial") // Not statically typed as Serializable
private RMIServerSocketFactory ssf = null; private RMIServerSocketFactory ssf = null;
/* indicate compatibility with JDK 1.1.x version of class */ /* indicate compatibility with JDK 1.1.x version of class */

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -38,6 +38,7 @@ import sun.rmi.transport.LiveRef;
* *
* @author Ann Wollrath * @author Ann Wollrath
*/ */
@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
public class ActivatableServerRef extends UnicastServerRef2 { public class ActivatableServerRef extends UnicastServerRef2 {
private static final long serialVersionUID = 2002967993223003793L; private static final long serialVersionUID = 2002967993223003793L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -145,9 +145,11 @@ public class Activation implements Serializable {
private static boolean debugExec; private static boolean debugExec;
/** maps activation id to its respective group id */ /** maps activation id to its respective group id */
@SuppressWarnings("serial") // Conditionally serializable
private Map<ActivationID,ActivationGroupID> idTable = private Map<ActivationID,ActivationGroupID> idTable =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
/** maps group id to its GroupEntry groups */ /** maps group id to its GroupEntry groups */
@SuppressWarnings("serial") // Conditionally serializable
private Map<ActivationGroupID,GroupEntry> groupTable = private Map<ActivationGroupID,GroupEntry> groupTable =
new ConcurrentHashMap<>(); new ConcurrentHashMap<>();
@ -297,6 +299,7 @@ public class Activation implements Serializable {
private static final String NAME = ActivationSystem.class.getName(); private static final String NAME = ActivationSystem.class.getName();
private static final long serialVersionUID = 4877330021609408794L; private static final long serialVersionUID = 4877330021609408794L;
@SuppressWarnings("serial") // Not statically typed as Serializable
private ActivationSystem systemStub = null; private ActivationSystem systemStub = null;
SystemRegistryImpl(int port, SystemRegistryImpl(int port,
@ -498,6 +501,7 @@ public class Activation implements Serializable {
* with RegistryImpl.checkAccess(). * with RegistryImpl.checkAccess().
* The kind of access is retained for an exception if one is thrown. * The kind of access is retained for an exception if one is thrown.
*/ */
@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
static class SameHostOnlyServerRef extends UnicastServerRef { static class SameHostOnlyServerRef extends UnicastServerRef {
private static final long serialVersionUID = 1234L; private static final long serialVersionUID = 1234L;
private String accessKind; // an exception message private String accessKind; // an exception message
@ -873,7 +877,9 @@ public class Activation implements Serializable {
ActivationGroupDesc desc = null; ActivationGroupDesc desc = null;
ActivationGroupID groupID = null; ActivationGroupID groupID = null;
long incarnation = 0; long incarnation = 0;
@SuppressWarnings("serial") // Conditionally serializable
Map<ActivationID,ObjectEntry> objects = new HashMap<>(); Map<ActivationID,ObjectEntry> objects = new HashMap<>();
@SuppressWarnings("serial") // Conditionally serializable
Set<ActivationID> restartSet = new HashSet<>(); Set<ActivationID> restartSet = new HashSet<>();
transient ActivationInstantiator group = null; transient ActivationInstantiator group = null;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -69,6 +69,7 @@ public class ActivationGroupImpl extends ActivationGroup {
new Hashtable<>(); new Hashtable<>();
private boolean groupInactive = false; private boolean groupInactive = false;
private final ActivationGroupID groupID; private final ActivationGroupID groupID;
@SuppressWarnings("serial") // Conditionally serializable
private final List<ActivationID> lockedIDs = new ArrayList<>(); private final List<ActivationID> lockedIDs = new ArrayList<>();
/** /**

View File

@ -40,7 +40,6 @@
#include "sys.h" #include "sys.h"
/* How the options get to OnLoad: */ /* How the options get to OnLoad: */
#define XDEBUG "-Xdebug"
#define XRUN "-Xrunjdwp" #define XRUN "-Xrunjdwp"
#define AGENTLIB "-agentlib:jdwp" #define AGENTLIB "-agentlib:jdwp"
@ -898,7 +897,7 @@ printUsage(void)
"--------\n" "--------\n"
" - The older " XRUN " interface can still be used, but will be removed in\n" " - The older " XRUN " interface can still be used, but will be removed in\n"
" a future release, for example:\n" " a future release, for example:\n"
" java " XDEBUG " " XRUN ":[help]|[<option>=<value>, ...]\n" " java " XRUN ":[help]|[<option>=<value>, ...]\n"
)); ));
#ifdef DEBUG #ifdef DEBUG

View File

@ -384,26 +384,26 @@ tier1 = \
hotspot_tier2_runtime = \ hotspot_tier2_runtime = \
runtime/ \ runtime/ \
serviceability/ \
-runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java \ -runtime/CommandLine/OptionsValidation/TestOptionsWithRanges.java \
-runtime/CompressedOops/UseCompressedOops.java \ -runtime/CompressedOops/UseCompressedOops.java \
-runtime/InvocationTests \ -runtime/InvocationTests \
-runtime/Thread/TestThreadDumpMonitorContention.java \ -runtime/Thread/TestThreadDumpMonitorContention.java \
-:tier1_runtime \ -:tier1_runtime \
-:tier1_serviceability \
-:hotspot_tier2_runtime_platform_agnostic \ -:hotspot_tier2_runtime_platform_agnostic \
-runtime/signal \ -runtime/signal \
-runtime/NMT/MallocStressTest.java -runtime/NMT/MallocStressTest.java
hotspot_tier2_serviceability = \
serviceability/ \
-:tier1_serviceability
hotspot_tier2_runtime_platform_agnostic = \ hotspot_tier2_runtime_platform_agnostic = \
runtime/SelectionResolution \ runtime/SelectionResolution \
-:tier1_runtime -:tier1_runtime
hotspot_tier3_runtime = \ hotspot_tier3_runtime = \
runtime/ \ runtime/ \
serviceability/ \
-:tier1_runtime \ -:tier1_runtime \
-:tier1_serviceability \
-:hotspot_tier2_runtime_platform_agnostic \ -:hotspot_tier2_runtime_platform_agnostic \
-:hotspot_tier2_runtime -:hotspot_tier2_runtime

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2019, Huawei Technologies Co. Ltd. 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 8231988
* @summary Unexpected test result caused by C2 IdealLoopTree::do_remove_empty_loop
*
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
* compiler.loopopts.TestRemoveEmptyLoop
*/
package compiler.loopopts;
public class TestRemoveEmptyLoop {
public void test() {
int i = 34;
for (; i > 0; i -= 11);
if (i < 0) {
// do nothing
} else {
throw new RuntimeException("Test failed.");
}
}
public static void main(String[] args) {
TestRemoveEmptyLoop _instance = new TestRemoveEmptyLoop();
for (int i = 0; i < 50000; i++) {
_instance.test();
}
System.out.println("Test passed.");
}
}

View File

@ -26,7 +26,12 @@
* @key gc * @key gc
* @requires vm.gc.Epsilon & !vm.graal.enabled * @requires vm.gc.Epsilon & !vm.graal.enabled
* @summary Basic sanity test for Epsilon * @summary Basic sanity test for Epsilon
* @run main/othervm -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch * @run main/othervm -Xms128m -Xmx1g -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
* @run main/othervm -Xms128m -Xmx1g -XX:-AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
* @run main/othervm -Xms128m -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
* @run main/othervm -Xmx1g -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
* @run main/othervm -Xmx1g -XX:-AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
* @run main/othervm -Xmx1g -XX:+AlwaysPreTouch -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC gc.epsilon.TestAlwaysPretouch
*/ */
package gc.epsilon; package gc.epsilon;

View File

@ -884,6 +884,7 @@ jdk/jfr/api/recording/event/TestPeriod.java 8215890 gener
jdk/jfr/event/io/EvilInstrument.java 8221331 generic-all jdk/jfr/event/io/EvilInstrument.java 8221331 generic-all
jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java 8228990,8229370 generic-all jdk/jfr/event/runtime/TestNetworkUtilizationEvent.java 8228990,8229370 generic-all
jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-all jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-all
jdk/jfr/event/oldobject/TestLargeRootSet.java 8205651 generic-all
############################################################################ ############################################################################

View File

@ -151,9 +151,13 @@ import static jdk.test.lib.Asserts.assertTrue;
reference. reference.
*/ */
class Target { class Target {
static Class<?> topLevelHostA; // Prevent unloading of the class
// We have to load all of the variants of the classes that we will // We have to load all of the variants of the classes that we will
// attempt to redefine. This requires some in-memory compilation // attempt to redefine. This requires some in-memory compilation
// and use of additional classloaders. // and use of additional classloaders.
public static void main(String[] args) throws Throwable { public static void main(String[] args) throws Throwable {
String origin = args[0]; String origin = args[0];
System.out.println("Target: Testing original Host class from " + origin); System.out.println("Target: Testing original Host class from " + origin);
@ -178,7 +182,7 @@ class Target {
String hostA = "public class " + name + " {}"; String hostA = "public class " + name + " {}";
byte[] bytes = InMemoryJavaCompiler.compile(name, hostA); byte[] bytes = InMemoryJavaCompiler.compile(name, hostA);
// And we have to load this into a new classloader // And we have to load this into a new classloader
Class<?> topLevelHostA = ByteCodeLoader.load(name, bytes); topLevelHostA = ByteCodeLoader.load(name, bytes);
// The loaded class has not been linked (as per ClassLoader.resolveClass) // The loaded class has not been linked (as per ClassLoader.resolveClass)
// and so will be filtered out by VirtualMachine.allClasses(). There are // and so will be filtered out by VirtualMachine.allClasses(). There are
// a number of ways to force linking - this is the simplest. // a number of ways to force linking - this is the simplest.

View File

@ -1,12 +1,10 @@
/* /*
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * 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 * under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this * published by the Free Software Foundation.
* 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 * This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@ -23,21 +21,21 @@
* questions. * questions.
*/ */
#include <jni_util.h> import java.awt.Toolkit;
/* fieldIDs for Font fields that may be accessed from C */ /**
struct FontIDs { * @test
jfieldID pData; * @key headful
jfieldID style; * @bug 4559047 7124404
jfieldID size; * @summary Solaris/Linux/macOS do not set awt.multiClickInterval desktop property
jmethodID getPeer; */
jmethodID getFamily; public final class GetMulticlickTime {
};
/* fieldIDs for PlatformFont fields that may be accessed from C */ public static void main(final String[] args) {
struct PlatformFontIDs { Integer time = (Integer) Toolkit.getDefaultToolkit()
jfieldID componentFonts; .getDesktopProperty("awt.multiClickInterval");
jfieldID fontConfig; if (time == null || time <= 0 || time > 30_000) {
jmethodID makeConvertedMultiFontString; throw new RuntimeException("awt.multiClickInterval:" + time);
jmethodID makeConvertedMultiFontChars; }
}; }
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/* /*
@test @test
@bug 4386025 @bug 4386025 8231243
@summary fonts not in win32 font directory print incorrectly. @summary fonts not in win32 font directory print incorrectly.
@author prr: area=PrinterJob @author prr: area=PrinterJob
@run main/manual CustomFont @run main/manual CustomFont
@ -83,12 +83,13 @@ public class CustomFont implements Printable {
Font customFont; Font customFont;
public CustomFont() { public CustomFont() {
try { try {
FileInputStream fin = new FileInputStream("A.ttf"); String dir = System.getProperty("test.src", ".");
String fileName = dir + File.separator + "A.ttf";
FileInputStream fin = new FileInputStream(fileName);
Font cf = Font.createFont(Font.TRUETYPE_FONT, fin); Font cf = Font.createFont(Font.TRUETYPE_FONT, fin);
customFont = cf.deriveFont(Font.PLAIN, 14); customFont = cf.deriveFont(Font.PLAIN, 14);
} catch (Exception ioe) { } catch (Exception ioe) {
System.err.println(ioe.getMessage()); throw new RuntimeException(ioe);
customFont = new Font("serif", Font.PLAIN, 14);
} }
} }
@ -99,7 +100,7 @@ public class CustomFont implements Printable {
g2D.setColor(Color.black); g2D.setColor(Color.black);
g2D.setFont(customFont); g2D.setFont(customFont);
String str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"; String str = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
g.drawString(str, 100, 100); g.drawString(str, 100, 100);
return Printable.PAGE_EXISTS; return Printable.PAGE_EXISTS;

View File

@ -0,0 +1,74 @@
/*
* 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 8212749
* @summary test whether input value check for
* DecimalFormat.setGroupingSize(int) works correctly.
* @run testng/othervm SetGroupingSizeTest
*/
import java.text.DecimalFormat;
import static org.testng.Assert.assertEquals;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
@Test
public class SetGroupingSizeTest {
@DataProvider
public static Object[][] validGroupingSizes() {
return new Object[][] {
{ 0 },
{ Byte.MAX_VALUE },
};
}
@DataProvider
public static Object[][] invalidGroupingSizes() {
return new Object[][] {
{ Byte.MIN_VALUE - 1 },
{ Byte.MIN_VALUE },
{ -1 },
{ Byte.MAX_VALUE + 1 },
{ Integer.MIN_VALUE },
{ Integer.MAX_VALUE },
};
}
@Test(dataProvider = "validGroupingSizes")
public void test_validGroupingSize(int newVal) {
DecimalFormat df = new DecimalFormat();
df.setGroupingSize(newVal);
assertEquals(df.getGroupingSize(), newVal);
}
@Test(dataProvider = "invalidGroupingSizes",
expectedExceptions = IllegalArgumentException.class)
public void test_invalidGroupingSize(int newVal) {
DecimalFormat df = new DecimalFormat();
df.setGroupingSize(newVal);
}
}