Merge
This commit is contained in:
commit
ff77d8762c
1
.hgtags
1
.hgtags
@ -323,3 +323,4 @@ c25e882cee9622ec75c4e9d60633539a2f0a8809 jdk9-b77
|
||||
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
|
||||
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
|
||||
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
|
||||
2050b3a0aadcb0e024bf798197421d58e54ec8bf jdk9-b81
|
||||
|
@ -323,3 +323,4 @@ d82072b699b880a1f647a5e2d7c0f86cec958941 jdk9-b76
|
||||
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
|
||||
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
|
||||
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
|
||||
b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
|
||||
|
@ -4364,7 +4364,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1435822080
|
||||
DATE_WHEN_GENERATED=1441958217
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -38307,6 +38307,48 @@ $as_echo "$as_me: Rewriting OBJCOPY to \"$new_complete\"" >&6;}
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||
# - version number is last blank separate word on first line
|
||||
# - version number formats that have been seen:
|
||||
# - <major>.<minor>
|
||||
# - <major>.<minor>.<micro>
|
||||
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||
OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||
-e 's/.* //' \
|
||||
-e '/^[01]\./b bad' \
|
||||
-e '/^2\./{' \
|
||||
-e ' s/^2\.//' \
|
||||
-e ' /^[0-9]$/b bad' \
|
||||
-e ' /^[0-9]\./b bad' \
|
||||
-e ' /^1[0-9]$/b bad' \
|
||||
-e ' /^1[0-9]\./b bad' \
|
||||
-e ' /^20\./b bad' \
|
||||
-e ' /^21\.0$/b bad' \
|
||||
-e ' /^21\.0\./b bad' \
|
||||
-e '}' \
|
||||
-e ':good' \
|
||||
-e 's/.*/VALID_VERSION/p' \
|
||||
-e 'q' \
|
||||
-e ':bad' \
|
||||
-e 's/.*/BAD_VERSION/p' \
|
||||
-e 'q'`
|
||||
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||
OBJCOPY=
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&5
|
||||
$as_echo "$as_me: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: objcopy reports version $OBJCOPY_VERSION" >&5
|
||||
$as_echo "$as_me: objcopy reports version $OBJCOPY_VERSION" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&5
|
||||
$as_echo "$as_me: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&5
|
||||
$as_echo "$as_me: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&6;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: Note: Solaris 11 Update 1 contains the correct version" >&5
|
||||
$as_echo "$as_me: Note: Solaris 11 Update 1 contains the correct version" >&6;}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -30,25 +30,6 @@
|
||||
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
|
||||
# using 'configure @CONFIGURE_COMMAND_LINE@'
|
||||
|
||||
# When calling macros, the spaces between arguments are
|
||||
# often semantically important! Sometimes we need to subst
|
||||
# spaces and commas, therefore we need the following macros.
|
||||
X:=
|
||||
SPACE:=$(X) $(X)
|
||||
COMMA:=,
|
||||
DOLLAR:=$$
|
||||
HASH:=\#
|
||||
LEFT_PAREN:=(
|
||||
RIGHT_PAREN:=)
|
||||
SQUOTE:='
|
||||
#'
|
||||
DQUOTE:="
|
||||
#"
|
||||
define NEWLINE
|
||||
|
||||
|
||||
endef
|
||||
|
||||
# The command line given to configure.
|
||||
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
|
||||
|
||||
|
@ -586,6 +586,43 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_EXTRA],
|
||||
# Only call fixup if objcopy was found.
|
||||
if test -n "$OBJCOPY"; then
|
||||
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
|
||||
if test "x$OPENJDK_BUILD_OS" = xsolaris; then
|
||||
# objcopy prior to 2.21.1 on solaris is broken and is not usable.
|
||||
# Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
|
||||
# - version number is last blank separate word on first line
|
||||
# - version number formats that have been seen:
|
||||
# - <major>.<minor>
|
||||
# - <major>.<minor>.<micro>
|
||||
OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
|
||||
# The outer [ ] is to prevent m4 from eating the [] in the sed expression.
|
||||
[ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
|
||||
-e 's/.* //' \
|
||||
-e '/^[01]\./b bad' \
|
||||
-e '/^2\./{' \
|
||||
-e ' s/^2\.//' \
|
||||
-e ' /^[0-9]$/b bad' \
|
||||
-e ' /^[0-9]\./b bad' \
|
||||
-e ' /^1[0-9]$/b bad' \
|
||||
-e ' /^1[0-9]\./b bad' \
|
||||
-e ' /^20\./b bad' \
|
||||
-e ' /^21\.0$/b bad' \
|
||||
-e ' /^21\.0\./b bad' \
|
||||
-e '}' \
|
||||
-e ':good' \
|
||||
-e 's/.*/VALID_VERSION/p' \
|
||||
-e 'q' \
|
||||
-e ':bad' \
|
||||
-e 's/.*/BAD_VERSION/p' \
|
||||
-e 'q'` ]
|
||||
if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
|
||||
OBJCOPY=
|
||||
AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.])
|
||||
AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION])
|
||||
AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version])
|
||||
AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version])
|
||||
AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version])
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -323,3 +323,4 @@ d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
|
||||
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
|
||||
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
|
||||
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
|
||||
45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
|
||||
|
@ -483,3 +483,4 @@ e66c3813789debfc06f206afde1bf7a84cb08451 jdk9-b77
|
||||
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
|
||||
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
|
||||
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
|
||||
4142c190cd5ca4fb70ec367b4f97ef936272d8ef jdk9-b81
|
||||
|
@ -2211,9 +2211,13 @@ void os::pd_print_cpu_info(outputStream* st, char* buf, size_t buflen) {
|
||||
}
|
||||
}
|
||||
|
||||
const char* search_string = IA32_ONLY("model name") AMD64_ONLY("model name")
|
||||
IA64_ONLY("") SPARC_ONLY("cpu")
|
||||
ARM32_ONLY("Processor") PPC_ONLY("Processor") AARCH64_ONLY("Processor");
|
||||
#if defined(AMD64) || defined(IA32) || defined(X32)
|
||||
const char* search_string = "model name";
|
||||
#elif defined(SPARC)
|
||||
const char* search_string = "cpu";
|
||||
#else
|
||||
const char* search_string = "Processor";
|
||||
#endif
|
||||
|
||||
// Parses the cpuinfo file for string representing the model name.
|
||||
void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
|
||||
@ -2248,9 +2252,25 @@ void os::get_summary_cpu_info(char* cpuinfo, size_t length) {
|
||||
}
|
||||
// cpuinfo not found or parsing failed, just print generic string. The entire
|
||||
// /proc/cpuinfo file will be printed later in the file (or enough of it for x86)
|
||||
strncpy(cpuinfo, IA32_ONLY("x86_32") AMD64_ONLY("x86_32")
|
||||
IA64_ONLY("IA64") SPARC_ONLY("sparcv9")
|
||||
ARM32_ONLY("ARM") PPC_ONLY("PPC64") AARCH64_ONLY("AArch64"), length);
|
||||
#if defined(AMD64)
|
||||
strncpy(cpuinfo, "x86_64", length);
|
||||
#elif defined(IA32)
|
||||
strncpy(cpuinfo, "x86_32", length);
|
||||
#elif defined(IA64)
|
||||
strncpy(cpuinfo, "IA64", length);
|
||||
#elif defined(SPARC)
|
||||
strncpy(cpuinfo, "sparcv9", length);
|
||||
#elif defined(AARCH64)
|
||||
strncpy(cpuinfo, "AArch64", length);
|
||||
#elif defined(ARM)
|
||||
strncpy(cpuinfo, "ARM", length);
|
||||
#elif defined(PPC)
|
||||
strncpy(cpuinfo, "PPC64", length);
|
||||
#elif defined(ZERO_LIBARCH)
|
||||
strncpy(cpuinfo, ZERO_LIBARCH, length);
|
||||
#else
|
||||
strncpy(cpuinfo, "unknown", length);
|
||||
#endif
|
||||
}
|
||||
|
||||
void os::print_siginfo(outputStream* st, void* siginfo) {
|
||||
|
@ -4877,6 +4877,26 @@ char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
|
||||
// Returns true=success, otherwise false.
|
||||
|
||||
bool os::pd_unmap_memory(char* addr, size_t bytes) {
|
||||
MEMORY_BASIC_INFORMATION mem_info;
|
||||
if (VirtualQuery(addr, &mem_info, sizeof(mem_info)) == 0) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
DWORD err = GetLastError();
|
||||
tty->print_cr("VirtualQuery() failed: GetLastError->%ld.", err);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Executable memory was not mapped using CreateFileMapping/MapViewOfFileEx.
|
||||
// Instead, executable region was allocated using VirtualAlloc(). See
|
||||
// pd_map_memory() above.
|
||||
//
|
||||
// The following flags should match the 'exec_access' flages used for
|
||||
// VirtualProtect() in pd_map_memory().
|
||||
if (mem_info.Protect == PAGE_EXECUTE_READ ||
|
||||
mem_info.Protect == PAGE_EXECUTE_READWRITE) {
|
||||
return pd_release_memory(addr, bytes);
|
||||
}
|
||||
|
||||
BOOL result = UnmapViewOfFile(addr);
|
||||
if (result == 0) {
|
||||
if (PrintMiscellaneous && Verbose) {
|
||||
|
@ -304,8 +304,7 @@ AdaptiveSizePolicy* CMSCollector::size_policy() {
|
||||
void ConcurrentMarkSweepGeneration::initialize_performance_counters() {
|
||||
|
||||
const char* gen_name = "old";
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
|
||||
|
||||
GenCollectorPolicy* gcp = GenCollectedHeap::heap()->gen_policy();
|
||||
// Generation Counters - generation 1, 1 subspace
|
||||
_gen_counters = new GenerationCounters(gen_name, 1, 1,
|
||||
gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
|
||||
|
@ -83,7 +83,7 @@ CollectionSetChooser::CollectionSetChooser() :
|
||||
_regions((ResourceObj::set_allocation_type((address) &_regions,
|
||||
ResourceObj::C_HEAP),
|
||||
100), true /* C_Heap */),
|
||||
_curr_index(0), _length(0), _first_par_unreserved_idx(0),
|
||||
_front(0), _end(0), _first_par_unreserved_idx(0),
|
||||
_region_live_threshold_bytes(0), _remaining_reclaimable_bytes(0) {
|
||||
_region_live_threshold_bytes =
|
||||
HeapRegion::GrainBytes * (size_t) G1MixedGCLiveThresholdPercent / 100;
|
||||
@ -91,19 +91,19 @@ CollectionSetChooser::CollectionSetChooser() :
|
||||
|
||||
#ifndef PRODUCT
|
||||
void CollectionSetChooser::verify() {
|
||||
guarantee(_length <= regions_length(),
|
||||
err_msg("_length: %u regions length: %u", _length, regions_length()));
|
||||
guarantee(_curr_index <= _length,
|
||||
err_msg("_curr_index: %u _length: %u", _curr_index, _length));
|
||||
guarantee(_end <= regions_length(),
|
||||
err_msg("_end: %u regions length: %u", _end, regions_length()));
|
||||
guarantee(_front <= _end,
|
||||
err_msg("_front: %u _end: %u", _front, _end));
|
||||
uint index = 0;
|
||||
size_t sum_of_reclaimable_bytes = 0;
|
||||
while (index < _curr_index) {
|
||||
while (index < _front) {
|
||||
guarantee(regions_at(index) == NULL,
|
||||
"all entries before _curr_index should be NULL");
|
||||
"all entries before _front should be NULL");
|
||||
index += 1;
|
||||
}
|
||||
HeapRegion *prev = NULL;
|
||||
while (index < _length) {
|
||||
while (index < _end) {
|
||||
HeapRegion *curr = regions_at(index++);
|
||||
guarantee(curr != NULL, "Regions in _regions array cannot be NULL");
|
||||
guarantee(!curr->is_young(), "should not be young!");
|
||||
@ -132,15 +132,15 @@ void CollectionSetChooser::sort_regions() {
|
||||
regions_trunc_to(_first_par_unreserved_idx);
|
||||
}
|
||||
_regions.sort(order_regions);
|
||||
assert(_length <= regions_length(), "Requirement");
|
||||
assert(_end <= regions_length(), "Requirement");
|
||||
#ifdef ASSERT
|
||||
for (uint i = 0; i < _length; i++) {
|
||||
for (uint i = 0; i < _end; i++) {
|
||||
assert(regions_at(i) != NULL, "Should be true by sorting!");
|
||||
}
|
||||
#endif // ASSERT
|
||||
if (G1PrintRegionLivenessInfo) {
|
||||
G1PrintRegionLivenessInfoClosure cl(gclog_or_tty, "Post-Sorting");
|
||||
for (uint i = 0; i < _length; ++i) {
|
||||
for (uint i = 0; i < _end; ++i) {
|
||||
HeapRegion* r = regions_at(i);
|
||||
cl.doHeapRegion(r);
|
||||
}
|
||||
@ -154,11 +154,19 @@ void CollectionSetChooser::add_region(HeapRegion* hr) {
|
||||
err_msg("Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index()));
|
||||
assert(!hr->is_young(), "should not be young!");
|
||||
_regions.append(hr);
|
||||
_length++;
|
||||
_end++;
|
||||
_remaining_reclaimable_bytes += hr->reclaimable_bytes();
|
||||
hr->calc_gc_efficiency();
|
||||
}
|
||||
|
||||
void CollectionSetChooser::push(HeapRegion* hr) {
|
||||
assert(hr != NULL, "Can't put back a NULL region");
|
||||
assert(_front >= 1, "Too many regions have been put back");
|
||||
_front--;
|
||||
regions_at_put(_front, hr);
|
||||
_remaining_reclaimable_bytes += hr->reclaimable_bytes();
|
||||
}
|
||||
|
||||
void CollectionSetChooser::prepare_for_par_region_addition(uint n_threads,
|
||||
uint n_regions,
|
||||
uint chunk_size) {
|
||||
@ -193,7 +201,7 @@ void CollectionSetChooser::update_totals(uint region_num,
|
||||
// We could have just used atomics instead of taking the
|
||||
// lock. However, we currently don't have an atomic add for size_t.
|
||||
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
|
||||
_length += region_num;
|
||||
_end += region_num;
|
||||
_remaining_reclaimable_bytes += reclaimable_bytes;
|
||||
} else {
|
||||
assert(reclaimable_bytes == 0, "invariant");
|
||||
@ -202,7 +210,7 @@ void CollectionSetChooser::update_totals(uint region_num,
|
||||
|
||||
void CollectionSetChooser::clear() {
|
||||
_regions.clear();
|
||||
_curr_index = 0;
|
||||
_length = 0;
|
||||
_front = 0;
|
||||
_end = 0;
|
||||
_remaining_reclaimable_bytes = 0;
|
||||
};
|
||||
|
@ -48,12 +48,10 @@ class CollectionSetChooser: public CHeapObj<mtGC> {
|
||||
|
||||
// The index of the next candidate old region to be considered for
|
||||
// addition to the CSet.
|
||||
uint _curr_index;
|
||||
uint _front;
|
||||
|
||||
// The number of candidate old regions added to the CSet chooser.
|
||||
// Note: this is not updated when removing a region using
|
||||
// remove_and_move_to_next() below.
|
||||
uint _length;
|
||||
// The index of the last candidate old region
|
||||
uint _end;
|
||||
|
||||
// Keeps track of the start of the next array chunk to be claimed by
|
||||
// parallel GC workers.
|
||||
@ -73,31 +71,33 @@ public:
|
||||
// collection without removing it from the CSet chooser.
|
||||
HeapRegion* peek() {
|
||||
HeapRegion* res = NULL;
|
||||
if (_curr_index < _length) {
|
||||
res = regions_at(_curr_index);
|
||||
if (_front < _end) {
|
||||
res = regions_at(_front);
|
||||
assert(res != NULL,
|
||||
err_msg("Unexpected NULL hr in _regions at index %u",
|
||||
_curr_index));
|
||||
_front));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
// Remove the given region from the CSet chooser and move to the
|
||||
// next one. The given region should be the current candidate region
|
||||
// in the CSet chooser.
|
||||
void remove_and_move_to_next(HeapRegion* hr) {
|
||||
// next one.
|
||||
HeapRegion* pop() {
|
||||
HeapRegion* hr = regions_at(_front);
|
||||
assert(hr != NULL, "pre-condition");
|
||||
assert(_curr_index < _length, "pre-condition");
|
||||
assert(regions_at(_curr_index) == hr, "pre-condition");
|
||||
regions_at_put(_curr_index, NULL);
|
||||
assert(_front < _end, "pre-condition");
|
||||
regions_at_put(_front, NULL);
|
||||
assert(hr->reclaimable_bytes() <= _remaining_reclaimable_bytes,
|
||||
err_msg("remaining reclaimable bytes inconsistent "
|
||||
"from region: " SIZE_FORMAT " remaining: " SIZE_FORMAT,
|
||||
hr->reclaimable_bytes(), _remaining_reclaimable_bytes));
|
||||
_remaining_reclaimable_bytes -= hr->reclaimable_bytes();
|
||||
_curr_index += 1;
|
||||
_front += 1;
|
||||
return hr;
|
||||
}
|
||||
|
||||
void push(HeapRegion* hr);
|
||||
|
||||
CollectionSetChooser();
|
||||
|
||||
void sort_regions();
|
||||
@ -113,7 +113,7 @@ public:
|
||||
}
|
||||
|
||||
// Returns the number candidate old regions added
|
||||
uint length() { return _length; }
|
||||
uint length() { return _end; }
|
||||
|
||||
// Serial version.
|
||||
void add_region(HeapRegion *hr);
|
||||
@ -135,7 +135,7 @@ public:
|
||||
void clear();
|
||||
|
||||
// Return the number of candidate regions that remain to be collected.
|
||||
uint remaining_regions() { return _length - _curr_index; }
|
||||
uint remaining_regions() { return _end - _front; }
|
||||
|
||||
// Determine whether the CSet chooser has more candidate regions or not.
|
||||
bool is_empty() { return remaining_regions() == 0; }
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "gc/g1/g1HotCardCache.hpp"
|
||||
#include "runtime/java.hpp"
|
||||
|
||||
ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure) :
|
||||
ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h) :
|
||||
_threads(NULL), _n_threads(0),
|
||||
_hot_card_cache(g1h)
|
||||
{
|
||||
@ -48,29 +48,46 @@ ConcurrentG1Refine::ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosu
|
||||
FLAG_SET_DEFAULT(G1ConcRefinementRedZone, yellow_zone() * 2);
|
||||
}
|
||||
set_red_zone(MAX2<int>(G1ConcRefinementRedZone, yellow_zone()));
|
||||
}
|
||||
|
||||
_n_worker_threads = thread_num();
|
||||
ConcurrentG1Refine* ConcurrentG1Refine::create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode) {
|
||||
ConcurrentG1Refine* cg1r = new ConcurrentG1Refine(g1h);
|
||||
if (cg1r == NULL) {
|
||||
*ecode = JNI_ENOMEM;
|
||||
vm_shutdown_during_initialization("Could not create ConcurrentG1Refine");
|
||||
return NULL;
|
||||
}
|
||||
cg1r->_n_worker_threads = thread_num();
|
||||
// We need one extra thread to do the young gen rset size sampling.
|
||||
_n_threads = _n_worker_threads + 1;
|
||||
cg1r->_n_threads = cg1r->_n_worker_threads + 1;
|
||||
|
||||
reset_threshold_step();
|
||||
cg1r->reset_threshold_step();
|
||||
|
||||
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads, mtGC);
|
||||
cg1r->_threads = NEW_C_HEAP_ARRAY_RETURN_NULL(ConcurrentG1RefineThread*, cg1r->_n_threads, mtGC);
|
||||
if (cg1r->_threads == NULL) {
|
||||
*ecode = JNI_ENOMEM;
|
||||
vm_shutdown_during_initialization("Could not allocate an array for ConcurrentG1RefineThread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint worker_id_offset = DirtyCardQueueSet::num_par_ids();
|
||||
|
||||
ConcurrentG1RefineThread *next = NULL;
|
||||
for (uint i = _n_threads - 1; i != UINT_MAX; i--) {
|
||||
ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(this, next, refine_closure, worker_id_offset, i);
|
||||
for (uint i = cg1r->_n_threads - 1; i != UINT_MAX; i--) {
|
||||
ConcurrentG1RefineThread* t = new ConcurrentG1RefineThread(cg1r, next, refine_closure, worker_id_offset, i);
|
||||
assert(t != NULL, "Conc refine should have been created");
|
||||
if (t->osthread() == NULL) {
|
||||
*ecode = JNI_ENOMEM;
|
||||
vm_shutdown_during_initialization("Could not create ConcurrentG1RefineThread");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
assert(t->cg1r() == this, "Conc refine thread should refer to this");
|
||||
_threads[i] = t;
|
||||
assert(t->cg1r() == cg1r, "Conc refine thread should refer to this");
|
||||
cg1r->_threads[i] = t;
|
||||
next = t;
|
||||
}
|
||||
*ecode = JNI_OK;
|
||||
return cg1r;
|
||||
}
|
||||
|
||||
void ConcurrentG1Refine::reset_threshold_step() {
|
||||
|
@ -71,10 +71,15 @@ class ConcurrentG1Refine: public CHeapObj<mtGC> {
|
||||
// Reset the threshold step value based of the current zone boundaries.
|
||||
void reset_threshold_step();
|
||||
|
||||
ConcurrentG1Refine(G1CollectedHeap* g1h);
|
||||
|
||||
public:
|
||||
ConcurrentG1Refine(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure);
|
||||
~ConcurrentG1Refine();
|
||||
|
||||
// Returns ConcurrentG1Refine instance if succeeded to create/initialize ConcurrentG1Refine and ConcurrentG1RefineThread.
|
||||
// Otherwise, returns NULL with error code.
|
||||
static ConcurrentG1Refine* create(G1CollectedHeap* g1h, CardTableEntryClosure* refine_closure, jint* ecode);
|
||||
|
||||
void init(G1RegionToSpaceMapper* card_counts_storage);
|
||||
void stop();
|
||||
|
||||
|
@ -2025,7 +2025,6 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
|
||||
_survivor_evac_stats(YoungPLABSize, PLABWeight),
|
||||
_old_evac_stats(OldPLABSize, PLABWeight),
|
||||
_expand_heap_after_alloc_failure(true),
|
||||
_surviving_young_words(NULL),
|
||||
_old_marking_cycles_started(0),
|
||||
_old_marking_cycles_completed(0),
|
||||
_heap_summary_sent(false),
|
||||
@ -2126,7 +2125,11 @@ jint G1CollectedHeap::initialize() {
|
||||
|
||||
_refine_cte_cl = new RefineCardTableEntryClosure();
|
||||
|
||||
_cg1r = new ConcurrentG1Refine(this, _refine_cte_cl);
|
||||
jint ecode = JNI_OK;
|
||||
_cg1r = ConcurrentG1Refine::create(this, _refine_cte_cl, &ecode);
|
||||
if (_cg1r == NULL) {
|
||||
return ecode;
|
||||
}
|
||||
|
||||
// Reserve the maximum.
|
||||
|
||||
@ -2397,6 +2400,10 @@ void G1CollectedHeap::ref_processing_init() {
|
||||
// (for efficiency/performance)
|
||||
}
|
||||
|
||||
CollectorPolicy* G1CollectedHeap::collector_policy() const {
|
||||
return g1_policy();
|
||||
}
|
||||
|
||||
size_t G1CollectedHeap::capacity() const {
|
||||
return _hrm.length() * HeapRegion::GrainBytes;
|
||||
}
|
||||
@ -3694,10 +3701,6 @@ size_t G1CollectedHeap::pending_card_num() {
|
||||
return (buffer_size * buffer_num + extra_cards) / oopSize;
|
||||
}
|
||||
|
||||
size_t G1CollectedHeap::cards_scanned() {
|
||||
return g1_rem_set()->cardsScanned();
|
||||
}
|
||||
|
||||
class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
|
||||
private:
|
||||
size_t _total_humongous;
|
||||
@ -3838,36 +3841,6 @@ void G1CollectedHeap::register_humongous_regions_with_cset() {
|
||||
cl.flush_rem_set_entries();
|
||||
}
|
||||
|
||||
void G1CollectedHeap::setup_surviving_young_words() {
|
||||
assert(_surviving_young_words == NULL, "pre-condition");
|
||||
uint array_length = g1_policy()->young_cset_region_length();
|
||||
_surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length, mtGC);
|
||||
if (_surviving_young_words == NULL) {
|
||||
vm_exit_out_of_memory(sizeof(size_t) * array_length, OOM_MALLOC_ERROR,
|
||||
"Not enough space for young surv words summary.");
|
||||
}
|
||||
memset(_surviving_young_words, 0, (size_t) array_length * sizeof(size_t));
|
||||
#ifdef ASSERT
|
||||
for (uint i = 0; i < array_length; ++i) {
|
||||
assert( _surviving_young_words[i] == 0, "memset above" );
|
||||
}
|
||||
#endif // !ASSERT
|
||||
}
|
||||
|
||||
void G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
|
||||
assert_at_safepoint(true);
|
||||
uint array_length = g1_policy()->young_cset_region_length();
|
||||
for (uint i = 0; i < array_length; ++i) {
|
||||
_surviving_young_words[i] += surv_young_words[i];
|
||||
}
|
||||
}
|
||||
|
||||
void G1CollectedHeap::cleanup_surviving_young_words() {
|
||||
guarantee( _surviving_young_words != NULL, "pre-condition" );
|
||||
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
|
||||
_surviving_young_words = NULL;
|
||||
}
|
||||
|
||||
#ifdef ASSERT
|
||||
class VerifyCSetClosure: public HeapRegionClosure {
|
||||
public:
|
||||
@ -4129,7 +4102,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
|
||||
#endif // YOUNG_LIST_VERBOSE
|
||||
|
||||
g1_policy()->finalize_cset(target_pause_time_ms);
|
||||
double time_remaining_ms = g1_policy()->finalize_young_cset_part(target_pause_time_ms);
|
||||
g1_policy()->finalize_old_cset_part(time_remaining_ms);
|
||||
|
||||
evacuation_info.set_collectionset_regions(g1_policy()->cset_region_length());
|
||||
|
||||
@ -4155,22 +4129,20 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
collection_set_iterate(&cl);
|
||||
#endif // ASSERT
|
||||
|
||||
setup_surviving_young_words();
|
||||
|
||||
// Initialize the GC alloc regions.
|
||||
_allocator->init_gc_alloc_regions(evacuation_info);
|
||||
|
||||
G1ParScanThreadStateSet per_thread_states(this, workers()->active_workers(), g1_policy()->young_cset_region_length());
|
||||
// Actually do the work...
|
||||
evacuate_collection_set(evacuation_info);
|
||||
evacuate_collection_set(evacuation_info, &per_thread_states);
|
||||
|
||||
free_collection_set(g1_policy()->collection_set(), evacuation_info);
|
||||
const size_t* surviving_young_words = per_thread_states.surviving_young_words();
|
||||
free_collection_set(g1_policy()->collection_set(), evacuation_info, surviving_young_words);
|
||||
|
||||
eagerly_reclaim_humongous_regions();
|
||||
|
||||
g1_policy()->clear_collection_set();
|
||||
|
||||
cleanup_surviving_young_words();
|
||||
|
||||
// Start a new incremental collection set for the next pause.
|
||||
g1_policy()->start_incremental_cset_building();
|
||||
|
||||
@ -4255,7 +4227,8 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
|
||||
// investigate this in CR 7178365.
|
||||
double sample_end_time_sec = os::elapsedTime();
|
||||
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
|
||||
g1_policy()->record_collection_pause_end(pause_time_ms);
|
||||
size_t total_cards_scanned = per_thread_states.total_cards_scanned();
|
||||
g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned);
|
||||
|
||||
evacuation_info.set_collectionset_used_before(g1_policy()->collection_set_bytes_used_before());
|
||||
evacuation_info.set_bytes_copied(g1_policy()->bytes_copied_during_gc());
|
||||
@ -4542,14 +4515,14 @@ class G1KlassScanClosure : public KlassClosure {
|
||||
class G1ParTask : public AbstractGangTask {
|
||||
protected:
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _pss;
|
||||
G1ParScanThreadStateSet* _pss;
|
||||
RefToScanQueueSet* _queues;
|
||||
G1RootProcessor* _root_processor;
|
||||
ParallelTaskTerminator _terminator;
|
||||
uint _n_workers;
|
||||
|
||||
public:
|
||||
G1ParTask(G1CollectedHeap* g1h, G1ParScanThreadState** per_thread_states, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor, uint n_workers)
|
||||
G1ParTask(G1CollectedHeap* g1h, G1ParScanThreadStateSet* per_thread_states, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor, uint n_workers)
|
||||
: AbstractGangTask("G1 collection"),
|
||||
_g1h(g1h),
|
||||
_pss(per_thread_states),
|
||||
@ -4607,7 +4580,7 @@ public:
|
||||
|
||||
ReferenceProcessor* rp = _g1h->ref_processor_stw();
|
||||
|
||||
G1ParScanThreadState* pss = _pss[worker_id];
|
||||
G1ParScanThreadState* pss = _pss->state_for_worker(worker_id);
|
||||
pss->set_ref_processor(rp);
|
||||
|
||||
bool only_young = _g1h->collector_state()->gcs_are_young();
|
||||
@ -4664,9 +4637,12 @@ public:
|
||||
worker_id);
|
||||
|
||||
G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, pss);
|
||||
_g1h->g1_rem_set()->oops_into_collection_set_do(&push_heap_rs_cl,
|
||||
size_t cards_scanned = _g1h->g1_rem_set()->oops_into_collection_set_do(&push_heap_rs_cl,
|
||||
weak_root_cl,
|
||||
worker_id);
|
||||
|
||||
_pss->add_cards_scanned(worker_id, cards_scanned);
|
||||
|
||||
double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec;
|
||||
|
||||
double term_sec = 0.0;
|
||||
@ -5264,14 +5240,14 @@ public:
|
||||
class G1STWRefProcTaskExecutor: public AbstractRefProcTaskExecutor {
|
||||
private:
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _pss;
|
||||
G1ParScanThreadStateSet* _pss;
|
||||
RefToScanQueueSet* _queues;
|
||||
WorkGang* _workers;
|
||||
uint _active_workers;
|
||||
|
||||
public:
|
||||
G1STWRefProcTaskExecutor(G1CollectedHeap* g1h,
|
||||
G1ParScanThreadState** per_thread_states,
|
||||
G1ParScanThreadStateSet* per_thread_states,
|
||||
WorkGang* workers,
|
||||
RefToScanQueueSet *task_queues,
|
||||
uint n_workers) :
|
||||
@ -5295,14 +5271,14 @@ class G1STWRefProcTaskProxy: public AbstractGangTask {
|
||||
typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
|
||||
ProcessTask& _proc_task;
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _pss;
|
||||
G1ParScanThreadStateSet* _pss;
|
||||
RefToScanQueueSet* _task_queues;
|
||||
ParallelTaskTerminator* _terminator;
|
||||
|
||||
public:
|
||||
G1STWRefProcTaskProxy(ProcessTask& proc_task,
|
||||
G1CollectedHeap* g1h,
|
||||
G1ParScanThreadState** per_thread_states,
|
||||
G1ParScanThreadStateSet* per_thread_states,
|
||||
RefToScanQueueSet *task_queues,
|
||||
ParallelTaskTerminator* terminator) :
|
||||
AbstractGangTask("Process reference objects in parallel"),
|
||||
@ -5320,7 +5296,7 @@ public:
|
||||
|
||||
G1STWIsAliveClosure is_alive(_g1h);
|
||||
|
||||
G1ParScanThreadState* pss = _pss[worker_id];
|
||||
G1ParScanThreadState* pss = _pss->state_for_worker(worker_id);
|
||||
pss->set_ref_processor(NULL);
|
||||
|
||||
G1ParScanExtRootClosure only_copy_non_heap_cl(_g1h, pss);
|
||||
@ -5400,13 +5376,13 @@ void G1STWRefProcTaskExecutor::execute(EnqueueTask& enq_task) {
|
||||
class G1ParPreserveCMReferentsTask: public AbstractGangTask {
|
||||
protected:
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _pss;
|
||||
G1ParScanThreadStateSet* _pss;
|
||||
RefToScanQueueSet* _queues;
|
||||
ParallelTaskTerminator _terminator;
|
||||
uint _n_workers;
|
||||
|
||||
public:
|
||||
G1ParPreserveCMReferentsTask(G1CollectedHeap* g1h, G1ParScanThreadState** per_thread_states, int workers, RefToScanQueueSet *task_queues) :
|
||||
G1ParPreserveCMReferentsTask(G1CollectedHeap* g1h, G1ParScanThreadStateSet* per_thread_states, int workers, RefToScanQueueSet *task_queues) :
|
||||
AbstractGangTask("ParPreserveCMReferents"),
|
||||
_g1h(g1h),
|
||||
_pss(per_thread_states),
|
||||
@ -5419,7 +5395,7 @@ public:
|
||||
ResourceMark rm;
|
||||
HandleMark hm;
|
||||
|
||||
G1ParScanThreadState* pss = _pss[worker_id];
|
||||
G1ParScanThreadState* pss = _pss->state_for_worker(worker_id);
|
||||
pss->set_ref_processor(NULL);
|
||||
assert(pss->queue_is_empty(), "both queue and overflow should be empty");
|
||||
|
||||
@ -5480,7 +5456,7 @@ public:
|
||||
};
|
||||
|
||||
// Weak Reference processing during an evacuation pause (part 1).
|
||||
void G1CollectedHeap::process_discovered_references(G1ParScanThreadState** per_thread_states) {
|
||||
void G1CollectedHeap::process_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
|
||||
double ref_proc_start = os::elapsedTime();
|
||||
|
||||
ReferenceProcessor* rp = _ref_processor_stw;
|
||||
@ -5525,7 +5501,7 @@ void G1CollectedHeap::process_discovered_references(G1ParScanThreadState** per_t
|
||||
// JNI refs.
|
||||
|
||||
// Use only a single queue for this PSS.
|
||||
G1ParScanThreadState* pss = per_thread_states[0];
|
||||
G1ParScanThreadState* pss = per_thread_states->state_for_worker(0);
|
||||
pss->set_ref_processor(NULL);
|
||||
assert(pss->queue_is_empty(), "pre-condition");
|
||||
|
||||
@ -5586,7 +5562,7 @@ void G1CollectedHeap::process_discovered_references(G1ParScanThreadState** per_t
|
||||
}
|
||||
|
||||
// Weak Reference processing during an evacuation pause (part 2).
|
||||
void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadState** per_thread_states) {
|
||||
void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states) {
|
||||
double ref_enq_start = os::elapsedTime();
|
||||
|
||||
ReferenceProcessor* rp = _ref_processor_stw;
|
||||
@ -5621,7 +5597,7 @@ void G1CollectedHeap::enqueue_discovered_references(G1ParScanThreadState** per_t
|
||||
g1_policy()->phase_times()->record_ref_enq_time(ref_enq_time * 1000.0);
|
||||
}
|
||||
|
||||
void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* per_thread_states) {
|
||||
_expand_heap_after_alloc_failure = true;
|
||||
_evacuation_failed = false;
|
||||
|
||||
@ -5641,11 +5617,6 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
double start_par_time_sec = os::elapsedTime();
|
||||
double end_par_time_sec;
|
||||
|
||||
G1ParScanThreadState** per_thread_states = NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC);
|
||||
for (uint i = 0; i < n_workers; i++) {
|
||||
per_thread_states[i] = new_par_scan_state(i);
|
||||
}
|
||||
|
||||
{
|
||||
G1RootProcessor root_processor(this, n_workers);
|
||||
G1ParTask g1_par_task(this, per_thread_states, _task_queues, &root_processor, n_workers);
|
||||
@ -5699,11 +5670,7 @@ void G1CollectedHeap::evacuate_collection_set(EvacuationInfo& evacuation_info) {
|
||||
_allocator->release_gc_alloc_regions(evacuation_info);
|
||||
g1_rem_set()->cleanup_after_oops_into_collection_set_do();
|
||||
|
||||
for (uint i = 0; i < n_workers; i++) {
|
||||
G1ParScanThreadState* pss = per_thread_states[i];
|
||||
delete pss;
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(G1ParScanThreadState*, per_thread_states);
|
||||
per_thread_states->flush();
|
||||
|
||||
record_obj_copy_mem_stats();
|
||||
|
||||
@ -6054,7 +6021,7 @@ void G1CollectedHeap::cleanUpCardTable() {
|
||||
g1_policy()->phase_times()->record_clear_ct_time(elapsed * 1000.0);
|
||||
}
|
||||
|
||||
void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info) {
|
||||
void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info, const size_t* surviving_young_words) {
|
||||
size_t pre_used = 0;
|
||||
FreeRegionList local_free_list("Local List for CSet Freeing");
|
||||
|
||||
@ -6108,7 +6075,7 @@ void G1CollectedHeap::free_collection_set(HeapRegion* cs_head, EvacuationInfo& e
|
||||
int index = cur->young_index_in_cset();
|
||||
assert(index != -1, "invariant");
|
||||
assert((uint) index < policy->young_cset_region_length(), "invariant");
|
||||
size_t words_survived = _surviving_young_words[index];
|
||||
size_t words_survived = surviving_young_words[index];
|
||||
cur->record_surv_words_in_group(words_survived);
|
||||
|
||||
// At this point the we have 'popped' cur from the collection set
|
||||
|
@ -56,6 +56,7 @@ class HRRSCleanupTask;
|
||||
class GenerationSpec;
|
||||
class OopsInHeapRegionClosure;
|
||||
class G1ParScanThreadState;
|
||||
class G1ParScanThreadStateSet;
|
||||
class G1KlassScanClosure;
|
||||
class G1ParScanThreadState;
|
||||
class ObjectClosure;
|
||||
@ -192,6 +193,7 @@ class G1CollectedHeap : public CollectedHeap {
|
||||
|
||||
// Closures used in implementation.
|
||||
friend class G1ParScanThreadState;
|
||||
friend class G1ParScanThreadStateSet;
|
||||
friend class G1ParTask;
|
||||
friend class G1PLABAllocator;
|
||||
friend class G1PrepareCompactClosure;
|
||||
@ -309,14 +311,8 @@ private:
|
||||
|
||||
volatile unsigned _gc_time_stamp;
|
||||
|
||||
size_t* _surviving_young_words;
|
||||
|
||||
G1HRPrinter _hr_printer;
|
||||
|
||||
void setup_surviving_young_words();
|
||||
void update_surviving_young_words(size_t* surv_young_words);
|
||||
void cleanup_surviving_young_words();
|
||||
|
||||
// It decides whether an explicit GC should start a concurrent cycle
|
||||
// instead of doing a STW GC. Currently, a concurrent cycle is
|
||||
// explicitly started if:
|
||||
@ -584,11 +580,11 @@ protected:
|
||||
|
||||
// Process any reference objects discovered during
|
||||
// an incremental evacuation pause.
|
||||
void process_discovered_references(G1ParScanThreadState** per_thread_states);
|
||||
void process_discovered_references(G1ParScanThreadStateSet* per_thread_states);
|
||||
|
||||
// Enqueue any remaining discovered references
|
||||
// after processing.
|
||||
void enqueue_discovered_references(G1ParScanThreadState** per_thread_states);
|
||||
void enqueue_discovered_references(G1ParScanThreadStateSet* per_thread_states);
|
||||
|
||||
public:
|
||||
WorkGang* workers() const { return _workers; }
|
||||
@ -683,9 +679,6 @@ public:
|
||||
// Allocates a new heap region instance.
|
||||
HeapRegion* new_heap_region(uint hrs_index, MemRegion mr);
|
||||
|
||||
// Allocates a new per thread par scan state for the given thread id.
|
||||
G1ParScanThreadState* new_par_scan_state(uint worker_id);
|
||||
|
||||
// Allocate the highest free region in the reserved heap. This will commit
|
||||
// regions as necessary.
|
||||
HeapRegion* alloc_highest_free_region();
|
||||
@ -799,7 +792,7 @@ protected:
|
||||
bool do_collection_pause_at_safepoint(double target_pause_time_ms);
|
||||
|
||||
// Actually do the work of evacuating the collection set.
|
||||
void evacuate_collection_set(EvacuationInfo& evacuation_info);
|
||||
void evacuate_collection_set(EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* per_thread_states);
|
||||
|
||||
// Print the header for the per-thread termination statistics.
|
||||
static void print_termination_stats_hdr(outputStream* const st);
|
||||
@ -833,7 +826,7 @@ protected:
|
||||
|
||||
// After a collection pause, make the regions in the CS into free
|
||||
// regions.
|
||||
void free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info);
|
||||
void free_collection_set(HeapRegion* cs_head, EvacuationInfo& evacuation_info, const size_t* surviving_young_words);
|
||||
|
||||
// Abandon the current collection set without recording policy
|
||||
// statistics or updating free lists.
|
||||
@ -1057,7 +1050,7 @@ public:
|
||||
// The current policy object for the collector.
|
||||
G1CollectorPolicy* g1_policy() const { return _g1_policy; }
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) g1_policy(); }
|
||||
virtual CollectorPolicy* collector_policy() const;
|
||||
|
||||
// Adaptive size policy. No such thing for g1.
|
||||
virtual AdaptiveSizePolicy* size_policy() { return NULL; }
|
||||
@ -1610,7 +1603,6 @@ public:
|
||||
|
||||
public:
|
||||
size_t pending_card_num();
|
||||
size_t cards_scanned();
|
||||
|
||||
protected:
|
||||
size_t _max_heap_capacity;
|
||||
|
@ -38,7 +38,3 @@ HeapRegion* G1CollectedHeap::new_heap_region(uint hrs_index,
|
||||
MemRegion mr) {
|
||||
return new HeapRegion(hrs_index, bot_shared(), mr);
|
||||
}
|
||||
|
||||
G1ParScanThreadState* G1CollectedHeap::new_par_scan_state(uint worker_id) {
|
||||
return new G1ParScanThreadState(this, worker_id);
|
||||
}
|
||||
|
@ -923,7 +923,7 @@ bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc
|
||||
// Anything below that is considered to be zero
|
||||
#define MIN_TIMER_GRANULARITY 0.0000001
|
||||
|
||||
void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
|
||||
void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms, size_t cards_scanned) {
|
||||
double end_time_sec = os::elapsedTime();
|
||||
assert(_cur_collection_pause_used_regions_at_start >= cset_region_length(),
|
||||
"otherwise, the subtraction below does not make sense");
|
||||
@ -1052,8 +1052,6 @@ void G1CollectorPolicy::record_collection_pause_end(double pause_time_ms) {
|
||||
_cost_per_card_ms_seq->add(cost_per_card_ms);
|
||||
}
|
||||
|
||||
size_t cards_scanned = _g1->cards_scanned();
|
||||
|
||||
double cost_per_entry_ms = 0.0;
|
||||
if (cards_scanned > 10) {
|
||||
cost_per_entry_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned;
|
||||
@ -1871,7 +1869,7 @@ uint G1CollectorPolicy::calc_max_old_cset_length() {
|
||||
}
|
||||
|
||||
|
||||
void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
double G1CollectorPolicy::finalize_young_cset_part(double target_pause_time_ms) {
|
||||
double young_start_time_sec = os::elapsedTime();
|
||||
|
||||
YoungList* young_list = _g1->young_list();
|
||||
@ -1883,7 +1881,6 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
guarantee(_collection_set == NULL, "Precondition");
|
||||
|
||||
double base_time_ms = predict_base_elapsed_time_ms(_pending_cards);
|
||||
double predicted_pause_time_ms = base_time_ms;
|
||||
double time_remaining_ms = MAX2(target_pause_time_ms - base_time_ms, 0.0);
|
||||
|
||||
ergo_verbose4(ErgoCSetConstruction | ErgoHigh,
|
||||
@ -1927,15 +1924,16 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
_collection_set = _inc_cset_head;
|
||||
_collection_set_bytes_used_before = _inc_cset_bytes_used_before;
|
||||
time_remaining_ms = MAX2(time_remaining_ms - _inc_cset_predicted_elapsed_time_ms, 0.0);
|
||||
predicted_pause_time_ms += _inc_cset_predicted_elapsed_time_ms;
|
||||
|
||||
ergo_verbose3(ErgoCSetConstruction | ErgoHigh,
|
||||
ergo_verbose4(ErgoCSetConstruction | ErgoHigh,
|
||||
"add young regions to CSet",
|
||||
ergo_format_region("eden")
|
||||
ergo_format_region("survivors")
|
||||
ergo_format_ms("predicted young region time"),
|
||||
ergo_format_ms("predicted young region time")
|
||||
ergo_format_ms("target pause time"),
|
||||
eden_region_length, survivor_region_length,
|
||||
_inc_cset_predicted_elapsed_time_ms);
|
||||
_inc_cset_predicted_elapsed_time_ms,
|
||||
target_pause_time_ms);
|
||||
|
||||
// The number of recorded young regions is the incremental
|
||||
// collection set's current size
|
||||
@ -1944,8 +1942,13 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
double young_end_time_sec = os::elapsedTime();
|
||||
phase_times()->record_young_cset_choice_time_ms((young_end_time_sec - young_start_time_sec) * 1000.0);
|
||||
|
||||
// Set the start of the non-young choice time.
|
||||
double non_young_start_time_sec = young_end_time_sec;
|
||||
return time_remaining_ms;
|
||||
}
|
||||
|
||||
void G1CollectorPolicy::finalize_old_cset_part(double time_remaining_ms) {
|
||||
double non_young_start_time_sec = os::elapsedTime();
|
||||
double predicted_old_time_ms = 0.0;
|
||||
|
||||
|
||||
if (!collector_state()->gcs_are_young()) {
|
||||
CollectionSetChooser* cset_chooser = _collectionSetChooser;
|
||||
@ -2033,8 +2036,8 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
|
||||
// We will add this region to the CSet.
|
||||
time_remaining_ms = MAX2(time_remaining_ms - predicted_time_ms, 0.0);
|
||||
predicted_pause_time_ms += predicted_time_ms;
|
||||
cset_chooser->remove_and_move_to_next(hr);
|
||||
predicted_old_time_ms += predicted_time_ms;
|
||||
cset_chooser->pop(); // already have region via peek()
|
||||
_g1->old_set_remove(hr);
|
||||
add_old_region_to_cset(hr);
|
||||
|
||||
@ -2068,16 +2071,13 @@ void G1CollectorPolicy::finalize_cset(double target_pause_time_ms) {
|
||||
|
||||
stop_incremental_cset_building();
|
||||
|
||||
ergo_verbose5(ErgoCSetConstruction,
|
||||
ergo_verbose3(ErgoCSetConstruction,
|
||||
"finish choosing CSet",
|
||||
ergo_format_region("eden")
|
||||
ergo_format_region("survivors")
|
||||
ergo_format_region("old")
|
||||
ergo_format_ms("predicted pause time")
|
||||
ergo_format_ms("target pause time"),
|
||||
eden_region_length, survivor_region_length,
|
||||
ergo_format_ms("predicted old region time")
|
||||
ergo_format_ms("time remaining"),
|
||||
old_cset_region_length(),
|
||||
predicted_pause_time_ms, target_pause_time_ms);
|
||||
predicted_old_time_ms, time_remaining_ms);
|
||||
|
||||
double non_young_end_time_sec = os::elapsedTime();
|
||||
phase_times()->record_non_young_cset_choice_time_ms((non_young_end_time_sec - non_young_start_time_sec) * 1000.0);
|
||||
|
@ -473,7 +473,7 @@ private:
|
||||
|
||||
// The number of bytes in the collection set before the pause. Set from
|
||||
// the incrementally built collection set at the start of an evacuation
|
||||
// pause, and incremented in finalize_cset() when adding old regions
|
||||
// pause, and incremented in finalize_old_cset_part() when adding old regions
|
||||
// (if any) to the collection set.
|
||||
size_t _collection_set_bytes_used_before;
|
||||
|
||||
@ -634,7 +634,7 @@ public:
|
||||
|
||||
// Record the start and end of an evacuation pause.
|
||||
void record_collection_pause_start(double start_time_sec);
|
||||
void record_collection_pause_end(double pause_time_ms);
|
||||
void record_collection_pause_end(double pause_time_ms, size_t cards_scanned);
|
||||
|
||||
// Record the start and end of a full collection.
|
||||
void record_full_collection_start();
|
||||
@ -689,7 +689,8 @@ public:
|
||||
// Choose a new collection set. Marks the chosen regions as being
|
||||
// "in_collection_set", and links them together. The head and number of
|
||||
// the collection set are available via access methods.
|
||||
void finalize_cset(double target_pause_time_ms);
|
||||
double finalize_young_cset_part(double target_pause_time_ms);
|
||||
virtual void finalize_old_cset_part(double time_remaining_ms);
|
||||
|
||||
// The head of the list (via "next_in_collection_set()") representing the
|
||||
// current collection set.
|
||||
@ -865,8 +866,8 @@ public:
|
||||
return _recorded_survivor_regions;
|
||||
}
|
||||
|
||||
void record_thread_age_table(ageTable* age_table) {
|
||||
_survivors_age_table.merge_par(age_table);
|
||||
void record_age_table(ageTable* age_table) {
|
||||
_survivors_age_table.merge(age_table);
|
||||
}
|
||||
|
||||
void update_max_gc_locker_expansion();
|
||||
|
@ -46,11 +46,11 @@ void G1EvacStats::adjust_desired_plab_sz() {
|
||||
if (_allocated == 0) {
|
||||
assert((_unused == 0),
|
||||
err_msg("Inconsistency in PLAB stats: "
|
||||
"_allocated: "SIZE_FORMAT", "
|
||||
"_wasted: "SIZE_FORMAT", "
|
||||
"_region_end_waste: "SIZE_FORMAT", "
|
||||
"_unused: "SIZE_FORMAT", "
|
||||
"_used : "SIZE_FORMAT,
|
||||
"_allocated: " SIZE_FORMAT ", "
|
||||
"_wasted: " SIZE_FORMAT ", "
|
||||
"_region_end_waste: " SIZE_FORMAT ", "
|
||||
"_unused: " SIZE_FORMAT ", "
|
||||
"_used : " SIZE_FORMAT,
|
||||
_allocated, _wasted, _region_end_waste, _unused, used()));
|
||||
_allocated = 1;
|
||||
}
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "runtime/prefetch.inline.hpp"
|
||||
|
||||
G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id)
|
||||
G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length)
|
||||
: _g1h(g1h),
|
||||
_refs(g1h->task_queue(worker_id)),
|
||||
_dcq(&g1h->dirty_card_queue_set()),
|
||||
@ -51,8 +51,8 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id)
|
||||
// non-young regions (where the age is -1)
|
||||
// We also add a few elements at the beginning and at the end in
|
||||
// an attempt to eliminate cache contention
|
||||
uint real_length = 1 + _g1h->g1_policy()->young_cset_region_length();
|
||||
uint array_length = PADDING_ELEM_NUM +
|
||||
size_t real_length = 1 + young_cset_length;
|
||||
size_t array_length = PADDING_ELEM_NUM +
|
||||
real_length +
|
||||
PADDING_ELEM_NUM;
|
||||
_surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
|
||||
@ -60,7 +60,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id)
|
||||
vm_exit_out_of_memory(array_length * sizeof(size_t), OOM_MALLOC_ERROR,
|
||||
"Not enough space for young surv histo.");
|
||||
_surviving_young_words = _surviving_young_words_base + PADDING_ELEM_NUM;
|
||||
memset(_surviving_young_words, 0, (size_t) real_length * sizeof(size_t));
|
||||
memset(_surviving_young_words, 0, real_length * sizeof(size_t));
|
||||
|
||||
_plab_allocator = G1PLABAllocator::create_allocator(_g1h->allocator());
|
||||
|
||||
@ -71,13 +71,21 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id)
|
||||
_dest[InCSetState::Old] = InCSetState::Old;
|
||||
}
|
||||
|
||||
G1ParScanThreadState::~G1ParScanThreadState() {
|
||||
// Pass locally gathered statistics to global state.
|
||||
void G1ParScanThreadState::flush(size_t* surviving_young_words) {
|
||||
_dcq.flush();
|
||||
// Update allocation statistics.
|
||||
_plab_allocator->flush_and_retire_stats();
|
||||
_g1h->g1_policy()->record_age_table(&_age_table);
|
||||
|
||||
uint length = _g1h->g1_policy()->young_cset_region_length();
|
||||
for (uint region_index = 0; region_index < length; region_index++) {
|
||||
surviving_young_words[region_index] += _surviving_young_words[region_index];
|
||||
}
|
||||
}
|
||||
|
||||
G1ParScanThreadState::~G1ParScanThreadState() {
|
||||
delete _plab_allocator;
|
||||
_g1h->g1_policy()->record_thread_age_table(&_age_table);
|
||||
// Update heap statistics.
|
||||
_g1h->update_surviving_young_words(_surviving_young_words);
|
||||
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
|
||||
}
|
||||
|
||||
@ -314,6 +322,42 @@ oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
|
||||
}
|
||||
}
|
||||
|
||||
G1ParScanThreadState* G1ParScanThreadStateSet::state_for_worker(uint worker_id) {
|
||||
assert(worker_id < _n_workers, "out of bounds access");
|
||||
return _states[worker_id];
|
||||
}
|
||||
|
||||
void G1ParScanThreadStateSet::add_cards_scanned(uint worker_id, size_t cards_scanned) {
|
||||
assert(worker_id < _n_workers, "out of bounds access");
|
||||
_cards_scanned[worker_id] += cards_scanned;
|
||||
}
|
||||
|
||||
size_t G1ParScanThreadStateSet::total_cards_scanned() const {
|
||||
assert(_flushed, "thread local state from the per thread states should have been flushed");
|
||||
return _total_cards_scanned;
|
||||
}
|
||||
|
||||
const size_t* G1ParScanThreadStateSet::surviving_young_words() const {
|
||||
assert(_flushed, "thread local state from the per thread states should have been flushed");
|
||||
return _surviving_young_words_total;
|
||||
}
|
||||
|
||||
void G1ParScanThreadStateSet::flush() {
|
||||
assert(!_flushed, "thread local state from the per thread states should be flushed once");
|
||||
assert(_total_cards_scanned == 0, "should have been cleared");
|
||||
|
||||
for (uint worker_index = 0; worker_index < _n_workers; ++worker_index) {
|
||||
G1ParScanThreadState* pss = _states[worker_index];
|
||||
|
||||
_total_cards_scanned += _cards_scanned[worker_index];
|
||||
|
||||
pss->flush(_surviving_young_words_total);
|
||||
delete pss;
|
||||
_states[worker_index] = NULL;
|
||||
}
|
||||
_flushed = true;
|
||||
}
|
||||
|
||||
oop G1ParScanThreadState::handle_evacuation_failure_par(oop old, markOop m) {
|
||||
assert(_g1h->obj_in_cs(old),
|
||||
err_msg("Object " PTR_FORMAT " should be in the CSet", p2i(old)));
|
||||
|
@ -82,7 +82,7 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
|
||||
}
|
||||
|
||||
public:
|
||||
G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id);
|
||||
G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id, size_t young_cset_length);
|
||||
~G1ParScanThreadState();
|
||||
|
||||
void set_ref_processor(ReferenceProcessor* rp) { _scanner.set_ref_processor(rp); }
|
||||
@ -121,6 +121,8 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
|
||||
return _surviving_young_words + 1;
|
||||
}
|
||||
|
||||
void flush(size_t* surviving_young_words);
|
||||
|
||||
private:
|
||||
#define G1_PARTIAL_ARRAY_MASK 0x2
|
||||
|
||||
@ -189,4 +191,48 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
|
||||
oop handle_evacuation_failure_par(oop obj, markOop m);
|
||||
};
|
||||
|
||||
class G1ParScanThreadStateSet : public StackObj {
|
||||
G1CollectedHeap* _g1h;
|
||||
G1ParScanThreadState** _states;
|
||||
size_t* _surviving_young_words_total;
|
||||
size_t* _cards_scanned;
|
||||
size_t _total_cards_scanned;
|
||||
uint _n_workers;
|
||||
bool _flushed;
|
||||
|
||||
public:
|
||||
G1ParScanThreadStateSet(G1CollectedHeap* g1h, uint n_workers, size_t young_cset_length) :
|
||||
_g1h(g1h),
|
||||
_states(NEW_C_HEAP_ARRAY(G1ParScanThreadState*, n_workers, mtGC)),
|
||||
_surviving_young_words_total(NEW_C_HEAP_ARRAY(size_t, young_cset_length, mtGC)),
|
||||
_cards_scanned(NEW_C_HEAP_ARRAY(size_t, n_workers, mtGC)),
|
||||
_total_cards_scanned(0),
|
||||
_n_workers(n_workers),
|
||||
_flushed(false) {
|
||||
for (uint i = 0; i < n_workers; ++i) {
|
||||
_states[i] = new_par_scan_state(i, young_cset_length);
|
||||
}
|
||||
memset(_surviving_young_words_total, 0, young_cset_length * sizeof(size_t));
|
||||
memset(_cards_scanned, 0, n_workers * sizeof(size_t));
|
||||
}
|
||||
|
||||
~G1ParScanThreadStateSet() {
|
||||
assert(_flushed, "thread local state from the per thread states should have been flushed");
|
||||
FREE_C_HEAP_ARRAY(G1ParScanThreadState*, _states);
|
||||
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_total);
|
||||
FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
|
||||
}
|
||||
|
||||
void flush();
|
||||
|
||||
G1ParScanThreadState* state_for_worker(uint worker_id);
|
||||
|
||||
void add_cards_scanned(uint worker_id, size_t cards_scanned);
|
||||
size_t total_cards_scanned() const;
|
||||
const size_t* surviving_young_words() const;
|
||||
|
||||
private:
|
||||
G1ParScanThreadState* new_par_scan_state(uint worker_id, size_t young_cset_length);
|
||||
};
|
||||
|
||||
#endif // SHARE_VM_GC_G1_G1PARSCANTHREADSTATE_HPP
|
||||
|
31
hotspot/src/share/vm/gc/g1/g1ParScanThreadState_ext.cpp
Normal file
31
hotspot/src/share/vm/gc/g1/g1ParScanThreadState_ext.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
|
||||
#include "gc/g1/g1ParScanThreadState.hpp"
|
||||
|
||||
G1ParScanThreadState* G1ParScanThreadStateSet::new_par_scan_state(uint worker_id, size_t young_cset_length) {
|
||||
return new G1ParScanThreadState(_g1h, worker_id, young_cset_length);
|
||||
}
|
@ -76,7 +76,6 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs)
|
||||
_ct_bs(ct_bs), _g1p(_g1->g1_policy()),
|
||||
_cg1r(g1->concurrent_g1_refine()),
|
||||
_cset_rs_update_cl(NULL),
|
||||
_cards_scanned(NULL), _total_cards_scanned(0),
|
||||
_prev_period_summary()
|
||||
{
|
||||
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
|
||||
@ -228,7 +227,7 @@ public:
|
||||
size_t cards_looked_up() { return _cards;}
|
||||
};
|
||||
|
||||
void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
|
||||
size_t G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
|
||||
OopClosure* non_heap_roots,
|
||||
uint worker_i) {
|
||||
double rs_time_start = os::elapsedTime();
|
||||
@ -246,11 +245,10 @@ void G1RemSet::scanRS(G1ParPushHeapRSClosure* oc,
|
||||
double scan_rs_time_sec = (os::elapsedTime() - rs_time_start)
|
||||
- scanRScl.strong_code_root_scan_time_sec();
|
||||
|
||||
assert(_cards_scanned != NULL, "invariant");
|
||||
_cards_scanned[worker_i] = scanRScl.cards_done();
|
||||
|
||||
_g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec);
|
||||
_g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec());
|
||||
|
||||
return scanRScl.cards_done();
|
||||
}
|
||||
|
||||
// Closure used for updating RSets and recording references that
|
||||
@ -298,7 +296,7 @@ void G1RemSet::cleanupHRRS() {
|
||||
HeapRegionRemSet::cleanup();
|
||||
}
|
||||
|
||||
void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
|
||||
size_t G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
|
||||
OopClosure* non_heap_roots,
|
||||
uint worker_i) {
|
||||
#if CARD_REPEAT_HISTO
|
||||
@ -322,10 +320,11 @@ void G1RemSet::oops_into_collection_set_do(G1ParPushHeapRSClosure* oc,
|
||||
DirtyCardQueue into_cset_dcq(&_g1->into_cset_dirty_card_queue_set());
|
||||
|
||||
updateRS(&into_cset_dcq, worker_i);
|
||||
scanRS(oc, non_heap_roots, worker_i);
|
||||
size_t cards_scanned = scanRS(oc, non_heap_roots, worker_i);
|
||||
|
||||
// We now clear the cached values of _cset_rs_update_cl for this worker
|
||||
_cset_rs_update_cl[worker_i] = NULL;
|
||||
return cards_scanned;
|
||||
}
|
||||
|
||||
void G1RemSet::prepare_for_oops_into_collection_set_do() {
|
||||
@ -333,23 +332,9 @@ void G1RemSet::prepare_for_oops_into_collection_set_do() {
|
||||
_g1->set_refine_cte_cl_concurrency(false);
|
||||
DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
|
||||
dcqs.concatenate_logs();
|
||||
|
||||
guarantee( _cards_scanned == NULL, "invariant" );
|
||||
_cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers(), mtGC);
|
||||
for (uint i = 0; i < n_workers(); ++i) {
|
||||
_cards_scanned[i] = 0;
|
||||
}
|
||||
_total_cards_scanned = 0;
|
||||
}
|
||||
|
||||
void G1RemSet::cleanup_after_oops_into_collection_set_do() {
|
||||
guarantee( _cards_scanned != NULL, "invariant" );
|
||||
_total_cards_scanned = 0;
|
||||
for (uint i = 0; i < n_workers(); ++i) {
|
||||
_total_cards_scanned += _cards_scanned[i];
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
|
||||
_cards_scanned = NULL;
|
||||
// Cleanup after copy
|
||||
_g1->set_refine_cte_cl_concurrency(true);
|
||||
// Set all cards back to clean.
|
||||
|
@ -62,9 +62,6 @@ protected:
|
||||
|
||||
ConcurrentG1Refine* _cg1r;
|
||||
|
||||
size_t* _cards_scanned;
|
||||
size_t _total_cards_scanned;
|
||||
|
||||
// Used for caching the closure that is responsible for scanning
|
||||
// references into the collection set.
|
||||
G1ParPushHeapRSClosure** _cset_rs_update_cl;
|
||||
@ -94,7 +91,10 @@ public:
|
||||
// partitioning the work to be done. It should be the same as
|
||||
// the "i" passed to the calling thread's work(i) function.
|
||||
// In the sequential case this param will be ignored.
|
||||
void oops_into_collection_set_do(G1ParPushHeapRSClosure* blk,
|
||||
//
|
||||
// Returns the number of cards scanned while looking for pointers
|
||||
// into the collection set.
|
||||
size_t oops_into_collection_set_do(G1ParPushHeapRSClosure* blk,
|
||||
OopClosure* non_heap_roots,
|
||||
uint worker_i);
|
||||
|
||||
@ -106,14 +106,13 @@ public:
|
||||
void prepare_for_oops_into_collection_set_do();
|
||||
void cleanup_after_oops_into_collection_set_do();
|
||||
|
||||
void scanRS(G1ParPushHeapRSClosure* oc,
|
||||
size_t scanRS(G1ParPushHeapRSClosure* oc,
|
||||
OopClosure* non_heap_roots,
|
||||
uint worker_i);
|
||||
|
||||
void updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i);
|
||||
|
||||
CardTableModRefBS* ct_bs() { return _ct_bs; }
|
||||
size_t cardsScanned() { return _total_cards_scanned; }
|
||||
|
||||
// Record, if necessary, the fact that *p (where "p" is in region "from",
|
||||
// which is required to be non-NULL) has changed to a new non-NULL value.
|
||||
|
@ -87,7 +87,7 @@ class ParallelScavengeHeap : public CollectedHeap {
|
||||
return CollectedHeap::ParallelScavengeHeap;
|
||||
}
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) _collector_policy; }
|
||||
virtual CollectorPolicy* collector_policy() const { return _collector_policy; }
|
||||
|
||||
static PSYoungGen* young_gen() { return _young_gen; }
|
||||
static PSOldGen* old_gen() { return _old_gen; }
|
||||
|
@ -213,7 +213,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
|
||||
_max_eden_size = size - (2*_max_survivor_size);
|
||||
|
||||
// allocate the performance counters
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*)gch->collector_policy();
|
||||
GenCollectorPolicy* gcp = gch->gen_policy();
|
||||
|
||||
// Generation counters -- generation 0, 3 subspaces
|
||||
_gen_counters = new GenerationCounters("new", 0, 3,
|
||||
|
@ -57,8 +57,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
|
||||
// initialize performance counters
|
||||
|
||||
const char* gen_name = "old";
|
||||
GenCollectorPolicy* gcp = (GenCollectorPolicy*) GenCollectedHeap::heap()->collector_policy();
|
||||
|
||||
GenCollectorPolicy* gcp = GenCollectedHeap::heap()->gen_policy();
|
||||
// Generation Counters -- generation 1, 1 subspace
|
||||
_gen_counters = new GenerationCounters(gen_name, 1, 1,
|
||||
gcp->min_old_size(), gcp->max_old_size(), &_virtual_space);
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "gc/shared/collectorPolicy.hpp"
|
||||
#include "gc/shared/gcPolicyCounters.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/atomic.inline.hpp"
|
||||
#include "utilities/copy.hpp"
|
||||
|
||||
/* Copyright (c) 1992, 2015, Oracle and/or its affiliates, and Stanford University.
|
||||
@ -73,12 +72,6 @@ void ageTable::merge(ageTable* subTable) {
|
||||
}
|
||||
}
|
||||
|
||||
void ageTable::merge_par(ageTable* subTable) {
|
||||
for (int i = 0; i < table_size; i++) {
|
||||
Atomic::add_ptr(subTable->sizes[i], &sizes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
uint ageTable::compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters) {
|
||||
size_t desired_survivor_size = (size_t)((((double) survivor_capacity)*TargetSurvivorRatio)/100);
|
||||
uint result;
|
||||
|
@ -68,7 +68,6 @@ class ageTable VALUE_OBJ_CLASS_SPEC {
|
||||
// Merge another age table with the current one. Used
|
||||
// for parallel young generation gc.
|
||||
void merge(ageTable* subTable);
|
||||
void merge_par(ageTable* subTable);
|
||||
|
||||
// calculate new tenuring threshold based on age information
|
||||
uint compute_tenuring_threshold(size_t survivor_capacity, GCPolicyCounters* gc_counters);
|
||||
|
@ -447,14 +447,16 @@ void BlockOffsetArrayNonContigSpace::split_block(HeapWord* blk,
|
||||
} else {
|
||||
// Unilaterally fix the first (num_pref_cards - 1) following
|
||||
// the "offset card" in the suffix block.
|
||||
const size_t right_most_fixed_index = suff_index + num_pref_cards - 1;
|
||||
set_remainder_to_point_to_start_incl(suff_index + 1,
|
||||
suff_index + num_pref_cards - 1, true /* reducing */);
|
||||
right_most_fixed_index, true /* reducing */);
|
||||
// Fix the appropriate cards in the remainder of the
|
||||
// suffix block -- these are the last num_pref_cards
|
||||
// cards in each power block of the "new" range plumbed
|
||||
// from suff_addr.
|
||||
bool more = true;
|
||||
uint i = 1;
|
||||
// Fix the first power block with back_by > num_pref_cards.
|
||||
while (more && (i < N_powers)) {
|
||||
size_t back_by = power_to_cards_back(i);
|
||||
size_t right_index = suff_index + back_by - 1;
|
||||
@ -463,6 +465,9 @@ void BlockOffsetArrayNonContigSpace::split_block(HeapWord* blk,
|
||||
right_index = end_index - 1;
|
||||
more = false;
|
||||
}
|
||||
if (left_index <= right_most_fixed_index) {
|
||||
left_index = right_most_fixed_index + 1;
|
||||
}
|
||||
if (back_by > num_pref_cards) {
|
||||
// Fill in the remainder of this "power block", if it
|
||||
// is non-null.
|
||||
@ -471,12 +476,14 @@ void BlockOffsetArrayNonContigSpace::split_block(HeapWord* blk,
|
||||
N_words + i - 1, true /* reducing */);
|
||||
} else {
|
||||
more = false; // we are done
|
||||
assert((end_index - 1) == right_index, "Must be at the end.");
|
||||
}
|
||||
i++;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
// Fix the rest of the power blocks.
|
||||
while (more && (i < N_powers)) {
|
||||
size_t back_by = power_to_cards_back(i);
|
||||
size_t right_index = suff_index + back_by - 1;
|
||||
|
@ -172,8 +172,6 @@ char* GenCollectedHeap::allocate(size_t alignment,
|
||||
void GenCollectedHeap::post_initialize() {
|
||||
CollectedHeap::post_initialize();
|
||||
ref_processing_init();
|
||||
GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
|
||||
guarantee(policy->is_generation_policy(), "Illegal policy type");
|
||||
assert((_young_gen->kind() == Generation::DefNew) ||
|
||||
(_young_gen->kind() == Generation::ParNew),
|
||||
"Wrong youngest generation type");
|
||||
@ -183,10 +181,10 @@ void GenCollectedHeap::post_initialize() {
|
||||
_old_gen->kind() == Generation::MarkSweepCompact,
|
||||
"Wrong generation kind");
|
||||
|
||||
policy->initialize_size_policy(def_new_gen->eden()->capacity(),
|
||||
_gen_policy->initialize_size_policy(def_new_gen->eden()->capacity(),
|
||||
_old_gen->capacity(),
|
||||
def_new_gen->from()->capacity());
|
||||
policy->initialize_gc_policy_counters();
|
||||
_gen_policy->initialize_gc_policy_counters();
|
||||
}
|
||||
|
||||
void GenCollectedHeap::ref_processing_init() {
|
||||
@ -822,10 +820,11 @@ bool GenCollectedHeap::create_cms_collector() {
|
||||
"Unexpected generation kinds");
|
||||
// Skip two header words in the block content verification
|
||||
NOT_PRODUCT(_skip_header_HeapWords = CMSCollector::skip_header_HeapWords();)
|
||||
CMSCollector* collector = new CMSCollector(
|
||||
(ConcurrentMarkSweepGeneration*)_old_gen,
|
||||
assert(_gen_policy->is_concurrent_mark_sweep_policy(), "Unexpected policy type");
|
||||
CMSCollector* collector =
|
||||
new CMSCollector((ConcurrentMarkSweepGeneration*)_old_gen,
|
||||
_rem_set->as_CardTableRS(),
|
||||
(ConcurrentMarkSweepPolicy*) collector_policy());
|
||||
_gen_policy->as_concurrent_mark_sweep_policy());
|
||||
|
||||
if (collector == NULL || !collector->completed_initialization()) {
|
||||
if (collector) {
|
||||
|
@ -153,7 +153,7 @@ public:
|
||||
// The generational collector policy.
|
||||
GenCollectorPolicy* gen_policy() const { return _gen_policy; }
|
||||
|
||||
virtual CollectorPolicy* collector_policy() const { return (CollectorPolicy*) gen_policy(); }
|
||||
virtual CollectorPolicy* collector_policy() const { return gen_policy(); }
|
||||
|
||||
// Adaptive size policy
|
||||
virtual AdaptiveSizePolicy* size_policy() {
|
||||
|
@ -56,11 +56,11 @@ import sun.hotspot.WhiteBox;
|
||||
* gc.g1.humongousObjects.TestHumongousThreshold
|
||||
*
|
||||
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* -XX:G1HeapRegionSize=16M
|
||||
* -Xms128M -XX:G1HeapRegionSize=16M
|
||||
* gc.g1.humongousObjects.TestHumongousThreshold
|
||||
*
|
||||
* @run main/othervm -XX:+UseG1GC -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:.
|
||||
* -XX:G1HeapRegionSize=32M
|
||||
* -Xms200M -XX:G1HeapRegionSize=32M
|
||||
* gc.g1.humongousObjects.TestHumongousThreshold
|
||||
*
|
||||
*/
|
||||
|
@ -90,6 +90,9 @@ public class CodelistTest {
|
||||
if (methodPrintedInLogFormat.contains("MethodHandle")) {
|
||||
continue;
|
||||
}
|
||||
if (methodPrintedInLogFormat.contains("sun.misc.Unsafe.getUnsafe")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
MethodIdentifierParser mf = new MethodIdentifierParser(methodPrintedInLogFormat);
|
||||
Method m = null;
|
||||
|
@ -323,3 +323,4 @@ be357705874c4ba1a69c38fb211e5e31e35bf9cb jdk9-b77
|
||||
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
|
||||
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
|
||||
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
|
||||
6a418934997fc4b56664b88f8417e2f0fe658091 jdk9-b81
|
||||
|
@ -326,3 +326,4 @@ bd6ece68cf8aca34c8d992569892060c82cfd3f1 jdk9-b77
|
||||
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
|
||||
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
|
||||
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
|
||||
139338618c77d793ab8b550f06819ddb8381316f jdk9-b81
|
||||
|
@ -323,3 +323,4 @@ f376824d4940f45719d91838f3f6249f873440db jdk9-b72
|
||||
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
|
||||
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
|
||||
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
|
||||
fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
|
||||
|
@ -38,7 +38,9 @@ include SetupJavaCompilers.gmk
|
||||
|
||||
$(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes", \
|
||||
ADD_JAVAC_FLAGS := -Xbootclasspath/p:$(call PathList, \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes), \
|
||||
SRC := $(JDK_TOPDIR)/make/src/classes $(BUILDTOOLS_OUTPUTDIR)/interim_cldrconverter_classes, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
|
||||
COPY := boot.modules ext.modules))
|
||||
@ -126,11 +128,11 @@ TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
|
||||
build.tools.cldrconverter.CLDRConverter
|
||||
|
||||
TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
|
||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||
build.tools.module.GenJdepsModulesXml
|
||||
|
||||
TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
|
||||
-cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
|
||||
-cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(JDK_OUTPUTDIR)) \
|
||||
build.tools.module.ImageBuilder
|
||||
|
||||
##########################################################################################
|
||||
@ -157,28 +159,6 @@ $(eval $(call SetupCopyFiles,COPY_JIMAGE_SERVICE_PROVIDER, \
|
||||
|
||||
##########################################################################################
|
||||
|
||||
# Tools needed on solaris because OBJCOPY is broken.
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), solaris)
|
||||
$(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
|
||||
SRC := $(JDK_TOPDIR)/make/src/native/add_gnu_debuglink, \
|
||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
||||
LDFLAGS := -lelf, \
|
||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
|
||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
||||
PROGRAM := add_gnu_debuglink))
|
||||
|
||||
$(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
|
||||
SRC := $(JDK_TOPDIR)/make/src/native/fix_empty_sec_hdr_flags, \
|
||||
TOOLCHAIN := TOOLCHAIN_BUILD, \
|
||||
LDFLAGS := -lelf, \
|
||||
OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
|
||||
OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
|
||||
PROGRAM := fix_empty_sec_hdr_flags))
|
||||
|
||||
BUILD_TOOLS_JDK += $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS)
|
||||
endif
|
||||
|
||||
$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
|
||||
|
||||
java-tools: $(BUILD_TOOLS_JDK)
|
||||
|
@ -77,9 +77,9 @@ $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
|
||||
$(ECHO) Generating beaninfo
|
||||
$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
|
||||
$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
|
||||
-sourcepath "$(subst $(SPACE),$(PATH_SEP),\
|
||||
-sourcepath $(call PathList,\
|
||||
$(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base)" \
|
||||
$(SUPPORT_OUTPUTDIR)/gensrc/java.base) \
|
||||
-doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
|
||||
-x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
|
||||
-t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
|
||||
|
@ -28,9 +28,6 @@ include NativeCompilation.gmk
|
||||
# Prepare the find cache.
|
||||
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
|
||||
|
||||
# Build tools
|
||||
include Tools.gmk
|
||||
|
||||
# When building a legacy overlay image (on solaris 64 bit), the launchers
|
||||
# need to be built with a different rpath and a different output dir.
|
||||
ifeq ($(OVERLAY_IMAGES), true)
|
||||
|
@ -27,9 +27,6 @@ include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include NativeCompilation.gmk
|
||||
|
||||
# Build tools
|
||||
include Tools.gmk
|
||||
|
||||
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
|
||||
|
||||
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2012, 2015, 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,6 +39,7 @@ SUNWprivate_1.1 {
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
Java_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
Java_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
@ -56,6 +57,7 @@ SUNWprivate_1.1 {
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeUpdate;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeCipher_nativeFinal;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_nativeFree;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivate_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPrivateCrt_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeKey_00024RSAPublic_nativeInit;
|
||||
JavaCritical_com_oracle_security_ucrypto_NativeRSASignature_nativeInit;
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 1997, 2015, 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
|
||||
@ -28,8 +28,7 @@
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
JNI_OnLoad;
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init;
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable;
|
||||
Java_java_net_PlainDatagramSocketImpl_dataAvailable;
|
||||
Java_java_net_PlainSocketImpl_socketListen;
|
||||
Java_java_net_PlainDatagramSocketImpl_getTTL;
|
||||
Java_java_net_PlainDatagramSocketImpl_init;
|
||||
|
@ -31,8 +31,9 @@ include RMICompilation.gmk
|
||||
|
||||
##########################################################################################
|
||||
|
||||
BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
|
||||
BTRMIC_ARGS := "-Xbootclasspath/p:$(BTRMIC_CP)" -cp "$(BTRMIC_CP)"
|
||||
BTRMIC_CP := $(call PathList, $(INTERIM_CORBA_JAR) \
|
||||
$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes $(INTERIM_LANGTOOLS_JAR))
|
||||
BTRMIC_ARGS := -Xbootclasspath/p:$(BTRMIC_CP) -cp $(BTRMIC_CP)
|
||||
RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
|
||||
|
||||
CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
|
||||
|
@ -27,15 +27,12 @@ package build.tools.cldrconverter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
class Bundle {
|
||||
static enum Type {
|
||||
@ -117,6 +114,7 @@ class Bundle {
|
||||
private final String cldrPath;
|
||||
private final EnumSet<Type> bundleTypes;
|
||||
private final String currencies;
|
||||
private Map<String, Object> targetMap;
|
||||
|
||||
static Bundle getBundle(String id) {
|
||||
return bundles.get(id);
|
||||
@ -176,6 +174,10 @@ class Bundle {
|
||||
* visible for the bundle's locale
|
||||
*/
|
||||
Map<String, Object> getTargetMap() throws Exception {
|
||||
if (targetMap != null) {
|
||||
return targetMap;
|
||||
}
|
||||
|
||||
String[] cldrBundles = getCLDRPath().split(",");
|
||||
|
||||
// myMap contains resources for id.
|
||||
@ -398,6 +400,7 @@ class Bundle {
|
||||
}
|
||||
}
|
||||
|
||||
targetMap = myMap;
|
||||
return myMap;
|
||||
}
|
||||
|
||||
@ -632,7 +635,7 @@ class Bundle {
|
||||
return null;
|
||||
}
|
||||
|
||||
static Object[][] jreTimeZoneNames = TimeZoneNames.getContents();
|
||||
static List<Object[]> jreTimeZoneNames = Arrays.asList(TimeZoneNames.getContents());
|
||||
private void fillInJREs(String key, Map<String, String> map) {
|
||||
String tzid = null;
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
package build.tools.cldrconverter;
|
||||
|
||||
import static build.tools.cldrconverter.Bundle.jreTimeZoneNames;
|
||||
import build.tools.cldrconverter.BundleGenerator.BundleType;
|
||||
import java.io.File;
|
||||
import java.nio.file.DirectoryStream;
|
||||
@ -564,6 +565,44 @@ public class CLDRConverter {
|
||||
|
||||
private static Map<String, Object> extractZoneNames(Map<String, Object> map, String id) {
|
||||
Map<String, Object> names = new HashMap<>();
|
||||
|
||||
// Copy over missing time zone ids from JRE for English locale
|
||||
if (id.equals("en")) {
|
||||
Map<String[], String> jreMetaMap = new HashMap<>();
|
||||
jreTimeZoneNames.stream().forEach(e -> {
|
||||
String tzid = (String)e[0];
|
||||
String[] data = (String[])e[1];
|
||||
|
||||
if (map.get(TIMEZONE_ID_PREFIX + tzid) == null &&
|
||||
handlerMetaZones.get(tzid) == null) {
|
||||
// First, check the CLDR meta key
|
||||
Optional<Map.Entry<String, String>> cldrMeta =
|
||||
handlerMetaZones.getData().entrySet().stream()
|
||||
.filter(me ->
|
||||
Arrays.deepEquals(data,
|
||||
(String[])map.get(METAZONE_ID_PREFIX + me.getValue())))
|
||||
.findAny();
|
||||
if (cldrMeta.isPresent()) {
|
||||
names.put(tzid, cldrMeta.get().getValue());
|
||||
} else {
|
||||
// check the JRE meta key, add if there is not.
|
||||
Optional<Map.Entry<String[], String>> jreMeta =
|
||||
jreMetaMap.entrySet().stream()
|
||||
.filter(jm -> Arrays.deepEquals(data, jm.getKey()))
|
||||
.findAny();
|
||||
if (jreMeta.isPresent()) {
|
||||
names.put(tzid, jreMeta.get().getValue());
|
||||
} else {
|
||||
String metaName = "JRE_" + tzid.replaceAll("[/-]", "_");
|
||||
names.put(METAZONE_ID_PREFIX + metaName, data);
|
||||
names.put(tzid, metaName);
|
||||
jreMetaMap.put(data, metaName);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
for (String tzid : handlerMetaZones.keySet()) {
|
||||
String tzKey = TIMEZONE_ID_PREFIX + tzid;
|
||||
Object data = map.get(tzKey);
|
||||
|
@ -266,22 +266,47 @@ class ResourceBundleGenerator implements BundleGenerator {
|
||||
out.println((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
|
||||
"package sun.util.resources.cldr.provider;\n\n")
|
||||
+ "import java.util.HashMap;\n"
|
||||
+ "import java.util.Locale;\n"
|
||||
+ "import java.util.Map;\n"
|
||||
+ "import java.util.ListResourceBundle;\n"
|
||||
+ "import sun.util.locale.provider.LocaleProviderAdapter;\n"
|
||||
+ "import sun.util.locale.provider.LocaleDataMetaInfo;\n");
|
||||
out.printf("public class %s extends ListResourceBundle implements LocaleDataMetaInfo {\n", className);
|
||||
out.println(" @Override\n" +
|
||||
" protected final Object[][] getContents() {\n" +
|
||||
" final Object[][] data = new Object[][] {");
|
||||
out.printf("public class %s implements LocaleDataMetaInfo {\n", className);
|
||||
out.println(" private static final Map<String, String> resourceNameToLocales = new HashMap<>();\n" +
|
||||
(CLDRConverter.isBaseModule ?
|
||||
" private static final Map<Locale, String[]> parentLocalesMap = new HashMap<>();\n\n" : "\n") +
|
||||
" static {\n");
|
||||
|
||||
for (String key : metaInfo.keySet()) {
|
||||
out.printf(" { \"%s\",\n", key);
|
||||
out.printf(" \"%s\" },\n",
|
||||
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
|
||||
metaInfo.get(key),
|
||||
key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)));
|
||||
if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
|
||||
String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
||||
if ("root".equals(parentTag)) {
|
||||
out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
|
||||
} else {
|
||||
out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
|
||||
parentTag);
|
||||
}
|
||||
out.println(" };\n return data;\n }\n\n");
|
||||
String[] childlen = toLocaleList(metaInfo.get(key), true).split(" ");
|
||||
out.printf(" new String[] {\n" +
|
||||
" ");
|
||||
int count = 0;
|
||||
for (int i = 0; i < childlen.length; i++) {
|
||||
String child = childlen[i];
|
||||
out.printf("\"%s\", ", child);
|
||||
count += child.length() + 4;
|
||||
if (i != childlen.length - 1 && count > 64) {
|
||||
out.printf("\n ");
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
out.printf("\n });\n");
|
||||
} else {
|
||||
out.printf(" resourceNameToLocales.put(\"%s\",\n", key);
|
||||
out.printf(" \"%s\");\n",
|
||||
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
|
||||
metaInfo.get(key), false));
|
||||
}
|
||||
}
|
||||
out.println(" }\n\n");
|
||||
|
||||
out.println(" @Override\n" +
|
||||
" public LocaleProviderAdapter.Type getType() {\n" +
|
||||
@ -290,19 +315,13 @@ class ResourceBundleGenerator implements BundleGenerator {
|
||||
|
||||
out.println(" @Override\n" +
|
||||
" public String availableLanguageTags(String category) {\n" +
|
||||
" return getString(category);\n" +
|
||||
" };\n\n");
|
||||
" return resourceNameToLocales.getOrDefault(category, \"\");\n" +
|
||||
" }\n\n");
|
||||
|
||||
if (CLDRConverter.isBaseModule) {
|
||||
out.printf(" public Map<String, String> parentLocales() {\n" +
|
||||
" Map<String, String> ret = new HashMap<>();\n" +
|
||||
" keySet().stream()\n" +
|
||||
" .filter(key -> key.startsWith(\"%s\"))\n" +
|
||||
" .forEach(key -> ret.put(key.substring(%d), getString(key)));\n" +
|
||||
" return ret.isEmpty() ? null : ret;\n" +
|
||||
" };\n}",
|
||||
CLDRConverter.PARENT_LOCALE_PREFIX,
|
||||
CLDRConverter.PARENT_LOCALE_PREFIX.length());
|
||||
out.printf(" public Map<Locale, String[]> parentLocales() {\n" +
|
||||
" return parentLocalesMap;\n" +
|
||||
" }\n}");
|
||||
} else {
|
||||
out.println("}");
|
||||
}
|
||||
|
@ -1,285 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name: add_gnu_debuglink.c
|
||||
*
|
||||
* Description: Add a ".gnu_debuglink" section that refers to the specified
|
||||
* debug_info_path to the specified ELF object.
|
||||
*
|
||||
* This program is adapted from the example program shown on the
|
||||
* elf(3elf) man page and from code from the Solaris compiler
|
||||
* driver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* needed to define SHF_EXCLUDE
|
||||
*/
|
||||
#define ELF_TARGET_ALL
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <libelf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void failure(void);
|
||||
static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
|
||||
size_t len);
|
||||
|
||||
void
|
||||
main(int argc, char ** argv) {
|
||||
/* new ELF section name */
|
||||
static char SEC_NAME[] = ".gnu_debuglink";
|
||||
|
||||
unsigned char buffer[8 * 1024]; /* I/O buffer */
|
||||
int buffer_len; /* buffer length */
|
||||
char * debug_info_path; /* debug info path */
|
||||
void * ehdr; /* ELF header */
|
||||
Elf * elf; /* ELF descriptor */
|
||||
char * elf_ident; /* ELF identity string */
|
||||
char * elf_obj; /* elf_obj file */
|
||||
int fd; /* descriptor for files */
|
||||
unsigned int file_crc = 0; /* CRC for debug info file */
|
||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
||||
Elf_Data * link_dat; /* ELF data for new debug info link */
|
||||
Elf_Data * name_dat; /* ELF data for new section name */
|
||||
Elf_Scn * new_scn; /* new ELF section descriptor */
|
||||
void * new_shdr; /* new ELF section header */
|
||||
Elf_Scn * scn; /* ELF section descriptor */
|
||||
void * shdr; /* ELF section header */
|
||||
|
||||
if (argc != 3) {
|
||||
(void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
debug_info_path = argv[1]; /* save for later */
|
||||
if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
(void) printf("Computing CRC for '%s'\n", debug_info_path);
|
||||
(void) fflush(stdout);
|
||||
/* compute CRC for the debug info file */
|
||||
for (;;) {
|
||||
int len = read(fd, buffer, sizeof buffer);
|
||||
if (len <= 0) {
|
||||
break;
|
||||
}
|
||||
file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
|
||||
}
|
||||
(void) close(fd);
|
||||
|
||||
/* open the elf_obj */
|
||||
elf_obj = argv[2];
|
||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
||||
exit(4);
|
||||
}
|
||||
|
||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
||||
|
||||
/* obtain the ELF descriptors from the input file */
|
||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* determine if ELFCLASS64 or not? */
|
||||
elf_ident = elf_getident(elf, NULL);
|
||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
||||
|
||||
/* get the ELF header */
|
||||
if (is_elfclass64) {
|
||||
ehdr = elf64_getehdr(elf);
|
||||
} else {
|
||||
ehdr = elf32_getehdr(elf);
|
||||
}
|
||||
if (ehdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the ELF section descriptor */
|
||||
if (is_elfclass64) {
|
||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
||||
} else {
|
||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
||||
}
|
||||
if (scn == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the section header */
|
||||
if (is_elfclass64) {
|
||||
shdr = elf64_getshdr(scn);
|
||||
} else {
|
||||
shdr = elf32_getshdr(scn);
|
||||
}
|
||||
if (shdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
(void) printf("Adding ELF data for new section name\n");
|
||||
(void) fflush(stdout);
|
||||
name_dat = elf_newdata(scn);
|
||||
name_dat->d_buf = (void *) SEC_NAME;
|
||||
if (is_elfclass64) {
|
||||
name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
|
||||
} else {
|
||||
name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
|
||||
}
|
||||
name_dat->d_align = 1;
|
||||
name_dat->d_size = strlen(SEC_NAME) + 1;
|
||||
|
||||
new_scn = elf_newscn(elf);
|
||||
|
||||
if (is_elfclass64) {
|
||||
new_shdr = elf64_getshdr(new_scn);
|
||||
((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
||||
((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
||||
((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
|
||||
((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
|
||||
((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
||||
} else {
|
||||
new_shdr = elf32_getshdr(new_scn);
|
||||
((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
|
||||
((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
|
||||
((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
|
||||
((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
|
||||
((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
|
||||
}
|
||||
|
||||
(void) printf("Adding ELF data for debug_info_path value\n");
|
||||
(void) fflush(stdout);
|
||||
(void) memset(buffer, 0, sizeof buffer);
|
||||
buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
|
||||
(void) strncpy((char *) buffer, debug_info_path, buffer_len);
|
||||
if (buffer_len % 4 != 0) {
|
||||
/* not on a 4 byte boundary so pad to the next one */
|
||||
buffer_len += (4 - buffer_len % 4);
|
||||
}
|
||||
/* save the CRC */
|
||||
(void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
|
||||
buffer_len += sizeof file_crc;
|
||||
|
||||
link_dat = elf_newdata(new_scn);
|
||||
link_dat->d_type = ELF_T_BYTE;
|
||||
link_dat->d_size = buffer_len;
|
||||
link_dat->d_buf = buffer;
|
||||
link_dat->d_align = 1;
|
||||
|
||||
(void) printf("Saving updates to '%s'\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
||||
(void) elf_end(elf); /* done with ELF obj */
|
||||
(void) close(fd);
|
||||
|
||||
(void) printf("Done updating '%s'\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
exit(0);
|
||||
} /* end main */
|
||||
|
||||
|
||||
static void
|
||||
failure() {
|
||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
||||
exit(5);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* The CRC used in gnu_debuglink, retrieved from
|
||||
* http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
|
||||
*/
|
||||
|
||||
static unsigned int
|
||||
gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
|
||||
static const unsigned int crc32_table[256] = {
|
||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
|
||||
0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
|
||||
0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
|
||||
0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
|
||||
0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
|
||||
0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
|
||||
0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
|
||||
0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
|
||||
0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
|
||||
0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
|
||||
0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
|
||||
0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
|
||||
0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
|
||||
0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
|
||||
0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
|
||||
0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
|
||||
0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
|
||||
0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
|
||||
0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
|
||||
0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
|
||||
0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
|
||||
0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
|
||||
0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
|
||||
0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
|
||||
0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
|
||||
0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
|
||||
0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
|
||||
0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
|
||||
0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
|
||||
0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
|
||||
0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
|
||||
0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
|
||||
0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
|
||||
0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
|
||||
0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
|
||||
0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
|
||||
0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
|
||||
0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
|
||||
0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
|
||||
0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
|
||||
0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
|
||||
0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
|
||||
0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
|
||||
0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
|
||||
0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
|
||||
0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
|
||||
0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
|
||||
0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
|
||||
0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
|
||||
0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
|
||||
0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
|
||||
0x2d02ef8d
|
||||
};
|
||||
|
||||
unsigned char *end;
|
||||
|
||||
crc = ~crc & 0xffffffff;
|
||||
for (end = buf + len; buf < end; ++buf) {
|
||||
crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
|
||||
}
|
||||
return ~crc & 0xffffffff;
|
||||
}
|
@ -1,181 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2013, 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.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Name: fix_empty_sec_hdr_flags.c
|
||||
*
|
||||
* Description: Remove the SHF_ALLOC flag from "empty" section headers.
|
||||
* An "empty" section header has sh_addr == 0 and sh_size == 0.
|
||||
*
|
||||
* This program is adapted from the example program shown on the
|
||||
* elf(3elf) man page and from code from the Solaris compiler
|
||||
* driver.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <libelf.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static void failure(void);
|
||||
|
||||
void
|
||||
main(int argc, char ** argv) {
|
||||
void * ehdr; /* ELF header */
|
||||
unsigned int i; /* section counter */
|
||||
int fd; /* descriptor for file */
|
||||
Elf * elf; /* ELF descriptor */
|
||||
char * elf_ident; /* ELF identity string */
|
||||
char * elf_obj; /* elf_obj file */
|
||||
int fix_count; /* number of flags fixed */
|
||||
int is_elfclass64; /* is an ELFCLASS64 file? */
|
||||
Elf_Scn * scn; /* ELF section descriptor */
|
||||
void * shdr; /* ELF section header */
|
||||
Elf_Data * shstrtab; /* ELF section header string table */
|
||||
|
||||
if (argc != 2) {
|
||||
(void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
/* open the elf_obj */
|
||||
elf_obj = argv[1];
|
||||
if ((fd = open(elf_obj, O_RDWR)) == -1) {
|
||||
(void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
|
||||
exit(3);
|
||||
}
|
||||
|
||||
(void) printf("Opening '%s' for update\n", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_version(EV_CURRENT); /* coordinate ELF versions */
|
||||
|
||||
/* obtain the ELF descriptors from the input file */
|
||||
if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* determine if ELFCLASS64 or not? */
|
||||
elf_ident = elf_getident(elf, NULL);
|
||||
is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
|
||||
|
||||
/* get the ELF header */
|
||||
if (is_elfclass64) {
|
||||
ehdr = elf64_getehdr(elf);
|
||||
} else {
|
||||
ehdr = elf32_getehdr(elf);
|
||||
}
|
||||
if (ehdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the ELF section descriptor */
|
||||
if (is_elfclass64) {
|
||||
scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
|
||||
} else {
|
||||
scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
|
||||
}
|
||||
if (scn == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
/* get the section header string table */
|
||||
shstrtab = elf_getdata(scn, NULL);
|
||||
if (shstrtab == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
fix_count = 0;
|
||||
|
||||
/* traverse the sections of the input file */
|
||||
for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
|
||||
int has_flag_set; /* is SHF_ALLOC flag set? */
|
||||
int is_empty; /* is section empty? */
|
||||
char * name; /* short hand pointer */
|
||||
|
||||
/* get the section header */
|
||||
if (is_elfclass64) {
|
||||
shdr = elf64_getshdr(scn);
|
||||
} else {
|
||||
shdr = elf32_getshdr(scn);
|
||||
}
|
||||
if (shdr == NULL) {
|
||||
failure();
|
||||
}
|
||||
|
||||
if (is_elfclass64) {
|
||||
name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
|
||||
} else {
|
||||
name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
|
||||
}
|
||||
|
||||
if (is_elfclass64) {
|
||||
has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
||||
is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
|
||||
((Elf64_Shdr *) shdr)->sh_size == 0;
|
||||
} else {
|
||||
has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
|
||||
is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
|
||||
((Elf32_Shdr *) shdr)->sh_size == 0;
|
||||
}
|
||||
|
||||
if (is_empty && has_flag_set) {
|
||||
(void) printf("section[%u] '%s' is empty, "
|
||||
"but SHF_ALLOC flag is set.\n", i, name);
|
||||
(void) printf("Clearing the SHF_ALLOC flag.\n");
|
||||
|
||||
if (is_elfclass64) {
|
||||
((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
||||
} else {
|
||||
((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
|
||||
}
|
||||
fix_count++;
|
||||
}
|
||||
} /* end for each ELF section */
|
||||
|
||||
if (fix_count > 0) {
|
||||
(void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
|
||||
(void) fflush(stdout);
|
||||
(void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
|
||||
(void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
|
||||
} else {
|
||||
(void) printf("No SHF_ALLOC flags needed to be cleared.\n");
|
||||
}
|
||||
|
||||
(void) elf_end(elf); /* done with ELF obj */
|
||||
(void) close(fd);
|
||||
|
||||
(void) printf("Done %s '%s'\n",
|
||||
(fix_count > 0) ? "updating" : "with", elf_obj);
|
||||
(void) fflush(stdout);
|
||||
exit(0);
|
||||
} /* end main */
|
||||
|
||||
|
||||
static void
|
||||
failure() {
|
||||
(void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
|
||||
exit(6);
|
||||
}
|
@ -141,15 +141,19 @@ void os_getCmdlineAndUserInfo(JNIEnv *env, jobject jinfo, pid_t pid) {
|
||||
struct stat stat_buf;
|
||||
|
||||
/*
|
||||
* Try to open /proc/<pid>/cmdline
|
||||
* Stat /proc/<pid> to get the user id
|
||||
*/
|
||||
snprintf(fn, sizeof fn, "/proc/%d/cmdline", pid);
|
||||
if ((fd = open(fn, O_RDONLY)) < 0) {
|
||||
return;
|
||||
snprintf(fn, sizeof fn, "/proc/%d", pid);
|
||||
if (stat(fn, &stat_buf) == 0) {
|
||||
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
||||
}
|
||||
|
||||
if (fstat(fd, &stat_buf) == 0) {
|
||||
unix_getUserInfo(env, jinfo, stat_buf.st_uid);
|
||||
/*
|
||||
* Try to open /proc/<pid>/cmdline
|
||||
*/
|
||||
strncat(fn, "/cmdline", sizeof fn - strnlen(fn, sizeof fn) - 1);
|
||||
if ((fd = open(fn, O_RDONLY)) < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
do { // Block to break out of on errors
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2015, 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
|
||||
@ -68,7 +68,6 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
return null;
|
||||
}
|
||||
});
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -364,6 +363,5 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
|
||||
return connectDisabled;
|
||||
}
|
||||
|
||||
native int dataAvailable();
|
||||
private static native void init();
|
||||
abstract int dataAvailable();
|
||||
}
|
||||
|
@ -233,8 +233,7 @@ public class DistributionPointFetcher {
|
||||
}
|
||||
CertStore ucs = null;
|
||||
try {
|
||||
ucs = URICertStore.getInstance
|
||||
(new URICertStore.URICertStoreParameters(uri));
|
||||
ucs = URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||
} catch (InvalidAlgorithmParameterException |
|
||||
NoSuchAlgorithmException e) {
|
||||
if (debug != null) {
|
||||
|
@ -26,15 +26,13 @@
|
||||
package sun.security.provider.certpath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Objects;
|
||||
import java.security.SecureRandom;
|
||||
|
||||
import sun.security.x509.AttributeNameEnumeration;
|
||||
import sun.security.x509.CertAttrSet;
|
||||
import sun.security.x509.Extension;
|
||||
import sun.security.x509.PKIXExtensions;
|
||||
import sun.security.util.*;
|
||||
import sun.security.util.Debug;
|
||||
import sun.security.util.DerValue;
|
||||
|
||||
/**
|
||||
* Represent the OCSP Nonce Extension.
|
||||
@ -43,252 +41,139 @@ import sun.security.util.*;
|
||||
* and help to prevent replay attacks (see RFC 6960, section 4.4.1).
|
||||
*
|
||||
* @see Extension
|
||||
* @see CertAttrSet
|
||||
*/
|
||||
public class OCSPNonceExtension extends Extension
|
||||
implements CertAttrSet<String> {
|
||||
public final class OCSPNonceExtension extends Extension {
|
||||
|
||||
/**
|
||||
* Attribute name.
|
||||
*/
|
||||
public static final String NAME = "OCSPNonce";
|
||||
public static final String NONCE = "nonce";
|
||||
|
||||
private static final String EXTENSION_NAME = "OCSPNonce";
|
||||
private byte[] nonceData = null;
|
||||
private String extensionName;
|
||||
|
||||
/**
|
||||
* Encode this extension value to DER and assign it to the
|
||||
* {@code extensionName} data member.
|
||||
*
|
||||
* @throws IOException if any errors occur during DER encoding
|
||||
*/
|
||||
private void encodeInternal() throws IOException {
|
||||
if (nonceData == null) {
|
||||
this.extensionValue = null;
|
||||
return;
|
||||
}
|
||||
DerOutputStream os = new DerOutputStream();
|
||||
os.putOctetString(this.nonceData);
|
||||
this.extensionValue = os.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code OCSPNonceExtension} by providing the nonce length.
|
||||
* The criticality is set to false. The random bytes will be generated
|
||||
* using the SUN provider.
|
||||
* The criticality is set to false, and the OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param length the number of random bytes composing the nonce
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if length is not a positive integer.
|
||||
*/
|
||||
public OCSPNonceExtension(int length) throws IOException {
|
||||
this(PKIXExtensions.OCSPNonce_Id, false, length, NAME);
|
||||
this(false, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the extension (also called by the subclass).
|
||||
* Create a {@code OCSPNonceExtension} by providing the nonce length and
|
||||
* criticality setting. The OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
||||
* extension
|
||||
* @param isCritical a boolean flag indicating if the criticality bit
|
||||
* is to be set for this extension
|
||||
* @param length the length of the nonce in bytes
|
||||
* @param extensionName the name of the extension
|
||||
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||
* is set for this extension
|
||||
* @param length the number of random bytes composing the nonce
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if length is not a positive integer.
|
||||
*/
|
||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
||||
boolean isCritical, int length, String extensionName)
|
||||
public OCSPNonceExtension(boolean isCritical, int length)
|
||||
throws IOException {
|
||||
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||
this.critical = isCritical;
|
||||
|
||||
if (length > 0) {
|
||||
SecureRandom rng = new SecureRandom();
|
||||
this.nonceData = new byte[length];
|
||||
rng.nextBytes(nonceData);
|
||||
this.extensionId = extensionId;
|
||||
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||
nonceData).toByteArray();
|
||||
} else {
|
||||
throw new IllegalArgumentException(
|
||||
"Length must be a positive integer");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code OCSPNonceExtension} by providing a nonce value.
|
||||
* The criticality is set to false, and the OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param incomingNonce The nonce data to be set for the extension. This
|
||||
* must be a non-null array of at least one byte long.
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||
* positive integer.
|
||||
* @throws NullPointerException if the incomingNonce is null.
|
||||
*/
|
||||
public OCSPNonceExtension(byte[] incomingNonce) throws IOException {
|
||||
this(false, incomingNonce);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a {@code OCSPNonceExtension} by providing a nonce value and
|
||||
* criticality setting. The OID for the extension will
|
||||
* be the value defined by "id-pkix-ocsp-nonce" from RFC 6960.
|
||||
*
|
||||
* @param isCritical a boolean flag indicating whether the criticality bit
|
||||
* is set for this extension
|
||||
* @param incomingNonce The nonce data to be set for the extension. This
|
||||
* must be a non-null array of at least one byte long.
|
||||
*
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension.
|
||||
* @throws IllegalArgumentException if the incomingNonce length is not a
|
||||
* positive integer.
|
||||
* @throws NullPointerException if the incomingNonce is null.
|
||||
*/
|
||||
public OCSPNonceExtension(boolean isCritical, byte[] incomingNonce)
|
||||
throws IOException {
|
||||
this.extensionId = PKIXExtensions.OCSPNonce_Id;
|
||||
this.critical = isCritical;
|
||||
this.extensionName = extensionName;
|
||||
encodeInternal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the extension using the provided criticality bit setting and
|
||||
* DER encoding.
|
||||
*
|
||||
* @param critical true if the extension is to be treated as critical.
|
||||
* @param value an array of DER encoded bytes of the extnValue for the
|
||||
* extension. It must not include the encapsulating OCTET STRING
|
||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
||||
* should be a simple OCTET STRING containing random bytes
|
||||
* (see RFC 6960, section 4.4.1).
|
||||
*
|
||||
* @throws ClassCastException if value is not an array of bytes
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension
|
||||
*/
|
||||
public OCSPNonceExtension(Boolean critical, Object value)
|
||||
throws IOException {
|
||||
this(PKIXExtensions.OCSPNonce_Id, critical, value, NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the extension (also called by the subclass).
|
||||
*
|
||||
* @param extensionId the {@code ObjectIdentifier} for the OCSP Nonce
|
||||
* extension
|
||||
* @param critical a boolean flag indicating if the criticality bit
|
||||
* is to be set for this extension
|
||||
* @param value an array of DER encoded bytes of the extnValue for the
|
||||
* extension. It must not include the encapsulating OCTET STRING
|
||||
* tag and length. For an {@code OCSPNonceExtension} the data value
|
||||
* should be a simple OCTET STRING containing random bytes
|
||||
* (see RFC 6960, section 4.4.1).
|
||||
* @param extensionName the name of the extension
|
||||
*
|
||||
* @throws ClassCastException if value is not an array of bytes
|
||||
* @throws IOException if any errors happen during encoding of the
|
||||
* extension
|
||||
*/
|
||||
protected OCSPNonceExtension(ObjectIdentifier extensionId,
|
||||
Boolean critical, Object value, String extensionName)
|
||||
throws IOException {
|
||||
this.extensionId = extensionId;
|
||||
this.critical = critical;
|
||||
this.extensionValue = (byte[]) value;
|
||||
DerValue val = new DerValue(this.extensionValue);
|
||||
this.nonceData = val.getOctetString();
|
||||
this.extensionName = extensionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the attribute value.
|
||||
*
|
||||
* @param name the name of the attribute.
|
||||
* @param obj an array of nonce bytes for the extension. It must not
|
||||
* contain any DER tags or length.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided or the supplied
|
||||
* {@code obj} is not a byte array
|
||||
*/
|
||||
@Override
|
||||
public void set(String name, Object obj) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
if (!(obj instanceof byte[])) {
|
||||
throw new IOException("Attribute must be of type byte[].");
|
||||
}
|
||||
nonceData = (byte[])obj;
|
||||
Objects.requireNonNull(incomingNonce, "Nonce data must be non-null");
|
||||
if (incomingNonce.length > 0) {
|
||||
this.nonceData = incomingNonce.clone();
|
||||
this.extensionValue = new DerValue(DerValue.tag_OctetString,
|
||||
nonceData).toByteArray();
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
}
|
||||
encodeInternal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attribute value.
|
||||
*
|
||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
||||
* is currently supported.
|
||||
*
|
||||
* @return an array of bytes that are the nonce data. It will not contain
|
||||
* any DER tags or length, only the random nonce bytes.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided.
|
||||
*/
|
||||
@Override
|
||||
public Object get(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
return nonceData;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
throw new IllegalArgumentException(
|
||||
"Nonce data must be at least 1 byte in length");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the attribute value.
|
||||
* Return the nonce bytes themselves, without any DER encoding.
|
||||
*
|
||||
* @param name the name of the attribute to retrieve. Only "OCSPNonce"
|
||||
* is currently supported.
|
||||
*
|
||||
* @throws IOException if an unsupported name is provided or an error
|
||||
* occurs during re-encoding of the extension.
|
||||
* @return A copy of the underlying nonce bytes
|
||||
*/
|
||||
@Override
|
||||
public void delete(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(NONCE)) {
|
||||
nonceData = null;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by"
|
||||
+ " CertAttrSet:" + extensionName + ".");
|
||||
}
|
||||
encodeInternal();
|
||||
public byte[] getNonceValue() {
|
||||
return nonceData.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a printable representation of the {@code OCSPNonceExtension}.
|
||||
*
|
||||
* @return a string representation of the extension.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
String s = super.toString() + extensionName + ": " +
|
||||
((nonceData == null) ? "" : Debug.toString(nonceData))
|
||||
+ "\n";
|
||||
return (s);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(super.toString()).append(EXTENSION_NAME).append(": ");
|
||||
sb.append((nonceData == null) ? "" : Debug.toString(nonceData));
|
||||
sb.append("\n");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the extension to an {@code OutputStream}
|
||||
* Return the name of the extension as a {@code String}
|
||||
*
|
||||
* @param out the {@code OutputStream} to write the extension to.
|
||||
*
|
||||
* @throws IOException on encoding errors.
|
||||
* @return the name of the extension
|
||||
*/
|
||||
@Override
|
||||
public void encode(OutputStream out) throws IOException {
|
||||
encode(out, PKIXExtensions.OCSPNonce_Id, this.critical);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the extension to the DerOutputStream.
|
||||
*
|
||||
* @param out the {@code OutputStream} to write the extension to.
|
||||
* @param extensionId the {@code ObjectIdentifier} used for this extension
|
||||
* @param isCritical a flag indicating if the criticality bit is set for
|
||||
* this extension.
|
||||
*
|
||||
* @throws IOException on encoding errors.
|
||||
*/
|
||||
protected void encode(OutputStream out, ObjectIdentifier extensionId,
|
||||
boolean isCritical) throws IOException {
|
||||
|
||||
DerOutputStream tmp = new DerOutputStream();
|
||||
|
||||
if (this.extensionValue == null) {
|
||||
this.extensionId = extensionId;
|
||||
this.critical = isCritical;
|
||||
encodeInternal();
|
||||
}
|
||||
super.encode(tmp);
|
||||
out.write(tmp.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an enumeration of names of attributes existing within this
|
||||
* attribute.
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<String> getElements() {
|
||||
AttributeNameEnumeration elements = new AttributeNameEnumeration();
|
||||
elements.addElement(NONCE);
|
||||
return (elements.elements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of this attribute.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return (extensionName);
|
||||
return EXTENSION_NAME;
|
||||
}
|
||||
}
|
||||
|
@ -44,9 +44,7 @@ import java.security.cert.CRLException;
|
||||
import java.security.cert.CRLSelector;
|
||||
import java.security.cert.URICertStoreParameters;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.security.cert.X509CRLSelector;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -160,12 +158,11 @@ class URICertStore extends CertStoreSpi {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
("params must be instanceof URICertStoreParameters");
|
||||
}
|
||||
this.uri = ((URICertStoreParameters) params).uri;
|
||||
this.uri = ((URICertStoreParameters) params).getURI();
|
||||
// if ldap URI, use an LDAPCertStore to fetch certs and CRLs
|
||||
if (uri.getScheme().toLowerCase(Locale.ENGLISH).equals("ldap")) {
|
||||
ldap = true;
|
||||
URICertStoreParameters lparams = new URICertStoreParameters(uri);
|
||||
ldapCertStore = CertStore.getInstance("LDAP", lparams);
|
||||
ldapCertStore = CertStore.getInstance("LDAP", params);
|
||||
}
|
||||
try {
|
||||
factory = CertificateFactory.getInstance("X.509");
|
||||
@ -183,7 +180,7 @@ class URICertStore extends CertStoreSpi {
|
||||
static synchronized CertStore getInstance(URICertStoreParameters params)
|
||||
throws NoSuchAlgorithmException, InvalidAlgorithmParameterException {
|
||||
if (debug != null) {
|
||||
debug.println("CertStore URI:" + params.uri);
|
||||
debug.println("CertStore URI:" + params.getURI());
|
||||
}
|
||||
CertStore ucs = certStoreCache.get(params);
|
||||
if (ucs == null) {
|
||||
@ -212,8 +209,7 @@ class URICertStore extends CertStoreSpi {
|
||||
}
|
||||
URI uri = ((URIName) gn).getURI();
|
||||
try {
|
||||
return URICertStore.getInstance
|
||||
(new URICertStore.URICertStoreParameters(uri));
|
||||
return URICertStore.getInstance(new URICertStoreParameters(uri));
|
||||
} catch (Exception ex) {
|
||||
if (debug != null) {
|
||||
debug.println("exception creating CertStore: " + ex);
|
||||
@ -420,40 +416,6 @@ class URICertStore extends CertStoreSpi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* CertStoreParameters for the URICertStore.
|
||||
*/
|
||||
static class URICertStoreParameters implements CertStoreParameters {
|
||||
private final URI uri;
|
||||
private volatile int hashCode = 0;
|
||||
URICertStoreParameters(URI uri) {
|
||||
this.uri = uri;
|
||||
}
|
||||
@Override public boolean equals(Object obj) {
|
||||
if (!(obj instanceof URICertStoreParameters)) {
|
||||
return false;
|
||||
}
|
||||
URICertStoreParameters params = (URICertStoreParameters) obj;
|
||||
return uri.equals(params.uri);
|
||||
}
|
||||
@Override public int hashCode() {
|
||||
if (hashCode == 0) {
|
||||
int result = 17;
|
||||
result = 37*result + uri.hashCode();
|
||||
hashCode = result;
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
@Override public Object clone() {
|
||||
try {
|
||||
return super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
/* Cannot happen */
|
||||
throw new InternalError(e.toString(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This class allows the URICertStore to be accessed as a CertStore.
|
||||
*/
|
||||
|
@ -41,6 +41,7 @@ import java.util.Objects;
|
||||
import java.util.ServiceLoader;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.stream.Stream;
|
||||
import sun.util.locale.provider.JRELocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleProviderAdapter;
|
||||
import sun.util.locale.provider.LocaleDataMetaInfo;
|
||||
@ -148,11 +149,9 @@ public class CLDRLocaleProviderAdapter extends JRELocaleProviderAdapter {
|
||||
private List<Locale> applyParentLocales(String baseName, List<Locale> candidates) {
|
||||
if (Objects.isNull(parentLocalesMap)) {
|
||||
Map<Locale, Locale> map = new HashMap<>();
|
||||
Map<String, String> parentLocales = baseMetaInfo.parentLocales();
|
||||
parentLocales.keySet().forEach(parent -> {
|
||||
Arrays.asList(parentLocales.get(parent).split(" ")).stream().forEach(child -> {
|
||||
map.put(Locale.forLanguageTag(child),
|
||||
"root".equals(parent) ? Locale.ROOT : Locale.forLanguageTag(parent));
|
||||
baseMetaInfo.parentLocales().forEach((parent, children) -> {
|
||||
Stream.of(children).forEach(child -> {
|
||||
map.put(Locale.forLanguageTag(child), parent);
|
||||
});
|
||||
});
|
||||
parentLocalesMap = Collections.unmodifiableMap(map);
|
||||
|
@ -57,6 +57,7 @@ Java_java_net_InetAddress_init(JNIEnv *env, jclass cls) {
|
||||
c = (*env)->FindClass(env,"java/net/InetAddress$InetAddressHolder");
|
||||
CHECK_NULL(c);
|
||||
iac_class = (*env)->NewGlobalRef(env, c);
|
||||
CHECK_NULL(iac_class);
|
||||
ia_holderID = (*env)->GetFieldID(env, ia_class, "holder", "Ljava/net/InetAddress$InetAddressHolder;");
|
||||
CHECK_NULL(ia_holderID);
|
||||
ia_preferIPv6AddressID = (*env)->GetStaticFieldID(env, ia_class, "preferIPv6Address", "Z");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007,2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
@ -130,6 +130,8 @@ class PlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
|
||||
protected native void disconnect0(int family);
|
||||
|
||||
native int dataAvailable();
|
||||
|
||||
/**
|
||||
* Perform class load-time initializations.
|
||||
*/
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2011, 2015, 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
|
||||
@ -31,3 +31,4 @@
|
||||
# and may not be available in a future release.
|
||||
#
|
||||
-server KNOWN
|
||||
-client IGNORE
|
||||
|
@ -35,14 +35,20 @@
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#ifdef __solaris__
|
||||
#if defined(__solaris__)
|
||||
#include <libscf.h>
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
#include "TimeZone_md.h"
|
||||
|
||||
#define SKIP_SPACE(p) while (*p == ' ' || *p == '\t') p++;
|
||||
|
||||
#if defined(_ALLBSD_SOURCE)
|
||||
#define dirent64 dirent
|
||||
#define readdir64_r readdir_r
|
||||
#endif
|
||||
|
||||
#if !defined(__solaris__) || defined(__sparcv9) || defined(amd64)
|
||||
#define fileopen fopen
|
||||
#define filegets fgets
|
||||
@ -50,19 +56,20 @@
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||
|
||||
|
||||
static const char *ETC_TIMEZONE_FILE = "/etc/timezone";
|
||||
static const char *ZONEINFO_DIR = "/usr/share/zoneinfo";
|
||||
static const char *DEFAULT_ZONEINFO_FILE = "/etc/localtime";
|
||||
#else
|
||||
#ifdef _AIX
|
||||
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
||||
#endif
|
||||
static const char *SYS_INIT_FILE = "/etc/default/init";
|
||||
static const char *ZONEINFO_DIR = "/usr/share/lib/zoneinfo";
|
||||
static const char *DEFAULT_ZONEINFO_FILE = "/usr/share/lib/zoneinfo/localtime";
|
||||
#endif /*__linux__*/
|
||||
#endif /* defined(__linux__) || defined(_ALLBSD_SOURCE) */
|
||||
|
||||
#if defined(_AIX)
|
||||
static const char *ETC_ENVIRONMENT_FILE = "/etc/environment";
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) || defined(MACOSX) || defined(__solaris__)
|
||||
|
||||
/*
|
||||
* Returns a pointer to the zone ID portion of the given zoneinfo file
|
||||
@ -108,8 +115,8 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
{
|
||||
DIR *dirp = NULL;
|
||||
struct stat statbuf;
|
||||
struct dirent *dp = NULL;
|
||||
struct dirent *entry = NULL;
|
||||
struct dirent64 *dp = NULL;
|
||||
struct dirent64 *entry = NULL;
|
||||
char *pathname = NULL;
|
||||
int fd = -1;
|
||||
char *dbuf = NULL;
|
||||
@ -120,19 +127,13 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry = (struct dirent *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
||||
entry = (struct dirent64 *) malloc((size_t) pathconf(dir, _PC_NAME_MAX));
|
||||
if (entry == NULL) {
|
||||
(void) closedir(dirp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(_AIX) || defined(__linux__) || defined(MACOSX) || (defined(__solaris__) \
|
||||
&& (defined(_POSIX_PTHREAD_SEMANTICS) || defined(_LP64)))
|
||||
while (readdir_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
||||
#else
|
||||
while ((dp = readdir_r(dirp, entry)) != NULL) {
|
||||
#endif
|
||||
|
||||
while (readdir64_r(dirp, entry, &dp) == 0 && dp != NULL) {
|
||||
/*
|
||||
* Skip '.' and '..' (and possibly other .* files)
|
||||
*/
|
||||
@ -145,7 +146,7 @@ findZoneinfoFile(char *buf, size_t size, const char *dir)
|
||||
*/
|
||||
if ((strcmp(dp->d_name, "ROC") == 0)
|
||||
|| (strcmp(dp->d_name, "posixrules") == 0)
|
||||
#ifdef __solaris__
|
||||
#if defined(__solaris__)
|
||||
/*
|
||||
* Skip the "src" and "tab" directories on Solaris.
|
||||
*/
|
||||
@ -230,7 +231,7 @@ getPlatformTimeZoneID()
|
||||
char *buf;
|
||||
size_t size;
|
||||
|
||||
#ifdef __linux__
|
||||
#if defined(__linux__)
|
||||
/*
|
||||
* Try reading the /etc/timezone file for Debian distros. There's
|
||||
* no spec of the file format available. This parsing assumes that
|
||||
@ -254,7 +255,7 @@ getPlatformTimeZoneID()
|
||||
return tz;
|
||||
}
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
#endif /* defined(__linux__) */
|
||||
|
||||
/*
|
||||
* Next, try /etc/localtime to find the zone ID.
|
||||
@ -318,8 +319,9 @@ getPlatformTimeZoneID()
|
||||
free((void *) buf);
|
||||
return tz;
|
||||
}
|
||||
#else
|
||||
#ifdef __solaris__
|
||||
|
||||
#elif defined(__solaris__)
|
||||
|
||||
#if !defined(__sparcv9) && !defined(amd64)
|
||||
|
||||
/*
|
||||
@ -444,8 +446,7 @@ filegets(char *s, int n, FILE *stream)
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
#endif /* not __sparcv9 */
|
||||
|
||||
#endif /* !defined(__sparcv9) && !defined(amd64) */
|
||||
|
||||
/*
|
||||
* Performs Solaris dependent mapping. Returns a zone ID if
|
||||
@ -546,7 +547,7 @@ cleanupScf(scf_handle_t *h,
|
||||
}
|
||||
|
||||
/*
|
||||
* Retruns a zone ID of Solaris when the TZ value is "localtime".
|
||||
* Returns a zone ID of Solaris when the TZ value is "localtime".
|
||||
* First, it tries scf. If scf fails, it looks for the same file as
|
||||
* /usr/share/lib/zoneinfo/localtime under /usr/share/lib/zoneinfo/.
|
||||
*/
|
||||
@ -615,10 +616,11 @@ getSolarisDefaultZoneID() {
|
||||
free((void *) buf);
|
||||
return tz;
|
||||
}
|
||||
#endif /*__solaris__*/
|
||||
#endif /*__linux__*/
|
||||
|
||||
#ifdef _AIX
|
||||
#endif /* defined(__solaris__) */
|
||||
|
||||
#elif defined(_AIX)
|
||||
|
||||
static char *
|
||||
getPlatformTimeZoneID()
|
||||
{
|
||||
@ -644,178 +646,33 @@ getPlatformTimeZoneID()
|
||||
|
||||
return tz;
|
||||
}
|
||||
static char *mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
||||
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
||||
* trys some libc implementation dependent mappings. If it still
|
||||
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
||||
* form.
|
||||
*/
|
||||
/*ARGSUSED1*/
|
||||
char *
|
||||
findJavaTZ_md(const char *java_home_dir)
|
||||
{
|
||||
char *tz;
|
||||
char *javatz = NULL;
|
||||
char *freetz = NULL;
|
||||
|
||||
tz = getenv("TZ");
|
||||
|
||||
#if defined(__linux__) || defined(_ALLBSD_SOURCE)
|
||||
if (tz == NULL) {
|
||||
#else
|
||||
#if defined (__solaris__) || defined(_AIX)
|
||||
if (tz == NULL || *tz == '\0') {
|
||||
#endif
|
||||
#endif
|
||||
tz = getPlatformTimeZoneID();
|
||||
freetz = tz;
|
||||
}
|
||||
|
||||
/*
|
||||
* Remove any preceding ':'
|
||||
*/
|
||||
if (tz != NULL && *tz == ':') {
|
||||
tz++;
|
||||
}
|
||||
|
||||
#ifdef __solaris__
|
||||
if (tz != NULL && strcmp(tz, "localtime") == 0) {
|
||||
tz = getSolarisDefaultZoneID();
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
freetz = tz;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (tz != NULL) {
|
||||
#ifdef __linux__
|
||||
/*
|
||||
* Ignore "posix/" prefix.
|
||||
*/
|
||||
if (strncmp(tz, "posix/", 6) == 0) {
|
||||
tz += 6;
|
||||
}
|
||||
#endif
|
||||
javatz = strdup(tz);
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
|
||||
#ifdef _AIX
|
||||
freetz = mapPlatformToJavaTimezone(java_home_dir, javatz);
|
||||
if (javatz != NULL) {
|
||||
free((void *) javatz);
|
||||
}
|
||||
javatz = freetz;
|
||||
#endif
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
||||
*/
|
||||
|
||||
#ifdef MACOSX
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
struct tm *local_tm;
|
||||
time_t clock;
|
||||
time_t currenttime;
|
||||
|
||||
clock = time(NULL);
|
||||
tzset();
|
||||
local_tm = localtime(&clock);
|
||||
if (local_tm->tm_gmtoff >= 0) {
|
||||
offset = (time_t) local_tm->tm_gmtoff;
|
||||
sign = '+';
|
||||
} else {
|
||||
offset = (time_t) -local_tm->tm_gmtoff;
|
||||
sign = '-';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#else
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
#ifdef __solaris__
|
||||
struct tm localtm;
|
||||
time_t currenttime;
|
||||
|
||||
currenttime = time(NULL);
|
||||
if (localtime_r(¤ttime, &localtm) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = localtm.tm_isdst ? altzone : timezone;
|
||||
#else
|
||||
offset = timezone;
|
||||
#endif /*__linux__*/
|
||||
|
||||
if (offset == 0) {
|
||||
return strdup("GMT");
|
||||
}
|
||||
|
||||
/* Note that the time offset direction is opposite. */
|
||||
if (offset > 0) {
|
||||
sign = '-';
|
||||
} else {
|
||||
offset = -offset;
|
||||
sign = '+';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#endif /* MACOSX */
|
||||
|
||||
#ifdef _AIX
|
||||
static char *
|
||||
mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
FILE *tzmapf;
|
||||
char mapfilename[PATH_MAX+1];
|
||||
char mapfilename[PATH_MAX + 1];
|
||||
char line[256];
|
||||
int linecount = 0;
|
||||
char temp[100], *temp_tz;
|
||||
char *tz_buf = NULL;
|
||||
char *temp_tz = NULL;
|
||||
char *javatz = NULL;
|
||||
char *str_tmp = NULL;
|
||||
size_t temp_tz_len = 0;
|
||||
size_t tz_len = 0;
|
||||
|
||||
/* On AIX, the TZ environment variable may end with a comma
|
||||
* followed by modifier fields. These are ignored here.
|
||||
*/
|
||||
strncpy(temp, tz, 100);
|
||||
temp_tz = strtok_r(temp, ",", &str_tmp);
|
||||
* followed by modifier fields. These are ignored here. */
|
||||
temp_tz = strchr(tz, ',');
|
||||
tz_len = (temp_tz == NULL) ? strlen(tz) : temp_tz - tz;
|
||||
tz_buf = (char *)malloc(tz_len + 1);
|
||||
memcpy(tz_buf, tz, tz_len);
|
||||
tz_buf[tz_len] = 0;
|
||||
|
||||
if(temp_tz == NULL)
|
||||
goto tzerr;
|
||||
|
||||
temp_tz_len = strlen(temp_tz);
|
||||
|
||||
if (strlen(java_home_dir) >= (PATH_MAX - 15)) {
|
||||
jio_fprintf(stderr, "java.home longer than maximum path length \n");
|
||||
/* Open tzmappings file, with buffer overrun check */
|
||||
if ((strlen(java_home_dir) + 15) > PATH_MAX) {
|
||||
jio_fprintf(stderr, "Path %s/lib/tzmappings exceeds maximum path length\n", java_home_dir);
|
||||
goto tzerr;
|
||||
}
|
||||
|
||||
strncpy(mapfilename, java_home_dir, PATH_MAX);
|
||||
strcpy(mapfilename, java_home_dir);
|
||||
strcat(mapfilename, "/lib/tzmappings");
|
||||
|
||||
if ((tzmapf = fopen(mapfilename, "r")) == NULL) {
|
||||
jio_fprintf(stderr, "can't open %s\n", mapfilename);
|
||||
goto tzerr;
|
||||
@ -848,7 +705,7 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
}
|
||||
|
||||
*p++ = '\0';
|
||||
if ((result = strncmp(temp_tz, sol, temp_tz_len)) == 0) {
|
||||
if ((result = strncmp(tz_buf, sol, tz_len)) == 0) {
|
||||
/*
|
||||
* If this is the current platform zone ID,
|
||||
* take the Java time zone ID (2nd field).
|
||||
@ -874,11 +731,150 @@ mapPlatformToJavaTimezone(const char *java_home_dir, const char *tz) {
|
||||
(void) fclose(tzmapf);
|
||||
|
||||
tzerr:
|
||||
if (tz_buf != NULL ) {
|
||||
free((void *) tz_buf);
|
||||
}
|
||||
|
||||
if (javatz == NULL) {
|
||||
return getGMTOffsetID();
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
#endif /* defined(_AIX) */
|
||||
|
||||
/*
|
||||
* findJavaTZ_md() maps platform time zone ID to Java time zone ID
|
||||
* using <java_home>/lib/tzmappings. If the TZ value is not found, it
|
||||
* trys some libc implementation dependent mappings. If it still
|
||||
* can't map to a Java time zone ID, it falls back to the GMT+/-hh:mm
|
||||
* form.
|
||||
*/
|
||||
/*ARGSUSED1*/
|
||||
char *
|
||||
findJavaTZ_md(const char *java_home_dir)
|
||||
{
|
||||
char *tz;
|
||||
char *javatz = NULL;
|
||||
char *freetz = NULL;
|
||||
|
||||
tz = getenv("TZ");
|
||||
|
||||
if (tz == NULL || *tz == '\0') {
|
||||
tz = getPlatformTimeZoneID();
|
||||
freetz = tz;
|
||||
}
|
||||
|
||||
if (tz != NULL) {
|
||||
/* Ignore preceding ':' */
|
||||
if (*tz == ':') {
|
||||
tz++;
|
||||
}
|
||||
#if defined(__linux__)
|
||||
/* Ignore "posix/" prefix on Linux. */
|
||||
if (strncmp(tz, "posix/", 6) == 0) {
|
||||
tz += 6;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
/* On AIX do the platform to Java mapping. */
|
||||
javatz = mapPlatformToJavaTimezone(java_home_dir, tz);
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
#else
|
||||
#if defined(__solaris__)
|
||||
/* Solaris might use localtime, so handle it here. */
|
||||
if (strcmp(tz, "localtime") == 0) {
|
||||
javatz = getSolarisDefaultZoneID();
|
||||
if (freetz != NULL) {
|
||||
free((void *) freetz);
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
if (freetz == NULL) {
|
||||
/* strdup if we are still working on getenv result. */
|
||||
javatz = strdup(tz);
|
||||
} else if (freetz != tz) {
|
||||
/* strdup and free the old buffer, if we moved the pointer. */
|
||||
javatz = strdup(tz);
|
||||
free((void *) freetz);
|
||||
} else {
|
||||
/* we are good if we already work on a freshly allocated buffer. */
|
||||
javatz = tz;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return javatz;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a GMT-offset-based zone ID. (e.g., "GMT-08:00")
|
||||
*/
|
||||
|
||||
#if defined(MACOSX)
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
struct tm *local_tm;
|
||||
time_t clock;
|
||||
time_t currenttime;
|
||||
|
||||
clock = time(NULL);
|
||||
tzset();
|
||||
local_tm = localtime(&clock);
|
||||
if (local_tm->tm_gmtoff >= 0) {
|
||||
offset = (time_t) local_tm->tm_gmtoff;
|
||||
sign = '+';
|
||||
} else {
|
||||
offset = (time_t) -local_tm->tm_gmtoff;
|
||||
sign = '-';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
char *
|
||||
getGMTOffsetID()
|
||||
{
|
||||
time_t offset;
|
||||
char sign, buf[32];
|
||||
#if defined(__solaris__)
|
||||
struct tm localtm;
|
||||
time_t currenttime;
|
||||
|
||||
currenttime = time(NULL);
|
||||
if (localtime_r(¤ttime, &localtm) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
offset = localtm.tm_isdst ? altzone : timezone;
|
||||
#else
|
||||
offset = timezone;
|
||||
#endif
|
||||
|
||||
if (offset == 0) {
|
||||
return strdup("GMT");
|
||||
}
|
||||
|
||||
/* Note that the time offset direction is opposite. */
|
||||
if (offset > 0) {
|
||||
sign = '-';
|
||||
} else {
|
||||
offset = -offset;
|
||||
sign = '+';
|
||||
}
|
||||
sprintf(buf, (const char *)"GMT%c%02d:%02d",
|
||||
sign, (int)(offset/3600), (int)((offset%3600)/60));
|
||||
return strdup(buf);
|
||||
}
|
||||
#endif /* MACOSX */
|
||||
|
@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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. Oracle designates this
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
||||
|
||||
static jfieldID IO_fd_fdID;
|
||||
|
||||
static jfieldID apdsi_fdID;
|
||||
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
|
||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fdID);
|
||||
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
int fd, retval;
|
||||
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
|
||||
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -32,6 +32,12 @@
|
||||
|
||||
#ifdef __solaris__
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <stropts.h>
|
||||
|
||||
#ifndef BSD_COMP
|
||||
#define BSD_COMP
|
||||
#endif
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <unistd.h>
|
||||
@ -52,6 +58,8 @@
|
||||
#endif
|
||||
#endif // __linux__
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#ifndef IPTOS_TOS_MASK
|
||||
#define IPTOS_TOS_MASK 0x1e
|
||||
#endif
|
||||
@ -2240,3 +2248,28 @@ Java_java_net_PlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
||||
{
|
||||
mcast_join_leave(env, this, iaObj, niObj, JNI_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_PlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_java_net_PlainDatagramSocketImpl_dataAvailable(JNIEnv *env, jobject this)
|
||||
{
|
||||
int fd, retval;
|
||||
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
|
||||
if (IS_NULL(fdObj)) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
fd = (*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
|
||||
if (ioctl(fd, FIONREAD, &retval) < 0) {
|
||||
return -1;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
@ -118,6 +118,8 @@ Java_sun_net_sdp_SdpSupport_convert0(JNIEnv *env, jclass cls, int fd)
|
||||
RESTARTABLE(dup2(s, fd), res);
|
||||
if (res < 0)
|
||||
JNU_ThrowIOExceptionWithLastError(env, "dup2");
|
||||
RESTARTABLE(close(s), res);
|
||||
res = close(s);
|
||||
if (res < 0 && !(*env)->ExceptionOccurred(env))
|
||||
JNU_ThrowIOExceptionWithLastError(env, "close");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
@ -45,7 +45,7 @@ import java.security.PrivilegedAction;
|
||||
|
||||
class DefaultDatagramSocketImplFactory
|
||||
{
|
||||
static Class<?> prefixImplClass = null;
|
||||
private final static Class<?> prefixImplClass;
|
||||
|
||||
/* the windows version. */
|
||||
private static float version;
|
||||
@ -54,16 +54,19 @@ class DefaultDatagramSocketImplFactory
|
||||
private static boolean preferIPv4Stack = false;
|
||||
|
||||
/* If the version supports a dual stack TCP implementation */
|
||||
private static boolean useDualStackImpl = false;
|
||||
private final static boolean useDualStackImpl;
|
||||
|
||||
/* sun.net.useExclusiveBind */
|
||||
private static String exclBindProp;
|
||||
|
||||
/* True if exclusive binding is on for Windows */
|
||||
private static boolean exclusiveBind = true;
|
||||
|
||||
private final static boolean exclusiveBind;
|
||||
|
||||
static {
|
||||
Class<?> prefixImplClassLocal = null;
|
||||
boolean useDualStackImplLocal = false;
|
||||
boolean exclusiveBindLocal = true;
|
||||
|
||||
// Determine Windows Version.
|
||||
java.security.AccessController.doPrivileged(
|
||||
new PrivilegedAction<Object>() {
|
||||
@ -78,7 +81,7 @@ class DefaultDatagramSocketImplFactory
|
||||
"java.net.preferIPv4Stack"));
|
||||
exclBindProp = System.getProperty(
|
||||
"sun.net.useExclusiveBind");
|
||||
} catch (NumberFormatException e ) {
|
||||
} catch (NumberFormatException e) {
|
||||
assert false : e;
|
||||
}
|
||||
return null; // nothing to return
|
||||
@ -87,14 +90,14 @@ class DefaultDatagramSocketImplFactory
|
||||
|
||||
// (version >= 6.0) implies Vista or greater.
|
||||
if (version >= 6.0 && !preferIPv4Stack) {
|
||||
useDualStackImpl = true;
|
||||
useDualStackImplLocal = true;
|
||||
}
|
||||
if (exclBindProp != null) {
|
||||
// sun.net.useExclusiveBind is true
|
||||
exclusiveBind = exclBindProp.length() == 0 ? true
|
||||
exclusiveBindLocal = exclBindProp.length() == 0 ? true
|
||||
: Boolean.parseBoolean(exclBindProp);
|
||||
} else if (version < 6.0) {
|
||||
exclusiveBind = false;
|
||||
exclusiveBindLocal = false;
|
||||
}
|
||||
|
||||
// impl.prefix
|
||||
@ -103,12 +106,16 @@ class DefaultDatagramSocketImplFactory
|
||||
prefix = AccessController.doPrivileged(
|
||||
new sun.security.action.GetPropertyAction("impl.prefix", null));
|
||||
if (prefix != null)
|
||||
prefixImplClass = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||
prefixImplClassLocal = Class.forName("java.net."+prefix+"DatagramSocketImpl");
|
||||
} catch (Exception e) {
|
||||
System.err.println("Can't find class: java.net." +
|
||||
prefix +
|
||||
"DatagramSocketImpl: check impl.prefix property");
|
||||
}
|
||||
|
||||
prefixImplClass = prefixImplClassLocal;
|
||||
useDualStackImpl = useDualStackImplLocal;
|
||||
exclusiveBind = exclusiveBindLocal;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,12 +133,10 @@ class DefaultDatagramSocketImplFactory
|
||||
throw new SocketException("can't instantiate DatagramSocketImpl");
|
||||
}
|
||||
} else {
|
||||
if (isMulticast)
|
||||
exclusiveBind = false;
|
||||
if (useDualStackImpl && !isMulticast)
|
||||
return new DualStackPlainDatagramSocketImpl(exclusiveBind);
|
||||
else
|
||||
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind);
|
||||
return new TwoStacksPlainDatagramSocketImpl(exclusiveBind && !isMulticast);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
@ -292,4 +292,6 @@ class DualStackPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
int optionValue) throws SocketException;
|
||||
|
||||
private static native int socketGetIntOption(int fd, int cmd) throws SocketException;
|
||||
|
||||
native int dataAvailable();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
@ -207,6 +207,8 @@ class TwoStacksPlainDatagramSocketImpl extends AbstractPlainDatagramSocketImpl
|
||||
|
||||
protected native void disconnect0(int family);
|
||||
|
||||
native int dataAvailable();
|
||||
|
||||
/**
|
||||
* Perform class load-time initializations.
|
||||
*/
|
||||
|
@ -1,113 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, 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. Oracle designates this
|
||||
* 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
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
|
||||
#include "jvm.h"
|
||||
#include "jni_util.h"
|
||||
#include "net_util.h"
|
||||
|
||||
#include "java_net_AbstractPlainDatagramSocketImpl.h"
|
||||
|
||||
static jfieldID IO_fd_fdID = NULL;
|
||||
static jfieldID apdsi_fdID = NULL;
|
||||
|
||||
static jfieldID apdsi_fd1ID = NULL;
|
||||
static jclass two_stacks_clazz = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: init
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL
|
||||
Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
|
||||
|
||||
apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fdID);
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
CHECK_NULL(IO_fd_fdID);
|
||||
|
||||
two_stacks_clazz = (*env)->FindClass(env, "java/net/TwoStacksPlainDatagramSocketImpl");
|
||||
CHECK_NULL(two_stacks_clazz);
|
||||
|
||||
/* Handle both TwoStacks and DualStack here */
|
||||
|
||||
if (JNU_Equals(env, cls, two_stacks_clazz)) {
|
||||
/* fd1 present only in TwoStack.. */
|
||||
apdsi_fd1ID = (*env)->GetFieldID(env, cls, "fd1",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(apdsi_fd1ID);
|
||||
}
|
||||
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_AbstractPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
SOCKET fd1;
|
||||
int rv = -1, rv1 = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (!IS_NULL(apdsi_fd1ID)) {
|
||||
/* TwoStacks */
|
||||
jobject fd1Obj = (*env)->GetObjectField(env, this, apdsi_fd1ID);
|
||||
if (!IS_NULL(fd1Obj)) {
|
||||
int retval = 0;
|
||||
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0 && rv1 < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2015, 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
|
||||
@ -70,6 +70,9 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
||||
return got_icmp;
|
||||
}
|
||||
|
||||
static jfieldID IO_fd_fdID = NULL;
|
||||
static jfieldID pdsi_fdID = NULL;
|
||||
|
||||
/*
|
||||
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||
* Method: initIDs
|
||||
@ -78,6 +81,13 @@ static jboolean purgeOutstandingICMP(JNIEnv *env, jint fd)
|
||||
JNIEXPORT void JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_initIDs
|
||||
(JNIEnv *env, jclass clazz)
|
||||
{
|
||||
pdsi_fdID = (*env)->GetFieldID(env, clazz, "fd",
|
||||
"Ljava/io/FileDescriptor;");
|
||||
CHECK_NULL(pdsi_fdID);
|
||||
IO_fd_fdID = NET_GetFileDescriptorID(env);
|
||||
CHECK_NULL(IO_fd_fdID);
|
||||
JNU_CHECK_EXCEPTION(env);
|
||||
|
||||
initInetAddressIDs(env);
|
||||
}
|
||||
|
||||
@ -503,3 +513,32 @@ JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_socketGetI
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_DualStackPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_DualStackPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
int rv = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -45,9 +45,10 @@ JNIEXPORT void JNICALL Java_java_net_DualStackPlainSocketImpl_initIDs
|
||||
jclass cls = (*env)->FindClass(env, "java/net/InetSocketAddress");
|
||||
CHECK_NULL(cls);
|
||||
isa_class = (*env)->NewGlobalRef(env, cls);
|
||||
CHECK_NULL(isa_class);
|
||||
isa_ctorID = (*env)->GetMethodID(env, cls, "<init>",
|
||||
"(Ljava/net/InetAddress;I)V");
|
||||
|
||||
CHECK_NULL(isa_ctorID);
|
||||
initInetAddressIDs(env);
|
||||
|
||||
// implement read timeout with select.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -2563,3 +2563,44 @@ Java_java_net_TwoStacksPlainDatagramSocketImpl_leave(JNIEnv *env, jobject this,
|
||||
{
|
||||
mcast_join_leave (env, this, iaObj, niObj, JNI_FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Class: java_net_TwoStacksPlainDatagramSocketImpl
|
||||
* Method: dataAvailable
|
||||
* Signature: ()I
|
||||
*/
|
||||
JNIEXPORT jint JNICALL Java_java_net_TwoStacksPlainDatagramSocketImpl_dataAvailable
|
||||
(JNIEnv *env, jobject this) {
|
||||
SOCKET fd;
|
||||
SOCKET fd1;
|
||||
int rv = -1, rv1 = -1;
|
||||
jobject fdObj = (*env)->GetObjectField(env, this, pdsi_fdID);
|
||||
jobject fd1Obj;
|
||||
|
||||
if (!IS_NULL(fdObj)) {
|
||||
int retval = 0;
|
||||
fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
|
||||
rv = ioctlsocket(fd, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
fd1Obj = (*env)->GetObjectField(env, this, pdsi_fd1ID);
|
||||
if (!IS_NULL(fd1Obj)) {
|
||||
int retval = 0;
|
||||
fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
|
||||
rv1 = ioctlsocket(fd1, FIONREAD, &retval);
|
||||
if (retval > 0) {
|
||||
return retval;
|
||||
}
|
||||
}
|
||||
|
||||
if (rv < 0 && rv1 < 0) {
|
||||
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
|
||||
"Socket closed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
||||
* Set the value to be associated with the given name, replacing
|
||||
* any previous association.
|
||||
*
|
||||
* @throw IllegalArgumentException if parameter or value is illegal
|
||||
* @throws IllegalArgumentException if parameter or value is illegal
|
||||
*/
|
||||
public void setParameter(String name, String value) {
|
||||
parameters.set(name, value);
|
||||
@ -233,7 +233,7 @@ MimeTypeParameterList(rawdata.substring(semIndex));
|
||||
/**
|
||||
* Remove any value associated with the given name.
|
||||
*
|
||||
* @throw IllegalArgumentException if parameter may not be deleted
|
||||
* @throws IllegalArgumentException if parameter may not be deleted
|
||||
*/
|
||||
public void removeParameter(String name) {
|
||||
parameters.remove(name);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -58,6 +58,7 @@ class AquaComboBoxButton extends JButton {
|
||||
this.list = list;
|
||||
|
||||
setModel(new DefaultButtonModel() {
|
||||
@Override
|
||||
public void setArmed(final boolean armed) {
|
||||
super.setArmed(isPressed() ? true : armed);
|
||||
}
|
||||
@ -66,12 +67,13 @@ class AquaComboBoxButton extends JButton {
|
||||
setEnabled(comboBox.isEnabled());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return comboBox == null ? true : comboBox.isEnabled();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public boolean isFocusTraversable() {
|
||||
@Override
|
||||
public boolean isFocusable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -92,6 +94,7 @@ class AquaComboBoxButton extends JButton {
|
||||
return State.ACTIVE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintComponent(final Graphics g) {
|
||||
// Don't Paint the button as usual
|
||||
// super.paintComponent( g );
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -303,7 +303,7 @@ public class AquaInternalFrameDockIconUI extends DesktopIconUI implements MouseL
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Deprecated
|
||||
public void hide() {
|
||||
final Container parent = getParent();
|
||||
final Rectangle r = this.getBounds();
|
||||
|
@ -991,9 +991,7 @@ public class AquaLookAndFeel extends BasicLookAndFeel {
|
||||
"Tree.ancestorInputMap", new UIDefaults.LazyInputMap(new Object[]{"ESCAPE", "cancel"}),};
|
||||
|
||||
table.putDefaults(defaults);
|
||||
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, table);
|
||||
}
|
||||
|
||||
protected void initSystemColorDefaults(final UIDefaults table) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -125,9 +125,8 @@ public abstract class OSXSurfaceData extends BufImgSurfaceData {
|
||||
return fConfig;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void setBounds(int x, int y, int w, int h) {
|
||||
fBounds.reshape(x, y, w, y + h);
|
||||
fBounds.setBounds(x, y, w, y + h);
|
||||
}
|
||||
|
||||
// START compositing support API
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2015, 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
|
||||
@ -77,7 +77,7 @@ public class CGLLayer extends CFRetainedResource {
|
||||
}
|
||||
|
||||
public Object getDestination() {
|
||||
return peer;
|
||||
return peer.getTarget();
|
||||
}
|
||||
|
||||
public SurfaceData replaceSurfaceData() {
|
||||
|
@ -576,6 +576,14 @@ public class LWWindowPeer
|
||||
: getDefaultMaximizedBounds());
|
||||
}
|
||||
|
||||
public Rectangle getMaximizedBounds() {
|
||||
synchronized (getStateLock()) {
|
||||
return (maximizedBounds == null)
|
||||
? getDefaultMaximizedBounds()
|
||||
: maximizedBounds;
|
||||
}
|
||||
}
|
||||
|
||||
private void setPlatformMaximizedBounds(Rectangle bounds) {
|
||||
platformWindow.setMaximizedBounds(
|
||||
bounds.x, bounds.y,
|
||||
|
@ -498,14 +498,9 @@ public class CPlatformWindow extends CFRetainedResource implements PlatformWindo
|
||||
// to be sure that there are no setBounds requests in the queue.
|
||||
LWCToolkit.flushNativeSelectors();
|
||||
this.normalBounds = peer.getBounds();
|
||||
|
||||
GraphicsConfiguration config = getPeer().getGraphicsConfiguration();
|
||||
Insets i = ((CGraphicsDevice)config.getDevice()).getScreenInsets();
|
||||
Rectangle toBounds = config.getBounds();
|
||||
setBounds(toBounds.x + i.left,
|
||||
toBounds.y + i.top,
|
||||
toBounds.width - i.left - i.right,
|
||||
toBounds.height - i.top - i.bottom);
|
||||
Rectangle maximizedBounds = peer.getMaximizedBounds();
|
||||
setBounds(maximizedBounds.x, maximizedBounds.y,
|
||||
maximizedBounds.width, maximizedBounds.height);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
package com.sun.java.swing.plaf.gtk;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import java.beans.*;
|
||||
import java.io.File;
|
||||
import java.lang.ref.*;
|
||||
@ -41,6 +40,8 @@ import javax.swing.text.DefaultEditorKit;
|
||||
|
||||
import com.sun.java.swing.plaf.gtk.GTKConstants.PositionType;
|
||||
import com.sun.java.swing.plaf.gtk.GTKConstants.StateType;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.UNIXToolkit;
|
||||
import sun.awt.OSInfo;
|
||||
@ -61,7 +62,7 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
* We should assume ON - or some variation of ON as no GTK desktop
|
||||
* ships with it OFF.
|
||||
*/
|
||||
static Object aaTextInfo;
|
||||
static Map<Object, Object> aaTextInfo;
|
||||
|
||||
/**
|
||||
* Solaris, or Linux with Sun JDS in a CJK Locale.
|
||||
@ -1337,7 +1338,9 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
if (fallbackFont != null) {
|
||||
table.put("TitledBorder.font", fallbackFont);
|
||||
}
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
if (aaTextInfo != null) {
|
||||
table.putAll(aaTextInfo);
|
||||
}
|
||||
}
|
||||
|
||||
protected void initSystemColorDefaults(UIDefaults table) {
|
||||
@ -1477,7 +1480,8 @@ public class GTKLookAndFeel extends SynthLookAndFeel {
|
||||
* XRender.
|
||||
*/
|
||||
gtkAAFontSettingsCond = !isSunCJK && SwingUtilities2.isLocalDisplay();
|
||||
aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(gtkAAFontSettingsCond);
|
||||
aaTextInfo = new HashMap<>(2);
|
||||
SwingUtilities2.putAATextInfo(gtkAAFontSettingsCond, aaTextInfo);
|
||||
}
|
||||
|
||||
static ReferenceQueue<GTKLookAndFeel> queue = new ReferenceQueue<GTKLookAndFeel>();
|
||||
|
@ -39,6 +39,8 @@ import sun.swing.SwingUtilities2;
|
||||
import sun.swing.plaf.synth.SynthIcon;
|
||||
|
||||
import com.sun.java.swing.plaf.gtk.GTKEngine.WidgetType;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -115,10 +117,12 @@ class GTKStyle extends SynthStyle implements GTKConstants {
|
||||
@Override
|
||||
public void installDefaults(SynthContext context) {
|
||||
super.installDefaults(context);
|
||||
if (!context.getRegion().isSubregion()) {
|
||||
context.getComponent().putClientProperty(
|
||||
SwingUtilities2.AA_TEXT_PROPERTY_KEY,
|
||||
GTKLookAndFeel.aaTextInfo);
|
||||
Map<Object, Object> aaTextInfo = GTKLookAndFeel.aaTextInfo;
|
||||
if (aaTextInfo != null && !context.getRegion().isSubregion()) {
|
||||
context.getComponent().putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||
aaTextInfo.get(KEY_TEXT_ANTIALIASING));
|
||||
context.getComponent().putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||
aaTextInfo.get(KEY_TEXT_LCD_CONTRAST));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -556,8 +556,7 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
* for both client property and UIDefaults.
|
||||
* Also need to set up listeners for changes in these settings.
|
||||
*/
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, table);
|
||||
this.aaSettings =
|
||||
new FontDesktopProperty(SunToolkit.DESKTOPFONTHINTS);
|
||||
}
|
||||
@ -835,12 +834,12 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
"InternalFrame.closeIcon",
|
||||
WindowsIconFactory.createFrameCloseIcon(),
|
||||
"InternalFrame.icon",
|
||||
(LazyValue) t -> new Object[]{
|
||||
(LazyValue) t -> new WindowsInternalFrameTitlePane.ScalableIconUIResource(new Object[]{
|
||||
// The constructor takes one arg: an array of UIDefaults.LazyValue
|
||||
// representing the icons
|
||||
SwingUtilities2.makeIcon(getClass(), BasicLookAndFeel.class, "icons/JavaCup16.png"),
|
||||
SwingUtilities2.makeIcon(getClass(), WindowsLookAndFeel.class, "icons/JavaCup32.png")
|
||||
},
|
||||
}),
|
||||
// Internal Frame Auditory Cue Mappings
|
||||
"InternalFrame.closeSound", "win.sound.close",
|
||||
"InternalFrame.maximizeSound", "win.sound.maximize",
|
||||
@ -2402,9 +2401,8 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
}
|
||||
|
||||
protected void updateUI() {
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(true);
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(true, defaults);
|
||||
super.updateUI();
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ abstract class MultipleGradientPaintContext implements PaintContext {
|
||||
*
|
||||
* @param position the unmanipulated position, which will be mapped
|
||||
* into the range 0 to 1
|
||||
* @returns integer color to display
|
||||
* @return integer color to display
|
||||
*/
|
||||
protected final int indexIntoGradientsArrays(float position) {
|
||||
// first, manipulate position value depending on the cycle method
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2015, 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
|
||||
@ -33,13 +33,10 @@ import java.awt.image.DirectColorModel;
|
||||
import java.awt.image.Raster;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.awt.peer.RobotPeer;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.security.AccessController;
|
||||
|
||||
import sun.awt.AWTPermissions;
|
||||
import sun.awt.ComponentFactory;
|
||||
import sun.awt.SunToolkit;
|
||||
import sun.awt.OSInfo;
|
||||
import sun.awt.image.SunWritableRaster;
|
||||
|
||||
/**
|
||||
@ -558,29 +555,9 @@ public class Robot {
|
||||
*/
|
||||
public synchronized void waitForIdle() {
|
||||
checkNotDispatchThread();
|
||||
|
||||
try {
|
||||
SunToolkit.flushPendingEvents();
|
||||
// 7185258: realSync() call blocks all DnD tests on OS X
|
||||
if (AccessController.doPrivileged(OSInfo.getOSTypeAction()) == OSInfo.OSType.MACOSX) {
|
||||
// post a dummy event to the queue so we know when
|
||||
// all the events before it have been processed
|
||||
EventQueue.invokeAndWait( new Runnable() {
|
||||
public void run() {
|
||||
// dummy implementation
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
|
||||
}
|
||||
} catch(InterruptedException ite) {
|
||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
||||
ite.printStackTrace();
|
||||
} catch(InvocationTargetException ine) {
|
||||
System.err.println("Robot.waitForIdle, non-fatal exception caught:");
|
||||
ine.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void checkNotDispatchThread() {
|
||||
if (EventQueue.isDispatchThread()) {
|
||||
@ -593,6 +570,7 @@ public class Robot {
|
||||
*
|
||||
* @return the string representation.
|
||||
*/
|
||||
@Override
|
||||
public synchronized String toString() {
|
||||
String params = "autoDelay = "+getAutoDelay()+", "+"autoWaitForIdle = "+isAutoWaitForIdle();
|
||||
return getClass().getName() + "[ " + params + " ]";
|
||||
|
@ -448,7 +448,7 @@ public abstract class Toolkit {
|
||||
*
|
||||
* @param s the error message
|
||||
* @param e the original exception
|
||||
* @throw the new AWTError including the cause (the original exception)
|
||||
* @throws the new AWTError including the cause (the original exception)
|
||||
*/
|
||||
private static void newAWTError(Throwable e, String s) {
|
||||
AWTError newAWTError = new AWTError(s);
|
||||
|
@ -133,13 +133,42 @@ public class JColorChooser extends JComponent implements Accessible {
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Color showDialog(Component component,
|
||||
String title, Color initialColor) throws HeadlessException {
|
||||
return showDialog(component, title, initialColor, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a modal color-chooser dialog and blocks until the
|
||||
* dialog is hidden. If the user presses the "OK" button, then
|
||||
* this method hides/disposes the dialog and returns the selected color.
|
||||
* If the user presses the "Cancel" button or closes the dialog without
|
||||
* pressing "OK", then this method hides/disposes the dialog and returns
|
||||
* <code>null</code>.
|
||||
*
|
||||
* @param component the parent <code>Component</code> for the dialog
|
||||
* @param title the String containing the dialog's title
|
||||
* @param initialColor the initial Color set when the color-chooser is shown
|
||||
* @param colorTransparencySelectionEnabled true if the transparency of
|
||||
* a color can be selected
|
||||
* @return the selected color or <code>null</code> if the user opted out
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
* @see java.awt.GraphicsEnvironment#isHeadless
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public static Color showDialog(Component component, String title,
|
||||
Color initialColor, boolean colorTransparencySelectionEnabled)
|
||||
throws HeadlessException {
|
||||
|
||||
final JColorChooser pane = new JColorChooser(initialColor != null?
|
||||
initialColor : Color.white);
|
||||
|
||||
for (AbstractColorChooserPanel ccPanel : pane.getChooserPanels()) {
|
||||
ccPanel.setColorTransparencySelectionEnabled(
|
||||
colorTransparencySelectionEnabled);
|
||||
}
|
||||
|
||||
ColorTracker ok = new ColorTracker(pane);
|
||||
JDialog dialog = createDialog(component, title, true, pane, ok, null);
|
||||
|
||||
@ -150,7 +179,6 @@ public class JColorChooser extends JComponent implements Accessible {
|
||||
return ok.getColor();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates and returns a new dialog containing the specified
|
||||
* <code>ColorChooser</code> pane along with "OK", "Cancel", and "Reset"
|
||||
|
@ -377,7 +377,8 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
/**
|
||||
* AA text hints.
|
||||
*/
|
||||
transient private Object aaTextInfo;
|
||||
transient private Object aaHint;
|
||||
transient private Object lcdRenderingHint;
|
||||
|
||||
static Graphics safelyGetGraphics(Component c) {
|
||||
return safelyGetGraphics(c, SwingUtilities.getRoot(c));
|
||||
@ -616,6 +617,15 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
*/
|
||||
public void updateUI() {}
|
||||
|
||||
/**
|
||||
* Returns the look and feel delegate that renders this component.
|
||||
*
|
||||
* @return the {@code ComponentUI} object that renders this component
|
||||
* @since 1.9
|
||||
*/
|
||||
public ComponentUI getUI() {
|
||||
return ui;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the look and feel delegate for this component.
|
||||
@ -655,8 +665,10 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
uninstallUIAndProperties();
|
||||
|
||||
// aaText shouldn't persist between look and feels, reset it.
|
||||
aaTextInfo =
|
||||
UIManager.getDefaults().get(SwingUtilities2.AA_TEXT_PROPERTY_KEY);
|
||||
aaHint = UIManager.getDefaults().get(
|
||||
RenderingHints.KEY_TEXT_ANTIALIASING);
|
||||
lcdRenderingHint = UIManager.getDefaults().get(
|
||||
RenderingHints.KEY_TEXT_LCD_CONTRAST);
|
||||
ComponentUI oldUI = ui;
|
||||
ui = newUI;
|
||||
if (ui != null) {
|
||||
@ -4048,8 +4060,10 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
* @see #putClientProperty
|
||||
*/
|
||||
public final Object getClientProperty(Object key) {
|
||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
||||
return aaTextInfo;
|
||||
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||
return aaHint;
|
||||
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||
return lcdRenderingHint;
|
||||
} else if (key == SwingUtilities2.COMPONENT_UI_PROPERTY_KEY) {
|
||||
return ui;
|
||||
}
|
||||
@ -4091,8 +4105,11 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
* @see #addPropertyChangeListener
|
||||
*/
|
||||
public final void putClientProperty(Object key, Object value) {
|
||||
if (key == SwingUtilities2.AA_TEXT_PROPERTY_KEY) {
|
||||
aaTextInfo = value;
|
||||
if (key == RenderingHints.KEY_TEXT_ANTIALIASING) {
|
||||
aaHint = value;
|
||||
return;
|
||||
} else if (key == RenderingHints.KEY_TEXT_LCD_CONTRAST) {
|
||||
lcdRenderingHint = value;
|
||||
return;
|
||||
}
|
||||
if (value == null && clientProperties == null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2015, 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
|
||||
@ -2304,8 +2304,10 @@ public class JTabbedPane extends JComponent
|
||||
}
|
||||
|
||||
public Rectangle getBounds() {
|
||||
return parent.getUI().getTabBounds(parent,
|
||||
parent.indexOfTab(title));
|
||||
int i = parent.indexOfTab(title);
|
||||
// Check for no title. Even though that's a bug in the app we should
|
||||
// inhibit an ArrayIndexOutOfBoundsException from getTabBounds.
|
||||
return (i == -1) ? null : parent.getUI().getTabBounds(parent, i);
|
||||
}
|
||||
|
||||
public void setBounds(Rectangle r) {
|
||||
|
@ -50,6 +50,14 @@ import javax.swing.*;
|
||||
@SuppressWarnings("serial") // Same-version serialization only
|
||||
public abstract class AbstractColorChooserPanel extends JPanel {
|
||||
|
||||
|
||||
/**
|
||||
* Identifies that the transparency of the color (alpha value) can be
|
||||
* selected
|
||||
*/
|
||||
public static final String TRANSPARENCY_ENABLED_PROPERTY
|
||||
= "TransparencyEnabled";
|
||||
|
||||
private final PropertyChangeListener enabledListener = new PropertyChangeListener() {
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
Object value = event.getNewValue();
|
||||
@ -201,6 +209,40 @@ public abstract class AbstractColorChooserPanel extends JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether color chooser panel allows to select the transparency
|
||||
* (alpha value) of a color.
|
||||
* This method fires a property-changed event, using the string value of
|
||||
* {@code TRANSPARENCY_ENABLED_PROPERTY} as the name
|
||||
* of the property.
|
||||
*
|
||||
* <p>The value is a hint and may not be applicable to all types of chooser
|
||||
* panel.
|
||||
*
|
||||
* <p>The default value is {@code true}.
|
||||
*
|
||||
* @param b true if the transparency of a color can be selected
|
||||
*
|
||||
* @beaninfo
|
||||
* bound: true
|
||||
* description: Sets the transparency of a color selection on or off.
|
||||
*
|
||||
* @see #isColorTransparencySelectionEnabled()
|
||||
*/
|
||||
public void setColorTransparencySelectionEnabled(boolean b){
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets whether color chooser panel allows to select the transparency
|
||||
* (alpha value) of a color.
|
||||
*
|
||||
* @return true if the transparency of a color can be selected
|
||||
* @see #setColorTransparencySelectionEnabled(boolean)
|
||||
*/
|
||||
public boolean isColorTransparencySelectionEnabled(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Draws the panel.
|
||||
* @param g the <code>Graphics</code> object
|
||||
|
@ -176,6 +176,21 @@ final class ColorChooserPanel extends AbstractColorChooserPanel implements Prope
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColorTransparencySelectionEnabled(boolean b){
|
||||
boolean oldValue = isColorTransparencySelectionEnabled();
|
||||
if (b != oldValue) {
|
||||
panel.setColorTransparencySelectionEnabled(b);
|
||||
firePropertyChange(TRANSPARENCY_ENABLED_PROPERTY,
|
||||
oldValue, b);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isColorTransparencySelectionEnabled(){
|
||||
return panel.isColorTransparencySelectionEnabled();
|
||||
}
|
||||
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
ColorSelectionModel model = getColorSelectionModel();
|
||||
if (model != null) {
|
||||
|
@ -145,7 +145,7 @@ final class ColorPanel extends JPanel implements ActionListener {
|
||||
}
|
||||
|
||||
void colorChanged() {
|
||||
this.color = new Color(getColor(0), true);
|
||||
this.color = new Color(getColor(0), isColorTransparencySelectionEnabled());
|
||||
Object parent = getParent();
|
||||
if (parent instanceof ColorChooserPanel) {
|
||||
ColorChooserPanel chooser = (ColorChooserPanel) parent;
|
||||
@ -208,6 +208,17 @@ final class ColorPanel extends JPanel implements ActionListener {
|
||||
return this.model.getColor(this.values);
|
||||
}
|
||||
|
||||
void setColorTransparencySelectionEnabled(boolean b) {
|
||||
if (spinners[model.getCount() - 1].isVisible() != b) {
|
||||
spinners[model.getCount() - 1].setVisible(b);
|
||||
colorChanged();
|
||||
}
|
||||
}
|
||||
|
||||
boolean isColorTransparencySelectionEnabled() {
|
||||
return spinners[model.getCount() - 1].isVisible();
|
||||
}
|
||||
|
||||
private void setValue(int index) {
|
||||
this.values[index] = this.spinners[index].getValue();
|
||||
}
|
||||
|
@ -95,6 +95,10 @@ final class SlidingSpinner implements ChangeListener {
|
||||
this.spinner.setVisible(visible);
|
||||
}
|
||||
|
||||
boolean isVisible() {
|
||||
return this.slider.isVisible();
|
||||
}
|
||||
|
||||
public void stateChanged(ChangeEvent event) {
|
||||
if (!this.internal) {
|
||||
if (this.spinner == event.getSource()) {
|
||||
|
@ -90,7 +90,7 @@ public class LayerUI<V extends Component>
|
||||
* and set the layer event mask to {@code 0}
|
||||
* in {@link #uninstallUI(javax.swing.JComponent)} after that.
|
||||
* By default this method calls the appropriate
|
||||
* {@code process<event type>Event}
|
||||
* {@code process<event} {@code type>Event}
|
||||
* method for the given class of event.
|
||||
* <p>
|
||||
* <b>Note:</b> Events are processed only for displayable {@code JLayer}s.
|
||||
|
@ -35,11 +35,11 @@ import javax.swing.event.InternalFrameEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyVetoException;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
|
||||
import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
|
||||
|
||||
import sun.swing.DefaultLookup;
|
||||
|
||||
import static sun.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY;
|
||||
|
||||
/**
|
||||
* The class that manages a basic title bar
|
||||
* <p>
|
||||
@ -217,8 +217,10 @@ public class BasicInternalFrameTitlePane extends JComponent
|
||||
}
|
||||
|
||||
private void updateProperties() {
|
||||
final Object aaTextInfo = frame.getClientProperty(AA_TEXT_PROPERTY_KEY);
|
||||
putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
putClientProperty(KEY_TEXT_ANTIALIASING,
|
||||
frame.getClientProperty(KEY_TEXT_ANTIALIASING));
|
||||
putClientProperty(KEY_TEXT_LCD_CONTRAST,
|
||||
frame.getClientProperty(KEY_TEXT_LCD_CONTRAST));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1514,8 +1514,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
||||
flushUnreferenced(); // Remove old listeners
|
||||
|
||||
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(lafCond);
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(lafCond, table);
|
||||
new AATextListener(this);
|
||||
}
|
||||
|
||||
@ -2204,9 +2203,7 @@ public class MetalLookAndFeel extends BasicLookAndFeel
|
||||
}
|
||||
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
|
||||
boolean lafCond = SwingUtilities2.isLocalDisplay();
|
||||
Object aaTextInfo =
|
||||
SwingUtilities2.AATextInfo.getAATextInfo(lafCond);
|
||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(lafCond, defaults);
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
@ -688,8 +688,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
|
||||
// enabled antialiasing depending on desktop settings
|
||||
flushUnreferenced();
|
||||
Object aaTextInfo = getAATextInfo();
|
||||
table.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(useLAFConditions(), table);
|
||||
new AATextListener(this);
|
||||
|
||||
if (defaultsMap != null) {
|
||||
@ -794,7 +793,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
*
|
||||
* @return the text antialiasing information associated to the desktop
|
||||
*/
|
||||
private static Object getAATextInfo() {
|
||||
private static boolean useLAFConditions() {
|
||||
String language = Locale.getDefault().getLanguage();
|
||||
String desktop =
|
||||
AccessController.doPrivileged(new GetPropertyAction("sun.desktop"));
|
||||
@ -805,10 +804,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
boolean isGnome = "gnome".equals(desktop);
|
||||
boolean isLocal = SwingUtilities2.isLocalDisplay();
|
||||
|
||||
boolean setAA = isLocal && (!isGnome || !isCjkLocale);
|
||||
|
||||
Object aaTextInfo = SwingUtilities2.AATextInfo.getAATextInfo(setAA);
|
||||
return aaTextInfo;
|
||||
return isLocal && (!isGnome || !isCjkLocale);
|
||||
}
|
||||
|
||||
private static ReferenceQueue<LookAndFeel> queue = new ReferenceQueue<LookAndFeel>();
|
||||
@ -844,8 +840,7 @@ public class SynthLookAndFeel extends BasicLookAndFeel {
|
||||
return;
|
||||
}
|
||||
|
||||
Object aaTextInfo = getAATextInfo();
|
||||
defaults.put(SwingUtilities2.AA_TEXT_PROPERTY_KEY, aaTextInfo);
|
||||
SwingUtilities2.putAATextInfo(useLAFConditions(), defaults);
|
||||
|
||||
updateUI();
|
||||
}
|
||||
|
@ -298,8 +298,8 @@ public void close()
|
||||
* Handles a parameterless RTF keyword. This is called by the superclass
|
||||
* (RTFParser) when a keyword is found in the input stream.
|
||||
*
|
||||
* @returns <code>true</code> if the keyword is recognized and handled;
|
||||
* <code>false</code> otherwise
|
||||
* @return true if the keyword is recognized and handled;
|
||||
* false otherwise
|
||||
* @see RTFParser#handleKeyword
|
||||
*/
|
||||
public boolean handleKeyword(String keyword)
|
||||
@ -444,8 +444,8 @@ public boolean handleKeyword(String keyword)
|
||||
* This is called by the superclass
|
||||
* (RTFParser) when a keyword is found in the input stream.
|
||||
*
|
||||
* @returns <code>true</code> if the keyword is recognized and handled;
|
||||
* <code>false</code> otherwise
|
||||
* @return true if the keyword is recognized and handled;
|
||||
* false otherwise
|
||||
* @see RTFParser#handleKeyword
|
||||
*/
|
||||
public boolean handleKeyword(String keyword, int parameter)
|
||||
@ -553,7 +553,7 @@ defineCharacterSet(String name, char[] table)
|
||||
* array of characters, mapping unsigned byte values to their Unicode
|
||||
* equivalents. The character set is loaded if necessary.
|
||||
*
|
||||
* @returns the character set
|
||||
* @return the character set
|
||||
*/
|
||||
public static Object
|
||||
getCharacterSet(final String name)
|
||||
@ -577,7 +577,7 @@ getCharacterSet(final String name)
|
||||
* must contain 256 decimal integers, separated by whitespace, with
|
||||
* no punctuation. B- and C- style comments are allowed.
|
||||
*
|
||||
* @returns the newly read character set
|
||||
* @return the newly read character set
|
||||
*/
|
||||
static char[] readCharset(InputStream strm)
|
||||
throws IOException
|
||||
@ -1349,7 +1349,7 @@ abstract class AttributeTrackingDestination implements Destination
|
||||
* Calculates the current text (character) attributes in a form suitable
|
||||
* for SwingText from the current parser state.
|
||||
*
|
||||
* @returns a new MutableAttributeSet containing the text attributes.
|
||||
* @return a new MutableAttributeSet containing the text attributes.
|
||||
*/
|
||||
MutableAttributeSet currentTextAttributes()
|
||||
{
|
||||
@ -1410,7 +1410,7 @@ abstract class AttributeTrackingDestination implements Destination
|
||||
* Calculates the current paragraph attributes (with keys
|
||||
* as given in StyleConstants) from the current parser state.
|
||||
*
|
||||
* @returns a newly created MutableAttributeSet.
|
||||
* @return a newly created MutableAttributeSet.
|
||||
* @see StyleConstants
|
||||
*/
|
||||
MutableAttributeSet currentParagraphAttributes()
|
||||
@ -1449,7 +1449,7 @@ abstract class AttributeTrackingDestination implements Destination
|
||||
* Calculates the current section attributes
|
||||
* from the current parser state.
|
||||
*
|
||||
* @returns a newly created MutableAttributeSet.
|
||||
* @return a newly created MutableAttributeSet.
|
||||
*/
|
||||
public AttributeSet currentSectionAttributes()
|
||||
{
|
||||
|
@ -124,18 +124,7 @@ public abstract class SunToolkit extends Toolkit
|
||||
* @param appContext AppContext to associate with the event queue
|
||||
*/
|
||||
private static void initEQ(AppContext appContext) {
|
||||
EventQueue eventQueue;
|
||||
|
||||
String eqName = System.getProperty("AWT.EventQueueClass",
|
||||
"java.awt.EventQueue");
|
||||
|
||||
try {
|
||||
eventQueue = (EventQueue)Class.forName(eqName).newInstance();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
System.err.println("Failed loading " + eqName + ": " + e);
|
||||
eventQueue = new EventQueue();
|
||||
}
|
||||
EventQueue eventQueue = new EventQueue();
|
||||
appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
|
||||
|
||||
PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
|
||||
|
@ -50,7 +50,7 @@ class DefaultShellFolder extends ShellFolder {
|
||||
* this default implementation can always be represented with a
|
||||
* <code>java.io.File</code> object instead.
|
||||
*
|
||||
* @returns a <code>java.io.File</code> replacement object.
|
||||
* @return a java.io.File replacement object.
|
||||
*/
|
||||
protected Object writeReplace() throws java.io.ObjectStreamException {
|
||||
return new File(getPath());
|
||||
|
@ -67,7 +67,7 @@ public abstract class ShellFolder extends File {
|
||||
* <code>java.io.File</code> instead. If not, then the object is most likely
|
||||
* depending on some internal (native) state and cannot be serialized.
|
||||
*
|
||||
* @returns a <code>java.io.File</code> replacement object, or <code>null</code>
|
||||
* @return a java.io.File replacement object, or null
|
||||
* if no suitable replacement can be found.
|
||||
*/
|
||||
protected abstract Object writeReplace() throws java.io.ObjectStreamException;
|
||||
|
@ -419,7 +419,7 @@ public class PSPrinterJob extends RasterPrinterJob {
|
||||
/**
|
||||
* Presents the user a dialog for changing properties of the
|
||||
* print job interactively.
|
||||
* @returns false if the user cancels the dialog and
|
||||
* @return false if the user cancels the dialog and
|
||||
* true otherwise.
|
||||
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
|
||||
* returns true.
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user