This commit is contained in:
J. Duke 2017-07-05 17:58:16 +02:00
commit 5ace67716d
289 changed files with 2761 additions and 3783 deletions

View File

@ -139,3 +139,4 @@ a6c4c248e8fa350c35014fa94bab5ac1a1ac3299 jdk8-b10
a4f28069d44a379cda99dd1d921d19f819726d22 jdk8-b15
4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b17
4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b16
7010bd24cdd07bc7daef80702f39124854dec36c jdk8-b18

View File

@ -205,3 +205,5 @@ d1f29d4e0bc60e8bd7ae961f1306d8ab33290212 jdk8-b17
d1f29d4e0bc60e8bd7ae961f1306d8ab33290212 jdk8-b16
6de8c9ba5907e4c5ca05ac4b8d84a8e2cbd92399 hs23-b07
a2fef924d8e6f37dac2a887315e3502876cc8e24 hs23-b08
61165f53f1656b9f99e4fb806429bf98b99d59c3 jdk8-b18
4bcf61041217f8677dcec18e90e9196acc945bba hs23-b09

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2011
HS_MAJOR_VER=23
HS_MINOR_VER=0
HS_BUILD_NUMBER=08
HS_BUILD_NUMBER=09
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -5968,7 +5968,9 @@ void MacroAssembler::call_VM_base(Register oop_result,
assert(number_of_arguments >= 0 , "cannot have negative number of arguments");
LP64_ONLY(assert(java_thread == r15_thread, "unexpected register"));
#ifdef ASSERT
LP64_ONLY(if (UseCompressedOops) verify_heapbase("call_VM_base");)
// TraceBytecodes does not use r12 but saves it over the call, so don't verify
// r12 is the heapbase.
LP64_ONLY(if (UseCompressedOops && !TraceBytecodes) verify_heapbase("call_VM_base");)
#endif // ASSERT
assert(java_thread != oop_result , "cannot use the same register for java_thread & oop_result");

View File

@ -33,7 +33,6 @@
// All local includes have been commented out.
*/
#ifndef JVM_MD_H
#define JVM_MD_H
@ -59,6 +58,7 @@
#include <dirent.h> /* For DIR */
#include <sys/param.h> /* For MAXPATHLEN */
#include <sys/socket.h> /* For socklen_t */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
@ -128,8 +128,4 @@
#endif
#endif /* JVM_MD_H */
// Reconciliation History
// jvm_solaris.h 1.6 99/06/22 16:38:47
// End
#endif // OS_BSD_VM_JVM_BSD_H

View File

@ -150,7 +150,6 @@
// for timer info max values which include all bits
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
#define SEC_IN_NANOSECS 1000000000LL
#define LARGEPAGES_BIT (1 << 6)
////////////////////////////////////////////////////////////////////////////////
@ -3445,8 +3444,6 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
// generates a SIGUSRx signal. Note that SIGUSR1 can interfere with
// SIGSEGV, see 4355769.
const int NANOSECS_PER_MILLISECS = 1000000;
int os::sleep(Thread* thread, jlong millis, bool interruptible) {
assert(thread == Thread::current(), "thread consistency check");
@ -3469,7 +3466,7 @@ int os::sleep(Thread* thread, jlong millis, bool interruptible) {
// not a guarantee() because JVM should not abort on kernel/glibc bugs
assert(!Bsd::supports_monotonic_clock(), "time moving backwards");
} else {
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS;
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC;
}
if(millis <= 0) {
@ -3508,7 +3505,7 @@ int os::sleep(Thread* thread, jlong millis, bool interruptible) {
// not a guarantee() because JVM should not abort on kernel/glibc bugs
assert(!Bsd::supports_monotonic_clock(), "time moving backwards");
} else {
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS;
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC;
}
if(millis <= 0) break ;
@ -4197,7 +4194,7 @@ jlong os::Bsd::fast_thread_cpu_time(clockid_t clockid) {
int rc = os::Bsd::clock_gettime(clockid, &tp);
assert(rc == 0, "clock_gettime is expected to return 0 code");
return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec;
return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
}
#endif
@ -5522,9 +5519,6 @@ void os::PlatformEvent::unpark() {
* is no need to track notifications.
*/
#define NANOSECS_PER_SEC 1000000000
#define NANOSECS_PER_MILLISEC 1000000
#define MAX_SECS 100000000
/*
* This code is common to bsd and solaris and will be moved to a

View File

@ -198,15 +198,15 @@ inline int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}
inline int os::recv(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
}
inline int os::send(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
}
inline int os::raw_send(int fd, char *buf, int nBytes, int flags) {
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
return os::send(fd, buf, nBytes, flags);
}
@ -246,57 +246,52 @@ inline int os::listen(int fd, int count) {
return ::listen(fd, count);
}
inline int os::connect(int fd, struct sockaddr *him, int len) {
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}
inline int os::accept(int fd, struct sockaddr *him, int *len) {
// This cast is from int to unsigned int on bsd. Since we
// only pass the parameter "len" around the vm and don't try to
// fetch it's value, this cast is safe for now. The java.net group
// may need and want to change this interface someday if socklen_t goes
// to 64 bits on some platform that we support.
inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
// At least OpenBSD and FreeBSD can return EINTR from accept.
RESTARTABLE_RETURN_INT(::accept(fd, him, (socklen_t *)len));
RESTARTABLE_RETURN_INT(::accept(fd, him, len));
}
inline int os::recvfrom(int fd, char *buf, int nBytes, int flags,
sockaddr *from, int *fromlen) {
RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen));
inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
inline int os::sendto(int fd, char *buf, int len, int flags,
struct sockaddr *to, int tolen) {
RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
inline int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr *to, socklen_t tolen) {
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
inline int os::socket_shutdown(int fd, int howto){
inline int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
inline int os::bind(int fd, struct sockaddr *him, int len){
inline int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
return ::getsockname(fd, him, (socklen_t *)len);
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, len);
}
inline int os::get_host_name(char* name, int namelen){
inline int os::get_host_name(char* name, int namelen) {
return ::gethostname(name, namelen);
}
inline struct hostent* os::get_host_by_name(char* name) {
inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}
inline int os::get_sock_opt(int fd, int level, int optname,
char *optval, int* optlen){
return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen);
char *optval, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char *optval, int optlen){
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
#endif // OS_BSD_VM_OS_BSD_INLINE_HPP

View File

@ -33,7 +33,6 @@
// All local includes have been commented out.
*/
#ifndef JVM_MD_H
#define JVM_MD_H
@ -44,6 +43,7 @@
#include <dirent.h> /* For DIR */
#include <sys/param.h> /* For MAXPATHLEN */
#include <sys/socket.h> /* For socklen_t */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
#define JNI_ONLOAD_SYMBOLS {"JNI_OnLoad"}
@ -95,8 +95,4 @@
#endif /* JVM_MD_H */
// Reconciliation History
// jvm_solaris.h 1.6 99/06/22 16:38:47
// End
#endif // OS_LINUX_VM_JVM_LINUX_H

View File

@ -127,7 +127,6 @@
// for timer info max values which include all bits
#define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF)
#define SEC_IN_NANOSECS 1000000000LL
#define LARGEPAGES_BIT (1 << 6)
////////////////////////////////////////////////////////////////////////////////
@ -3259,8 +3258,6 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
// generates a SIGUSRx signal. Note that SIGUSR1 can interfere with
// SIGSEGV, see 4355769.
const int NANOSECS_PER_MILLISECS = 1000000;
int os::sleep(Thread* thread, jlong millis, bool interruptible) {
assert(thread == Thread::current(), "thread consistency check");
@ -3283,7 +3280,7 @@ int os::sleep(Thread* thread, jlong millis, bool interruptible) {
// not a guarantee() because JVM should not abort on kernel/glibc bugs
assert(!Linux::supports_monotonic_clock(), "time moving backwards");
} else {
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS;
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC;
}
if(millis <= 0) {
@ -3322,7 +3319,7 @@ int os::sleep(Thread* thread, jlong millis, bool interruptible) {
// not a guarantee() because JVM should not abort on kernel/glibc bugs
assert(!Linux::supports_monotonic_clock(), "time moving backwards");
} else {
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISECS;
millis -= (newtime - prevtime) / NANOSECS_PER_MILLISEC;
}
if(millis <= 0) break ;
@ -3924,7 +3921,7 @@ jlong os::Linux::fast_thread_cpu_time(clockid_t clockid) {
int rc = os::Linux::clock_gettime(clockid, &tp);
assert(rc == 0, "clock_gettime is expected to return 0 code");
return (tp.tv_sec * SEC_IN_NANOSECS) + tp.tv_nsec;
return (tp.tv_sec * NANOSECS_PER_SEC) + tp.tv_nsec;
}
/////
@ -5165,9 +5162,6 @@ void os::PlatformEvent::unpark() {
* is no need to track notifications.
*/
#define NANOSECS_PER_SEC 1000000000
#define NANOSECS_PER_MILLISEC 1000000
#define MAX_SECS 100000000
/*
* This code is common to linux and solaris and will be moved to a

View File

@ -202,15 +202,15 @@ inline int os::socket(int domain, int type, int protocol) {
return ::socket(domain, type, protocol);
}
inline int os::recv(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, (unsigned int) flags));
inline int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::recv(fd, buf, nBytes, flags));
}
inline int os::send(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, (unsigned int) flags));
inline int os::send(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
}
inline int os::raw_send(int fd, char *buf, int nBytes, int flags) {
inline int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
return os::send(fd, buf, nBytes, flags);
}
@ -250,57 +250,53 @@ inline int os::listen(int fd, int count) {
return ::listen(fd, count);
}
inline int os::connect(int fd, struct sockaddr *him, int len) {
inline int os::connect(int fd, struct sockaddr* him, socklen_t len) {
RESTARTABLE_RETURN_INT(::connect(fd, him, len));
}
inline int os::accept(int fd, struct sockaddr *him, int *len) {
// This cast is from int to unsigned int on linux. Since we
// only pass the parameter "len" around the vm and don't try to
// fetch it's value, this cast is safe for now. The java.net group
// may need and want to change this interface someday if socklen_t goes
// to 64 bits on some platform that we support.
// Linux doc says this can't return EINTR, unlike accept() on Solaris
return ::accept(fd, him, (socklen_t *)len);
inline int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
// Linux doc says this can't return EINTR, unlike accept() on Solaris.
// But see attachListener_linux.cpp, LinuxAttachListener::dequeue().
return (int)::accept(fd, him, len);
}
inline int os::recvfrom(int fd, char *buf, int nBytes, int flags,
sockaddr *from, int *fromlen) {
RESTARTABLE_RETURN_INT(::recvfrom(fd, buf, nBytes, (unsigned int) flags, from, (socklen_t *)fromlen));
inline int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
RESTARTABLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen));
}
inline int os::sendto(int fd, char *buf, int len, int flags,
struct sockaddr *to, int tolen) {
RESTARTABLE_RETURN_INT(::sendto(fd, buf, len, (unsigned int) flags, to, tolen));
inline int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
RESTARTABLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen));
}
inline int os::socket_shutdown(int fd, int howto){
inline int os::socket_shutdown(int fd, int howto) {
return ::shutdown(fd, howto);
}
inline int os::bind(int fd, struct sockaddr *him, int len){
inline int os::bind(int fd, struct sockaddr* him, socklen_t len) {
return ::bind(fd, him, len);
}
inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
return ::getsockname(fd, him, (socklen_t *)len);
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
return ::getsockname(fd, him, len);
}
inline int os::get_host_name(char* name, int namelen){
inline int os::get_host_name(char* name, int namelen) {
return ::gethostname(name, namelen);
}
inline struct hostent* os::get_host_by_name(char* name) {
inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}
inline int os::get_sock_opt(int fd, int level, int optname,
char *optval, int* optlen){
return ::getsockopt(fd, level, optname, optval, (socklen_t *)optlen);
char* optval, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char *optval, int optlen){
const char* optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
#endif // OS_LINUX_VM_OS_LINUX_INLINE_HPP

View File

@ -33,7 +33,6 @@
// All local includes have been commented out.
*/
#ifndef JVM_MD_H
#define JVM_MD_H
@ -44,6 +43,7 @@
#include <dirent.h> /* For DIR */
#include <sys/param.h> /* For MAXPATHLEN */
#include <sys/socket.h> /* For socklen_t */
#include <unistd.h> /* For F_OK, R_OK, W_OK */
#include <sys/int_types.h> /* for intptr_t types (64 Bit cleanliness) */
@ -82,7 +82,6 @@
#define JVM_O_EXCL O_EXCL
#define JVM_O_CREAT O_CREAT
/* Signal definitions */
#define BREAK_SIGNAL SIGQUIT /* Thread dumping support. */

View File

@ -1674,7 +1674,6 @@ void* os::thread_local_storage_at(int index) {
}
const int NANOSECS_PER_MILLISECS = 1000000;
// gethrtime can move backwards if read from one cpu and then a different cpu
// getTimeNanos is guaranteed to not move backward on Solaris
// local spinloop created as faster for a CAS on an int than
@ -1803,7 +1802,7 @@ double os::elapsedVTime() {
// getTimeMillis guaranteed to not move backwards on Solaris
jlong getTimeMillis() {
jlong nanotime = getTimeNanos();
return (jlong)(nanotime / NANOSECS_PER_MILLISECS);
return (jlong)(nanotime / NANOSECS_PER_MILLISEC);
}
// Must return millis since Jan 1 1970 for JVM_CurrentTimeMillis
@ -6064,10 +6063,7 @@ void os::PlatformEvent::unpark() {
* is no need to track notifications.
*/
#define NANOSECS_PER_SEC 1000000000
#define NANOSECS_PER_MILLISEC 1000000
#define MAX_SECS 100000000
/*
* This code is common to linux and solaris and will be moved to a
* common place in dolphin.
@ -6363,17 +6359,16 @@ int os::socket_close(int fd) {
RESTARTABLE_RETURN_INT(::close(fd));
}
int os::recv(int fd, char *buf, int nBytes, int flags) {
INTERRUPTIBLE_RETURN_INT(::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
INTERRUPTIBLE_RETURN_INT((int)::recv(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
}
int os::send(int fd, char *buf, int nBytes, int flags) {
INTERRUPTIBLE_RETURN_INT(::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
int os::send(int fd, char* buf, size_t nBytes, uint flags) {
INTERRUPTIBLE_RETURN_INT((int)::send(fd, buf, nBytes, flags), os::Solaris::clear_interrupted);
}
int os::raw_send(int fd, char *buf, int nBytes, int flags) {
RESTARTABLE_RETURN_INT(::send(fd, buf, nBytes, flags));
int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
RESTARTABLE_RETURN_INT((int)::send(fd, buf, nBytes, flags));
}
// As both poll and select can be interrupted by signals, we have to be
@ -6408,19 +6403,19 @@ int os::timeout(int fd, long timeout) {
}
}
int os::connect(int fd, struct sockaddr *him, int len) {
int os::connect(int fd, struct sockaddr *him, socklen_t len) {
int _result;
INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,
INTERRUPTIBLE_NORESTART(::connect(fd, him, len), _result,\
os::Solaris::clear_interrupted);
// Depending on when thread interruption is reset, _result could be
// one of two values when errno == EINTR
if (((_result == OS_INTRPT) || (_result == OS_ERR))
&& (errno == EINTR)) {
&& (errno == EINTR)) {
/* restarting a connect() changes its errno semantics */
INTERRUPTIBLE(::connect(fd, him, len), _result,
os::Solaris::clear_interrupted);
INTERRUPTIBLE(::connect(fd, him, len), _result,\
os::Solaris::clear_interrupted);
/* undo these changes */
if (_result == OS_ERR) {
if (errno == EALREADY) {
@ -6434,43 +6429,38 @@ int os::connect(int fd, struct sockaddr *him, int len) {
return _result;
}
int os::accept(int fd, struct sockaddr *him, int *len) {
if (fd < 0)
return OS_ERR;
INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him,\
(socklen_t*) len), os::Solaris::clear_interrupted);
}
int os::recvfrom(int fd, char *buf, int nBytes, int flags,
sockaddr *from, int *fromlen) {
//%%note jvm_r11
INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes,\
flags, from, fromlen), os::Solaris::clear_interrupted);
int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
if (fd < 0) {
return OS_ERR;
}
INTERRUPTIBLE_RETURN_INT((int)::accept(fd, him, len),\
os::Solaris::clear_interrupted);
}
int os::sendto(int fd, char *buf, int len, int flags,
struct sockaddr *to, int tolen) {
//%%note jvm_r11
INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags,\
to, tolen), os::Solaris::clear_interrupted);
int os::recvfrom(int fd, char* buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
INTERRUPTIBLE_RETURN_INT((int)::recvfrom(fd, buf, nBytes, flags, from, fromlen),\
os::Solaris::clear_interrupted);
}
int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
INTERRUPTIBLE_RETURN_INT((int)::sendto(fd, buf, len, flags, to, tolen),\
os::Solaris::clear_interrupted);
}
int os::socket_available(int fd, jint *pbytes) {
if (fd < 0)
return OS_OK;
int ret;
RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
//%% note ioctl can return 0 when successful, JVM_SocketAvailable
// is expected to return 0 on failure and 1 on success to the jdk.
return (ret == OS_ERR) ? 0 : 1;
if (fd < 0) {
return OS_OK;
}
int ret;
RESTARTABLE(::ioctl(fd, FIONREAD, pbytes), ret);
// note: ioctl can return 0 when successful, JVM_SocketAvailable
// is expected to return 0 on failure and 1 on success to the jdk.
return (ret == OS_ERR) ? 0 : 1;
}
int os::bind(int fd, struct sockaddr *him, int len) {
int os::bind(int fd, struct sockaddr* him, socklen_t len) {
INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
os::Solaris::clear_interrupted);
os::Solaris::clear_interrupted);
}

View File

@ -243,24 +243,25 @@ inline int os::socket_shutdown(int fd, int howto){
return ::shutdown(fd, howto);
}
inline int os::get_sock_name(int fd, struct sockaddr *him, int *len){
return ::getsockname(fd, him, (socklen_t*) len);
inline int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len){
return ::getsockname(fd, him, len);
}
inline int os::get_host_name(char* name, int namelen){
return ::gethostname(name, namelen);
}
inline struct hostent* os::get_host_by_name(char* name) {
inline struct hostent* os::get_host_by_name(char* name) {
return ::gethostbyname(name);
}
inline int os::get_sock_opt(int fd, int level, int optname,
char *optval, int* optlen){
return ::getsockopt(fd, level, optname, optval, (socklen_t*) optlen);
char* optval, socklen_t* optlen) {
return ::getsockopt(fd, level, optname, optval, optlen);
}
inline int os::set_sock_opt(int fd, int level, int optname,
const char *optval, int optlen){
const char *optval, socklen_t optlen) {
return ::setsockopt(fd, level, optname, optval, optlen);
}
#endif // OS_SOLARIS_VM_OS_SOLARIS_INLINE_HPP

View File

@ -22,6 +22,9 @@
*
*/
#ifndef OS_WINDOWS_VM_JVM_WINDOWS_H
#define OS_WINDOWS_VM_JVM_WINDOWS_H
#ifndef _JAVASOFT_JVM_MD_H_
#define _JAVASOFT_JVM_MD_H_
@ -54,10 +57,10 @@ typedef struct _MODULEINFO {
#include <Psapi.h>
#endif
#include <Tlhelp32.h>
typedef unsigned int socklen_t;
// #include "jni.h"
#define JNI_ONLOAD_SYMBOLS {"_JNI_OnLoad@8", "JNI_OnLoad"}
@ -129,3 +132,5 @@ JVM_GetThreadInterruptEvent();
#define SHUTDOWN2_SIGNAL SIGTERM
#endif /* !_JAVASOFT_JVM_MD_H_ */
#endif // OS_WINDOWS_VM_JVM_WINDOWS_H

View File

@ -821,17 +821,15 @@ jlong os::javaTimeMillis() {
}
}
#define NANOS_PER_SEC CONST64(1000000000)
#define NANOS_PER_MILLISEC 1000000
jlong os::javaTimeNanos() {
if (!has_performance_count) {
return javaTimeMillis() * NANOS_PER_MILLISEC; // the best we can do.
return javaTimeMillis() * NANOSECS_PER_MILLISEC; // the best we can do.
} else {
LARGE_INTEGER current_count;
QueryPerformanceCounter(&current_count);
double current = as_long(current_count);
double freq = performance_frequency;
jlong time = (jlong)((current/freq) * NANOS_PER_SEC);
jlong time = (jlong)((current/freq) * NANOSECS_PER_SEC);
return time;
}
}
@ -847,15 +845,15 @@ void os::javaTimeNanos_info(jvmtiTimerInfo *info_ptr) {
info_ptr->may_skip_forward = true;
} else {
jlong freq = performance_frequency;
if (freq < NANOS_PER_SEC) {
if (freq < NANOSECS_PER_SEC) {
// the performance counter is 64 bits and we will
// be multiplying it -- so no wrap in 64 bits
info_ptr->max_value = ALL_64_BITS;
} else if (freq > NANOS_PER_SEC) {
} else if (freq > NANOSECS_PER_SEC) {
// use the max value the counter can reach to
// determine the max value which could be returned
julong max_counter = (julong)ALL_64_BITS;
info_ptr->max_value = (jlong)(max_counter / (freq / NANOS_PER_SEC));
info_ptr->max_value = (jlong)(max_counter / (freq / NANOSECS_PER_SEC));
} else {
// the performance counter is 64 bits and we will
// be using it directly -- so no wrap in 64 bits
@ -4851,7 +4849,7 @@ static void initSock() {
::mutexUnlock(&sockFnTableMutex);
}
struct hostent* os::get_host_by_name(char* name) {
struct hostent* os::get_host_by_name(char* name) {
if (!sock_initialized) {
initSock();
}
@ -4882,39 +4880,39 @@ int os::listen(int fd, int count) {
return 0;
}
int os::connect(int fd, struct sockaddr *him, int len) {
int os::connect(int fd, struct sockaddr* him, socklen_t len) {
ShouldNotReachHere();
return 0;
}
int os::accept(int fd, struct sockaddr *him, int *len) {
int os::accept(int fd, struct sockaddr* him, socklen_t* len) {
ShouldNotReachHere();
return 0;
}
int os::sendto(int fd, char *buf, int len, int flags,
struct sockaddr *to, int tolen) {
int os::sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen) {
ShouldNotReachHere();
return 0;
}
int os::recvfrom(int fd, char *buf, int nBytes, int flags,
sockaddr *from, int *fromlen) {
int os::recvfrom(int fd, char *buf, size_t nBytes, uint flags,
sockaddr* from, socklen_t* fromlen) {
ShouldNotReachHere();
return 0;
}
int os::recv(int fd, char *buf, int nBytes, int flags) {
int os::recv(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
}
int os::send(int fd, char *buf, int nBytes, int flags) {
int os::send(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
}
int os::raw_send(int fd, char *buf, int nBytes, int flags) {
int os::raw_send(int fd, char* buf, size_t nBytes, uint flags) {
ShouldNotReachHere();
return 0;
}
@ -4934,24 +4932,24 @@ int os::socket_shutdown(int fd, int howto) {
return 0;
}
int os::bind(int fd, struct sockaddr *him, int len) {
int os::bind(int fd, struct sockaddr* him, socklen_t len) {
ShouldNotReachHere();
return 0;
}
int os::get_sock_name(int fd, struct sockaddr *him, int *len) {
int os::get_sock_name(int fd, struct sockaddr* him, socklen_t* len) {
ShouldNotReachHere();
return 0;
}
int os::get_sock_opt(int fd, int level, int optname,
char *optval, int* optlen) {
char* optval, socklen_t* optlen) {
ShouldNotReachHere();
return 0;
}
int os::set_sock_opt(int fd, int level, int optname,
const char *optval, int optlen) {
const char* optval, socklen_t optlen) {
ShouldNotReachHere();
return 0;
}

View File

@ -336,12 +336,6 @@ class CompactibleFreeListSpace: public CompactibleSpace {
unallocated_block() : end());
}
// This is needed because the default implementation uses block_start()
// which can;t be used at certain times (for example phase 3 of mark-sweep).
// A better fix is to change the assertions in phase 3 of mark-sweep to
// use is_in_reserved(), but that is deferred since the is_in() assertions
// are buried through several layers of callers and are used elsewhere
// as well.
bool is_in(const void* p) const {
return used_region().contains(p);
}

View File

@ -1117,12 +1117,9 @@ public:
// Calculates the number of active workers for a concurrent
// phase.
int ConcurrentMark::calc_parallel_marking_threads() {
size_t n_conc_workers;
if (!G1CollectedHeap::use_parallel_gc_threads()) {
n_conc_workers = 1;
} else {
size_t ConcurrentMark::calc_parallel_marking_threads() {
if (G1CollectedHeap::use_parallel_gc_threads()) {
size_t n_conc_workers = 0;
if (!UseDynamicNumberOfGCThreads ||
(!FLAG_IS_DEFAULT(ConcGCThreads) &&
!ForceDynamicNumberOfGCThreads)) {
@ -1137,9 +1134,13 @@ int ConcurrentMark::calc_parallel_marking_threads() {
// Don't scale down "n_conc_workers" by scale_parallel_threads() because
// that scaling has already gone into "_max_parallel_marking_threads".
}
assert(n_conc_workers > 0, "Always need at least 1");
return n_conc_workers;
}
assert(n_conc_workers > 0, "Always need at least 1");
return (int) MAX2(n_conc_workers, (size_t) 1);
// If we are not running with any parallel GC threads we will not
// have spawned any marking threads either. Hence the number of
// concurrent workers should be 0.
return 0;
}
void ConcurrentMark::markFromRoots() {
@ -1151,24 +1152,24 @@ void ConcurrentMark::markFromRoots() {
// stop-the-world GC happens even as we mark in this generation.
_restart_for_overflow = false;
// Parallel task terminator is set in "set_phase()".
force_overflow_conc()->init();
// _g1h has _n_par_threads
_parallel_marking_threads = calc_parallel_marking_threads();
assert(parallel_marking_threads() <= max_parallel_marking_threads(),
"Maximum number of marking threads exceeded");
_parallel_workers->set_active_workers((int)_parallel_marking_threads);
// Don't set _n_par_threads because it affects MT in proceess_strong_roots()
// and the decisions on that MT processing is made elsewhere.
assert( _parallel_workers->active_workers() > 0, "Should have been set");
set_phase(_parallel_workers->active_workers(), true /* concurrent */);
size_t active_workers = MAX2((size_t) 1, parallel_marking_threads());
// Parallel task terminator is set in "set_phase()"
set_phase(active_workers, true /* concurrent */);
CMConcurrentMarkingTask markingTask(this, cmThread());
if (parallel_marking_threads() > 0) {
_parallel_workers->set_active_workers((int)active_workers);
// Don't set _n_par_threads because it affects MT in proceess_strong_roots()
// and the decisions on that MT processing is made elsewhere.
assert(_parallel_workers->active_workers() > 0, "Should have been set");
_parallel_workers->run_task(&markingTask);
} else {
markingTask.work(0);
@ -1765,8 +1766,7 @@ void ConcurrentMark::cleanup() {
HeapRegionRemSet::reset_for_cleanup_tasks();
g1h->set_par_threads();
size_t n_workers = g1h->n_par_threads();
size_t n_workers;
// Do counting once more with the world stopped for good measure.
G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(),
@ -1776,8 +1776,10 @@ void ConcurrentMark::cleanup() {
HeapRegion::InitialClaimValue),
"sanity check");
g1h->set_par_threads();
n_workers = g1h->n_par_threads();
assert(g1h->n_par_threads() == (int) n_workers,
"Should not have been reset");
"Should not have been reset");
g1h->workers()->run_task(&g1_par_count_task);
// Done with the parallel phase so reset to 0.
g1h->set_par_threads(0);
@ -1786,6 +1788,7 @@ void ConcurrentMark::cleanup() {
HeapRegion::FinalCountClaimValue),
"sanity check");
} else {
n_workers = 1;
g1_par_count_task.work(0);
}
@ -1851,7 +1854,6 @@ void ConcurrentMark::cleanup() {
(note_end_end - note_end_start)*1000.0);
}
// call below, since it affects the metric by which we sort the heap
// regions.
if (G1ScrubRemSets) {
@ -2329,9 +2331,9 @@ public:
}
}
CMRemarkTask(ConcurrentMark* cm) :
CMRemarkTask(ConcurrentMark* cm, int active_workers) :
AbstractGangTask("Par Remark"), _cm(cm) {
_cm->terminator()->reset_for_reuse(cm->_g1h->workers()->active_workers());
_cm->terminator()->reset_for_reuse(active_workers);
}
};
@ -2357,7 +2359,7 @@ void ConcurrentMark::checkpointRootsFinalWork() {
// constructor and pass values of the active workers
// through the gang in the task.
CMRemarkTask remarkTask(this);
CMRemarkTask remarkTask(this, active_workers);
g1h->set_par_threads(active_workers);
g1h->workers()->run_task(&remarkTask);
g1h->set_par_threads(0);
@ -2367,7 +2369,7 @@ void ConcurrentMark::checkpointRootsFinalWork() {
int active_workers = 1;
set_phase(active_workers, false /* concurrent */);
CMRemarkTask remarkTask(this);
CMRemarkTask remarkTask(this, active_workers);
// We will start all available threads, even if we decide that the
// active_workers will be fewer. The extra ones will just bail out
// immediately.
@ -3123,13 +3125,12 @@ void ConcurrentMark::complete_marking_in_collection_set() {
}
double start = os::elapsedTime();
int n_workers = g1h->workers()->total_workers();
G1ParCompleteMarkInCSetTask complete_mark_task(g1h, this);
assert(g1h->check_cset_heap_region_claim_values(HeapRegion::InitialClaimValue), "sanity");
if (G1CollectedHeap::use_parallel_gc_threads()) {
int n_workers = g1h->workers()->active_workers();
g1h->set_par_threads(n_workers);
g1h->workers()->run_task(&complete_mark_task);
g1h->set_par_threads(0);

View File

@ -718,7 +718,7 @@ public:
size_t scale_parallel_threads(size_t n_par_threads);
// Calculates the number of GC threads to be used in a concurrent phase.
int calc_parallel_marking_threads();
size_t calc_parallel_marking_threads();
// The following three are interaction between CM and
// G1CollectedHeap

View File

@ -1294,7 +1294,7 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
g1_policy()->stop_incremental_cset_building();
tear_down_region_sets(false /* free_list_only */);
g1_policy()->set_full_young_gcs(true);
g1_policy()->set_gcs_are_young(true);
// See the comments in g1CollectedHeap.hpp and
// G1CollectedHeap::ref_processing_init() about
@ -1842,7 +1842,9 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
_full_collections_completed(0),
_in_cset_fast_test(NULL),
_in_cset_fast_test_base(NULL),
_dirty_cards_region_list(NULL) {
_dirty_cards_region_list(NULL),
_worker_cset_start_region(NULL),
_worker_cset_start_region_time_stamp(NULL) {
_g1h = this; // To catch bugs.
if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
vm_exit_during_initialization("Failed necessary allocation.");
@ -1863,12 +1865,17 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
}
_rem_set_iterator = iter_arr;
_worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues);
_worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues);
for (int i = 0; i < n_queues; i++) {
RefToScanQueue* q = new RefToScanQueue();
q->initialize();
_task_queues->register_queue(i, q);
}
clear_cset_start_regions();
guarantee(_task_queues != NULL, "task_queues allocation failure.");
}
@ -2411,8 +2418,11 @@ void G1CollectedHeap::collect(GCCause::Cause cause) {
}
bool G1CollectedHeap::is_in(const void* p) const {
HeapRegion* hr = _hrs.addr_to_region((HeapWord*) p);
if (hr != NULL) {
if (_g1_committed.contains(p)) {
// Given that we know that p is in the committed space,
// heap_region_containing_raw() should successfully
// return the containing region.
HeapRegion* hr = heap_region_containing_raw(p);
return hr->is_in(p);
} else {
return _perm_gen->as_gen()->is_in(p);
@ -2684,25 +2694,80 @@ bool G1CollectedHeap::check_cset_heap_region_claim_values(jint claim_value) {
}
#endif // ASSERT
// We want the parallel threads to start their collection
// set iteration at different collection set regions to
// avoid contention.
// If we have:
// n collection set regions
// p threads
// Then thread t will start at region t * floor (n/p)
// Clear the cached CSet starting regions and (more importantly)
// the time stamps. Called when we reset the GC time stamp.
void G1CollectedHeap::clear_cset_start_regions() {
assert(_worker_cset_start_region != NULL, "sanity");
assert(_worker_cset_start_region_time_stamp != NULL, "sanity");
int n_queues = MAX2((int)ParallelGCThreads, 1);
for (int i = 0; i < n_queues; i++) {
_worker_cset_start_region[i] = NULL;
_worker_cset_start_region_time_stamp[i] = 0;
}
}
// Given the id of a worker, obtain or calculate a suitable
// starting region for iterating over the current collection set.
HeapRegion* G1CollectedHeap::start_cset_region_for_worker(int worker_i) {
HeapRegion* result = g1_policy()->collection_set();
assert(get_gc_time_stamp() > 0, "should have been updated by now");
HeapRegion* result = NULL;
unsigned gc_time_stamp = get_gc_time_stamp();
if (_worker_cset_start_region_time_stamp[worker_i] == gc_time_stamp) {
// Cached starting region for current worker was set
// during the current pause - so it's valid.
// Note: the cached starting heap region may be NULL
// (when the collection set is empty).
result = _worker_cset_start_region[worker_i];
assert(result == NULL || result->in_collection_set(), "sanity");
return result;
}
// The cached entry was not valid so let's calculate
// a suitable starting heap region for this worker.
// We want the parallel threads to start their collection
// set iteration at different collection set regions to
// avoid contention.
// If we have:
// n collection set regions
// p threads
// Then thread t will start at region floor ((t * n) / p)
result = g1_policy()->collection_set();
if (G1CollectedHeap::use_parallel_gc_threads()) {
size_t cs_size = g1_policy()->cset_region_length();
int n_workers = workers()->total_workers();
size_t cs_spans = cs_size / n_workers;
size_t ind = cs_spans * worker_i;
for (size_t i = 0; i < ind; i++) {
int active_workers = workers()->active_workers();
assert(UseDynamicNumberOfGCThreads ||
active_workers == workers()->total_workers(),
"Unless dynamic should use total workers");
size_t end_ind = (cs_size * worker_i) / active_workers;
size_t start_ind = 0;
if (worker_i > 0 &&
_worker_cset_start_region_time_stamp[worker_i - 1] == gc_time_stamp) {
// Previous workers starting region is valid
// so let's iterate from there
start_ind = (cs_size * (worker_i - 1)) / active_workers;
result = _worker_cset_start_region[worker_i - 1];
}
for (size_t i = start_ind; i < end_ind; i++) {
result = result->next_in_collection_set();
}
}
// Note: the calculated starting heap region may be NULL
// (when the collection set is empty).
assert(result == NULL || result->in_collection_set(), "sanity");
assert(_worker_cset_start_region_time_stamp[worker_i] != gc_time_stamp,
"should be updated only once per pause");
_worker_cset_start_region[worker_i] = result;
OrderAccess::storestore();
_worker_cset_start_region_time_stamp[worker_i] = gc_time_stamp;
return result;
}
@ -3461,20 +3526,19 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
// for the duration of this pause.
g1_policy()->decide_on_conc_mark_initiation();
// We do not allow initial-mark to be piggy-backed on a
// partially-young GC.
// We do not allow initial-mark to be piggy-backed on a mixed GC.
assert(!g1_policy()->during_initial_mark_pause() ||
g1_policy()->full_young_gcs(), "sanity");
g1_policy()->gcs_are_young(), "sanity");
// We also do not allow partially-young GCs during marking.
assert(!mark_in_progress() || g1_policy()->full_young_gcs(), "sanity");
// We also do not allow mixed GCs during marking.
assert(!mark_in_progress() || g1_policy()->gcs_are_young(), "sanity");
char verbose_str[128];
sprintf(verbose_str, "GC pause ");
if (g1_policy()->full_young_gcs()) {
if (g1_policy()->gcs_are_young()) {
strcat(verbose_str, "(young)");
} else {
strcat(verbose_str, "(partial)");
strcat(verbose_str, "(mixed)");
}
if (g1_policy()->during_initial_mark_pause()) {
strcat(verbose_str, " (initial-mark)");
@ -3723,8 +3787,9 @@ G1CollectedHeap::do_collection_pause_at_safepoint(double target_pause_time_ms) {
double end_time_sec = os::elapsedTime();
double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS;
g1_policy()->record_pause_time_ms(pause_time_ms);
int active_gc_threads = workers()->active_workers();
g1_policy()->record_collection_pause_end(active_gc_threads);
int active_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
workers()->active_workers() : 1);
g1_policy()->record_collection_pause_end(active_workers);
MemoryService::track_memory_usage();
@ -5248,8 +5313,10 @@ void G1CollectedHeap::process_discovered_references() {
int active_workers = (G1CollectedHeap::use_parallel_gc_threads() ?
workers()->active_workers() : 1);
assert(active_workers == workers()->active_workers(),
"Need to reset active_workers");
assert(!G1CollectedHeap::use_parallel_gc_threads() ||
active_workers == workers()->active_workers(),
"Need to reset active_workers");
set_par_threads(active_workers);
G1ParPreserveCMReferentsTask keep_cm_referents(this, active_workers, _task_queues);
@ -5387,13 +5454,13 @@ void G1CollectedHeap::evacuate_collection_set() {
assert(UseDynamicNumberOfGCThreads ||
n_workers == workers()->total_workers(),
"If not dynamic should be using all the workers");
workers()->set_active_workers(n_workers);
set_par_threads(n_workers);
} else {
assert(n_par_threads() == 0,
"Should be the original non-parallel value");
n_workers = 1;
}
workers()->set_active_workers(n_workers);
G1ParTask g1_par_task(this, _task_queues);
@ -5415,6 +5482,7 @@ void G1CollectedHeap::evacuate_collection_set() {
workers()->run_task(&g1_par_task);
} else {
StrongRootsScope srs(this);
g1_par_task.set_for_termination(n_workers);
g1_par_task.work(0);
}
@ -5663,8 +5731,8 @@ void G1CollectedHeap::cleanUpCardTable() {
// Iterate over the dirty cards region list.
G1ParCleanupCTTask cleanup_task(ct_bs, this);
if (ParallelGCThreads > 0) {
set_par_threads(workers()->total_workers());
if (G1CollectedHeap::use_parallel_gc_threads()) {
set_par_threads();
workers()->run_task(&cleanup_task);
set_par_threads(0);
} else {
@ -6072,8 +6140,9 @@ HeapRegion* MutatorAllocRegion::allocate_new_region(size_t word_size,
void G1CollectedHeap::set_par_threads() {
// Don't change the number of workers. Use the value previously set
// in the workgroup.
assert(G1CollectedHeap::use_parallel_gc_threads(), "shouldn't be here otherwise");
int n_workers = workers()->active_workers();
assert(UseDynamicNumberOfGCThreads ||
assert(UseDynamicNumberOfGCThreads ||
n_workers == workers()->total_workers(),
"Otherwise should be using the total number of workers");
if (n_workers == 0) {

View File

@ -943,6 +943,16 @@ protected:
// discovery.
G1CMIsAliveClosure _is_alive_closure_cm;
// Cache used by G1CollectedHeap::start_cset_region_for_worker().
HeapRegion** _worker_cset_start_region;
// Time stamp to validate the regions recorded in the cache
// used by G1CollectedHeap::start_cset_region_for_worker().
// The heap region entry for a given worker is valid iff
// the associated time stamp value matches the current value
// of G1CollectedHeap::_gc_time_stamp.
unsigned int* _worker_cset_start_region_time_stamp;
enum G1H_process_strong_roots_tasks {
G1H_PS_mark_stack_oops_do,
G1H_PS_refProcessor_oops_do,
@ -1030,6 +1040,9 @@ public:
void reset_gc_time_stamp() {
_gc_time_stamp = 0;
OrderAccess::fence();
// Clear the cached CSet starting regions and time stamps.
// Their validity is dependent on the GC timestamp.
clear_cset_start_regions();
}
void increment_gc_time_stamp() {
@ -1196,7 +1209,7 @@ public:
HumongousRegionSet* humongous_proxy_set,
bool par);
// Returns "TRUE" iff "p" points into the allocated area of the heap.
// Returns "TRUE" iff "p" points into the committed areas of the heap.
virtual bool is_in(const void* p) const;
// Return "TRUE" iff the given object address is within the collection
@ -1300,9 +1313,12 @@ public:
bool check_cset_heap_region_claim_values(jint claim_value);
#endif // ASSERT
// Given the id of a worker, calculate a suitable
// starting region for iterating over the current
// collection set.
// Clear the cached cset start regions and (more importantly)
// the time stamps. Called when we reset the GC time stamp.
void clear_cset_start_regions();
// Given the id of a worker, obtain or calculate a suitable
// starting region for iterating over the current collection set.
HeapRegion* start_cset_region_for_worker(int worker_i);
// Iterate over the regions (if any) in the current collection set.

View File

@ -50,7 +50,7 @@ static double cost_per_card_ms_defaults[] = {
};
// all the same
static double fully_young_cards_per_entry_ratio_defaults[] = {
static double young_cards_per_entry_ratio_defaults[] = {
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
};
@ -168,11 +168,10 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pending_card_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
_rs_length_diff_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_card_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_fully_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
_partially_young_cards_per_entry_ratio_seq(
new TruncatedSeq(TruncatedSeqLength)),
_young_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
_mixed_cards_per_entry_ratio_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_partially_young_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_mixed_cost_per_entry_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_byte_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
_cost_per_byte_ms_during_cm_seq(new TruncatedSeq(TruncatedSeqLength)),
_constant_other_time_ms_seq(new TruncatedSeq(TruncatedSeqLength)),
@ -185,9 +184,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pause_time_target_ms((double) MaxGCPauseMillis),
_full_young_gcs(true),
_full_young_pause_num(0),
_partial_young_pause_num(0),
_gcs_are_young(true),
_young_pause_num(0),
_mixed_pause_num(0),
_during_marking(false),
_in_marking_window(false),
@ -198,7 +197,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
_young_gc_eff_seq(new TruncatedSeq(TruncatedSeqLength)),
_recent_prev_end_times_for_all_gcs_sec(new TruncatedSeq(NumPrevPausesForHeuristics)),
_recent_prev_end_times_for_all_gcs_sec(
new TruncatedSeq(NumPrevPausesForHeuristics)),
_recent_avg_pause_time_ratio(0.0),
@ -206,8 +206,9 @@ G1CollectorPolicy::G1CollectorPolicy() :
_initiate_conc_mark_if_possible(false),
_during_initial_mark_pause(false),
_should_revert_to_full_young_gcs(false),
_last_full_young_gc(false),
_should_revert_to_young_gcs(false),
_last_young_gc(false),
_last_gc_was_young(false),
_eden_bytes_before_gc(0),
_survivor_bytes_before_gc(0),
@ -308,8 +309,8 @@ G1CollectorPolicy::G1CollectorPolicy() :
_pending_card_diff_seq->add(0.0);
_rs_length_diff_seq->add(rs_length_diff_defaults[index]);
_cost_per_card_ms_seq->add(cost_per_card_ms_defaults[index]);
_fully_young_cards_per_entry_ratio_seq->add(
fully_young_cards_per_entry_ratio_defaults[index]);
_young_cards_per_entry_ratio_seq->add(
young_cards_per_entry_ratio_defaults[index]);
_cost_per_entry_ms_seq->add(cost_per_entry_ms_defaults[index]);
_cost_per_byte_ms_seq->add(cost_per_byte_ms_defaults[index]);
_constant_other_time_ms_seq->add(constant_other_time_ms_defaults[index]);
@ -606,7 +607,7 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) {
size_t young_list_target_length = 0;
if (adaptive_young_list_length()) {
if (full_young_gcs()) {
if (gcs_are_young()) {
young_list_target_length =
calculate_young_list_target_length(rs_lengths,
base_min_length,
@ -619,10 +620,10 @@ void G1CollectorPolicy::update_young_list_target_length(size_t rs_lengths) {
// possible to maximize how many old regions we can add to it.
}
} else {
if (full_young_gcs()) {
if (gcs_are_young()) {
young_list_target_length = _young_list_fixed_length;
} else {
// A bit arbitrary: during partially-young GCs we allocate half
// A bit arbitrary: during mixed GCs we allocate half
// the young regions to try to add old regions to the CSet.
young_list_target_length = _young_list_fixed_length / 2;
// We choose to accept that we might go under the desired min
@ -655,7 +656,7 @@ G1CollectorPolicy::calculate_young_list_target_length(size_t rs_lengths,
size_t desired_min_length,
size_t desired_max_length) {
assert(adaptive_young_list_length(), "pre-condition");
assert(full_young_gcs(), "only call this for fully-young GCs");
assert(gcs_are_young(), "only call this for young GCs");
// In case some edge-condition makes the desired max length too small...
if (desired_max_length <= desired_min_length) {
@ -858,12 +859,11 @@ void G1CollectorPolicy::record_full_collection_end() {
_g1->clear_full_collection();
// "Nuke" the heuristics that control the fully/partially young GC
// transitions and make sure we start with fully young GCs after the
// Full GC.
set_full_young_gcs(true);
_last_full_young_gc = false;
_should_revert_to_full_young_gcs = false;
// "Nuke" the heuristics that control the young/mixed GC
// transitions and make sure we start with young GCs after the Full GC.
set_gcs_are_young(true);
_last_young_gc = false;
_should_revert_to_young_gcs = false;
clear_initiate_conc_mark_if_possible();
clear_during_initial_mark_pause();
_known_garbage_bytes = 0;
@ -892,7 +892,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
if (PrintGCDetails) {
gclog_or_tty->stamp(PrintGCTimeStamps);
gclog_or_tty->print("[GC pause");
gclog_or_tty->print(" (%s)", full_young_gcs() ? "young" : "partial");
gclog_or_tty->print(" (%s)", gcs_are_young() ? "young" : "mixed");
}
// We only need to do this here as the policy will only be applied
@ -951,7 +951,7 @@ void G1CollectorPolicy::record_collection_pause_start(double start_time_sec,
// the evacuation pause if marking is in progress.
_cur_satb_drain_time_ms = 0.0;
_last_young_gc_full = false;
_last_gc_was_young = false;
// do that for any other surv rate groups
_short_lived_surv_rate_group->stop_adding_regions();
@ -988,8 +988,8 @@ void G1CollectorPolicy::record_concurrent_mark_cleanup_start() {
}
void G1CollectorPolicy::record_concurrent_mark_cleanup_completed() {
_should_revert_to_full_young_gcs = false;
_last_full_young_gc = true;
_should_revert_to_young_gcs = false;
_last_young_gc = true;
_in_marking_window = false;
}
@ -1153,7 +1153,7 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
size_t marking_initiating_used_threshold =
(_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
if (!_g1->mark_in_progress() && !_last_full_young_gc) {
if (!_g1->mark_in_progress() && !_last_young_gc) {
assert(!last_pause_included_initial_mark, "invariant");
if (cur_used_bytes > marking_initiating_used_threshold) {
if (cur_used_bytes > _prev_collection_pause_used_at_end_bytes) {
@ -1458,57 +1458,57 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
new_in_marking_window_im = true;
}
if (_last_full_young_gc) {
if (_last_young_gc) {
if (!last_pause_included_initial_mark) {
ergo_verbose2(ErgoPartiallyYoungGCs,
"start partially-young GCs",
ergo_verbose2(ErgoMixedGCs,
"start mixed GCs",
ergo_format_byte_perc("known garbage"),
_known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(false);
set_gcs_are_young(false);
} else {
ergo_verbose0(ErgoPartiallyYoungGCs,
"do not start partially-young GCs",
ergo_verbose0(ErgoMixedGCs,
"do not start mixed GCs",
ergo_format_reason("concurrent cycle is about to start"));
}
_last_full_young_gc = false;
_last_young_gc = false;
}
if ( !_last_young_gc_full ) {
if (_should_revert_to_full_young_gcs) {
ergo_verbose2(ErgoPartiallyYoungGCs,
"end partially-young GCs",
ergo_format_reason("partially-young GCs end requested")
if (!_last_gc_was_young) {
if (_should_revert_to_young_gcs) {
ergo_verbose2(ErgoMixedGCs,
"end mixed GCs",
ergo_format_reason("mixed GCs end requested")
ergo_format_byte_perc("known garbage"),
_known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(true);
set_gcs_are_young(true);
} else if (_known_garbage_ratio < 0.05) {
ergo_verbose3(ErgoPartiallyYoungGCs,
"end partially-young GCs",
ergo_verbose3(ErgoMixedGCs,
"end mixed GCs",
ergo_format_reason("known garbage percent lower than threshold")
ergo_format_byte_perc("known garbage")
ergo_format_perc("threshold"),
_known_garbage_bytes, _known_garbage_ratio * 100.0,
0.05 * 100.0);
set_full_young_gcs(true);
set_gcs_are_young(true);
} else if (adaptive_young_list_length() &&
(get_gc_eff_factor() * cur_efficiency < predict_young_gc_eff())) {
ergo_verbose5(ErgoPartiallyYoungGCs,
"end partially-young GCs",
ergo_verbose5(ErgoMixedGCs,
"end mixed GCs",
ergo_format_reason("current GC efficiency lower than "
"predicted fully-young GC efficiency")
"predicted young GC efficiency")
ergo_format_double("GC efficiency factor")
ergo_format_double("current GC efficiency")
ergo_format_double("predicted fully-young GC efficiency")
ergo_format_double("predicted young GC efficiency")
ergo_format_byte_perc("known garbage"),
get_gc_eff_factor(), cur_efficiency,
predict_young_gc_eff(),
_known_garbage_bytes, _known_garbage_ratio * 100.0);
set_full_young_gcs(true);
set_gcs_are_young(true);
}
}
_should_revert_to_full_young_gcs = false;
_should_revert_to_young_gcs = false;
if (_last_young_gc_full && !_during_marking) {
if (_last_gc_was_young && !_during_marking) {
_young_gc_eff_seq->add(cur_efficiency);
}
@ -1534,19 +1534,21 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
double cost_per_entry_ms = 0.0;
if (cards_scanned > 10) {
cost_per_entry_ms = scan_rs_time / (double) cards_scanned;
if (_last_young_gc_full)
if (_last_gc_was_young) {
_cost_per_entry_ms_seq->add(cost_per_entry_ms);
else
_partially_young_cost_per_entry_ms_seq->add(cost_per_entry_ms);
} else {
_mixed_cost_per_entry_ms_seq->add(cost_per_entry_ms);
}
}
if (_max_rs_lengths > 0) {
double cards_per_entry_ratio =
(double) cards_scanned / (double) _max_rs_lengths;
if (_last_young_gc_full)
_fully_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
else
_partially_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
if (_last_gc_was_young) {
_young_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
} else {
_mixed_cards_per_entry_ratio_seq->add(cards_per_entry_ratio);
}
}
// It turns out that, sometimes, _max_rs_lengths can get smaller
@ -1563,10 +1565,11 @@ void G1CollectorPolicy::record_collection_pause_end(int no_of_gc_threads) {
double cost_per_byte_ms = 0.0;
if (copied_bytes > 0) {
cost_per_byte_ms = obj_copy_time / (double) copied_bytes;
if (_in_marking_window)
if (_in_marking_window) {
_cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
else
} else {
_cost_per_byte_ms_seq->add(cost_per_byte_ms);
}
}
double all_other_time_ms = pause_time_ms -
@ -1722,10 +1725,11 @@ predict_young_collection_elapsed_time_ms(size_t adjustment) {
size_t rs_lengths = g1h->young_list()->sampled_rs_lengths() +
predict_rs_length_diff();
size_t card_num;
if (full_young_gcs())
if (gcs_are_young()) {
card_num = predict_young_card_num(rs_lengths);
else
} else {
card_num = predict_non_young_card_num(rs_lengths);
}
size_t young_byte_size = young_num * HeapRegion::GrainBytes;
double accum_yg_surv_rate =
_short_lived_surv_rate_group->accum_surv_rate(adjustment);
@ -1745,10 +1749,11 @@ double
G1CollectorPolicy::predict_base_elapsed_time_ms(size_t pending_cards) {
size_t rs_length = predict_rs_length_diff();
size_t card_num;
if (full_young_gcs())
if (gcs_are_young()) {
card_num = predict_young_card_num(rs_length);
else
} else {
card_num = predict_non_young_card_num(rs_length);
}
return predict_base_elapsed_time_ms(pending_cards, card_num);
}
@ -1766,10 +1771,11 @@ G1CollectorPolicy::predict_region_elapsed_time_ms(HeapRegion* hr,
bool young) {
size_t rs_length = hr->rem_set()->occupied();
size_t card_num;
if (full_young_gcs())
if (gcs_are_young()) {
card_num = predict_young_card_num(rs_length);
else
} else {
card_num = predict_non_young_card_num(rs_length);
}
size_t bytes_to_copy = predict_bytes_to_copy(hr);
double region_elapsed_time_ms =
@ -1817,14 +1823,14 @@ void G1CollectorPolicy::check_if_region_is_too_expensive(double
// I don't think we need to do this when in young GC mode since
// marking will be initiated next time we hit the soft limit anyway...
if (predicted_time_ms > _expensive_region_limit_ms) {
ergo_verbose2(ErgoPartiallyYoungGCs,
"request partially-young GCs end",
ergo_verbose2(ErgoMixedGCs,
"request mixed GCs end",
ergo_format_reason("predicted region time higher than threshold")
ergo_format_ms("predicted region time")
ergo_format_ms("threshold"),
predicted_time_ms, _expensive_region_limit_ms);
// no point in doing another partial one
_should_revert_to_full_young_gcs = true;
// no point in doing another mixed GC
_should_revert_to_young_gcs = true;
}
}
@ -2033,8 +2039,8 @@ void G1CollectorPolicy::print_tracing_info() const {
print_summary_sd(0, "Total", _all_pause_times_ms);
gclog_or_tty->print_cr("");
gclog_or_tty->print_cr("");
gclog_or_tty->print_cr(" Full Young GC Pauses: %8d", _full_young_pause_num);
gclog_or_tty->print_cr(" Partial Young GC Pauses: %8d", _partial_young_pause_num);
gclog_or_tty->print_cr(" Young GC Pauses: %8d", _young_pause_num);
gclog_or_tty->print_cr(" Mixed GC Pauses: %8d", _mixed_pause_num);
gclog_or_tty->print_cr("");
gclog_or_tty->print_cr("EVACUATION PAUSES");
@ -2188,11 +2194,11 @@ G1CollectorPolicy::decide_on_conc_mark_initiation() {
// initiate a new cycle.
set_during_initial_mark_pause();
// We do not allow non-full young GCs during marking.
if (!full_young_gcs()) {
set_full_young_gcs(true);
ergo_verbose0(ErgoPartiallyYoungGCs,
"end partially-young GCs",
// We do not allow mixed GCs during marking.
if (!gcs_are_young()) {
set_gcs_are_young(true);
ergo_verbose0(ErgoMixedGCs,
"end mixed GCs",
ergo_format_reason("concurrent cycle is about to start"));
}
@ -2623,12 +2629,12 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
double young_start_time_sec = os::elapsedTime();
_collection_set_bytes_used_before = 0;
_last_young_gc_full = full_young_gcs() ? true : false;
_last_gc_was_young = gcs_are_young() ? true : false;
if (_last_young_gc_full) {
++_full_young_pause_num;
if (_last_gc_was_young) {
++_young_pause_num;
} else {
++_partial_young_pause_num;
++_mixed_pause_num;
}
// The young list is laid with the survivor regions from the previous
@ -2675,7 +2681,7 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
// We are doing young collections so reset this.
non_young_start_time_sec = young_end_time_sec;
if (!full_young_gcs()) {
if (!gcs_are_young()) {
bool should_continue = true;
NumberSeq seq;
double avg_prediction = 100000000000000000.0; // something very large
@ -2732,14 +2738,14 @@ void G1CollectorPolicy::choose_collection_set(double target_pause_time_ms) {
} while (should_continue);
if (!adaptive_young_list_length() &&
cset_region_length() < _young_list_fixed_length) {
cset_region_length() < _young_list_fixed_length) {
ergo_verbose2(ErgoCSetConstruction,
"request partially-young GCs end",
"request mixed GCs end",
ergo_format_reason("CSet length lower than target")
ergo_format_region("CSet")
ergo_format_region("young target"),
cset_region_length(), _young_list_fixed_length);
_should_revert_to_full_young_gcs = true;
_should_revert_to_young_gcs = true;
}
ergo_verbose2(ErgoCSetConstruction | ErgoHigh,

View File

@ -164,8 +164,8 @@ private:
// times for a given worker thread.
double* _par_last_gc_worker_other_times_ms;
// indicates whether we are in full young or partially young GC mode
bool _full_young_gcs;
// indicates whether we are in young or mixed GC mode
bool _gcs_are_young;
// if true, then it tries to dynamically adjust the length of the
// young list
@ -178,10 +178,10 @@ private:
// locker is active. This should be >= _young_list_target_length;
size_t _young_list_max_length;
bool _last_young_gc_full;
bool _last_gc_was_young;
unsigned _full_young_pause_num;
unsigned _partial_young_pause_num;
unsigned _young_pause_num;
unsigned _mixed_pause_num;
bool _during_marking;
bool _in_marking_window;
@ -211,10 +211,10 @@ private:
TruncatedSeq* _pending_card_diff_seq;
TruncatedSeq* _rs_length_diff_seq;
TruncatedSeq* _cost_per_card_ms_seq;
TruncatedSeq* _fully_young_cards_per_entry_ratio_seq;
TruncatedSeq* _partially_young_cards_per_entry_ratio_seq;
TruncatedSeq* _young_cards_per_entry_ratio_seq;
TruncatedSeq* _mixed_cards_per_entry_ratio_seq;
TruncatedSeq* _cost_per_entry_ms_seq;
TruncatedSeq* _partially_young_cost_per_entry_ms_seq;
TruncatedSeq* _mixed_cost_per_entry_ms_seq;
TruncatedSeq* _cost_per_byte_ms_seq;
TruncatedSeq* _constant_other_time_ms_seq;
TruncatedSeq* _young_other_cost_per_region_ms_seq;
@ -322,20 +322,22 @@ public:
size_t predict_pending_card_diff() {
double prediction = get_new_neg_prediction(_pending_card_diff_seq);
if (prediction < 0.00001)
if (prediction < 0.00001) {
return 0;
else
} else {
return (size_t) prediction;
}
}
size_t predict_pending_cards() {
size_t max_pending_card_num = _g1->max_pending_card_num();
size_t diff = predict_pending_card_diff();
size_t prediction;
if (diff > max_pending_card_num)
if (diff > max_pending_card_num) {
prediction = max_pending_card_num;
else
} else {
prediction = max_pending_card_num - diff;
}
return prediction;
}
@ -356,57 +358,62 @@ public:
return (double) pending_cards * predict_cost_per_card_ms();
}
double predict_fully_young_cards_per_entry_ratio() {
return get_new_prediction(_fully_young_cards_per_entry_ratio_seq);
double predict_young_cards_per_entry_ratio() {
return get_new_prediction(_young_cards_per_entry_ratio_seq);
}
double predict_partially_young_cards_per_entry_ratio() {
if (_partially_young_cards_per_entry_ratio_seq->num() < 2)
return predict_fully_young_cards_per_entry_ratio();
else
return get_new_prediction(_partially_young_cards_per_entry_ratio_seq);
double predict_mixed_cards_per_entry_ratio() {
if (_mixed_cards_per_entry_ratio_seq->num() < 2) {
return predict_young_cards_per_entry_ratio();
} else {
return get_new_prediction(_mixed_cards_per_entry_ratio_seq);
}
}
size_t predict_young_card_num(size_t rs_length) {
return (size_t) ((double) rs_length *
predict_fully_young_cards_per_entry_ratio());
predict_young_cards_per_entry_ratio());
}
size_t predict_non_young_card_num(size_t rs_length) {
return (size_t) ((double) rs_length *
predict_partially_young_cards_per_entry_ratio());
predict_mixed_cards_per_entry_ratio());
}
double predict_rs_scan_time_ms(size_t card_num) {
if (full_young_gcs())
if (gcs_are_young()) {
return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq);
else
return predict_partially_young_rs_scan_time_ms(card_num);
} else {
return predict_mixed_rs_scan_time_ms(card_num);
}
}
double predict_partially_young_rs_scan_time_ms(size_t card_num) {
if (_partially_young_cost_per_entry_ms_seq->num() < 3)
double predict_mixed_rs_scan_time_ms(size_t card_num) {
if (_mixed_cost_per_entry_ms_seq->num() < 3) {
return (double) card_num * get_new_prediction(_cost_per_entry_ms_seq);
else
return (double) card_num *
get_new_prediction(_partially_young_cost_per_entry_ms_seq);
} else {
return (double) (card_num *
get_new_prediction(_mixed_cost_per_entry_ms_seq));
}
}
double predict_object_copy_time_ms_during_cm(size_t bytes_to_copy) {
if (_cost_per_byte_ms_during_cm_seq->num() < 3)
return 1.1 * (double) bytes_to_copy *
get_new_prediction(_cost_per_byte_ms_seq);
else
if (_cost_per_byte_ms_during_cm_seq->num() < 3) {
return (1.1 * (double) bytes_to_copy) *
get_new_prediction(_cost_per_byte_ms_seq);
} else {
return (double) bytes_to_copy *
get_new_prediction(_cost_per_byte_ms_during_cm_seq);
get_new_prediction(_cost_per_byte_ms_during_cm_seq);
}
}
double predict_object_copy_time_ms(size_t bytes_to_copy) {
if (_in_marking_window && !_in_marking_window_im)
if (_in_marking_window && !_in_marking_window_im) {
return predict_object_copy_time_ms_during_cm(bytes_to_copy);
else
} else {
return (double) bytes_to_copy *
get_new_prediction(_cost_per_byte_ms_seq);
get_new_prediction(_cost_per_byte_ms_seq);
}
}
double predict_constant_other_time_ms() {
@ -414,15 +421,13 @@ public:
}
double predict_young_other_time_ms(size_t young_num) {
return
(double) young_num *
get_new_prediction(_young_other_cost_per_region_ms_seq);
return (double) young_num *
get_new_prediction(_young_other_cost_per_region_ms_seq);
}
double predict_non_young_other_time_ms(size_t non_young_num) {
return
(double) non_young_num *
get_new_prediction(_non_young_other_cost_per_region_ms_seq);
return (double) non_young_num *
get_new_prediction(_non_young_other_cost_per_region_ms_seq);
}
void check_if_region_is_too_expensive(double predicted_time_ms);
@ -456,7 +461,7 @@ public:
double predict_survivor_regions_evac_time();
void cset_regions_freed() {
bool propagate = _last_young_gc_full && !_in_marking_window;
bool propagate = _last_gc_was_young && !_in_marking_window;
_short_lived_surv_rate_group->all_surviving_words_recorded(propagate);
_survivor_surv_rate_group->all_surviving_words_recorded(propagate);
// also call it on any more surv rate groups
@ -628,8 +633,8 @@ private:
// initial-mark work.
volatile bool _during_initial_mark_pause;
bool _should_revert_to_full_young_gcs;
bool _last_full_young_gc;
bool _should_revert_to_young_gcs;
bool _last_young_gc;
// This set of variables tracks the collector efficiency, in order to
// determine whether we should initiate a new marking.
@ -985,11 +990,11 @@ public:
return _young_list_max_length;
}
bool full_young_gcs() {
return _full_young_gcs;
bool gcs_are_young() {
return _gcs_are_young;
}
void set_full_young_gcs(bool full_young_gcs) {
_full_young_gcs = full_young_gcs;
void set_gcs_are_young(bool gcs_are_young) {
_gcs_are_young = gcs_are_young;
}
bool adaptive_young_list_length() {

View File

@ -52,14 +52,13 @@ void G1ErgoVerbose::set_enabled(bool enabled) {
const char* G1ErgoVerbose::to_string(int tag) {
ErgoHeuristic n = extract_heuristic(tag);
switch (n) {
case ErgoHeapSizing: return "Heap Sizing";
case ErgoCSetConstruction: return "CSet Construction";
case ErgoConcCycles: return "Concurrent Cycles";
case ErgoPartiallyYoungGCs: return "Partially-Young GCs";
case ErgoHeapSizing: return "Heap Sizing";
case ErgoCSetConstruction: return "CSet Construction";
case ErgoConcCycles: return "Concurrent Cycles";
case ErgoMixedGCs: return "Mixed GCs";
default:
ShouldNotReachHere();
// Keep the Windows compiler happy
return NULL;
}
}

View File

@ -69,7 +69,7 @@ typedef enum {
ErgoHeapSizing = 0,
ErgoCSetConstruction,
ErgoConcCycles,
ErgoPartiallyYoungGCs,
ErgoMixedGCs,
ErgoHeuristicNum
} ErgoHeuristic;

View File

@ -119,7 +119,7 @@ class G1MonitoringSupport : public CHeapObj {
G1CollectedHeap* _g1h;
// jstat performance counters
// incremental collections both fully and partially young
// incremental collections both young and mixed
CollectorCounters* _incremental_collection_counters;
// full stop-the-world collections
CollectorCounters* _full_collection_counters;

View File

@ -672,15 +672,20 @@ void PSMarkSweep::mark_sweep_phase4() {
}
jlong PSMarkSweep::millis_since_last_gc() {
jlong ret_val = os::javaTimeMillis() - _time_of_last_gc;
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
jlong ret_val = now - _time_of_last_gc;
// XXX See note in genCollectedHeap::millis_since_last_gc().
if (ret_val < 0) {
NOT_PRODUCT(warning("time warp: %d", ret_val);)
NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);)
return 0;
}
return ret_val;
}
void PSMarkSweep::reset_millis_since_last_gc() {
_time_of_last_gc = os::javaTimeMillis();
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
_time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
}

View File

@ -3398,17 +3398,22 @@ PSParallelCompact::move_and_update(ParCompactionManager* cm, SpaceId space_id) {
}
jlong PSParallelCompact::millis_since_last_gc() {
jlong ret_val = os::javaTimeMillis() - _time_of_last_gc;
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
jlong ret_val = now - _time_of_last_gc;
// XXX See note in genCollectedHeap::millis_since_last_gc().
if (ret_val < 0) {
NOT_PRODUCT(warning("time warp: %d", ret_val);)
NOT_PRODUCT(warning("time warp: "INT64_FORMAT, ret_val);)
return 0;
}
return ret_val;
}
void PSParallelCompact::reset_millis_since_last_gc() {
_time_of_last_gc = os::javaTimeMillis();
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
_time_of_last_gc = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
}
ParMarkBitMap::IterationStatus MoveAndUpdateClosure::copy_until_full()

View File

@ -471,3 +471,26 @@ oop CollectedHeap::Class_obj_allocate(KlassHandle klass, int size, KlassHandle r
return mirror;
}
/////////////// Unit tests ///////////////
#ifndef PRODUCT
void CollectedHeap::test_is_in() {
CollectedHeap* heap = Universe::heap();
// Test that NULL is not in the heap.
assert(!heap->is_in(NULL), "NULL is unexpectedly in the heap");
// Test that a pointer to before the heap start is reported as outside the heap.
assert(heap->_reserved.start() >= (void*)MinObjAlignment, "sanity");
void* before_heap = (void*)((intptr_t)heap->_reserved.start() - MinObjAlignment);
assert(!heap->is_in(before_heap),
err_msg("before_heap: " PTR_FORMAT " is unexpectedly in the heap", before_heap));
// Test that a pointer to after the heap end is reported as outside the heap.
assert(heap->_reserved.end() <= (void*)(uintptr_t(-1) - (uint)MinObjAlignment), "sanity");
void* after_heap = (void*)((intptr_t)heap->_reserved.end() + MinObjAlignment);
assert(!heap->is_in(after_heap),
err_msg("after_heap: " PTR_FORMAT " is unexpectedly in the heap", after_heap));
}
#endif

View File

@ -217,8 +217,8 @@ class CollectedHeap : public CHeapObj {
return p == NULL || is_in_reserved(p);
}
// Returns "TRUE" if "p" points to the head of an allocated object in the
// heap. Since this method can be expensive in general, we restrict its
// Returns "TRUE" iff "p" points into the committed areas of the heap.
// Since this method can be expensive in general, we restrict its
// use to assertion checking only.
virtual bool is_in(const void* p) const = 0;
@ -648,6 +648,10 @@ class CollectedHeap : public CHeapObj {
// reduce the occurrence of ParallelGCThreads to uses where the
// actual number may be germane.
static bool use_parallel_gc_threads() { return ParallelGCThreads > 0; }
/////////////// Unit tests ///////////////
NOT_PRODUCT(static void test_is_in();)
};
// Class to set and reset the GC cause for a CollectedHeap.

View File

@ -957,7 +957,7 @@ bool GenCollectedHeap::is_in_young(oop p) {
return result;
}
// Returns "TRUE" iff "p" points into the allocated area of the heap.
// Returns "TRUE" iff "p" points into the committed areas of the heap.
bool GenCollectedHeap::is_in(const void* p) const {
#ifndef ASSERT
guarantee(VerifyBeforeGC ||
@ -1460,26 +1460,22 @@ class GenTimeOfLastGCClosure: public GenCollectedHeap::GenClosure {
};
jlong GenCollectedHeap::millis_since_last_gc() {
jlong now = os::javaTimeMillis();
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
GenTimeOfLastGCClosure tolgc_cl(now);
// iterate over generations getting the oldest
// time that a generation was collected
generation_iterate(&tolgc_cl, false);
tolgc_cl.do_generation(perm_gen());
// XXX Despite the assert above, since javaTimeMillis()
// doesnot guarantee monotonically increasing return
// values (note, i didn't say "strictly monotonic"),
// we need to guard against getting back a time
// later than now. This should be fixed by basing
// on someting like gethrtime() which guarantees
// monotonicity. Note that cond_wait() is susceptible
// to a similar problem, because its interface is
// based on absolute time in the form of the
// system time's notion of UCT. See also 4506635
// for yet another problem of similar nature. XXX
// javaTimeNanos() is guaranteed to be monotonically non-decreasing
// provided the underlying platform provides such a time source
// (and it is bug free). So we still have to guard against getting
// back a time later than 'now'.
jlong retVal = now - tolgc_cl.time();
if (retVal < 0) {
NOT_PRODUCT(warning("time warp: %d", retVal);)
NOT_PRODUCT(warning("time warp: "INT64_FORMAT, retVal);)
return 0;
}
return retVal;

View File

@ -198,7 +198,7 @@ public:
// Mostly used for testing purposes. Caller does not hold the Heap_lock on entry.
void collect(GCCause::Cause cause, int max_level);
// Returns "TRUE" iff "p" points into the allocated area of the heap.
// Returns "TRUE" iff "p" points into the committed areas of the heap.
// The methods is_in(), is_in_closed_subset() and is_in_youngest() may
// be expensive to compute in general, so, to prevent
// their inadvertent use in product jvm's, we restrict their use to

View File

@ -220,7 +220,7 @@ class Generation: public CHeapObj {
MemRegion prev_used_region() const { return _prev_used_region; }
virtual void save_used_region() { _prev_used_region = used_region(); }
// Returns "TRUE" iff "p" points into an allocated object in the generation.
// Returns "TRUE" iff "p" points into the committed areas in the generation.
// For some kinds of generations, this may be an expensive operation.
// To avoid performance problems stemming from its inadvertent use in
// product jvm's, we restrict its use to assertion checking or
@ -413,10 +413,13 @@ class Generation: public CHeapObj {
// Time (in ms) when we were last collected or now if a collection is
// in progress.
virtual jlong time_of_last_gc(jlong now) {
// XXX See note in genCollectedHeap::millis_since_last_gc()
// Both _time_of_last_gc and now are set using a time source
// that guarantees monotonically non-decreasing values provided
// the underlying platform provides such a source. So we still
// have to guard against non-monotonicity.
NOT_PRODUCT(
if (now < _time_of_last_gc) {
warning("time warp: %d to %d", _time_of_last_gc, now);
warning("time warp: "INT64_FORMAT" to "INT64_FORMAT, _time_of_last_gc, now);
}
)
return _time_of_last_gc;

View File

@ -43,7 +43,9 @@ void referenceProcessor_init() {
}
void ReferenceProcessor::init_statics() {
jlong now = os::javaTimeMillis();
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
// Initialize the soft ref timestamp clock.
_soft_ref_timestamp_clock = now;
@ -151,7 +153,10 @@ void ReferenceProcessor::weak_oops_do(OopClosure* f) {
void ReferenceProcessor::update_soft_ref_master_clock() {
// Update (advance) the soft ref master clock field. This must be done
// after processing the soft ref list.
jlong now = os::javaTimeMillis();
// We need a monotonically non-deccreasing time in ms but
// os::javaTimeMillis() does not guarantee monotonicity.
jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
jlong soft_ref_clock = java_lang_ref_SoftReference::clock();
assert(soft_ref_clock == _soft_ref_timestamp_clock, "soft ref clocks out of sync");
@ -161,10 +166,11 @@ void ReferenceProcessor::update_soft_ref_master_clock() {
_soft_ref_timestamp_clock, now);
}
)
// In product mode, protect ourselves from system time being adjusted
// externally and going backward; see note in the implementation of
// GenCollectedHeap::time_since_last_gc() for the right way to fix
// this uniformly throughout the VM; see bug-id 4741166. XXX
// The values of now and _soft_ref_timestamp_clock are set using
// javaTimeNanos(), which is guaranteed to be monotonically
// non-decreasing provided the underlying platform provides such
// a time source (and it is bug free).
// In product mode, however, protect ourselves from non-monotonicty.
if (now > _soft_ref_timestamp_clock) {
_soft_ref_timestamp_clock = now;
java_lang_ref_SoftReference::set_clock(now);

View File

@ -304,11 +304,6 @@ void ContiguousSpace::clear(bool mangle_space) {
CompactibleSpace::clear(mangle_space);
}
bool Space::is_in(const void* p) const {
HeapWord* b = block_start_const(p);
return b != NULL && block_is_obj(b);
}
bool ContiguousSpace::is_in(const void* p) const {
return _bottom <= p && p < _top;
}

View File

@ -187,7 +187,7 @@ class Space: public CHeapObj {
// expensive operation. To prevent performance problems
// on account of its inadvertent use in product jvm's,
// we restrict its use to assertion checks only.
virtual bool is_in(const void* p) const;
virtual bool is_in(const void* p) const = 0;
// Returns true iff the given reserved memory of the space contains the
// given address.

View File

@ -38,9 +38,7 @@ bool arrayOopDesc::check_max_length_overflow(BasicType type) {
return (julong)(size_t)bytes == bytes;
}
bool arrayOopDesc::test_max_array_length() {
tty->print_cr("test_max_array_length");
void arrayOopDesc::test_max_array_length() {
assert(check_max_length_overflow(T_BOOLEAN), "size_t overflow for boolean array");
assert(check_max_length_overflow(T_CHAR), "size_t overflow for char array");
assert(check_max_length_overflow(T_FLOAT), "size_t overflow for float array");
@ -54,8 +52,6 @@ bool arrayOopDesc::test_max_array_length() {
assert(check_max_length_overflow(T_NARROWOOP), "size_t overflow for narrowOop array");
// T_VOID and T_ADDRESS are not supported by max_array_length()
return true;
}

View File

@ -128,7 +128,7 @@ class arrayOopDesc : public oopDesc {
#ifndef PRODUCT
static bool check_max_length_overflow(BasicType type);
static int32_t old_max_array_length(BasicType type);
static bool test_max_array_length();
static void test_max_array_length();
#endif
};

View File

@ -5037,16 +5037,25 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
#ifndef PRODUCT
#include "gc_interface/collectedHeap.hpp"
#include "utilities/quickSort.hpp"
#define run_unit_test(unit_test_function_call) \
tty->print_cr("Running test: " #unit_test_function_call); \
unit_test_function_call
void execute_internal_vm_tests() {
if (ExecuteInternalVMTests) {
assert(QuickSort::test_quick_sort(), "test_quick_sort failed");
assert(arrayOopDesc::test_max_array_length(), "test_max_array_length failed");
tty->print_cr("Running internal VM tests");
run_unit_test(arrayOopDesc::test_max_array_length());
run_unit_test(CollectedHeap::test_is_in());
run_unit_test(QuickSort::test_quick_sort());
tty->print_cr("All internal VM tests passed");
}
}
#undef run_unit_test
#endif
#ifndef USDT2

View File

@ -3515,14 +3515,14 @@ JVM_END
JVM_LEAF(jint, JVM_Recv(jint fd, char *buf, jint nBytes, jint flags))
JVMWrapper2("JVM_Recv (0x%x)", fd);
//%note jvm_r6
return os::recv(fd, buf, nBytes, flags);
return os::recv(fd, buf, (size_t)nBytes, (uint)flags);
JVM_END
JVM_LEAF(jint, JVM_Send(jint fd, char *buf, jint nBytes, jint flags))
JVMWrapper2("JVM_Send (0x%x)", fd);
//%note jvm_r6
return os::send(fd, buf, nBytes, flags);
return os::send(fd, buf, (size_t)nBytes, (uint)flags);
JVM_END
@ -3543,42 +3543,51 @@ JVM_END
JVM_LEAF(jint, JVM_Connect(jint fd, struct sockaddr *him, jint len))
JVMWrapper2("JVM_Connect (0x%x)", fd);
//%note jvm_r6
return os::connect(fd, him, len);
return os::connect(fd, him, (socklen_t)len);
JVM_END
JVM_LEAF(jint, JVM_Bind(jint fd, struct sockaddr *him, jint len))
JVMWrapper2("JVM_Bind (0x%x)", fd);
//%note jvm_r6
return os::bind(fd, him, len);
return os::bind(fd, him, (socklen_t)len);
JVM_END
JVM_LEAF(jint, JVM_Accept(jint fd, struct sockaddr *him, jint *len))
JVMWrapper2("JVM_Accept (0x%x)", fd);
//%note jvm_r6
return os::accept(fd, him, (int *)len);
socklen_t socklen = (socklen_t)(*len);
jint result = os::accept(fd, him, &socklen);
*len = (jint)socklen;
return result;
JVM_END
JVM_LEAF(jint, JVM_RecvFrom(jint fd, char *buf, int nBytes, int flags, struct sockaddr *from, int *fromlen))
JVMWrapper2("JVM_RecvFrom (0x%x)", fd);
//%note jvm_r6
return os::recvfrom(fd, buf, nBytes, flags, from, fromlen);
socklen_t socklen = (socklen_t)(*fromlen);
jint result = os::recvfrom(fd, buf, (size_t)nBytes, (uint)flags, from, &socklen);
*fromlen = (int)socklen;
return result;
JVM_END
JVM_LEAF(jint, JVM_GetSockName(jint fd, struct sockaddr *him, int *len))
JVMWrapper2("JVM_GetSockName (0x%x)", fd);
//%note jvm_r6
return os::get_sock_name(fd, him, len);
socklen_t socklen = (socklen_t)(*len);
jint result = os::get_sock_name(fd, him, &socklen);
*len = (int)socklen;
return result;
JVM_END
JVM_LEAF(jint, JVM_SendTo(jint fd, char *buf, int len, int flags, struct sockaddr *to, int tolen))
JVMWrapper2("JVM_SendTo (0x%x)", fd);
//%note jvm_r6
return os::sendto(fd, buf, len, flags, to, tolen);
return os::sendto(fd, buf, (size_t)len, (uint)flags, to, (socklen_t)tolen);
JVM_END
@ -3592,21 +3601,26 @@ JVM_END
JVM_LEAF(jint, JVM_GetSockOpt(jint fd, int level, int optname, char *optval, int *optlen))
JVMWrapper2("JVM_GetSockOpt (0x%x)", fd);
//%note jvm_r6
return os::get_sock_opt(fd, level, optname, optval, optlen);
socklen_t socklen = (socklen_t)(*optlen);
jint result = os::get_sock_opt(fd, level, optname, optval, &socklen);
*optlen = (int)socklen;
return result;
JVM_END
JVM_LEAF(jint, JVM_SetSockOpt(jint fd, int level, int optname, const char *optval, int optlen))
JVMWrapper2("JVM_GetSockOpt (0x%x)", fd);
//%note jvm_r6
return os::set_sock_opt(fd, level, optname, optval, optlen);
return os::set_sock_opt(fd, level, optname, optval, (socklen_t)optlen);
JVM_END
JVM_LEAF(int, JVM_GetHostName(char* name, int namelen))
JVMWrapper("JVM_GetHostName");
return os::get_host_name(name, namelen);
JVM_END
// Library support ///////////////////////////////////////////////////////////////////////////
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
@ -3647,6 +3661,7 @@ JVM_LEAF(void*, JVM_FindLibraryEntry(void* handle, const char* name))
return os::dll_lookup(handle, name);
JVM_END
// Floating point support ////////////////////////////////////////////////////////////////////
JVM_LEAF(jboolean, JVM_IsNaN(jdouble a))
@ -3655,7 +3670,6 @@ JVM_LEAF(jboolean, JVM_IsNaN(jdouble a))
JVM_END
// JNI version ///////////////////////////////////////////////////////////////////////////////
JVM_LEAF(jboolean, JVM_IsSupportedJNIVersion(jint version))

View File

@ -43,7 +43,7 @@
#ifdef TARGET_ARCH_ppc
# include "bytes_ppc.hpp"
#endif
// FIXME: add Deprecated, LVT, LVTT attributes
// FIXME: add Deprecated, LVTT attributes
// FIXME: fix Synthetic attribute
// FIXME: per Serguei, add error return handling for constantPoolOopDesc::copy_cpool_bytes()
@ -136,8 +136,9 @@ void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
constMethodHandle const_method(thread(), method->constMethod());
u2 line_num_cnt = 0;
int stackmap_len = 0;
int local_variable_table_length = 0;
// compute number and length of attributes -- FIXME: for now no LVT
// compute number and length of attributes
int attr_count = 0;
int attr_size = 0;
if (const_method->has_linenumber_table()) {
@ -170,6 +171,25 @@ void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
attr_size += 2 + 4 + stackmap_len;
}
}
if (method->has_localvariable_table()) {
local_variable_table_length = method->localvariable_table_length();
++attr_count;
if (local_variable_table_length != 0) {
// Compute the size of the local variable table attribute (VM stores raw):
// LocalVariableTable_attribute {
// u2 attribute_name_index;
// u4 attribute_length;
// u2 local_variable_table_length;
// {
// u2 start_pc;
// u2 length;
// u2 name_index;
// u2 descriptor_index;
// u2 index;
// }
attr_size += 2 + 4 + 2 + local_variable_table_length * (2 + 2 + 2 + 2 + 2);
}
}
typeArrayHandle exception_table(thread(), const_method->exception_table());
int exception_table_length = exception_table->length();
@ -203,8 +223,9 @@ void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
if (stackmap_len != 0) {
write_stackmap_table_attribute(method, stackmap_len);
}
// FIXME: write LVT attribute
if (local_variable_table_length != 0) {
write_local_variable_table_attribute(method, local_variable_table_length);
}
}
// Write Exceptions attribute
@ -371,6 +392,36 @@ void JvmtiClassFileReconstituter::write_line_number_table_attribute(methodHandle
}
}
// Write LineNumberTable attribute
// JVMSpec| LocalVariableTable_attribute {
// JVMSpec| u2 attribute_name_index;
// JVMSpec| u4 attribute_length;
// JVMSpec| u2 local_variable_table_length;
// JVMSpec| { u2 start_pc;
// JVMSpec| u2 length;
// JVMSpec| u2 name_index;
// JVMSpec| u2 descriptor_index;
// JVMSpec| u2 index;
// JVMSpec| } local_variable_table[local_variable_table_length];
// JVMSpec| }
void JvmtiClassFileReconstituter::write_local_variable_table_attribute(methodHandle method, u2 num_entries) {
write_attribute_name_index("LocalVariableTable");
write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2));
write_u2(num_entries);
assert(method->localvariable_table_length() == num_entries, "just checking");
LocalVariableTableElement *elem = method->localvariable_table_start();
for (int j=0; j<method->localvariable_table_length(); j++) {
write_u2(elem->start_bci);
write_u2(elem->length);
write_u2(elem->name_cp_index);
write_u2(elem->descriptor_cp_index);
write_u2(elem->slot);
elem++;
}
}
// Write stack map table attribute
// JSR-202| StackMapTable_attribute {
// JSR-202| u2 attribute_name_index;

View File

@ -119,6 +119,7 @@ class JvmtiClassFileReconstituter : public JvmtiConstantPoolReconstituter {
void write_source_debug_extension_attribute();
u2 line_number_table_entries(methodHandle method);
void write_line_number_table_attribute(methodHandle method, u2 num_entries);
void write_local_variable_table_attribute(methodHandle method, u2 num_entries);
void write_stackmap_table_attribute(methodHandle method, int stackmap_table_len);
u2 inner_classes_attribute_length();
void write_inner_classes_attribute(int length);

View File

@ -82,16 +82,19 @@ bool Flag::is_unlocked() const {
}
bool Flag::is_writeable() const {
return (strcmp(kind, "{manageable}") == 0 || strcmp(kind, "{product rw}") == 0);
return strcmp(kind, "{manageable}") == 0 ||
strcmp(kind, "{product rw}") == 0 ||
is_writeable_ext();
}
// All flags except "manageable" are assumed internal flags.
// All flags except "manageable" are assumed to be internal flags.
// Long term, we need to define a mechanism to specify which flags
// are external/stable and change this function accordingly.
bool Flag::is_external() const {
return (strcmp(kind, "{manageable}") == 0);
return strcmp(kind, "{manageable}") == 0 || is_external_ext();
}
// Length of format string (e.g. "%.1234s") for printing ccstr below
#define FORMAT_BUFFER_LEN 16

View File

@ -245,6 +245,8 @@ struct Flag {
bool is_unlocker_ext() const;
bool is_unlocked_ext() const;
bool is_writeable_ext() const;
bool is_external_ext() const;
void print_on(outputStream* st, bool withComments = false );
void print_as_flag(outputStream* st);

View File

@ -53,4 +53,12 @@ inline bool Flag::is_unlocked_ext() const {
return true;
}
inline bool Flag::is_writeable_ext() const {
return false;
}
inline bool Flag::is_external_ext() const {
return false;
}
#endif // SHARE_VM_RUNTIME_GLOBALS_EXT_HPP

View File

@ -584,28 +584,28 @@ class os: AllStatic {
static int socket(int domain, int type, int protocol);
static int socket_close(int fd);
static int socket_shutdown(int fd, int howto);
static int recv(int fd, char *buf, int nBytes, int flags);
static int send(int fd, char *buf, int nBytes, int flags);
static int raw_send(int fd, char *buf, int nBytes, int flags);
static int recv(int fd, char* buf, size_t nBytes, uint flags);
static int send(int fd, char* buf, size_t nBytes, uint flags);
static int raw_send(int fd, char* buf, size_t nBytes, uint flags);
static int timeout(int fd, long timeout);
static int listen(int fd, int count);
static int connect(int fd, struct sockaddr *him, int len);
static int bind(int fd, struct sockaddr *him, int len);
static int accept(int fd, struct sockaddr *him, int *len);
static int recvfrom(int fd, char *buf, int nbytes, int flags,
struct sockaddr *from, int *fromlen);
static int get_sock_name(int fd, struct sockaddr *him, int *len);
static int sendto(int fd, char *buf, int len, int flags,
struct sockaddr *to, int tolen);
static int socket_available(int fd, jint *pbytes);
static int connect(int fd, struct sockaddr* him, socklen_t len);
static int bind(int fd, struct sockaddr* him, socklen_t len);
static int accept(int fd, struct sockaddr* him, socklen_t* len);
static int recvfrom(int fd, char* buf, size_t nbytes, uint flags,
struct sockaddr* from, socklen_t* fromlen);
static int get_sock_name(int fd, struct sockaddr* him, socklen_t* len);
static int sendto(int fd, char* buf, size_t len, uint flags,
struct sockaddr* to, socklen_t tolen);
static int socket_available(int fd, jint* pbytes);
static int get_sock_opt(int fd, int level, int optname,
char *optval, int* optlen);
char* optval, socklen_t* optlen);
static int set_sock_opt(int fd, int level, int optname,
const char *optval, int optlen);
const char* optval, socklen_t optlen);
static int get_host_name(char* name, int namelen);
static struct hostent* get_host_by_name(char* name);
static struct hostent* get_host_by_name(char* name);
// Printing 64 bit integers
static const char* jlong_format_specifier();
@ -715,7 +715,6 @@ class os: AllStatic {
# include "os_bsd_zero.hpp"
#endif
// debugging support (mostly used by debug.cpp but also fatal error handler)
static bool find(address pc, outputStream* st = tty); // OS specific function to make sense out of an address

View File

@ -33,6 +33,7 @@
#include "oops/objArrayKlass.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/arguments.hpp"
#include "runtime/globals.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/interfaceSupport.hpp"
#include "runtime/javaCalls.hpp"

View File

@ -175,6 +175,9 @@ const int MILLIUNITS = 1000; // milli units per base unit
const int MICROUNITS = 1000000; // micro units per base unit
const int NANOUNITS = 1000000000; // nano units per base unit
const jlong NANOSECS_PER_SEC = CONST64(1000000000);
const jint NANOSECS_PER_MILLISEC = 1000000;
inline const char* proper_unit_for_byte_size(size_t s) {
if (s >= 10*M) {
return "M";

View File

@ -1021,7 +1021,7 @@ int networkStream::read(char *buf, size_t len) {
void networkStream::flush() {
if (size() != 0) {
int result = os::raw_send(_socket, (char *)base(), (int)size(), 0);
int result = os::raw_send(_socket, (char *)base(), size(), 0);
assert(result != -1, "connection error");
assert(result == (int)size(), "didn't send enough data");
}

View File

@ -93,8 +93,7 @@ bool QuickSort::sort_and_compare(int* arrayToSort, int* expectedResult, int leng
return compare_arrays(arrayToSort, expectedResult, length);
}
bool QuickSort::test_quick_sort() {
tty->print_cr("test_quick_sort");
void QuickSort::test_quick_sort() {
{
int* test_array = NULL;
int* expected_array = NULL;
@ -214,7 +213,6 @@ bool QuickSort::test_quick_sort() {
delete[] test_array;
delete[] expected_array;
}
return true;
}
#endif

View File

@ -130,7 +130,7 @@ class QuickSort : AllStatic {
static void print_array(const char* prefix, int* array, int length);
static bool compare_arrays(int* actual, int* expected, int length);
template <class C> static bool sort_and_compare(int* arrayToSort, int* expectedResult, int length, C comparator, bool idempotent = false);
static bool test_quick_sort();
static void test_quick_sort();
#endif
};

View File

@ -139,3 +139,4 @@ f1ec21b8142168ff40f3278d2f6b5fe4bd5f3b26 jdk8-b09
3c248d0e2c486624cc0d7aba1e4df45ae5774ff7 jdk8-b15
b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17
929597c6e777f742ad252660045ebaa4a3ea4772 jdk8-b16
334bd51fb3f321cd6777416ae7bafac71a84140a jdk8-b18

View File

@ -239,7 +239,7 @@ classes : $(CLASSES_INIT) .delete.classlist .compile.classlist
$(CAT) $<.filtered; \
$(ECHO) "# Running javac: $$numfiles files; in $(CURDIR)"; \
$(ECHO) $(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
$(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered; \
$(JAVAC_CMD) -sourcepath "$(SOURCEPATH)" -d $(CLASSDESTDIR) @$<.filtered && \
$(ECHO) "# javac finished"; \
fi
@$(java-vm-cleanup)

View File

@ -25,15 +25,15 @@
# Properties for jprt
# Release to build for
# Locked down to jdk8
jprt.tools.default.release=jdk8
# The different build flavors we want, we override here so we just get these 2
jprt.build.flavors=product,fastdebug
# Standard list of jprt build targets for this source tree
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
jprt.build.targets= \
solaris_sparc_5.10-{product|fastdebug}, \
solaris_sparcv9_5.10-{product|fastdebug}, \
solaris_i586_5.10-{product|fastdebug}, \
solaris_x64_5.10-{product|fastdebug}, \
@ -45,247 +45,59 @@ jprt.build.targets= \
# User can select the test set with jprt submit "-testset name" option
jprt.my.test.set=${jprt.test.set}
# Standard vm test target
# Test target list (no fastdebug & limited c2 testing)
jprt.my.test.target.set= \
solaris_sparc_5.10-product-c1-TESTNAME, \
solaris_sparcv9_5.10-product-c2-TESTNAME, \
solaris_i586_5.10-product-c1-TESTNAME, \
solaris_x64_5.10-product-c2-TESTNAME, \
linux_i586_2.6-product-{c1|c2}-TESTNAME, \
linux_x64_2.6-product-c2-TESTNAME, \
windows_i586_5.1-product-c1-TESTNAME, \
windows_x64_5.2-product-c2-TESTNAME
# Default vm test targets (testset=default)
jprt.vm.default.test.targets= \
solaris_sparc_5.10-product-c1-jvm98, \
solaris_sparcv9_5.10-product-c2-jvm98, \
solaris_i586_5.10-product-c1-jvm98, \
solaris_x64_5.10-product-c2-jvm98, \
linux_i586_2.6-product-{c1|c2}-jvm98, \
linux_x64_2.6-product-c2-jvm98, \
windows_i586_5.1-product-c1-jvm98, \
windows_x64_5.2-product-c2-jvm98
${jprt.my.test.target.set:TESTNAME=jvm98}
# Select vm testlist to use (allow for testset to be empty too)
jprt.vm.all.test.targets=${jprt.vm.default.test.targets}
jprt.vm..test.targets=${jprt.vm.default.test.targets}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Default jdk test targets in test/Makefile (no fastdebug & limited c2)
# Default jdk test targets (testset=default)
jprt.make.rule.default.test.targets= \
\
solaris_sparc_5.10-product-c1-jdk_beans1, \
solaris_sparcv9_5.10-product-c2-jdk_beans1, \
solaris_i586_5.10-product-c1-jdk_beans1, \
solaris_x64_5.10-product-c2-jdk_beans1, \
linux_i586_2.6-product-{c1|c2}-jdk_beans1, \
linux_x64_2.6-product-c2-jdk_beans1, \
windows_i586_5.1-product-c1-jdk_beans1, \
windows_x64_5.2-product-c2-jdk_beans1, \
\
solaris_sparc_5.10-product-c1-jdk_io, \
solaris_sparcv9_5.10-product-c2-jdk_io, \
solaris_i586_5.10-product-c1-jdk_io, \
solaris_x64_5.10-product-c2-jdk_io, \
linux_i586_2.6-product-{c1|c2}-jdk_io, \
linux_x64_2.6-product-c2-jdk_io, \
windows_i586_5.1-product-c1-jdk_io, \
windows_x64_5.2-product-c2-jdk_io, \
\
solaris_sparc_5.10-product-c1-jdk_lang, \
solaris_sparcv9_5.10-product-c2-jdk_lang, \
solaris_i586_5.10-product-c1-jdk_lang, \
solaris_x64_5.10-product-c2-jdk_lang, \
linux_i586_2.6-product-{c1|c2}-jdk_lang, \
linux_x64_2.6-product-c2-jdk_lang, \
windows_i586_5.1-product-c1-jdk_lang, \
windows_x64_5.2-product-c2-jdk_lang, \
\
solaris_sparc_5.10-product-c1-jdk_math, \
solaris_sparcv9_5.10-product-c2-jdk_math, \
solaris_i586_5.10-product-c1-jdk_math, \
solaris_x64_5.10-product-c2-jdk_math, \
linux_i586_2.6-product-{c1|c2}-jdk_math, \
linux_x64_2.6-product-c2-jdk_math, \
windows_i586_5.1-product-c1-jdk_math, \
windows_x64_5.2-product-c2-jdk_math, \
\
solaris_sparc_5.10-product-c1-jdk_misc, \
solaris_sparcv9_5.10-product-c2-jdk_misc, \
solaris_i586_5.10-product-c1-jdk_misc, \
solaris_x64_5.10-product-c2-jdk_misc, \
linux_i586_2.6-product-{c1|c2}-jdk_misc, \
linux_x64_2.6-product-c2-jdk_misc, \
windows_i586_5.1-product-c1-jdk_misc, \
windows_x64_5.2-product-c2-jdk_misc, \
\
solaris_sparc_5.10-product-c1-jdk_net, \
solaris_sparcv9_5.10-product-c2-jdk_net, \
solaris_i586_5.10-product-c1-jdk_net, \
solaris_x64_5.10-product-c2-jdk_net, \
linux_i586_2.6-product-{c1|c2}-jdk_net, \
linux_x64_2.6-product-c2-jdk_net, \
windows_i586_5.1-product-c1-jdk_net, \
windows_x64_5.2-product-c2-jdk_net, \
\
solaris_sparc_5.10-product-c1-jdk_nio1, \
solaris_sparcv9_5.10-product-c2-jdk_nio1, \
solaris_i586_5.10-product-c1-jdk_nio1, \
solaris_x64_5.10-product-c2-jdk_nio1, \
linux_i586_2.6-product-{c1|c2}-jdk_nio1, \
linux_x64_2.6-product-c2-jdk_nio1, \
windows_i586_5.1-product-c1-jdk_nio1, \
windows_x64_5.2-product-c2-jdk_nio1, \
\
solaris_sparc_5.10-product-c1-jdk_nio2, \
solaris_sparcv9_5.10-product-c2-jdk_nio2, \
solaris_i586_5.10-product-c1-jdk_nio2, \
solaris_x64_5.10-product-c2-jdk_nio2, \
linux_i586_2.6-product-{c1|c2}-jdk_nio2, \
linux_x64_2.6-product-c2-jdk_nio2, \
windows_i586_5.1-product-c1-jdk_nio2, \
windows_x64_5.2-product-c2-jdk_nio2, \
\
solaris_sparc_5.10-product-c1-jdk_nio3, \
solaris_sparcv9_5.10-product-c2-jdk_nio3, \
solaris_i586_5.10-product-c1-jdk_nio3, \
solaris_x64_5.10-product-c2-jdk_nio3, \
linux_i586_2.6-product-{c1|c2}-jdk_nio3, \
linux_x64_2.6-product-c2-jdk_nio3, \
windows_i586_5.1-product-c1-jdk_nio3, \
windows_x64_5.2-product-c2-jdk_nio3, \
\
solaris_sparc_5.10-product-c1-jdk_security1, \
solaris_sparcv9_5.10-product-c2-jdk_security1, \
solaris_i586_5.10-product-c1-jdk_security1, \
solaris_x64_5.10-product-c2-jdk_security1, \
linux_i586_2.6-product-{c1|c2}-jdk_security1, \
linux_x64_2.6-product-c2-jdk_security1, \
windows_i586_5.1-product-c1-jdk_security1, \
windows_x64_5.2-product-c2-jdk_security1, \
\
solaris_sparc_5.10-product-c1-jdk_text, \
solaris_sparcv9_5.10-product-c2-jdk_text, \
solaris_i586_5.10-product-c1-jdk_text, \
solaris_x64_5.10-product-c2-jdk_text, \
linux_i586_2.6-product-{c1|c2}-jdk_text, \
linux_x64_2.6-product-c2-jdk_text, \
windows_i586_5.1-product-c1-jdk_text, \
windows_x64_5.2-product-c2-jdk_text, \
\
solaris_sparc_5.10-product-c1-jdk_tools1, \
solaris_sparcv9_5.10-product-c2-jdk_tools1, \
solaris_i586_5.10-product-c1-jdk_tools1, \
solaris_x64_5.10-product-c2-jdk_tools1, \
linux_i586_2.6-product-{c1|c2}-jdk_tools1, \
linux_x64_2.6-product-c2-jdk_tools1, \
windows_i586_5.1-product-c1-jdk_tools1, \
windows_x64_5.2-product-c2-jdk_tools1, \
\
solaris_sparc_5.10-product-c1-jdk_util, \
solaris_sparcv9_5.10-product-c2-jdk_util, \
solaris_i586_5.10-product-c1-jdk_util, \
solaris_x64_5.10-product-c2-jdk_util, \
linux_i586_2.6-product-{c1|c2}-jdk_util, \
linux_x64_2.6-product-c2-jdk_util, \
windows_i586_5.1-product-c1-jdk_util, \
windows_x64_5.2-product-c2-jdk_util
${jprt.my.test.target.set:TESTNAME=jdk_beans1}, \
${jprt.my.test.target.set:TESTNAME=jdk_io}, \
${jprt.my.test.target.set:TESTNAME=jdk_lang}, \
${jprt.my.test.target.set:TESTNAME=jdk_math}, \
${jprt.my.test.target.set:TESTNAME=jdk_misc}, \
${jprt.my.test.target.set:TESTNAME=jdk_net}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio1}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio2}, \
${jprt.my.test.target.set:TESTNAME=jdk_nio3}, \
${jprt.my.test.target.set:TESTNAME=jdk_security1}, \
${jprt.my.test.target.set:TESTNAME=jdk_text}, \
${jprt.my.test.target.set:TESTNAME=jdk_util}
# All jdk test targets in test/Makefile (still no fastdebug & limited c2)
# All vm test targets (testset=all)
jprt.vm.all.test.targets= \
${jprt.vm.default.test.targets}, \
${jprt.my.test.target.set:TESTNAME=runThese}, \
${jprt.my.test.target.set:TESTNAME=jbb_default}
# All jdk test targets (testset=all)
jprt.make.rule.all.test.targets= \
\
${jprt.make.rule.default.test.targets}, \
\
solaris_sparc_5.10-product-c1-jdk_awt, \
solaris_sparcv9_5.10-product-c2-jdk_awt, \
solaris_i586_5.10-product-c1-jdk_awt, \
solaris_x64_5.10-product-c2-jdk_awt, \
linux_i586_2.6-product-{c1|c2}-jdk_awt, \
linux_x64_2.6-product-c2-jdk_awt, \
windows_i586_5.1-product-c1-jdk_awt, \
windows_x64_5.2-product-c2-jdk_awt, \
\
solaris_sparc_5.10-product-c1-jdk_beans2, \
solaris_sparcv9_5.10-product-c2-jdk_beans2, \
solaris_i586_5.10-product-c1-jdk_beans2, \
solaris_x64_5.10-product-c2-jdk_beans2, \
linux_i586_2.6-product-{c1|c2}-jdk_beans2, \
linux_x64_2.6-product-c2-jdk_beans2, \
windows_i586_5.1-product-c1-jdk_beans2, \
windows_x64_5.2-product-c2-jdk_beans2, \
\
solaris_sparc_5.10-product-c1-jdk_beans3, \
solaris_sparcv9_5.10-product-c2-jdk_beans3, \
solaris_i586_5.10-product-c1-jdk_beans3, \
solaris_x64_5.10-product-c2-jdk_beans3, \
linux_i586_2.6-product-{c1|c2}-jdk_beans3, \
linux_x64_2.6-product-c2-jdk_beans3, \
windows_i586_5.1-product-c1-jdk_beans3, \
windows_x64_5.2-product-c2-jdk_beans3, \
\
solaris_sparc_5.10-product-c1-jdk_management1, \
solaris_sparcv9_5.10-product-c2-jdk_management1, \
solaris_i586_5.10-product-c1-jdk_management1, \
solaris_x64_5.10-product-c2-jdk_management1, \
linux_i586_2.6-product-{c1|c2}-jdk_management1, \
linux_x64_2.6-product-c2-jdk_management1, \
windows_i586_5.1-product-c1-jdk_management1, \
windows_x64_5.2-product-c2-jdk_management1, \
\
solaris_sparc_5.10-product-c1-jdk_management2, \
solaris_sparcv9_5.10-product-c2-jdk_management2, \
solaris_i586_5.10-product-c1-jdk_management2, \
solaris_x64_5.10-product-c2-jdk_management2, \
linux_i586_2.6-product-{c1|c2}-jdk_management2, \
linux_x64_2.6-product-c2-jdk_management2, \
windows_i586_5.1-product-c1-jdk_management2, \
windows_x64_5.2-product-c2-jdk_management2, \
\
solaris_sparc_5.10-product-c1-jdk_rmi, \
solaris_sparcv9_5.10-product-c2-jdk_rmi, \
solaris_i586_5.10-product-c1-jdk_rmi, \
solaris_x64_5.10-product-c2-jdk_rmi, \
linux_i586_2.6-product-{c1|c2}-jdk_rmi, \
linux_x64_2.6-product-c2-jdk_rmi, \
windows_i586_5.1-product-c1-jdk_rmi, \
windows_x64_5.2-product-c2-jdk_rmi, \
\
solaris_sparc_5.10-product-c1-jdk_security2, \
solaris_sparcv9_5.10-product-c2-jdk_security2, \
solaris_i586_5.10-product-c1-jdk_security2, \
solaris_x64_5.10-product-c2-jdk_security2, \
linux_i586_2.6-product-{c1|c2}-jdk_security2, \
linux_x64_2.6-product-c2-jdk_security2, \
windows_i586_5.1-product-c1-jdk_security2, \
windows_x64_5.2-product-c2-jdk_security2, \
\
solaris_sparc_5.10-product-c1-jdk_security3, \
solaris_sparcv9_5.10-product-c2-jdk_security3, \
solaris_i586_5.10-product-c1-jdk_security3, \
solaris_x64_5.10-product-c2-jdk_security3, \
linux_i586_2.6-product-{c1|c2}-jdk_security3, \
linux_x64_2.6-product-c2-jdk_security3, \
windows_i586_5.1-product-c1-jdk_security3, \
windows_x64_5.2-product-c2-jdk_security3, \
\
solaris_sparc_5.10-product-c1-jdk_sound, \
solaris_sparcv9_5.10-product-c2-jdk_sound, \
solaris_i586_5.10-product-c1-jdk_sound, \
solaris_x64_5.10-product-c2-jdk_sound, \
linux_i586_2.6-product-{c1|c2}-jdk_sound, \
linux_x64_2.6-product-c2-jdk_sound, \
windows_i586_5.1-product-c1-jdk_sound, \
windows_x64_5.2-product-c2-jdk_sound, \
\
solaris_sparc_5.10-product-c1-jdk_swing, \
solaris_sparcv9_5.10-product-c2-jdk_swing, \
solaris_i586_5.10-product-c1-jdk_swing, \
solaris_x64_5.10-product-c2-jdk_swing, \
linux_i586_2.6-product-{c1|c2}-jdk_swing, \
linux_x64_2.6-product-c2-jdk_swing, \
windows_i586_5.1-product-c1-jdk_swing, \
windows_x64_5.2-product-c2-jdk_swing, \
\
solaris_sparc_5.10-product-c1-jdk_tools2, \
solaris_sparcv9_5.10-product-c2-jdk_tools2, \
solaris_i586_5.10-product-c1-jdk_tools2, \
solaris_x64_5.10-product-c2-jdk_tools2, \
linux_i586_2.6-product-{c1|c2}-jdk_tools2, \
linux_x64_2.6-product-c2-jdk_tools2, \
windows_i586_5.1-product-c1-jdk_tools2, \
windows_x64_5.2-product-c2-jdk_tools2
${jprt.make.rule.default.test.targets}, \
${jprt.my.test.target.set:TESTNAME=jdk_awt}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans2}, \
${jprt.my.test.target.set:TESTNAME=jdk_beans3}, \
${jprt.my.test.target.set:TESTNAME=jdk_management1}, \
${jprt.my.test.target.set:TESTNAME=jdk_management2}, \
${jprt.my.test.target.set:TESTNAME=jdk_rmi}, \
${jprt.my.test.target.set:TESTNAME=jdk_security2}, \
${jprt.my.test.target.set:TESTNAME=jdk_security3}, \
${jprt.my.test.target.set:TESTNAME=jdk_sound}, \
${jprt.my.test.target.set:TESTNAME=jdk_swing}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools1}, \
${jprt.my.test.target.set:TESTNAME=jdk_tools2}
# JCK test targets in test/Makefile (no fastdebug & limited c2, windows broken)
# JCK test targets in test/Makefile (no windows)
jprt.my.jck.test.target.set= \
solaris_sparc_5.10-product-c1-JCK7TESTRULE, \
solaris_sparcv9_5.10-product-c2-JCK7TESTRULE, \
@ -301,8 +113,10 @@ jprt.make.rule.jck.test.targets= \
${jprt.my.jck.test.target.set:JCK7TESTRULE=jck7compiler}
# Select list to use (allow for testset to be empty too)
jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
jprt.make.rule..test.targets=${jprt.make.rule.default.test.targets}
jprt.make.rule.test.targets=${jprt.make.rule.${jprt.my.test.set}.test.targets}
jprt.vm..test.targets=${jprt.vm.default.test.targets}
jprt.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
# Directories to be excluded from the source bundles
jprt.bundle.exclude.src.dirs=build dist webrev

View File

@ -35,7 +35,7 @@ class ArrayRegionTypeNode extends AbstractSimpleTypeNode {
}
String javaType() {
return "List";
return "List<?>";
}
public void genJavaWrite(PrintWriter writer, int depth,

View File

@ -89,7 +89,7 @@ class OutNode extends AbstractTypeListNode {
if (Main.genDebug) {
indent(writer, depth+1);
writer.println(
"if ((vm.traceFlags & vm.TRACE_SENDS) != 0) {");
"if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {");
indent(writer, depth+2);
writer.print(
"vm.printTrace(\"Sending Command(id=\" + ps.pkt.id + \") ");

View File

@ -29,5 +29,5 @@ package com.sun.java.swing;
*
* @deprecated Use {@link javax.swing.Painter} instead.
*/
public interface Painter<T> extends javax.swing.Painter {
public interface Painter<T> extends javax.swing.Painter<T> {
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
*/
public class AbsentInformationException extends Exception
{
private static final long serialVersionUID = 4988939309582416373L;
public AbsentInformationException()
{
super();

View File

@ -69,6 +69,7 @@ package com.sun.jdi;
*/
public class ClassNotLoadedException extends Exception
{
private static final long serialVersionUID = -6242978768444298722L;
private String className;
public ClassNotLoadedException(String className) {

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class ClassNotPreparedException extends RuntimeException {
private static final long serialVersionUID = -6120698967144079642L;
public ClassNotPreparedException()
{
super();

View File

@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class IncompatibleThreadStateException extends Exception
{
private static final long serialVersionUID = 6199174323414551389L;
public IncompatibleThreadStateException()
{
super();

View File

@ -35,6 +35,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InconsistentDebugInfoException extends RuntimeException {
private static final long serialVersionUID = 7964236415376861808L;
public InconsistentDebugInfoException() {
super();
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InternalException extends RuntimeException {
private static final long serialVersionUID = -9171606393104480607L;
private int errorCode;
public InternalException() {

View File

@ -36,6 +36,7 @@ package com.sun.jdi;
*/
@Deprecated
public class InvalidCodeIndexException extends RuntimeException {
private static final long serialVersionUID = 7416010225133747805L;
public InvalidCodeIndexException() {
super();
}

View File

@ -36,6 +36,7 @@ package com.sun.jdi;
*/
@Deprecated
public class InvalidLineNumberException extends RuntimeException {
private static final long serialVersionUID = 4048709912372692875L;
public InvalidLineNumberException() {
super();
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class InvalidStackFrameException extends RuntimeException {
private static final long serialVersionUID = -1919378296505827922L;
public InvalidStackFrameException() {
super();
}

View File

@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class InvalidTypeException extends Exception
{
private static final long serialVersionUID = 2256667231949650806L;
public InvalidTypeException()
{
super();

View File

@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class InvocationException extends Exception
{
private static final long serialVersionUID = 6066780907971918568L;
ObjectReference exception;
public InvocationException(ObjectReference exception)

View File

@ -79,7 +79,7 @@ package com.sun.jdi;
*/
public final class JDIPermission extends java.security.BasicPermission {
private static final long serialVersionUID = -6988461416938786271L;
/**
* The <code>JDIPermission</code> class represents access rights to the
* <code>VirtualMachineManager</code>

View File

@ -34,6 +34,7 @@ package com.sun.jdi;
*/
public class NativeMethodException extends RuntimeException {
private static final long serialVersionUID = 3924951669039469992L;
public NativeMethodException() {
super();
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class ObjectCollectedException extends RuntimeException {
private static final long serialVersionUID = -1928428056197269588L;
public ObjectCollectedException() {
super();
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.5
*/
public class VMCannotBeModifiedException extends UnsupportedOperationException {
private static final long serialVersionUID = -4063879815130164009L;
public VMCannotBeModifiedException() {
super();
}

View File

@ -35,6 +35,7 @@ package com.sun.jdi;
*/
public class VMDisconnectedException extends RuntimeException {
private static final long serialVersionUID = 2892975269768351637L;
public VMDisconnectedException() {
super();
}

View File

@ -34,6 +34,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class VMMismatchException extends RuntimeException {
private static final long serialVersionUID = 289169358790459564L;
public VMMismatchException() {
super();
}

View File

@ -33,6 +33,7 @@ package com.sun.jdi;
* @since 1.3
*/
public class VMOutOfMemoryException extends RuntimeException {
private static final long serialVersionUID = 71504228548910686L;
public VMOutOfMemoryException() {
super();
}

View File

@ -38,6 +38,7 @@ import java.util.Collections;
*/
public class IllegalConnectorArgumentsException extends Exception
{
private static final long serialVersionUID = -3042212603611350941L;
List<String> names;
/**

View File

@ -55,7 +55,7 @@ package com.sun.jdi.connect;
* @since 1.5
*/
public class TransportTimeoutException extends java.io.IOException {
private static final long serialVersionUID = 4107035242623365074L;
/**
* Constructs a <tt>TransportTimeoutException</tt> with no detail
* message.

View File

@ -36,6 +36,7 @@ package com.sun.jdi.connect;
*/
public class VMStartException extends Exception
{
private static final long serialVersionUID = 6408644824640801020L;
Process process;
public VMStartException(Process process) {

View File

@ -46,7 +46,7 @@ package com.sun.jdi.connect.spi;
* @since 1.5
*/
public class ClosedConnectionException extends java.io.IOException {
private static final long serialVersionUID = 3877032124297204774L;
/**
* Constructs a <tt>ClosedConnectionException</tt> with no detail
* message.

View File

@ -33,6 +33,7 @@ package com.sun.jdi.request;
*/
public class DuplicateRequestException extends RuntimeException
{
private static final long serialVersionUID = -3719784920313411060L;
public DuplicateRequestException()
{
super();

View File

@ -36,6 +36,7 @@ package com.sun.jdi.request;
* @since 1.3
*/
public class InvalidRequestStateException extends RuntimeException {
private static final long serialVersionUID = -3774632428543322148L;
public InvalidRequestStateException()
{
super();

View File

@ -70,8 +70,8 @@ public class ArrayReferenceImpl extends ObjectReferenceImpl
}
public Value getValue(int index) {
List list = getValues(index, 1);
return (Value)list.get(0);
List<Value> list = getValues(index, 1);
return list.get(0);
}
public List<Value> getValues() {

View File

@ -61,7 +61,7 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
return findType(componentSignature());
}
void addVisibleMethods(Map map) {
void addVisibleMethods(Map<String, Method> map) {
// arrays don't have methods
}
@ -83,10 +83,10 @@ public class ArrayTypeImpl extends ReferenceTypeImpl
if (PacketStream.isObjectTag(tag)) {
// It's a reference type
JNITypeParser parser = new JNITypeParser(componentSignature());
List list = vm.classesByName(parser.typeName());
Iterator iter = list.iterator();
List<ReferenceType> list = vm.classesByName(parser.typeName());
Iterator<ReferenceType> iter = list.iterator();
while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next();
ReferenceType type = iter.next();
ClassLoaderReference cl = type.classLoader();
if ((cl == null)?
(classLoader() == null) :

View File

@ -78,7 +78,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
}
public int intValue() {
return(int)((value)?1:0);
return (value)?1:0;
}
public long longValue() {
@ -90,7 +90,7 @@ public class BooleanValueImpl extends PrimitiveValueImpl
}
public double doubleValue() {
return(double)((value)?1.0:0.0);
return (value)?1.0:0.0;
}
public String toString() {

View File

@ -75,7 +75,7 @@ public class CharValueImpl extends PrimitiveValueImpl
}
public char charValue() {
return(char)value;
return value;
}
public short shortValue() {

View File

@ -80,7 +80,7 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
classes = Collections.unmodifiableList(classes);
if (local != null) {
local.visibleClasses = classes;
if ((vm.traceFlags & vm.TRACE_OBJREFS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_OBJREFS) != 0) {
vm.printTrace(description() +
" temporarily caching visible classes (count = " +
classes.size() + ")");
@ -95,9 +95,9 @@ public class ClassLoaderReferenceImpl extends ObjectReferenceImpl
Type findType(String signature) throws ClassNotLoadedException {
List<ReferenceType> types = visibleClasses();
Iterator iter = types.iterator();
Iterator<ReferenceType> iter = types.iterator();
while (iter.hasNext()) {
ReferenceType type = (ReferenceType)iter.next();
ReferenceType type = iter.next();
if (type.signature().equals(signature)) {
return type;
}

View File

@ -76,7 +76,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
List<InterfaceType> immediate = interfaces();
list.addAll(interfaces());
Iterator iter = immediate.iterator();
Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addSuperinterfaces(list);
@ -389,7 +389,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
* overwrite them in the hash table
*/
Iterator iter = interfaces().iterator();
Iterator<InterfaceType> iter = interfaces().iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
interfaze.addVisibleMethods(methodMap);
@ -411,7 +411,7 @@ public class ClassTypeImpl extends ReferenceTypeImpl
return true;
} else {
List<InterfaceType> interfaces = interfaces();
Iterator iter = interfaces.iterator();
Iterator<InterfaceType> iter = interfaces.iterator();
while (iter.hasNext()) {
InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next();
if (interfaze.isAssignableTo(type)) {

View File

@ -192,7 +192,7 @@ public class ConcreteMethodImpl extends MethodImpl {
return super.codeIndexToLineInfo(stratum, codeIndex);
}
Iterator iter = lineLocations.iterator();
Iterator<Location> iter = lineLocations.iterator();
/*
* Treat code before the beginning of the first line table
* entry as part of the first line. javac will generate
@ -221,9 +221,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(2);
Iterator iter = variables.iterator();
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next();
LocalVariable variable = iter.next();
if (variable.name().equals(name)) {
retList.add(variable);
}
@ -235,9 +235,9 @@ public class ConcreteMethodImpl extends MethodImpl {
List<LocalVariable> variables = getVariables();
List<LocalVariable> retList = new ArrayList<LocalVariable>(variables.size());
Iterator iter = variables.iterator();
Iterator<LocalVariable> iter = variables.iterator();
while(iter.hasNext()) {
LocalVariable variable = (LocalVariable)iter.next();
LocalVariable variable = iter.next();
if (variable.isArgument()) {
retList.add(variable);
}
@ -291,7 +291,7 @@ public class ConcreteMethodImpl extends MethodImpl {
SDE.LineStratum lastLineStratum = null;
SDE.Stratum baseStratum =
declaringType.stratum(SDE.BASE_STRATUM_NAME);
Iterator it = getBaseLocations().lineLocations.iterator();
Iterator<Location> it = getBaseLocations().lineLocations.iterator();
while(it.hasNext()) {
LocationImpl loc = (LocationImpl)it.next();
int baseLineNumber = loc.lineNumber(baseStratum);

View File

@ -47,9 +47,9 @@ abstract class ConnectorImpl implements Connector {
public Map<String,Argument> defaultArguments() {
Map<String,Argument> defaults = new java.util.LinkedHashMap<String,Argument>();
Collection values = defaultArguments.values();
Collection<Argument> values = defaultArguments.values();
Iterator iter = values.iterator();
Iterator<Argument> iter = values.iterator();
while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next();
defaults.put(argument.name(), (Argument)argument.clone());
@ -96,7 +96,7 @@ abstract class ConnectorImpl implements Connector {
mustSpecify, list));
}
ArgumentImpl argument(String name, Map arguments)
ArgumentImpl argument(String name, Map<String, ? extends Argument> arguments)
throws IllegalConnectorArgumentsException {
ArgumentImpl argument = (ArgumentImpl)arguments.get(name);
@ -130,7 +130,7 @@ abstract class ConnectorImpl implements Connector {
public String toString() {
String string = name() + " (defaults: ";
Iterator iter = defaultArguments().values().iterator();
Iterator<Argument> iter = defaultArguments().values().iterator();
boolean first = true;
while (iter.hasNext()) {
ArgumentImpl argument = (ArgumentImpl)iter.next();
@ -222,7 +222,7 @@ abstract class ConnectorImpl implements Connector {
class BooleanArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.BooleanArgument {
private static final long serialVersionUID = 1624542968639361316L;
BooleanArgumentImpl(String name, String label, String description,
boolean value,
boolean mustSpecify) {
@ -277,7 +277,7 @@ abstract class ConnectorImpl implements Connector {
class IntegerArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.IntegerArgument {
private static final long serialVersionUID = 763286081923797770L;
private final int min;
private final int max;
@ -378,7 +378,7 @@ abstract class ConnectorImpl implements Connector {
class StringArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.StringArgument {
private static final long serialVersionUID = 7500484902692107464L;
StringArgumentImpl(String name, String label, String description,
String value,
boolean mustSpecify) {
@ -396,7 +396,7 @@ abstract class ConnectorImpl implements Connector {
class SelectedArgumentImpl extends ConnectorImpl.ArgumentImpl
implements Connector.SelectedArgument {
private static final long serialVersionUID = -5689584530908382517L;
private final List<String> choices;
SelectedArgumentImpl(String name, String label, String description,

View File

@ -101,7 +101,7 @@ public class DoubleValueImpl extends PrimitiveValueImpl
}
public double doubleValue() {
return(double)value;
return value;
}
byte checkedByteValue() throws InvalidTypeException {

View File

@ -43,7 +43,7 @@ import java.util.*;
class EventRequestManagerImpl extends MirrorImpl
implements EventRequestManager
{
List[] requestLists;
List<? extends EventRequest>[] requestLists;
private static int methodExitEventCmd = 0;
static int JDWPtoJDISuspendPolicy(byte jdwpPolicy) {
@ -91,7 +91,7 @@ class EventRequestManagerImpl extends MirrorImpl
* access/modification should be protected by synchronizing on
* the enclosing instance of EventRequestImpl.
*/
List filters = new ArrayList();
List<Object> filters = new ArrayList<>();
boolean isEnabled = false;
boolean deleted = false;
@ -195,7 +195,6 @@ class EventRequestManagerImpl extends MirrorImpl
*/
synchronized void set() {
JDWP.EventRequest.Set.Modifier[] mods =
(JDWP.EventRequest.Set.Modifier[])
filters.toArray(
new JDWP.EventRequest.Set.Modifier[filters.size()]);
try {
@ -582,10 +581,10 @@ class EventRequestManagerImpl extends MirrorImpl
/*
* Make sure this isn't a duplicate
*/
List requests = stepRequests();
Iterator iter = requests.iterator();
List<StepRequest> requests = stepRequests();
Iterator<StepRequest> iter = requests.iterator();
while (iter.hasNext()) {
StepRequest request = (StepRequest)iter.next();
StepRequest request = iter.next();
if ((request != this) &&
request.isEnabled() &&
request.thread().equals(thread)) {
@ -735,7 +734,7 @@ class EventRequestManagerImpl extends MirrorImpl
}
requestLists = new List[highest+1];
for (int i=0; i <= highest; i++) {
requestLists[i] = new ArrayList();
requestLists[i] = new ArrayList<>();
}
}
@ -852,7 +851,7 @@ class EventRequestManagerImpl extends MirrorImpl
public void deleteEventRequests(List<? extends EventRequest> eventRequests) {
validateMirrors(eventRequests);
// copy the eventRequests to avoid ConcurrentModificationException
Iterator iter = (new ArrayList(eventRequests)).iterator();
Iterator<? extends EventRequest> iter = (new ArrayList<>(eventRequests)).iterator();
while (iter.hasNext()) {
((EventRequestImpl)iter.next()).delete();
}
@ -869,76 +868,76 @@ class EventRequestManagerImpl extends MirrorImpl
}
public List<StepRequest> stepRequests() {
return unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
return (List<StepRequest>)unmodifiableRequestList(JDWP.EventKind.SINGLE_STEP);
}
public List<ClassPrepareRequest> classPrepareRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
return (List<ClassPrepareRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_PREPARE);
}
public List<ClassUnloadRequest> classUnloadRequests() {
return unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
return (List<ClassUnloadRequest>)unmodifiableRequestList(JDWP.EventKind.CLASS_UNLOAD);
}
public List<ThreadStartRequest> threadStartRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_START);
return (List<ThreadStartRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_START);
}
public List<ThreadDeathRequest> threadDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
return (List<ThreadDeathRequest>)unmodifiableRequestList(JDWP.EventKind.THREAD_DEATH);
}
public List<ExceptionRequest> exceptionRequests() {
return unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
return (List<ExceptionRequest>)unmodifiableRequestList(JDWP.EventKind.EXCEPTION);
}
public List<BreakpointRequest> breakpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
return (List<BreakpointRequest>)unmodifiableRequestList(JDWP.EventKind.BREAKPOINT);
}
public List<AccessWatchpointRequest> accessWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
return (List<AccessWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_ACCESS);
}
public List<ModificationWatchpointRequest> modificationWatchpointRequests() {
return unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
return (List<ModificationWatchpointRequest>)unmodifiableRequestList(JDWP.EventKind.FIELD_MODIFICATION);
}
public List<MethodEntryRequest> methodEntryRequests() {
return unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
return (List<MethodEntryRequest>)unmodifiableRequestList(JDWP.EventKind.METHOD_ENTRY);
}
public List<MethodExitRequest> methodExitRequests() {
return unmodifiableRequestList(
return (List<MethodExitRequest>)unmodifiableRequestList(
EventRequestManagerImpl.methodExitEventCmd);
}
public List<MonitorContendedEnterRequest> monitorContendedEnterRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
return (List<MonitorContendedEnterRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTER);
}
public List<MonitorContendedEnteredRequest> monitorContendedEnteredRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
return (List<MonitorContendedEnteredRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_CONTENDED_ENTERED);
}
public List<MonitorWaitRequest> monitorWaitRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
return (List<MonitorWaitRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAIT);
}
public List<MonitorWaitedRequest> monitorWaitedRequests() {
return unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
return (List<MonitorWaitedRequest>)unmodifiableRequestList(JDWP.EventKind.MONITOR_WAITED);
}
public List<VMDeathRequest> vmDeathRequests() {
return unmodifiableRequestList(JDWP.EventKind.VM_DEATH);
return (List<VMDeathRequest>)unmodifiableRequestList(JDWP.EventKind.VM_DEATH);
}
List unmodifiableRequestList(int eventCmd) {
List<? extends EventRequest> unmodifiableRequestList(int eventCmd) {
return Collections.unmodifiableList(requestList(eventCmd));
}
EventRequest request(int eventCmd, int requestId) {
List rl = requestList(eventCmd);
List<? extends EventRequest> rl = requestList(eventCmd);
for (int i = rl.size() - 1; i >= 0; i--) {
EventRequestImpl er = (EventRequestImpl)rl.get(i);
if (er.id == requestId) {

View File

@ -47,7 +47,7 @@ enum EventDestination {UNKNOWN_EVENT, INTERNAL_EVENT, CLIENT_EVENT};
* that is on the queues are all for client requests.
*/
public class EventSetImpl extends ArrayList<Event> implements EventSet {
private static final long serialVersionUID = -4857338819787924570L;
private VirtualMachineImpl vm; // we implement Mirror
private Packet pkt;
private byte suspendPolicy;
@ -607,7 +607,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
PacketStream ps = new PacketStream(vm, pkt);
JDWP.Event.Composite compEvt = new JDWP.Event.Composite(vm, ps);
suspendPolicy = compEvt.suspendPolicy;
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
switch(suspendPolicy) {
case JDWP.SuspendPolicy.ALL:
vm.printTrace("EventSet: SUSPEND_ALL");
@ -626,7 +626,7 @@ public class EventSetImpl extends ArrayList<Event> implements EventSet {
ThreadReference fix6485605 = null;
for (int i = 0; i < compEvt.events.length; i++) {
EventImpl evt = createEvent(compEvt.events[i]);
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
try {
vm.printTrace("Event: " + evt);
} catch (VMDisconnectedException ee) {

View File

@ -97,7 +97,7 @@ public class FloatValueImpl extends PrimitiveValueImpl
}
public float floatValue() {
return(float)value;
return value;
}
public double doubleValue() {

View File

@ -105,7 +105,7 @@ public class GenericAttachingConnector
/**
* Attach to a target VM using the specified address and Connector arguments.
*/
public VirtualMachine attach(String address, Map args)
public VirtualMachine attach(String address, Map<String, ? extends Connector.Argument> args)
throws IOException, IllegalConnectorArgumentsException
{
String ts = argument(ARG_TIMEOUT, args).value();

View File

@ -83,7 +83,7 @@ public class IntegerValueImpl extends PrimitiveValueImpl
}
public int intValue() {
return(int)value;
return value;
}
public long longValue() {

View File

@ -128,9 +128,9 @@ public class InterfaceTypeImpl extends ReferenceTypeImpl
* list being built.
*/
List<InterfaceType> immediate = new ArrayList<InterfaceType>(superinterfaces());
Iterator iter = immediate.iterator();
Iterator<InterfaceType> iter = immediate.iterator();
while (iter.hasNext()) {
InterfaceType interfaze = (InterfaceType)iter.next();
InterfaceType interfaze = iter.next();
if (list.contains(interfaze)) {
iter.remove();
}

View File

@ -59,7 +59,7 @@ public class InternalEventHandler implements Runnable
ClassUnloadEvent cuEvent = (ClassUnloadEvent)event;
vm.removeReferenceType(cuEvent.classSignature());
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Unload Event for " +
cuEvent.classSignature());
}
@ -68,7 +68,7 @@ public class InternalEventHandler implements Runnable
((ReferenceTypeImpl)cpEvent.referenceType())
.markPrepared();
if ((vm.traceFlags & vm.TRACE_EVENTS) != 0) {
if ((vm.traceFlags & VirtualMachine.TRACE_EVENTS) != 0) {
vm.printTrace("Handled Prepare Event for " +
cpEvent.referenceType().name());
}

View File

@ -27,7 +27,7 @@ package com.sun.tools.jdi;
import com.sun.jdi.*;
class JDWPException extends Exception {
private static final long serialVersionUID = -6321344442751299874L;
short errorCode;
JDWPException(short errorCode) {

View File

@ -1,904 +0,0 @@
/*
* Copyright (c) 1998, 2000, 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.
*/
package com.sun.tools.jdi;
import java.io.*;
import java.util.*;
/**
* Hash table based implementation of the Map interface. This implementation
* provides all of the optional Map operations, and permits null values and
* the null key. (HashMap is roughly equivalent to Hashtable, except that it
* is unsynchronized and permits nulls.) In addition, elements in the map are
* ordered and doubly linked together.
* <p>
* This implementation provides constant-time performance for the basic
* operations (get and put), assuming the the hash function disperses the
* elements properly among the buckets. Iteration over Collection views
* requires time proportional to its size (the number of key-value mappings)
* and returns elements in the order they are linked. In a HashMap the
* iteration would require time proportional to the capacity of the map
* plus the map size.
* <p>
* An instance of LinkedHashMap has two parameters that affect its efficiency:
* its <i>capacity</i> and its <i>load factor</i>. The load factor should be
* between 0.0 and 1.0. When the number of mappings in the LinkedHashMap exceeds
* the product of the load factor and the current capacity, the capacity is
* increased by calling the rehash method which requires time proportional
* to the number of key-value mappings in the map. Larger load factors
* use memory more efficiently, at the expense of larger expected time per
* lookup.
* <p>
* If many mappings are to be stored in a LinkedHashMap, creating it with a
* sufficiently large capacity will allow the mappings to be stored more
* efficiently than letting it perform automatic rehashing as needed to grow
* the table.
* <p>
* <strong>Note that this implementation is not synchronized.</strong> If
* multiple threads access a LinkedHashMap concurrently, and at least one of the
* threads modifies the LinkedHashMap structurally, it <em>must</em> be
* synchronized externally. (A structural modification is any operation that
* adds or deletes one or more mappings; merely changing the value associated
* with a key that is already contained in the Table is not a structural
* modification.) This is typically accomplished by synchronizing on some
* object that naturally encapsulates the LinkedHashMap. If no such object
* exists, the LinkedHashMap should be "wrapped" using the
* Collections.synchronizedSet method. This is best done at creation time, to
* prevent accidental unsynchronized access to the LinkedHashMap:
* <pre>
* Map m = Collections.synchronizedMap(new LinkedHashMap(...));
* </pre>
* <p>
* The Iterators returned by the iterator methods of the Collections returned
* by all of LinkedHashMap's "collection view methods" are <em>fail-fast</em>:
* if the LinkedHashMap is structurally modified at any time after the Iterator
* is created, in any way except through the Iterator's own remove or add
* methods, the Iterator will throw a ConcurrentModificationException. Thus,
* in the face of concurrent modification, the Iterator fails quickly and
* cleanly, rather than risking arbitrary, non-deterministic behavior at an
* undetermined time in the future.
*
* @author Josh Bloch
* @author Arthur van Hoff
* @author Zhenghua Li
* @see Object#hashCode()
* @see java.util.Collection
* @see java.util.Map
* @see java.util.TreeMap
* @see java.util.Hashtable
* @see java.util.HashMap
*/
import java.io.Serializable;
public class LinkedHashMap extends AbstractMap implements Map, Serializable {
/**
* The hash table data.
*/
private transient Entry table[];
/**
* The head of the double linked list.
*/
private transient Entry header;
/**
* The total number of mappings in the hash table.
*/
private transient int count;
/**
* Rehashes the table when count exceeds this threshold.
*/
private int threshold;
/**
* The load factor for the LinkedHashMap.
*/
private float loadFactor;
/**
* The number of times this LinkedHashMap has been structurally modified
* Structural modifications are those that change the number of mappings in
* the LinkedHashMap or otherwise modify its internal structure (e.g.,
* rehash). This field is used to make iterators on Collection-views of
* the LinkedHashMap fail-fast. (See ConcurrentModificationException).
*/
private transient int modCount = 0;
/**
* Constructs a new, empty LinkedHashMap with the specified initial
* capacity and the specified load factor.
*
* @param initialCapacity the initial capacity of the LinkedHashMap.
* @param loadFactor a number between 0.0 and 1.0.
* @exception IllegalArgumentException if the initial capacity is less
* than or equal to zero, or if the load factor is less than
* or equal to zero.
*/
public LinkedHashMap(int initialCapacity, float loadFactor) {
if (initialCapacity < 0)
throw new IllegalArgumentException("Illegal Initial Capacity: "+
initialCapacity);
if ((loadFactor > 1) || (loadFactor <= 0))
throw new IllegalArgumentException("Illegal Load factor: "+
loadFactor);
if (initialCapacity==0)
initialCapacity = 1;
this.loadFactor = loadFactor;
table = new Entry[initialCapacity];
threshold = (int)(initialCapacity * loadFactor);
header = new Entry(-1, null, null, null);
header.before = header.after = header;
}
/**
* Constructs a new, empty LinkedHashMap with the specified initial capacity
* and default load factor.
*
* @param initialCapacity the initial capacity of the LinkedHashMap.
*/
public LinkedHashMap(int initialCapacity) {
this(initialCapacity, 0.75f);
}
/**
* Constructs a new, empty LinkedHashMap with a default capacity and load
* factor.
*/
public LinkedHashMap() {
this(101, 0.75f);
}
/**
* Constructs a new LinkedHashMap with the same mappings as the given
* Map. The LinkedHashMap is created with a capacity of thrice the number
* of mappings in the given Map or 11 (whichever is greater), and a
* default load factor.
*/
public LinkedHashMap(Map t) {
this(Math.max(3*t.size(), 11), 0.75f);
putAll(t);
}
/**
* Returns the number of key-value mappings in this Map.
*/
public int size() {
return count;
}
/**
* Returns true if this Map contains no key-value mappings.
*/
public boolean isEmpty() {
return count == 0;
}
/**
* Returns true if this LinkedHashMap maps one or more keys to the specified
* value.
*
* @param value value whose presence in this Map is to be tested.
*/
public boolean containsValue(Object value) {
if (value==null) {
for (Entry e = header.after; e != header; e = e.after)
if (e.value==null)
return true;
} else {
for (Entry e = header.after; e != header; e = e.after)
if (value.equals(e.value))
return true;
}
return false;
}
/**
* Returns true if this LinkedHashMap contains a mapping for the specified
* key.
*
* @param key key whose presence in this Map is to be tested.
*/
public boolean containsKey(Object key) {
Entry tab[] = table;
if (key != null) {
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index]; e != null; e = e.next)
if (e.hash==hash && e.key.equals(key))
return true;
} else {
for (Entry e = tab[0]; e != null; e = e.next)
if (e.key==null)
return true;
}
return false;
}
/**
* Returns the value to which this LinkedHashMap maps the specified key.
* Returns null if the LinkedHashMap contains no mapping for this key.
* A return value of null does not <em>necessarily</em> indicate that the
* LinkedHashMap contains no mapping for the key; it's also possible that
* the LinkedHashMap explicitly maps the key to null. The containsKey
* operation may be used to distinguish these two cases.
*
* @param key key whose associated value is to be returned.
*/
public Object get(Object key) {
Entry e = getEntry(key);
return e==null ? null : e.value;
}
/**
* Returns the entry associated with the specified key in the LinkedHashMap.
* Returns null if the LinkedHashMap contains no mapping for this key.
*/
private Entry getEntry(Object key) {
Entry tab[] = table;
if (key != null) {
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index]; e != null; e = e.next)
if ((e.hash == hash) && e.key.equals(key))
return e;
} else {
for (Entry e = tab[0]; e != null; e = e.next)
if (e.key==null)
return e;
}
return null;
}
/**
* Rehashes the contents of the LinkedHashMap into a LinkedHashMap with a
* larger capacity. This method is called automatically when the
* number of keys in the LinkedHashMap exceeds this LinkedHashMap's capacity
* and load factor.
*/
private void rehash() {
int oldCapacity = table.length;
Entry oldMap[] = table;
int newCapacity = oldCapacity * 2 + 1;
Entry newMap[] = new Entry[newCapacity];
modCount++;
threshold = (int)(newCapacity * loadFactor);
table = newMap;
for (Entry e = header.after; e != header; e = e.after) {
int index = (e.hash & 0x7FFFFFFF) % newCapacity;
e.next = newMap[index];
newMap[index] = e;
}
}
/**
* Remove an entry from the linked list.
*/
private void listRemove(Entry entry) {
if (entry == null) {
return;
}
entry.before.after = entry.after;
entry.after.before = entry.before;
}
/**
* Add the specified entry before the specified existing entry to
* the linked list.
*/
private void listAddBefore(Entry entry, Entry existEntry) {
entry.after = existEntry;
entry.before = existEntry.before;
entry.before.after = entry;
entry.after.before = entry;
}
/**
* Returns the position of the mapping for the specified key
* in the ordered map.
*
* @param key the specified key.
* @return index of the key mapping.
*/
public int indexOf(Object key) {
int i = 0;
if (key == null) {
for (Entry e = header.after; e != header; e = e.after, i++)
if (e.key == null)
return i;
} else {
for (Entry e = header.after; e != header; e = e.after, i++)
if(key.equals(e.key))
return i;
}
return -1;
}
/**
* Associates the specified value with the specified key in this
* LinkedHashMap. If the LinkedHashMap previously contained a mapping for
* this key, the old value is replaced and the position of this mapping
* entry in the double linked list remains the same. Otherwise, a new
* mapping entry is created and inserted into the list before the specified
* existing mapping entry. The method returns the previous value associated
* with the specified key, or null if there was no mapping for key. A null
* return can also indicate that the LinkedHashMap previously associated
* null with the specified key.
*/
private Object putAhead(Object key, Object value, Entry existEntry) {
// Makes sure the key is not already in the LinkedHashMap.
Entry tab[] = table;
int hash = 0;
int index = 0;
if (key != null) {
hash = key.hashCode();
index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index] ; e != null ; e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
Object old = e.value;
e.value = value;
return old;
}
}
} else {
for (Entry e = tab[0] ; e != null ; e = e.next) {
if (e.key == null) {
Object old = e.value;
e.value = value;
return old;
}
}
}
modCount++;
if (count >= threshold) {
// Rehash the table if the threshold is exceeded
rehash();
tab = table;
index = (hash & 0x7FFFFFFF) % tab.length;
}
// Creates the new entry.
Entry e = new Entry(hash, key, value, tab[index]);
tab[index] = e;
listAddBefore(e, existEntry);
count++;
return null;
}
/**
* Associates the specified value with the specified key in this
* LinkedHashMap and position the mapping at the specified index.
* If the LinkedHashMap previously contained a mapping for this key,
* the old value is replaced and the position of this mapping entry
* in the double linked list remains the same. Otherwise, a new mapping
* entry is created and inserted into the list at the specified
* position.
*
* @param index the position to put the key-value mapping.
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
* @return previous value associated with specified key, or null if there
* was no mapping for key. A null return can also indicate that
* the LinkedHashMap previously associated null with the specified
* key.
*/
public Object put(int index, Object key, Object value) {
if (index < 0 || index > count)
throw new IndexOutOfBoundsException();
Entry e = header.after;
if (index == count)
return putAhead(key, value, header); //fast approach for append
else {
for (int i = 0; i < index; i++)
e = e.after;
return putAhead(key, value, e);
}
}
/**
* Associates the specified value with the specified key in this
* LinkedHashMap. If the LinkedHashMap previously contained a mapping for
* this key, the old value is replaced. The mapping entry is also appended
* to the end of the ordered linked list.
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
* @return previous value associated with specified key, or null if there
* was no mapping for key. A null return can also indicate that
* the LinkedHashMap previously associated null with the specified
* key.
*/
public Object put(Object key, Object value) {
return putAhead(key, value, header);
}
/**
* Removes the mapping for this key from this LinkedHashMap if present.
* The mapping would also be removed from the double linked list.
*
* @param key key whose mapping is to be removed from the Map.
* @return previous value associated with specified key, or null if there
* was no mapping for key. A null return can also indicate that
* the LinkedHashMap previously associated null with the specified
* key.
*/
public Object remove(Object key) {
Entry tab[] = table;
if (key != null) {
int hash = key.hashCode();
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index], prev = null; e != null;
prev = e, e = e.next) {
if ((e.hash == hash) && e.key.equals(key)) {
modCount++;
if (prev != null)
prev.next = e.next;
else
tab[index] = e.next;
count--;
Object oldValue = e.value;
e.value = null;
listRemove(e);
return oldValue;
}
}
} else {
for (Entry e = tab[0], prev = null; e != null;
prev = e, e = e.next) {
if (e.key == null) {
modCount++;
if (prev != null)
prev.next = e.next;
else
tab[0] = e.next;
count--;
Object oldValue = e.value;
e.value = null;
listRemove(e);
return oldValue;
}
}
}
return null;
}
/**
* Copies all of the mappings from the specified Map to this LinkedHashMap
* These mappings will replace any mappings that this LinkedHashMap had for
* any of the keys currently in the specified Map.
*
* @param t Mappings to be stored in this Map.
*/
public void putAll(Map t) {
Iterator i = t.entrySet().iterator();
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
put(e.getKey(), e.getValue());
}
}
/**
* Removes all mappings from this LinkedHashMap.
*/
public void clear() {
Entry tab[] = table;
modCount++;
for (int index = tab.length; --index >= 0; )
tab[index] = null;
count = 0;
header.before = header.after = header;
}
/**
* Returns a shallow copy of this LinkedHashMap. The keys and values
* themselves are not cloned.
*/
public Object clone() {
return new LinkedHashMap(this);
}
// Views
private transient Set keySet = null;
private transient Set entries = null;
private transient Collection values = null;
/**
* Returns a Set view of the keys contained in this LinkedHashMap. The Set
* is backed by the LinkedHashMap, so changes to the LinkedHashMap are
* reflected in the Set, and vice-versa. The Set supports element removal,
* which removes the corresponding mapping from the LinkedHashMap, via the
* Iterator.remove, Set.remove, removeAll retainAll, and clear operations.
* It does not support the add or addAll operations.
*/
public Set keySet() {
if (keySet == null) {
keySet = new AbstractSet() {
public Iterator iterator() {
return new HashIterator(KEYS);
}
public int size() {
return count;
}
public boolean contains(Object o) {
return containsKey(o);
}
public boolean remove(Object o) {
return LinkedHashMap.this.remove(o) != null;
}
public void clear() {
LinkedHashMap.this.clear();
}
};
}
return keySet;
}
/**
* Returns a Collection view of the values contained in this LinkedHashMap.
* The Collection is backed by the LinkedHashMap, so changes to the
* LinkedHashMap are reflected in the Collection, and vice-versa. The
* Collection supports element removal, which removes the corresponding
* mapping from the LinkedHashMap, via the Iterator.remove,
* Collection.remove, removeAll, retainAll and clear operations. It does
* not support the add or addAll operations.
*/
public Collection values() {
if (values==null) {
values = new AbstractCollection() {
public Iterator iterator() {
return new HashIterator(VALUES);
}
public int size() {
return count;
}
public boolean contains(Object o) {
return containsValue(o);
}
public void clear() {
LinkedHashMap.this.clear();
}
};
}
return values;
}
/**
* Returns a Collection view of the mappings contained in this
* LinkedHashMap. Each element in the returned collection is a Map.Entry.
* The Collection is backed by the LinkedHashMap, so changes to the
* LinkedHashMap are reflected in the Collection, and vice-versa. The
* Collection supports element removal, which removes the corresponding
* mapping from the LinkedHashMap, via the Iterator.remove,
* Collection.remove, removeAll, retainAll and clear operations. It does
* not support the add or addAll operations.
*
* @see java.util.Map.Entry
*/
public Set entrySet() {
if (entries==null) {
entries = new AbstractSet() {
public Iterator iterator() {
return new HashIterator(ENTRIES);
}
public boolean contains(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry entry = (Map.Entry)o;
Object key = entry.getKey();
Entry tab[] = table;
int hash = (key==null ? 0 : key.hashCode());
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index]; e != null; e = e.next)
if (e.hash==hash && e.equals(entry))
return true;
return false;
}
public boolean remove(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry entry = (Map.Entry)o;
Object key = entry.getKey();
Entry tab[] = table;
int hash = (key==null ? 0 : key.hashCode());
int index = (hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index], prev = null; e != null;
prev = e, e = e.next) {
if (e.hash==hash && e.equals(entry)) {
modCount++;
if (prev != null)
prev.next = e.next;
else
tab[index] = e.next;
count--;
e.value = null;
listRemove(e);
return true;
}
}
return false;
}
public int size() {
return count;
}
public void clear() {
LinkedHashMap.this.clear();
}
};
}
return entries;
}
/**
* Compares the specified Object with this Map for equality.
* Returns true if the given object is also a LinkedHashMap and the two
* Maps represent the same mappings in the same order. More formally,
* two Maps <code>t1</code> and <code>t2</code> represent the same mappings
* if <code>t1.keySet().equals(t2.keySet())</code> and for every
* key <code>k</code> in <code>t1.keySet()</code>, <code>
* (t1.get(k)==null ? t2.get(k)==null : t1.get(k).equals(t2.get(k)))
* </code>.
* <p>
* This implementation first checks if the specified Object is this Map;
* if so it returns true. Then, it checks if the specified Object is
* a Map whose size is identical to the size of this Set; if not, it
* it returns false. If so, it iterates over this Map and the specified
* Map's entrySet() Collection, and checks that the specified Map contains
* each mapping that this Map contains at the same position. If the
* specified Map fails to contain such a mapping in the right order, false
* is returned. If the iteration completes, true is returned.
*
* @param o Object to be compared for equality with this Map.
* @return true if the specified Object is equal to this Map.
*
*/
public boolean equals(Object o) {
if (o == this)
return true;
if (!(o instanceof LinkedHashMap))
return false;
LinkedHashMap t = (LinkedHashMap) o;
if (t.size() != size())
return false;
Iterator i1 = entrySet().iterator();
Iterator i2 = t.entrySet().iterator();
while (i1.hasNext()) {
Entry e1 = (Entry) i1.next();
Entry e2 = (Entry) i2.next();
Object key1 = e1.getKey();
Object value1 = e1.getValue();
Object key2 = e2.getKey();
Object value2 = e2.getValue();
if ((key1 == null ? key2 == null : key1.equals(key2)) &&
(value1 == null ? value2 == null : value1.equals(value2))) {
continue;
} else {
return false;
}
}
return true;
}
/**
* LinkedHashMap collision list entry.
*/
private static class Entry implements Map.Entry {
int hash;
Object key;
Object value;
Entry next;
// These fields comprise the doubly linked list that is used for
// iteration.
Entry before, after;
Entry(int hash, Object key, Object value, Entry next) {
this.hash = hash;
this.key = key;
this.value = value;
this.next = next;
}
// Map.Entry Ops
public Object getKey() {
return key;
}
public Object getValue() {
return value;
}
public Object setValue(Object value) {
Object oldValue = this.value;
this.value = value;
return oldValue;
}
public boolean equals(Object o) {
if (!(o instanceof Map.Entry))
return false;
Map.Entry e = (Map.Entry)o;
return (key==null ? e.getKey()==null : key.equals(e.getKey())) &&
(value==null ? e.getValue()==null : value.equals(e.getValue()));
}
public int hashCode() {
return hash ^ (value==null ? 0 : value.hashCode());
}
public String toString() {
return key+"="+value;
}
}
// Types of Iterators
private static final int KEYS = 0;
private static final int VALUES = 1;
private static final int ENTRIES = 2;
private class HashIterator implements Iterator {
private Entry[] table = LinkedHashMap.this.table;
private Entry entry = null;
private Entry lastReturned = null;
private int type;
/**
* The modCount value that the iterator believes that the backing
* List should have. If this expectation is violated, the iterator
* has detected concurrent modification.
*/
private int expectedModCount = modCount;
HashIterator(int type) {
this.type = type;
this.entry = LinkedHashMap.this.header.after;
}
public boolean hasNext() {
return entry != header;
}
public Object next() {
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
if (entry == LinkedHashMap.this.header)
throw new NoSuchElementException();
Entry e = lastReturned = entry;
entry = e.after;
return type == KEYS ? e.key : (type == VALUES ? e.value : e);
}
public void remove() {
if (lastReturned == null)
throw new IllegalStateException();
if (modCount != expectedModCount)
throw new ConcurrentModificationException();
Entry[] tab = LinkedHashMap.this.table;
int index = (lastReturned.hash & 0x7FFFFFFF) % tab.length;
for (Entry e = tab[index], prev = null; e != null;
prev = e, e = e.next) {
if (e == lastReturned) {
modCount++;
expectedModCount++;
if (prev == null)
tab[index] = e.next;
else
prev.next = e.next;
count--;
listRemove(e);
lastReturned = null;
return;
}
}
throw new ConcurrentModificationException();
}
}
/**
* Save the state of the LinkedHashMap to a stream (i.e., serialize it).
* The objects will be written out in the order they are linked
* in the list.
*/
private void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
// Write out the threshold, loadfactor, and any hidden stuff
s.defaultWriteObject();
// Write out number of buckets
s.writeInt(table.length);
// Write out size (number of Mappings)
s.writeInt(count);
// Write out keys and values (alternating)
for (Entry e = header.after; e != header; e = e.after) {
s.writeObject(e.key);
s.writeObject(e.value);
}
}
/**
* Reconstitute the LinkedHashMap from a stream (i.e., deserialize it).
*/
private void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException
{
// Read in the threshold, loadfactor, and any hidden stuff
s.defaultReadObject();
// Read in number of buckets and allocate the bucket array;
int numBuckets = s.readInt();
table = new Entry[numBuckets];
header = new Entry(-1, null, null, null);
header.before = header;
header.after = header;
// Read in size (number of Mappings)
int size = s.readInt();
// Read the keys and values, and put the mappings in the LinkedHashMap
for (int i=0; i<size; i++) {
Object key = s.readObject();
Object value = s.readObject();
put(key, value);
}
}
}

View File

@ -93,7 +93,7 @@ public class LongValueImpl extends PrimitiveValueImpl
}
public long longValue() {
return(long)value;
return value;
}
public float floatValue() {

View File

@ -362,7 +362,7 @@ public abstract class MethodImpl extends TypeComponentImpl
int argSize = arguments.size();
JNITypeParser parser = new JNITypeParser(signature());
List signatures = parser.argumentSignatures();
List<String> signatures = parser.argumentSignatures();
if (signatures.size() != argSize) {
throw new IllegalArgumentException("Invalid argument count: expected " +

Some files were not shown because too many files have changed in this diff Show More