This commit is contained in:
Rob McKenna 2020-09-30 15:37:52 +00:00
commit 79518f34e7
34 changed files with 624 additions and 110 deletions

View File

@ -651,6 +651,7 @@ a32f58c6b8be81877411767de7ba9c4cf087c1b5 jdk-15+31
b0817631d2f4395508cb10e81c3858a94d9ae4de jdk-15+34
fd60c3146a024037cdd9be34c645bb793995a7cc jdk-15+35
e3f940bd3c8fcdf4ca704c6eb1ac745d155859d5 jdk-15+36
e3f940bd3c8fcdf4ca704c6eb1ac745d155859d5 jdk-15-ga
93813843680bbe1b7efbca56c03fd137f20a2c31 jdk-15.0.1+0
286ddf41c3f697bcf684042544fa4736ba1b85f3 jdk-15.0.1+1
08e8fa30d8456913dd0f698f9c61e4adac22805a jdk-15.0.1+2

View File

@ -218,10 +218,12 @@ AC_DEFUN([FLAGS_SETUP_SYSROOT_FLAGS],
# We also need -iframework<path>/System/Library/Frameworks
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -iframework [$]$1SYSROOT/System/Library/Frameworks"
# These always need to be set, or we can't find the frameworks embedded in JavaVM.framework
# set this here so it doesn't have to be peppered throughout the forest
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
if test -d "[$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks" ; then
# These always need to be set on macOS 10.X, or we can't find the frameworks embedded in JavaVM.framework
# set this here so it doesn't have to be peppered throughout the forest
$1SYSROOT_CFLAGS="[$]$1SYSROOT_CFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
$1SYSROOT_LDFLAGS="[$]$1SYSROOT_LDFLAGS -F [$]$1SYSROOT/System/Library/Frameworks/JavaVM.framework/Frameworks"
fi
fi
AC_SUBST($1SYSROOT_CFLAGS)

View File

@ -87,6 +87,20 @@ AC_DEFUN_ONCE([LIB_SETUP_LIBFFI],
[LIBFFI_FOUND=no]
)
fi
# on macos we need a special case for system's libffi as
# headers are located only in sdk in $SYSROOT and in ffi subfolder
if test "x$LIBFFI_FOUND" = xno; then
if test "x$SYSROOT" != "x"; then
AC_CHECK_HEADER([$SYSROOT/usr/include/ffi/ffi.h],
[
LIBFFI_FOUND=yes
LIBFFI_CFLAGS="-I${SYSROOT}/usr/include/ffi"
LIBFFI_LIBS=-lffi
],
[LIBFFI_FOUND=no]
)
fi
fi
if test "x$LIBFFI_FOUND" = xno; then
HELP_MSG_MISSING_DEPENDENCY([ffi])
AC_MSG_ERROR([Could not find libffi! $HELP_MSG])

View File

@ -902,9 +902,14 @@ AC_DEFUN_ONCE([TOOLCHAIN_SETUP_BUILD_COMPILERS],
# FIXME: we should list the discovered compilers as an exclude pattern!
# If we do that, we can do this detection before POST_DETECTION, and still
# find the build compilers in the tools dir, if needed.
UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
if test "x$OPENJDK_BUILD_OS" = xmacosx; then
UTIL_REQUIRE_PROGS(BUILD_CC, [clang cl cc gcc])
UTIL_REQUIRE_PROGS(BUILD_CXX, [clang++ cl CC g++])
else
UTIL_REQUIRE_PROGS(BUILD_CC, [cl cc gcc])
UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
fi
UTIL_FIXUP_EXECUTABLE(BUILD_CC)
UTIL_REQUIRE_PROGS(BUILD_CXX, [cl CC g++])
UTIL_FIXUP_EXECUTABLE(BUILD_CXX)
UTIL_PATH_PROGS(BUILD_NM, nm gcc-nm)
UTIL_FIXUP_EXECUTABLE(BUILD_NM)

View File

@ -91,9 +91,6 @@ else ifeq ($(call isTargetOs, macosx), true)
# NOTE: The old build tested clang version to make sure this workaround
# for the clang bug was still needed.
BUILD_LIBJVM_loopTransform.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
ifneq ($(DEBUG_LEVEL), slowdebug)
BUILD_LIBJVM_unsafe.cpp_CXXFLAGS := -O1
endif
# The following files are compiled at various optimization
# levels due to optimization issues encountered at the
@ -109,7 +106,6 @@ else ifeq ($(call isTargetOs, macosx), true)
sharedRuntimeTrig.cpp \
sharedRuntimeTrans.cpp \
loopTransform.cpp \
unsafe.cpp \
jvmciCompilerToVM.cpp \
#
endif

View File

@ -267,7 +267,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
// as to avoid memory stomping of the _mount_path pointer later on in the cgroup v1
// block in the hybrid case.
//
if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %*s %s %*[^-]- %s cgroup2 %*s", tmp_mount_point, tmp_fs_type) == 2) {
if (is_cgroupsV2 && sscanf(p, "%*d %*d %*d:%*d %*s %s %*[^-]- %s %*s %*s", tmp_mount_point, tmp_fs_type) == 2) {
// we likely have an early match return (e.g. cgroup fs match), be sure we have cgroup2 as fstype
if (!cgroupv2_mount_point_found && strcmp("cgroup2", tmp_fs_type) == 0) {
cgroupv2_mount_point_found = true;
@ -289,7 +289,7 @@ bool CgroupSubsystemFactory::determine_type(CgroupInfo* cg_infos,
* Example for host:
* 34 28 0:29 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,memory
*/
if (sscanf(p, "%*d %*d %*d:%*d %s %s %*[^-]- %s cgroup %s", tmproot, tmpmount, tmp_fs_type, tmpcgroups) == 4) {
if (sscanf(p, "%*d %*d %*d:%*d %s %s %*[^-]- %s %*s %s", tmproot, tmpmount, tmp_fs_type, tmpcgroups) == 4) {
if (strcmp("cgroup", tmp_fs_type) != 0) {
// Skip cgroup2 fs lines on hybrid or unified hierarchy.
continue;

View File

@ -60,7 +60,7 @@ void ShenandoahAdaptiveHeuristics::choose_collection_set_from_regiondata(Shenand
// we hit max_cset. When max_cset is hit, we terminate the cset selection. Note that in this scheme,
// ShenandoahGarbageThreshold is the soft threshold which would be ignored until min_garbage is hit.
size_t capacity = ShenandoahHeap::heap()->max_capacity();
size_t capacity = ShenandoahHeap::heap()->soft_max_capacity();
size_t max_cset = (size_t)((1.0 * capacity / 100 * ShenandoahEvacReserve) / ShenandoahEvacWaste);
size_t free_target = (capacity / 100 * ShenandoahMinFreeThreshold) + max_cset;
size_t min_garbage = (free_target > actual_free ? (free_target - actual_free) : 0);
@ -102,9 +102,14 @@ void ShenandoahAdaptiveHeuristics::record_cycle_start() {
bool ShenandoahAdaptiveHeuristics::should_start_gc() const {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t capacity = heap->max_capacity();
size_t max_capacity = heap->max_capacity();
size_t capacity = heap->soft_max_capacity();
size_t available = heap->free_set()->available();
// Make sure the code below treats available without the soft tail.
size_t soft_tail = max_capacity - capacity;
available = (available > soft_tail) ? (available - soft_tail) : 0;
// Check if we are falling below the worst limit, time to trigger the GC, regardless of
// anything else.
size_t min_threshold = capacity / 100 * ShenandoahMinFreeThreshold;

View File

@ -47,9 +47,14 @@ ShenandoahCompactHeuristics::ShenandoahCompactHeuristics() : ShenandoahHeuristic
bool ShenandoahCompactHeuristics::should_start_gc() const {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t capacity = heap->max_capacity();
size_t max_capacity = heap->max_capacity();
size_t capacity = heap->soft_max_capacity();
size_t available = heap->free_set()->available();
// Make sure the code below treats available without the soft tail.
size_t soft_tail = max_capacity - capacity;
available = (available > soft_tail) ? (available - soft_tail) : 0;
size_t threshold_bytes_allocated = capacity / 100 * ShenandoahAllocationThreshold;
size_t min_threshold = capacity / 100 * ShenandoahMinFreeThreshold;

View File

@ -58,8 +58,8 @@ void ShenandoahPassiveHeuristics::choose_collection_set_from_regiondata(Shenando
// Do not select too large CSet that would overflow the available free space.
// Take at least the entire evacuation reserve, and be free to overflow to free space.
size_t capacity = ShenandoahHeap::heap()->max_capacity();
size_t available = MAX2(capacity / 100 * ShenandoahEvacReserve, actual_free);
size_t max_capacity = ShenandoahHeap::heap()->max_capacity();
size_t available = MAX2(max_capacity / 100 * ShenandoahEvacReserve, actual_free);
size_t max_cset = (size_t)(available / ShenandoahEvacWaste);
log_info(gc, ergo)("CSet Selection. Actual Free: " SIZE_FORMAT "%s, Max CSet: " SIZE_FORMAT "%s",

View File

@ -42,8 +42,14 @@ ShenandoahStaticHeuristics::~ShenandoahStaticHeuristics() {}
bool ShenandoahStaticHeuristics::should_start_gc() const {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t capacity = heap->max_capacity();
size_t max_capacity = heap->max_capacity();
size_t capacity = heap->soft_max_capacity();
size_t available = heap->free_set()->available();
// Make sure the code below treats available without the soft tail.
size_t soft_tail = max_capacity - capacity;
available = (available > soft_tail) ? (available - soft_tail) : 0;
size_t threshold_available = capacity / 100 * ShenandoahMinFreeThreshold;
if (available < threshold_available) {

View File

@ -103,6 +103,9 @@ void ShenandoahControlThread::run_service() {
// This control loop iteration have seen this much allocations.
size_t allocs_seen = Atomic::xchg(&_allocs_seen, (size_t)0);
// Check if we have seen a new target for soft max heap size.
bool soft_max_changed = check_soft_max_changed();
// Choose which GC mode to run in. The block below should select a single mode.
GCMode mode = none;
GCCause::Cause cause = GCCause::_last_gc_cause;
@ -288,13 +291,20 @@ void ShenandoahControlThread::run_service() {
double current = os::elapsedTime();
if (ShenandoahUncommit && (explicit_gc_requested || (current - last_shrink_time > shrink_period))) {
// Try to uncommit enough stale regions. Explicit GC tries to uncommit everything.
// Regular paths uncommit only occasionally.
double shrink_before = explicit_gc_requested ?
if (ShenandoahUncommit && (explicit_gc_requested || soft_max_changed || (current - last_shrink_time > shrink_period))) {
// Explicit GC tries to uncommit everything down to min capacity.
// Soft max change tries to uncommit everything down to target capacity.
// Periodic uncommit tries to uncommit suitable regions down to min capacity.
double shrink_before = (explicit_gc_requested || soft_max_changed) ?
current :
current - (ShenandoahUncommitDelay / 1000.0);
service_uncommit(shrink_before);
size_t shrink_until = soft_max_changed ?
heap->soft_max_capacity() :
heap->min_capacity();
service_uncommit(shrink_before, shrink_until);
heap->phase_timings()->flush_cycle_to_global();
last_shrink_time = current;
}
@ -317,6 +327,25 @@ void ShenandoahControlThread::run_service() {
}
}
bool ShenandoahControlThread::check_soft_max_changed() const {
ShenandoahHeap* heap = ShenandoahHeap::heap();
size_t new_soft_max = Atomic::load(&SoftMaxHeapSize);
size_t old_soft_max = heap->soft_max_capacity();
if (new_soft_max != old_soft_max) {
new_soft_max = MAX2(heap->min_capacity(), new_soft_max);
new_soft_max = MIN2(heap->max_capacity(), new_soft_max);
if (new_soft_max != old_soft_max) {
log_info(gc)("Soft Max Heap Size: " SIZE_FORMAT "%s -> " SIZE_FORMAT "%s",
byte_size_in_proper_unit(old_soft_max), proper_unit_for_byte_size(old_soft_max),
byte_size_in_proper_unit(new_soft_max), proper_unit_for_byte_size(new_soft_max)
);
heap->set_soft_max_capacity(new_soft_max);
return true;
}
}
return false;
}
void ShenandoahControlThread::service_concurrent_normal_cycle(GCCause::Cause cause) {
// Normal cycle goes via all concurrent phases. If allocation failure (af) happens during
// any of the concurrent phases, it first degrades to Degenerated GC and completes GC there.
@ -476,14 +505,14 @@ void ShenandoahControlThread::service_stw_degenerated_cycle(GCCause::Cause cause
heap->shenandoah_policy()->record_success_degenerated();
}
void ShenandoahControlThread::service_uncommit(double shrink_before) {
void ShenandoahControlThread::service_uncommit(double shrink_before, size_t shrink_until) {
ShenandoahHeap* heap = ShenandoahHeap::heap();
// Determine if there is work to do. This avoids taking heap lock if there is
// no work available, avoids spamming logs with superfluous logging messages,
// and minimises the amount of work while locks are taken.
if (heap->committed() <= heap->min_capacity()) return;
if (heap->committed() <= shrink_until) return;
bool has_work = false;
for (size_t i = 0; i < heap->num_regions(); i++) {
@ -495,7 +524,7 @@ void ShenandoahControlThread::service_uncommit(double shrink_before) {
}
if (has_work) {
heap->entry_uncommit(shrink_before);
heap->entry_uncommit(shrink_before, shrink_until);
}
}

View File

@ -103,7 +103,7 @@ private:
void service_concurrent_normal_cycle(GCCause::Cause cause);
void service_stw_full_cycle(GCCause::Cause cause);
void service_stw_degenerated_cycle(GCCause::Cause cause, ShenandoahHeap::ShenandoahDegenPoint point);
void service_uncommit(double shrink_before);
void service_uncommit(double shrink_before, size_t shrink_until);
bool try_set_alloc_failure_gc();
void notify_alloc_failure_waiters();
@ -120,6 +120,9 @@ private:
void handle_requested_gc(GCCause::Cause cause);
bool is_explicit_gc(GCCause::Cause cause) const;
bool check_soft_max_changed() const;
public:
// Constructor
ShenandoahControlThread();

View File

@ -164,6 +164,9 @@ jint ShenandoahHeap::initialize() {
assert(num_min_regions <= _num_regions, "sanity");
_minimum_size = num_min_regions * reg_size_bytes;
// Default to max heap size.
_soft_max_size = _num_regions * reg_size_bytes;
_committed = _initial_size;
size_t heap_page_size = UseLargePages ? (size_t)os::large_page_size() : (size_t)os::vm_page_size();
@ -541,8 +544,9 @@ void ShenandoahHeap::reset_mark_bitmap() {
void ShenandoahHeap::print_on(outputStream* st) const {
st->print_cr("Shenandoah Heap");
st->print_cr(" " SIZE_FORMAT "%s total, " SIZE_FORMAT "%s committed, " SIZE_FORMAT "%s used",
st->print_cr(" " SIZE_FORMAT "%s max, " SIZE_FORMAT "%s soft max, " SIZE_FORMAT "%s committed, " SIZE_FORMAT "%s used",
byte_size_in_proper_unit(max_capacity()), proper_unit_for_byte_size(max_capacity()),
byte_size_in_proper_unit(soft_max_capacity()), proper_unit_for_byte_size(soft_max_capacity()),
byte_size_in_proper_unit(committed()), proper_unit_for_byte_size(committed()),
byte_size_in_proper_unit(used()), proper_unit_for_byte_size(used()));
st->print_cr(" " SIZE_FORMAT " x " SIZE_FORMAT"%s regions",
@ -679,6 +683,21 @@ size_t ShenandoahHeap::max_capacity() const {
return _num_regions * ShenandoahHeapRegion::region_size_bytes();
}
size_t ShenandoahHeap::soft_max_capacity() const {
size_t v = Atomic::load(&_soft_max_size);
assert(min_capacity() <= v && v <= max_capacity(),
"Should be in bounds: " SIZE_FORMAT " <= " SIZE_FORMAT " <= " SIZE_FORMAT,
min_capacity(), v, max_capacity());
return v;
}
void ShenandoahHeap::set_soft_max_capacity(size_t v) {
assert(min_capacity() <= v && v <= max_capacity(),
"Should be in bounds: " SIZE_FORMAT " <= " SIZE_FORMAT " <= " SIZE_FORMAT,
min_capacity(), v, max_capacity());
Atomic::store(&_soft_max_size, v);
}
size_t ShenandoahHeap::min_capacity() const {
return _minimum_size;
}
@ -693,7 +712,7 @@ bool ShenandoahHeap::is_in(const void* p) const {
return p >= heap_base && p < last_region_end;
}
void ShenandoahHeap::op_uncommit(double shrink_before) {
void ShenandoahHeap::op_uncommit(double shrink_before, size_t shrink_until) {
assert (ShenandoahUncommit, "should be enabled");
// Application allocates from the beginning of the heap, and GC allocates at
@ -707,8 +726,7 @@ void ShenandoahHeap::op_uncommit(double shrink_before) {
if (r->is_empty_committed() && (r->empty_time() < shrink_before)) {
ShenandoahHeapLocker locker(lock());
if (r->is_empty_committed()) {
// Do not uncommit below minimal capacity
if (committed() < min_capacity() + ShenandoahHeapRegion::region_size_bytes()) {
if (committed() < shrink_until + ShenandoahHeapRegion::region_size_bytes()) {
break;
}
@ -3002,12 +3020,12 @@ void ShenandoahHeap::entry_preclean() {
}
}
void ShenandoahHeap::entry_uncommit(double shrink_before) {
void ShenandoahHeap::entry_uncommit(double shrink_before, size_t shrink_until) {
static const char *msg = "Concurrent uncommit";
ShenandoahConcurrentPhase gc_phase(msg, ShenandoahPhaseTimings::conc_uncommit, true /* log_heap_usage */);
EventMark em("%s", msg);
op_uncommit(shrink_before);
op_uncommit(shrink_before, shrink_until);
}
void ShenandoahHeap::try_inject_alloc_failure() {

View File

@ -161,6 +161,7 @@ public:
private:
size_t _initial_size;
size_t _minimum_size;
volatile size_t _soft_max_size;
shenandoah_padding(0);
volatile size_t _used;
volatile size_t _committed;
@ -179,12 +180,15 @@ public:
size_t bytes_allocated_since_gc_start();
void reset_bytes_allocated_since_gc_start();
size_t min_capacity() const;
size_t max_capacity() const;
size_t initial_capacity() const;
size_t capacity() const;
size_t used() const;
size_t committed() const;
size_t min_capacity() const;
size_t max_capacity() const;
size_t soft_max_capacity() const;
size_t initial_capacity() const;
size_t capacity() const;
size_t used() const;
size_t committed() const;
void set_soft_max_capacity(size_t v);
// ---------- Workers handling
//
@ -393,7 +397,7 @@ public:
void entry_evac();
void entry_updaterefs();
void entry_cleanup_complete();
void entry_uncommit(double shrink_before);
void entry_uncommit(double shrink_before, size_t shrink_until);
private:
// Actual work for the phases
@ -418,7 +422,7 @@ private:
void op_stw_evac();
void op_updaterefs();
void op_cleanup_complete();
void op_uncommit(double shrink_before);
void op_uncommit(double shrink_before, size_t shrink_until);
void rendezvous_threads();

View File

@ -106,26 +106,26 @@
"How much heap should be free before some heuristics trigger the "\
"initial (learning) cycles. Affects cycle frequency on startup " \
"and after drastic state changes, e.g. after degenerated/full " \
"GC cycles. In percents of total heap size.") \
"GC cycles. In percents of (soft) max heap size.") \
range(0,100) \
\
experimental(uintx, ShenandoahMinFreeThreshold, 10, \
"How much heap should be free before most heuristics trigger the "\
"collection, even without other triggers. Provides the safety " \
"margin for many heuristics. In percents of total heap size.") \
"margin for many heuristics. In percents of (soft) max heap size.")\
range(0,100) \
\
experimental(uintx, ShenandoahAllocationThreshold, 0, \
"How many new allocations should happen since the last GC cycle " \
"before some heuristics trigger the collection. In percents of " \
"total heap size. Set to zero to effectively disable.") \
"(soft) max heap size. Set to zero to effectively disable.") \
range(0,100) \
\
experimental(uintx, ShenandoahAllocSpikeFactor, 5, \
"How much of heap should some heuristics reserve for absorbing " \
"the allocation spikes. Larger value wastes more memory in " \
"non-emergency cases, but provides more safety in emergency " \
"cases. In percents of total heap size.") \
"cases. In percents of (soft) max heap size.") \
range(0,100) \
\
experimental(uintx, ShenandoahLearningSteps, 5, \

View File

@ -180,6 +180,7 @@ bool JfrStackTrace::record_thread(JavaThread& thread, frame& frame) {
u4 count = 0;
_reached_root = true;
_hash = 1;
while (!st.at_end()) {
if (count >= _max_frames) {
_reached_root = false;
@ -201,7 +202,9 @@ bool JfrStackTrace::record_thread(JavaThread& thread, frame& frame) {
}
const int lineno = method->line_number_from_bci(bci);
// Can we determine if it's inlined?
_hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
_hash = (_hash * 31) + mid;
_hash = (_hash * 31) + bci;
_hash = (_hash * 31) + type;
_frames[count] = JfrStackFrame(mid, bci, type, lineno, method->method_holder());
st.samples_next();
count++;
@ -240,6 +243,7 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
vfs.next();
}
_hash = 1;
while (!vfs.at_end()) {
if (count >= _max_frames) {
_reached_root = false;
@ -255,8 +259,9 @@ bool JfrStackTrace::record_safe(JavaThread* thread, int skip) {
else {
bci = vfs.bci();
}
// Can we determine if it's inlined?
_hash = (_hash << 2) + (unsigned int)(((size_t)mid >> 2) + (bci << 4) + type);
_hash = (_hash * 31) + mid;
_hash = (_hash * 31) + bci;
_hash = (_hash * 31) + type;
_frames[count] = JfrStackFrame(mid, bci, type, method->method_holder());
vfs.next();
count++;

View File

@ -1575,7 +1575,7 @@ C2V_END
// Creates a scope where the current thread is attached and detached
// from HotSpot if it wasn't already attached when entering the scope.
extern "C" void jio_printf(const char *fmt, ...);
extern "C" int jio_printf(const char *fmt, ...);
class AttachDetach : public StackObj {
public:
bool _attached;

View File

@ -4210,17 +4210,26 @@ Node *PhaseIdealLoop::get_late_ctrl( Node *n, Node *early ) {
}
} else {
Node *sctrl = has_ctrl(s) ? get_ctrl(s) : s->in(0);
const TypePtr* adr_type = s->adr_type();
if (s->is_ArrayCopy()) {
// Copy to known instance needs destination type to test for aliasing
const TypePtr* dest_type = s->as_ArrayCopy()->_dest_type;
if (dest_type != TypeOopPtr::BOTTOM) {
adr_type = dest_type;
}
}
assert(sctrl != NULL || !s->is_reachable_from_root(), "must have control");
if (sctrl != NULL && !sctrl->is_top() && C->can_alias(adr_type, load_alias_idx) && is_dominator(early, sctrl)) {
LCA = dom_lca_for_get_late_ctrl(LCA, sctrl, n);
if (sctrl != NULL && !sctrl->is_top() && is_dominator(early, sctrl)) {
const TypePtr* adr_type = s->adr_type();
if (s->is_ArrayCopy()) {
// Copy to known instance needs destination type to test for aliasing
const TypePtr* dest_type = s->as_ArrayCopy()->_dest_type;
if (dest_type != TypeOopPtr::BOTTOM) {
adr_type = dest_type;
}
}
if (C->can_alias(adr_type, load_alias_idx)) {
LCA = dom_lca_for_get_late_ctrl(LCA, sctrl, n);
} else if (s->is_CFG()) {
for (DUIterator_Fast imax, i = s->fast_outs(imax); i < imax; i++) {
Node* s1 = s->fast_out(i);
if (_igvn.type(s1) == Type::MEMORY) {
worklist.push(s1);
}
}
}
}
}
}

View File

@ -528,7 +528,8 @@ void Parse::do_lookupswitch() {
for (int j = 0; j < len; j++) {
table[3*j+0] = iter().get_int_table(2+2*j);
table[3*j+1] = iter().get_dest_table(2+2*j+1);
table[3*j+2] = profile == NULL ? 1 : profile->count_at(j);
// Handle overflow when converting from uint to jint
table[3*j+2] = (profile == NULL) ? 1 : MIN2<uint>(max_jint, profile->count_at(j));
}
qsort(table, len, 3*sizeof(table[0]), jint_cmp);
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2020, 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
@ -57,7 +57,7 @@ Java_sun_awt_windows_WInputMethod_createNativeContext(JNIEnv *env, jobject self)
TRY;
// use special message to call ImmCreateContext() in main thread.
return (jint)AwtToolkit::GetInstance().SendMessage(WM_AWT_CREATECONTEXT);
return (jint)AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_CREATECONTEXT);
CATCH_BAD_ALLOC_RET(0);
}
@ -74,7 +74,7 @@ Java_sun_awt_windows_WInputMethod_destroyNativeContext(JNIEnv *env, jobject self
TRY_NO_VERIFY;
// use special message to call ImmDestroyContext() in main thread.
AwtToolkit::GetInstance().SendMessage(WM_AWT_DESTROYCONTEXT, context, 0);
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_DESTROYCONTEXT, context, 0);
CATCH_BAD_ALLOC;
}
@ -101,7 +101,7 @@ Java_sun_awt_windows_WInputMethod_enableNativeIME(JNIEnv *env, jobject self, job
enis->context = context;
enis->useNativeCompWindow = useNativeCompWindow;
AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
@ -128,7 +128,7 @@ Java_sun_awt_windows_WInputMethod_disableNativeIME(JNIEnv *env, jobject self, jo
enis->context = NULL;
enis->useNativeCompWindow = JNI_TRUE;
AwtToolkit::GetInstance().SendMessage(WM_AWT_ASSOCIATECONTEXT,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ASSOCIATECONTEXT,
reinterpret_cast<WPARAM>(enis), (LPARAM)0);
// global refs are deleted in message handler
@ -205,7 +205,7 @@ Java_sun_awt_windows_WInputMethod_endCompositionNative(JNIEnv *env, jobject self
// 10/29/98 - Changed to commit it according to the flag.
// use special message to call ImmNotifyIME() in main thread.
AwtToolkit::GetInstance().SendMessage(WM_AWT_ENDCOMPOSITION, context,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_ENDCOMPOSITION, context,
(LPARAM)(flag != sun_awt_windows_WInputMethod_DISCARD_INPUT));
CATCH_BAD_ALLOC;
@ -222,7 +222,7 @@ Java_sun_awt_windows_WInputMethod_setConversionStatus(JNIEnv *env, jobject self,
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
AwtToolkit::GetInstance().SendMessage(WM_AWT_SETCONVERSIONSTATUS,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETCONVERSIONSTATUS,
context,
MAKELPARAM((WORD)request, (WORD)0));
@ -240,7 +240,7 @@ Java_sun_awt_windows_WInputMethod_getConversionStatus(JNIEnv *env, jobject self,
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
return (jint) AwtToolkit::GetInstance().SendMessage(
return (jint) AwtToolkit::GetInstance().InvokeInputMethodFunction(
WM_AWT_GETCONVERSIONSTATUS, context, 0);
CATCH_BAD_ALLOC_RET(0);
@ -257,7 +257,7 @@ Java_sun_awt_windows_WInputMethod_setOpenStatus(JNIEnv *env, jobject self, jint
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
AwtToolkit::GetInstance().SendMessage(WM_AWT_SETOPENSTATUS,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_SETOPENSTATUS,
context, flag);
CATCH_BAD_ALLOC;
@ -274,7 +274,7 @@ Java_sun_awt_windows_WInputMethod_getOpenStatus(JNIEnv *env, jobject self, jint
TRY;
// use special message to call ImmSetConversionStatus() in main thread.
return (jboolean)(AwtToolkit::GetInstance().SendMessage(
return (jboolean)(AwtToolkit::GetInstance().InvokeInputMethodFunction(
WM_AWT_GETOPENSTATUS,
context, 0));
CATCH_BAD_ALLOC_RET(0);
@ -392,7 +392,7 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WInputMethod_setStatusWindowVisible
jobject peerGlobalRef = env->NewGlobalRef(peer);
// use special message to access pData on the toolkit thread
LRESULT res = AwtToolkit::GetInstance().SendMessage(WM_AWT_GET_DEFAULT_IME_HANDLER,
LRESULT res = AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_GET_DEFAULT_IME_HANDLER,
reinterpret_cast<WPARAM>(peerGlobalRef), 0);
// global ref is deleted in message handler
@ -431,7 +431,7 @@ JNIEXPORT void JNICALL Java_sun_awt_windows_WInputMethod_openCandidateWindow
// See CR 4805862, AwtToolkit::WndProc
// use special message to open candidate window in main thread.
AwtToolkit::GetInstance().SendMessage(WM_AWT_OPENCANDIDATEWINDOW,
AwtToolkit::GetInstance().InvokeInputMethodFunction(WM_AWT_OPENCANDIDATEWINDOW,
(WPARAM)peerGlobalRef, MAKELONG(x, y));
// global ref is deleted in message handler

View File

@ -343,6 +343,7 @@ AwtToolkit::AwtToolkit() {
::GetKeyboardState(m_lastKeyboardState);
m_waitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
m_inputMethodWaitEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
isInDoDragDropLoop = FALSE;
eventNumber = 0;
}
@ -777,6 +778,7 @@ BOOL AwtToolkit::Dispose() {
delete tk.m_cmdIDs;
::CloseHandle(m_waitEvent);
::CloseHandle(m_inputMethodWaitEvent);
tk.m_isDisposed = TRUE;
@ -1087,11 +1089,17 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
// it returs with no error. (This restriction is not documented)
// So we must use thse messages to call these APIs in main thread.
case WM_AWT_CREATECONTEXT: {
return reinterpret_cast<LRESULT>(
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = reinterpret_cast<LRESULT>(
reinterpret_cast<void*>(ImmCreateContext()));
::SetEvent(tk.m_inputMethodWaitEvent);
return tk.m_inputMethodData;
}
case WM_AWT_DESTROYCONTEXT: {
ImmDestroyContext((HIMC)wParam);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
case WM_AWT_ASSOCIATECONTEXT: {
@ -1117,17 +1125,21 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
}
delete data;
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
case WM_AWT_GET_DEFAULT_IME_HANDLER: {
LRESULT ret = (LRESULT)FALSE;
jobject peer = (jobject)wParam;
AwtToolkit& tk = AwtToolkit::GetInstance();
AwtComponent* comp = (AwtComponent*)JNI_GET_PDATA(peer);
if (comp != NULL) {
HWND defaultIMEHandler = ImmGetDefaultIMEWnd(comp->GetHWnd());
if (defaultIMEHandler != NULL) {
AwtToolkit::GetInstance().SetInputMethodWindow(defaultIMEHandler);
tk.SetInputMethodWindow(defaultIMEHandler);
ret = (LRESULT)TRUE;
}
}
@ -1135,6 +1147,8 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
if (peer != NULL) {
env->DeleteGlobalRef(peer);
}
tk.m_inputMethodData = ret;
::SetEvent(tk.m_inputMethodWaitEvent);
return ret;
}
case WM_AWT_HANDLE_NATIVE_IME_EVENT: {
@ -1170,6 +1184,9 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
Changed to commit it according to the flag 10/29/98*/
ImmNotifyIME((HIMC)wParam, NI_COMPOSITIONSTR,
(lParam ? CPS_COMPLETE : CPS_CANCEL), 0);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
case WM_AWT_SETCONVERSIONSTATUS: {
@ -1177,12 +1194,18 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
DWORD smode;
ImmGetConversionStatus((HIMC)wParam, (LPDWORD)&cmode, (LPDWORD)&smode);
ImmSetConversionStatus((HIMC)wParam, (DWORD)LOWORD(lParam), smode);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
case WM_AWT_GETCONVERSIONSTATUS: {
DWORD cmode;
DWORD smode;
ImmGetConversionStatus((HIMC)wParam, (LPDWORD)&cmode, (LPDWORD)&smode);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = cmode;
::SetEvent(tk.m_inputMethodWaitEvent);
return cmode;
}
case WM_AWT_ACTIVATEKEYBOARDLAYOUT: {
@ -1217,6 +1240,9 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
// instead of LOWORD and HIWORD
p->OpenCandidateWindow(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
env->DeleteGlobalRef(peerObject);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
@ -1238,10 +1264,16 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
case WM_AWT_SETOPENSTATUS: {
ImmSetOpenStatus((HIMC)wParam, (BOOL)lParam);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = 0;
::SetEvent(tk.m_inputMethodWaitEvent);
return 0;
}
case WM_AWT_GETOPENSTATUS: {
return (DWORD)ImmGetOpenStatus((HIMC)wParam);
AwtToolkit& tk = AwtToolkit::GetInstance();
tk.m_inputMethodData = (DWORD)ImmGetOpenStatus((HIMC)wParam);
::SetEvent(tk.m_inputMethodWaitEvent);
return tk.m_inputMethodData;
}
case WM_DISPLAYCHANGE: {
// Reinitialize screens
@ -3166,3 +3198,33 @@ BOOL AwtToolkit::TICloseTouchInputHandle(HTOUCHINPUT hTouchInput) {
}
return m_pCloseTouchInputHandle(hTouchInput);
}
/*
* The fuction intended for access to an IME API. It posts IME message to the queue and
* waits untill the message processing is completed.
*
* On Windows 10 the IME may process the messages send via SenMessage() from other threads
* when the IME is called by TranslateMessage(). This may cause an reentrancy issue when
* the windows procedure processing the sent message call an IME function and leaves
* the IME functionality in an unexpected state.
* This function avoids reentrancy issue and must be used for sending of all IME messages
* instead of SendMessage().
*/
LRESULT AwtToolkit::InvokeInputMethodFunction(UINT msg, WPARAM wParam, LPARAM lParam) {
/*
* DND runs on the main thread. So it is necessary to use SendMessage() to call an IME
* function once the DND is active; otherwise a hang is possible since DND may wait for
* the IME completion.
*/
if (isInDoDragDropLoop) {
return SendMessage(msg, wParam, lParam);
} else {
CriticalSection::Lock lock(m_inputMethodLock);
if (PostMessage(msg, wParam, lParam)) {
::WaitForSingleObject(m_inputMethodWaitEvent, INFINITE);
return m_inputMethodData;
}
return 0;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -244,6 +244,8 @@ public:
UINT cInputs, PTOUCHINPUT pInputs, int cbSize);
BOOL TICloseTouchInputHandle(HTOUCHINPUT hTouchInput);
LRESULT InvokeInputMethodFunction(UINT msg, WPARAM wParam=0, LPARAM lParam=0);
INLINE BOOL localPump() { return m_localPump; }
INLINE BOOL VerifyComponents() { return FALSE; } // TODO: Use new DebugHelper class to set this flag
INLINE HWND GetHWnd() { return m_toolkitHWnd; }
@ -498,6 +500,10 @@ private:
HMODULE m_dllHandle; /* The module handle. */
CriticalSection m_Sync;
CriticalSection m_inputMethodLock;
HANDLE m_inputMethodWaitEvent;
LRESULT m_inputMethodData;
/* track display changes - used by palette-updating code.
This is a workaround for a windows bug that prevents

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -56,7 +56,7 @@ public class FormatData_ar_JO extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // february
"\u0622\u0630\u0627\u0631", // march
"\u0646\u064a\u0633\u0627\u0646", // april
"\u0646\u0648\u0627\u0631", // may
"\u0623\u064a\u0627\u0631", // may
"\u062d\u0632\u064a\u0631\u0627\u0646", // june
"\u062a\u0645\u0648\u0632", // july
"\u0622\u0628", // august
@ -73,7 +73,7 @@ public class FormatData_ar_JO extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // abb february
"\u0622\u0630\u0627\u0631", // abb march
"\u0646\u064a\u0633\u0627\u0646", // abb april
"\u0646\u0648\u0627\u0631", // abb may
"\u0623\u064a\u0627\u0631", // abb may
"\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
"\u062a\u0645\u0648\u0632", // abb july
"\u0622\u0628", // abb august

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -56,7 +56,7 @@ public class FormatData_ar_LB extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // february
"\u0622\u0630\u0627\u0631", // march
"\u0646\u064a\u0633\u0627\u0646", // april
"\u0646\u0648\u0627\u0631", // may
"\u0623\u064a\u0627\u0631", // may
"\u062d\u0632\u064a\u0631\u0627\u0646", // june
"\u062a\u0645\u0648\u0632", // july
"\u0622\u0628", // august
@ -73,7 +73,7 @@ public class FormatData_ar_LB extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // abb february
"\u0622\u0630\u0627\u0631", // abb march
"\u0646\u064a\u0633\u0627\u0646", // abb april
"\u0646\u0648\u0627\u0631", // abb may
"\u0623\u064a\u0627\u0631", // abb may
"\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
"\u062a\u0645\u0648\u0632", // abb july
"\u0622\u0628", // abb august

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2020, 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
@ -56,8 +56,8 @@ public class FormatData_ar_SY extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // february
"\u0622\u0630\u0627\u0631", // march
"\u0646\u064a\u0633\u0627\u0646", // april
"\u0646\u0648\u0627\u0631\u0627\u0646", // may
"\u062d\u0632\u064a\u0631", // june
"\u0623\u064a\u0627\u0631", // may
"\u062d\u0632\u064a\u0631\u0627\u0646", // june
"\u062a\u0645\u0648\u0632", // july
"\u0622\u0628", // august
"\u0623\u064a\u0644\u0648\u0644", // september
@ -73,7 +73,7 @@ public class FormatData_ar_SY extends ParallelListResourceBundle {
"\u0634\u0628\u0627\u0637", // abb february
"\u0622\u0630\u0627\u0631", // abb march
"\u0646\u064a\u0633\u0627\u0646", // abb april
"\u0646\u0648\u0627\u0631", // abb may
"\u0623\u064a\u0627\u0631", // abb may
"\u062d\u0632\u064a\u0631\u0627\u0646", // abb june
"\u062a\u0645\u0648\u0632", // abb july
"\u0622\u0628", // abb august

View File

@ -0,0 +1,69 @@
/*
* Copyright (c) 2020, Red Hat, Inc. 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 8252292
* @summary 8240795 may cause anti-dependency to be missed
* @requires vm.gc.Parallel
*
* @run main/othervm -XX:-BackgroundCompilation -XX:+UseParallelGC TestMissingAntiDependency
*
*/
public class TestMissingAntiDependency {
public static void main(String[] args) {
int[] src = new int[10];
for (int i = 0; i < 20_000; i++) {
test(src, true, true, 10);
test(src, true, false, 10);
test(src, false, false, 10);
}
src[9] = 42;
final int v = test(src, true, true, 1);
if (v != 42) {
throw new RuntimeException("Incorrect return value " + v);
}
}
private static int test(int[] src, boolean flag1, boolean flag2, int stop) {
int v = 0;
int j = 1;
for (; j < 10; j++) {
for (int i = 0; i < 2; i++) {
}
}
int[] dst = new int[10];
for (int i = 0; i < stop; i ++) {
if (flag1) {
System.arraycopy(src, 0, dst, 0, j);
v = dst[9];
if (flag2) {
src[9] = 0x42;
}
}
}
return v;
}
}

View File

@ -62,7 +62,7 @@ public class TestCompileCommand {
out.shouldContain(expected_output);
}
out.shouldNotContain("CompileCommand: An error occured during parsing");
out.shouldNotContain("CompileCommand: An error occurred during parsing");
out.shouldHaveExitValue(0);
}

View File

@ -0,0 +1,62 @@
/*
* Copyright (c) 2020, 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 8251458
* @summary Test int range overflow of MultiBranchData counter.
* @run main/othervm -XX:CompileCommand=dontinline,compiler.profiling.TestMultiBranchDataOverflow::test
* -Xbatch -XX:Tier4BackEdgeThreshold=2147483647
* compiler.profiling.TestMultiBranchDataOverflow
*/
package compiler.profiling;
public class TestMultiBranchDataOverflow {
public static int test(int val, long max) {
int res = 0;
for (long l = 0; l < max; ++l) {
switch (val) {
case 0:
return 0;
case 42:
res++;
break;
}
}
return res;
}
public static void main(String[] args) {
// Warmup to generate profile information that has a MultiBranchData
// counter > Integer.MAX_VALUE for the i == 42 lookupswitch branch.
long max = Integer.MAX_VALUE + 100_000L;
test(42, max);
// Trigger C2 compilation
for (int i = 0; i < 10_000; ++i) {
test(42, 1);
}
}
}

View File

@ -89,20 +89,20 @@ public class CgroupSubsystemFactory {
"net_cls 0 1 1\n" +
"blkio 0 1 1\n" +
"perf_event 0 1 1 ";
private String cgroupV2LineHybrid = "31 30 0:27 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:5 - cgroup2 cgroup2 rw,seclabel,nsdelegate\n";
private String cgroupv1MountInfoLineMemory = "35 30 0:31 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:7 - cgroup cgroup rw,seclabel,memory\n";
private String cgroupV2LineHybrid = "31 30 0:27 / /sys/fs/cgroup/unified rw,nosuid,nodev,noexec,relatime shared:5 - cgroup2 none rw,seclabel,nsdelegate\n";
private String cgroupv1MountInfoLineMemory = "35 30 0:31 / /sys/fs/cgroup/memory rw,nosuid,nodev,noexec,relatime shared:7 - cgroup none rw,seclabel,memory\n";
private String mntInfoHybridStub =
"30 23 0:26 / /sys/fs/cgroup ro,nosuid,nodev,noexec shared:4 - tmpfs tmpfs ro,seclabel,mode=755\n" +
"32 30 0:28 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup cgroup rw,seclabel,xattr,name=systemd\n" +
"36 30 0:32 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:8 - cgroup cgroup rw,seclabel,pids\n" +
"37 30 0:33 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:9 - cgroup cgroup rw,seclabel,perf_event\n" +
"38 30 0:34 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:10 - cgroup cgroup rw,seclabel,net_cls,net_prio\n" +
"39 30 0:35 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:11 - cgroup cgroup rw,seclabel,hugetlb\n" +
"40 30 0:36 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:12 - cgroup cgroup rw,seclabel,cpu,cpuacct\n" +
"41 30 0:37 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:13 - cgroup cgroup rw,seclabel,devices\n" +
"42 30 0:38 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:14 - cgroup cgroup rw,seclabel,cpuset\n" +
"43 30 0:39 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:15 - cgroup cgroup rw,seclabel,blkio\n" +
"44 30 0:40 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup cgroup rw,seclabel,freezer";
"32 30 0:28 / /sys/fs/cgroup/systemd rw,nosuid,nodev,noexec,relatime shared:6 - cgroup none rw,seclabel,xattr,name=systemd\n" +
"36 30 0:32 / /sys/fs/cgroup/pids rw,nosuid,nodev,noexec,relatime shared:8 - cgroup none rw,seclabel,pids\n" +
"37 30 0:33 / /sys/fs/cgroup/perf_event rw,nosuid,nodev,noexec,relatime shared:9 - cgroup none rw,seclabel,perf_event\n" +
"38 30 0:34 / /sys/fs/cgroup/net_cls,net_prio rw,nosuid,nodev,noexec,relatime shared:10 - cgroup none rw,seclabel,net_cls,net_prio\n" +
"39 30 0:35 / /sys/fs/cgroup/hugetlb rw,nosuid,nodev,noexec,relatime shared:11 - cgroup none rw,seclabel,hugetlb\n" +
"40 30 0:36 / /sys/fs/cgroup/cpu,cpuacct rw,nosuid,nodev,noexec,relatime shared:12 - cgroup none rw,seclabel,cpu,cpuacct\n" +
"41 30 0:37 / /sys/fs/cgroup/devices rw,nosuid,nodev,noexec,relatime shared:13 - cgroup none rw,seclabel,devices\n" +
"42 30 0:38 / /sys/fs/cgroup/cpuset rw,nosuid,nodev,noexec,relatime shared:14 - cgroup none rw,seclabel,cpuset\n" +
"43 30 0:39 / /sys/fs/cgroup/blkio rw,nosuid,nodev,noexec,relatime shared:15 - cgroup none rw,seclabel,blkio\n" +
"44 30 0:40 / /sys/fs/cgroup/freezer rw,nosuid,nodev,noexec,relatime shared:16 - cgroup none rw,seclabel,freezer";
private String mntInfoHybridRest = cgroupv1MountInfoLineMemory + mntInfoHybridStub;
private String mntInfoHybridMissingMemory = mntInfoHybridStub;
private String mntInfoHybrid = cgroupV2LineHybrid + mntInfoHybridRest;
@ -122,7 +122,7 @@ public class CgroupSubsystemFactory {
"hugetlb 6 1 1\n" +
"pids 3 80 1";
private String mntInfoCgroupsV2Only =
"28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 cgroup2 rw,seclabel,nsdelegate";
"28 21 0:25 / /sys/fs/cgroup rw,nosuid,nodev,noexec,relatime shared:4 - cgroup2 none rw,seclabel,nsdelegate";
private void setup() {
try {

View File

@ -0,0 +1,137 @@
/*
* Copyright (c) 2020, Red Hat, Inc. 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 TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
* -XX:+ShenandoahDegeneratedGC
* -Dtarget=10000
* TestDynamicSoftMaxHeapSize
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive
* -XX:-ShenandoahDegeneratedGC
* -Dtarget=10000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=aggressive
* -Dtarget=1000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=adaptive
* -Dtarget=10000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=static
* -Dtarget=10000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCHeuristics=compact
* -Dtarget=1000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=aggressive
* -Dtarget=1000
* TestDynamicSoftMaxHeapSize
*/
/*
* @test TestDynamicSoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
*
* @run main/othervm -Xms16m -Xmx512m -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions
* -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu
* -Dtarget=10000
* TestDynamicSoftMaxHeapSize
*/
import java.util.Random;
import jdk.test.lib.Utils;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.dcmd.PidJcmdExecutor;
public class TestDynamicSoftMaxHeapSize {
static final long TARGET_MB = Long.getLong("target", 10_000); // 10 Gb allocation
static final long STRIDE = 10_000_000;
static volatile Object sink;
public static void main(String[] args) throws Exception {
long count = TARGET_MB * 1024 * 1024 / 16;
Random r = Utils.getRandomInstance();
PidJcmdExecutor jcmd = new PidJcmdExecutor();
for (long c = 0; c < count; c += STRIDE) {
// Sizes specifically include heaps below Xms and above Xmx to test saturation code.
jcmd.execute("VM.set_flag SoftMaxHeapSize " + r.nextInt(768*1024*1024), true);
for (long s = 0; s < STRIDE; s++) {
sink = new Object();
}
Thread.sleep(1);
}
}
}

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2020, Red Hat, Inc. 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 TestSoftMaxHeapSize
* @summary Test that Shenandoah checks SoftMaxHeapSize
* @requires vm.gc.Shenandoah & !vm.graal.enabled
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
* @run driver TestSoftMaxHeapSize
*/
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.process.OutputAnalyzer;
public class TestSoftMaxHeapSize {
public static void main(String[] args) throws Exception {
{
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
"-XX:+UseShenandoahGC",
"-Xms4m",
"-Xmx128m",
"-XX:SoftMaxHeapSize=4m",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
}
{
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
"-XX:+UseShenandoahGC",
"-Xms4m",
"-Xmx128m",
"-XX:SoftMaxHeapSize=128m",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(0);
}
{
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UnlockExperimentalVMOptions",
"-XX:+UseShenandoahGC",
"-Xms4m",
"-Xmx128m",
"-XX:SoftMaxHeapSize=129m",
"-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldHaveExitValue(1);
output.shouldContain("SoftMaxHeapSize must be less than or equal to the maximum heap size");
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -24,6 +24,7 @@
/**
* @test
* @summary JVM crash if the frame is disposed in DropTargetListener
* @bug 8252470
* @key headful
* @author Petr Pchelko
* @library ../../regtesthelpers

View File

@ -1187,7 +1187,7 @@ FormatData/ar_JO/MonthNames/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\
FormatData/ar_JO/MonthNames/1=\u0634\u0628\u0627\u0637
FormatData/ar_JO/MonthNames/2=\u0622\u0630\u0627\u0631
FormatData/ar_JO/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_JO/MonthNames/4=\u0646\u0648\u0627\u0631
FormatData/ar_JO/MonthNames/4=\u0623\u064a\u0627\u0631
FormatData/ar_JO/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_JO/MonthNames/6=\u062a\u0645\u0648\u0632
FormatData/ar_JO/MonthNames/7=\u0622\u0628
@ -1200,7 +1200,7 @@ FormatData/ar_JO/MonthAbbreviations/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u064
FormatData/ar_JO/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
FormatData/ar_JO/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
FormatData/ar_JO/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_JO/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
FormatData/ar_JO/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
FormatData/ar_JO/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_JO/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
FormatData/ar_JO/MonthAbbreviations/7=\u0622\u0628
@ -1363,7 +1363,7 @@ FormatData/ar_LB/MonthNames/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\
FormatData/ar_LB/MonthNames/1=\u0634\u0628\u0627\u0637
FormatData/ar_LB/MonthNames/2=\u0622\u0630\u0627\u0631
FormatData/ar_LB/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_LB/MonthNames/4=\u0646\u0648\u0627\u0631
FormatData/ar_LB/MonthNames/4=\u0623\u064a\u0627\u0631
FormatData/ar_LB/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_LB/MonthNames/6=\u062a\u0645\u0648\u0632
FormatData/ar_LB/MonthNames/7=\u0622\u0628
@ -1376,7 +1376,7 @@ FormatData/ar_LB/MonthAbbreviations/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u064
FormatData/ar_LB/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
FormatData/ar_LB/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
FormatData/ar_LB/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_LB/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
FormatData/ar_LB/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
FormatData/ar_LB/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_LB/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
FormatData/ar_LB/MonthAbbreviations/7=\u0622\u0628
@ -1980,8 +1980,8 @@ FormatData/ar_SY/MonthNames/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u0644\u062b\
FormatData/ar_SY/MonthNames/1=\u0634\u0628\u0627\u0637
FormatData/ar_SY/MonthNames/2=\u0622\u0630\u0627\u0631
FormatData/ar_SY/MonthNames/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_SY/MonthNames/4=\u0646\u0648\u0627\u0631\u0627\u0646
FormatData/ar_SY/MonthNames/5=\u062d\u0632\u064a\u0631
FormatData/ar_SY/MonthNames/4=\u0623\u064a\u0627\u0631
FormatData/ar_SY/MonthNames/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_SY/MonthNames/6=\u062a\u0645\u0648\u0632
FormatData/ar_SY/MonthNames/7=\u0622\u0628
FormatData/ar_SY/MonthNames/8=\u0623\u064a\u0644\u0648\u0644
@ -1993,7 +1993,7 @@ FormatData/ar_SY/MonthAbbreviations/0=\u0643\u0627\u0646\u0648\u0646 \u0627\u064
FormatData/ar_SY/MonthAbbreviations/1=\u0634\u0628\u0627\u0637
FormatData/ar_SY/MonthAbbreviations/2=\u0622\u0630\u0627\u0631
FormatData/ar_SY/MonthAbbreviations/3=\u0646\u064a\u0633\u0627\u0646
FormatData/ar_SY/MonthAbbreviations/4=\u0646\u0648\u0627\u0631
FormatData/ar_SY/MonthAbbreviations/4=\u0623\u064a\u0627\u0631
FormatData/ar_SY/MonthAbbreviations/5=\u062d\u0632\u064a\u0631\u0627\u0646
FormatData/ar_SY/MonthAbbreviations/6=\u062a\u0645\u0648\u0632
FormatData/ar_SY/MonthAbbreviations/7=\u0622\u0628

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,7 +39,7 @@
* 8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916
* 8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841 8190918
* 8187946 8195478 8181157 8179071 8193552 8202026 8204269 8202537 8208746
* 8209775 8221432 8227127 8230284 8231273 8233579 8234288
* 8209775 8221432 8227127 8230284 8231273 8233579 8234288 8250665
* @summary Verify locale data
* @modules java.base/sun.util.resources
* @modules jdk.localedata