--- a/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
b5060eae3b32fd9f884a09774338cd8186d7fafa jdk8-b15
736a63b854f321c7824b7e47890135f80aee05e3 jdk8-b16
f0eccb2946986fb9626efde7d8ed9c8192623f5c jdk8-b17
+885050364691ac1ac978305c63f3368a197fb04d jdk8-b18
+0ff7113a0882ec82d642cb9f0297b4e497807ced jdk8-b19
--- a/.hgtags-top-repo Wed Jan 04 03:49:35 2012 -0800
+++ b/.hgtags-top-repo Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
a4f28069d44a379cda99dd1d921d19f819726d22 jdk8-b15
4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b17
4e06ae613e99549835896720c7a68c29ad5543f5 jdk8-b16
+7010bd24cdd07bc7daef80702f39124854dec36c jdk8-b18
+237bc29afbfc6f56a4fe4a6008e2befb59c44bac jdk8-b19
--- a/corba/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/corba/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
7da69e7175a7c7564ee6d0e52255cbb8a57ef577 jdk8-b15
82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b17
82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b16
+312cf15d16577ef198b033d2a4cc0a52369b7343 jdk8-b18
+e1366c5d84ef984095a332bcee70b3938232d07d jdk8-b19
--- a/corba/make/jprt.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/corba/make/jprt.properties Wed Jan 04 10:57:39 2012 -0800
@@ -25,21 +25,21 @@
# Properties for jprt
-# The release to build
+# 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}, \
- solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
- solaris_x64_5.10-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
- windows_i586_5.1-{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}, \
+ linux_i586_2.6-{product|fastdebug}, \
+ linux_x64_2.6-{product|fastdebug}, \
+ windows_i586_5.1-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug}
# Directories to be excluded from the source bundles
--- a/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Wed Jan 04 03:49:35 2012 -0800
+++ b/corba/src/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java Wed Jan 04 10:57:39 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2011, 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
@@ -113,6 +113,9 @@
import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
import com.sun.corba.se.impl.util.JDKBridge;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
/**
* ClientDelegate is the RMI client-side subcontract or representation
* It implements RMI delegate as well as our internal ClientRequestDispatcher
@@ -122,6 +125,9 @@
implements
ClientRequestDispatcher
{
+ private ConcurrentMap<ContactInfo, Object> locks =
+ new ConcurrentHashMap<ContactInfo, Object>();
+
public OutputObject beginRequest(Object self, String opName,
boolean isOneWay, ContactInfo contactInfo)
{
@@ -148,8 +154,21 @@
// This locking is done so that multiple connections are not created
// for the same endpoint
- //6929137 - Synchronized on contactInfo to avoid blocking across multiple endpoints
- synchronized (contactInfo) {
+ // 7046238 - Synchronization on a single monitor for contactInfo parameters
+ // with identical hashCode(), so we lock on same monitor for equal parameters
+ // (which can refer to equal (in terms of equals()) but not the same objects)
+
+ Object lock = locks.get(contactInfo);
+
+ if (lock == null) {
+ Object newLock = new Object();
+ lock = locks.putIfAbsent(contactInfo, newLock);
+ if (lock == null) {
+ lock = newLock;
+ }
+ }
+
+ synchronized (lock) {
if (contactInfo.isConnectionBased()) {
if (contactInfo.shouldCacheConnection()) {
connection = (CorbaConnection)
@@ -254,7 +273,7 @@
registerWaiter(messageMediator);
// Do connection reclaim now
- synchronized (contactInfo) {
+ synchronized (lock) {
if (contactInfo.isConnectionBased()) {
if (contactInfo.shouldCacheConnection()) {
OutboundConnectionCache connectionCache =
--- a/hotspot/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -205,3 +205,6 @@
d1f29d4e0bc60e8bd7ae961f1306d8ab33290212 jdk8-b16
6de8c9ba5907e4c5ca05ac4b8d84a8e2cbd92399 hs23-b07
a2fef924d8e6f37dac2a887315e3502876cc8e24 hs23-b08
+61165f53f1656b9f99e4fb806429bf98b99d59c3 jdk8-b18
+4bcf61041217f8677dcec18e90e9196acc945bba hs23-b09
+9232e0ecbc2cec54dcc8f93004fb00c214446460 jdk8-b19
--- a/hotspot/make/hotspot_version Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/make/hotspot_version Wed Jan 04 10:57:39 2012 -0800
@@ -35,7 +35,7 @@
HS_MAJOR_VER=23
HS_MINOR_VER=0
-HS_BUILD_NUMBER=08
+HS_BUILD_NUMBER=09
JDK_MAJOR_VER=1
JDK_MINOR_VER=8
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -5968,7 +5968,9 @@
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");
--- a/hotspot/src/os/bsd/vm/jvm_bsd.h Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/bsd/vm/jvm_bsd.h Wed Jan 04 10:57:39 2012 -0800
@@ -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
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
* 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
--- a/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/bsd/vm/os_bsd.inline.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -198,15 +198,15 @@
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 @@
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
--- a/hotspot/src/os/linux/vm/jvm_linux.h Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/linux/vm/jvm_linux.h Wed Jan 04 10:57:39 2012 -0800
@@ -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
--- a/hotspot/src/os/linux/vm/os_linux.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -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 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
* 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
--- a/hotspot/src/os/linux/vm/os_linux.inline.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/linux/vm/os_linux.inline.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -202,15 +202,15 @@
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 @@
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
--- a/hotspot/src/os/solaris/vm/jvm_solaris.h Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/solaris/vm/jvm_solaris.h Wed Jan 04 10:57:39 2012 -0800
@@ -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. */
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -1674,7 +1674,6 @@
}
-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 @@
// 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 @@
* 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 @@
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::send(int fd, char *buf, int nBytes, int flags) {
- INTERRUPTIBLE_RETURN_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::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, 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, 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::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 @@
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::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::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::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;
-}
-
-
-int os::bind(int fd, struct sockaddr *him, int len) {
+ 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, socklen_t len) {
INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
- os::Solaris::clear_interrupted);
-}
+ os::Solaris::clear_interrupted);
+}
--- a/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/solaris/vm/os_solaris.inline.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -243,24 +243,25 @@
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
--- a/hotspot/src/os/windows/vm/jvm_windows.h Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/windows/vm/jvm_windows.h Wed Jan 04 10:57:39 2012 -0800
@@ -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,9 +57,9 @@
#include <Psapi.h>
#endif
-
+#include <Tlhelp32.h>
-#include <Tlhelp32.h>
+typedef unsigned int socklen_t;
// #include "jni.h"
@@ -129,3 +132,5 @@
#define SHUTDOWN2_SIGNAL SIGTERM
#endif /* !_JAVASOFT_JVM_MD_H_ */
+
+#endif // OS_WINDOWS_VM_JVM_WINDOWS_H
--- a/hotspot/src/os/windows/vm/os_windows.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/os/windows/vm/os_windows.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -821,17 +821,15 @@
}
}
-#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(¤t_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 @@
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 @@
::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 @@
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 @@
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;
}
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -336,12 +336,6 @@
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);
}
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -1117,12 +1117,9 @@
// 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 @@
// 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 @@
// 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 @@
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 @@
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 @@
HeapRegion::FinalCountClaimValue),
"sanity check");
} else {
+ n_workers = 1;
g1_par_count_task.work(0);
}
@@ -1851,7 +1854,6 @@
(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 @@
}
}
- 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 @@
// 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 @@
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 @@
}
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);
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -718,7 +718,7 @@
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
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -1294,7 +1294,7 @@
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 @@
_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 @@
}
_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 @@
}
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 @@
}
#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 @@
// 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");
-
- // We also do not allow partially-young GCs during marking.
- assert(!mark_in_progress() || g1_policy()->full_young_gcs(), "sanity");
+ g1_policy()->gcs_are_young(), "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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -943,6 +943,16 @@
// 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 @@
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 @@
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 @@
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.
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -50,7 +50,7 @@
};
// 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 @@
_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 @@
_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 @@
_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 @@
_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 @@
_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 @@
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 @@
// 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 @@
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 @@
_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 @@
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 @@
// 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_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 @@
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 @@
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;
-
- if (_last_young_gc_full && !_during_marking) {
+ _should_revert_to_young_gcs = false;
+
+ if (_last_gc_was_young && !_during_marking) {
_young_gc_eff_seq->add(cur_efficiency);
}
@@ -1534,19 +1534,21 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 @@
// 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 @@
double young_start_time_sec = os::elapsedTime();
_collection_set_bytes_used_before = 0;
- _last_young_gc_full = full_young_gcs() ? true : false;
-
- if (_last_young_gc_full) {
- ++_full_young_pause_num;
+ _last_gc_was_young = gcs_are_young() ? true : false;
+
+ 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 @@
// 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 @@
} 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,
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -164,8 +164,8 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
// 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 @@
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() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -52,14 +52,13 @@
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;
}
}
-
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ErgoVerbose.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -69,7 +69,7 @@
ErgoHeapSizing = 0,
ErgoCSetConstruction,
ErgoConcCycles,
- ErgoPartiallyYoungGCs,
+ ErgoMixedGCs,
ErgoHeuristicNum
} ErgoHeuristic;
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MonitoringSupport.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -119,7 +119,7 @@
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;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -672,15 +672,20 @@
}
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;
}
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -3398,17 +3398,22 @@
}
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()
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -471,3 +471,26 @@
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
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -217,8 +217,8 @@
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 @@
// 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.
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -957,7 +957,7 @@
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 @@
};
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;
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -198,7 +198,7 @@
// 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
--- a/hotspot/src/share/vm/memory/generation.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/generation.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -220,7 +220,7 @@
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 @@
// 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;
--- a/hotspot/src/share/vm/memory/referenceProcessor.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/referenceProcessor.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -43,7 +43,9 @@
}
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::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 @@
_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);
--- a/hotspot/src/share/vm/memory/space.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/space.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -304,11 +304,6 @@
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;
}
--- a/hotspot/src/share/vm/memory/space.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/memory/space.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -187,7 +187,7 @@
// 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.
--- a/hotspot/src/share/vm/oops/arrayOop.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/oops/arrayOop.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -38,9 +38,7 @@
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 @@
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;
}
--- a/hotspot/src/share/vm/oops/arrayOop.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/oops/arrayOop.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -128,7 +128,7 @@
#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
};
--- a/hotspot/src/share/vm/prims/jni.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/prims/jni.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -5037,16 +5037,25 @@
#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
--- a/hotspot/src/share/vm/prims/jvm.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/prims/jvm.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -3515,14 +3515,14 @@
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_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_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 @@
return os::dll_lookup(handle, name);
JVM_END
+
// Floating point support ////////////////////////////////////////////////////////////////////
JVM_LEAF(jboolean, JVM_IsNaN(jdouble a))
@@ -3655,7 +3670,6 @@
JVM_END
-
// JNI version ///////////////////////////////////////////////////////////////////////////////
JVM_LEAF(jboolean, JVM_IsSupportedJNIVersion(jint version))
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -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 @@
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 @@
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 @@
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 @@
}
}
+// 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;
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -119,6 +119,7 @@
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);
--- a/hotspot/src/share/vm/runtime/globals.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/runtime/globals.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -82,16 +82,19 @@
}
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
--- a/hotspot/src/share/vm/runtime/globals.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/runtime/globals.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -245,6 +245,8 @@
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);
--- a/hotspot/src/share/vm/runtime/globals_ext.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/runtime/globals_ext.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -53,4 +53,12 @@
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
--- a/hotspot/src/share/vm/runtime/os.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/runtime/os.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -584,28 +584,28 @@
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 @@
# 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
--- a/hotspot/src/share/vm/services/management.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/services/management.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -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"
--- a/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/utilities/globalDefinitions.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -175,6 +175,9 @@
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";
--- a/hotspot/src/share/vm/utilities/ostream.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/utilities/ostream.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -1021,7 +1021,7 @@
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");
}
--- a/hotspot/src/share/vm/utilities/quickSort.cpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp Wed Jan 04 10:57:39 2012 -0800
@@ -93,8 +93,7 @@
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 @@
delete[] test_array;
delete[] expected_array;
}
- return true;
}
#endif
--- a/hotspot/src/share/vm/utilities/quickSort.hpp Wed Jan 04 03:49:35 2012 -0800
+++ b/hotspot/src/share/vm/utilities/quickSort.hpp Wed Jan 04 10:57:39 2012 -0800
@@ -130,7 +130,7 @@
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
};
--- a/jaxp/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxp/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
804f666d6d44e33caac12ad8da3d2780ac44ef72 jdk8-b15
09eb517404b059607aca30cdd1af83ffc57eafeb jdk8-b17
09eb517404b059607aca30cdd1af83ffc57eafeb jdk8-b16
+ebec6a7e8d4e481d205a2109ddeea8121d76db7f jdk8-b18
+dffeb62b1a7fc8b316bf58fe5479323f3661894e jdk8-b19
--- a/jaxp/build.xml Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxp/build.xml Wed Jan 04 10:57:39 2012 -0800
@@ -43,14 +43,6 @@
Run 'make help' for help using the Makefile.
</description>
- <!-- Mac is special, need to downgrade these before build.properties. -->
- <condition property="javac.source" value="1.5">
- <os family="mac"/>
- </condition>
- <condition property="javac.target" value="1.5">
- <os family="mac"/>
- </condition>
-
<!-- Project build properties. -->
<property file="build.properties"/>
--- a/jaxp/make/jprt.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxp/make/jprt.properties Wed Jan 04 10:57:39 2012 -0800
@@ -25,21 +25,21 @@
# Properties for jprt
-# The release to build
+# 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}, \
- solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
- solaris_x64_5.10-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
- windows_i586_5.1-{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}, \
+ linux_i586_2.6-{product|fastdebug}, \
+ linux_x64_2.6-{product|fastdebug}, \
+ windows_i586_5.1-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug}
# Directories to be excluded from the source bundles
--- a/jaxws/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxws/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
c9ab96ff23d52d85d5dcce1f9c0fd7a3de418c74 jdk8-b15
3d45ab79643d5b4cc7e050ae2d9c08b4d89d665e jdk8-b17
3d45ab79643d5b4cc7e050ae2d9c08b4d89d665e jdk8-b16
+54928c8850f5498670dd43d6c9299f36de1a6746 jdk8-b18
+b73b733214aa43648d69a2da51e6b48fda902a2d jdk8-b19
--- a/jaxws/build.xml Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxws/build.xml Wed Jan 04 10:57:39 2012 -0800
@@ -43,14 +43,6 @@
Run 'make help' for help using the Makefile.
</description>
- <!-- Mac is special, need to downgrade these before build.properties. -->
- <condition property="javac.source" value="1.5">
- <os family="mac"/>
- </condition>
- <condition property="javac.target" value="1.5">
- <os family="mac"/>
- </condition>
-
<!-- Project build properties. -->
<property file="build.properties"/>
--- a/jaxws/make/jprt.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/jaxws/make/jprt.properties Wed Jan 04 10:57:39 2012 -0800
@@ -25,21 +25,21 @@
# Properties for jprt
-# The release to build
+# 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}, \
- solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
- solaris_x64_5.10-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
- windows_i586_5.1-{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}, \
+ linux_i586_2.6-{product|fastdebug}, \
+ linux_x64_2.6-{product|fastdebug}, \
+ windows_i586_5.1-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug}
# Directories to be excluded from the source bundles
--- a/jdk/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -140,3 +140,4 @@
b71d1acfae5240d8c1359443cd02b5ddb587231c jdk8-b17
929597c6e777f742ad252660045ebaa4a3ea4772 jdk8-b16
334bd51fb3f321cd6777416ae7bafac71a84140a jdk8-b18
+3778f85773055e81eab6c5ef828935ecca241810 jdk8-b19
--- a/jdk/make/common/Release.gmk Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/make/common/Release.gmk Wed Jan 04 10:57:39 2012 -0800
@@ -82,11 +82,13 @@
SHARE_JRE_DOC_SRC = $(JDK_TOPDIR)
# Same files for jdk and jre, no name changes
IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+ IMAGE_DOCLIST_JDK_DEMOS_AND_SAMPLES =
IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
else
# make/closed/common/Defs.gmk for closed location of SHARE_JDK_DOC_SRC
IMAGE_DOCLIST_JDK = COPYRIGHT README.html LICENSE THIRDPARTYLICENSEREADME.txt
+ IMAGE_DOCLIST_JDK_DEMOS_AND_SAMPLES = demo/DEMOS_LICENSE sample/SAMPLES_LICENSE
IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html LICENSE THIRDPARTYLICENSEREADME.txt
ifeq ($(PLATFORM), windows)
IMAGE_DOCLIST_JRE += README.txt
@@ -98,6 +100,7 @@
# Paths to these files we need
JDK_DOCFILES = $(IMAGE_DOCLIST_JDK:%=$(JDK_IMAGE_DIR)/%)
JRE_DOCFILES = $(IMAGE_DOCLIST_JRE:%=$(JRE_IMAGE_DIR)/%)
+JDK_DEMOS_AND_SAMPLES_DOCFILES = $(IMAGE_DOCLIST_JDK_DEMOS_AND_SAMPLES:%=$(JDK_IMAGE_DIR)/%)
# absolute directory names: note, these must exist prior to build
# time - they are created in the main Makefile.
@@ -486,6 +489,12 @@
$(JDK_IMAGE_DIR)/%: $(SHARE_JDK_DOC_SRC)/%
$(process-doc-file)
+$(JDK_IMAGE_DIR)/demo/DEMOS_LICENSE: $(SHARE_JDK_DOC_SRC)/DEMOS_LICENSE
+ $(process-doc-file)
+
+$(JDK_IMAGE_DIR)/sample/SAMPLES_LICENSE: $(SHARE_JDK_DOC_SRC)/SAMPLES_LICENSE
+ $(process-doc-file)
+
# JRE files
$(JRE_IMAGE_DIR)/%: $(SHARE_JRE_DOC_SRC)/%
$(process-doc-file)
@@ -914,7 +923,8 @@
# Standard jdk image
initial-image-jdk:: initial-image-jdk-setup \
initial-image-jdk-db \
- $(JDK_DOCFILES)
+ $(JDK_DOCFILES) \
+ $(JDK_DEMOS_AND_SAMPLES_DOCFILES)
$(MKDIR) $(JDK_IMAGE_DIR)/lib
@#
@# Copy in the jars in lib that only belong in the JDK
--- a/jdk/make/common/shared/Defs-control.gmk Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/make/common/shared/Defs-control.gmk Wed Jan 04 10:57:39 2012 -0800
@@ -75,9 +75,11 @@
SRC_BUNDLEDIR = $(OUTPUTDIR)/source-bundles
ABS_SRC_BUNDLEDIR = $(ABS_OUTPUTDIR)/source-bundles
BIN_BUNDLEDIR = $(OUTPUTDIR)/bundles
+BIN_DEMOS_BUNDLEDIR = $(OUTPUTDIR)/demos-bundles
ABS_BIN_BUNDLEDIR = $(ABS_OUTPUTDIR)/bundles
dummy := $(shell $(MKDIR) -p $(BIN_BUNDLEDIR))
+dummy := $(shell $(MKDIR) -p $(BIN_DEMOS_BUNDLEDIR) )
dummy := $(shell $(MKDIR) -p $(SRC_BUNDLEDIR) )
TEMP_DIR = $(OUTPUTDIR)/tmp
--- a/jdk/src/share/classes/sun/text/resources/FormatData_bg.java Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/src/share/classes/sun/text/resources/FormatData_bg.java Wed Jan 04 10:57:39 2012 -0800
@@ -130,16 +130,16 @@
},
{ "DateTimePatterns",
new String[] {
- "HH:mm:ss z", // full time pattern
+ "HH:mm:ss zzzz", // full time pattern
"HH:mm:ss z", // long time pattern
- "H:mm:ss", // medium time pattern
- "H:mm", // short time pattern
- "EEEE, yyyy, MMMM d", // full date pattern
- "EEEE, yyyy, MMMM d", // long date pattern
- "yyyy-M-d", // medium date pattern
- "yy-M-d", // short date pattern
+ "HH:mm:ss", // medium time pattern
+ "HH:mm", // short time pattern
+ "dd MMMM y, EEEE", // full date pattern
+ "dd MMMM y", // long date pattern
+ "dd.MM.yyyy", // medium date pattern
+ "dd.MM.yy", // short date pattern
"{1} {0}" // date-time pattern
- }
+ }
},
{ "DateTimePatternChars", "GanjkHmsSEDFwWxhKzZ" },
};
--- a/jdk/test/sun/text/resources/LocaleData Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/test/sun/text/resources/LocaleData Wed Jan 04 10:57:39 2012 -0800
@@ -7010,3 +7010,12 @@
# bug 7101495
CalendarData/lv/firstDayOfWeek=2
CalendarData/lv/minimalDaysInFirstWeek=4
+
+# bug 7003124
+FormatData/bg/DateTimePatterns/0=HH:mm:ss zzzz
+FormatData/bg/DateTimePatterns/2=HH:mm:ss
+FormatData/bg/DateTimePatterns/3=HH:mm
+FormatData/bg/DateTimePatterns/4=dd MMMM y, EEEE
+FormatData/bg/DateTimePatterns/5=dd MMMM y
+FormatData/bg/DateTimePatterns/6=dd.MM.yyyy
+FormatData/bg/DateTimePatterns/7=dd.MM.yy
--- a/jdk/test/sun/text/resources/LocaleDataTest.java Wed Jan 04 03:49:35 2012 -0800
+++ b/jdk/test/sun/text/resources/LocaleDataTest.java Wed Jan 04 10:57:39 2012 -0800
@@ -34,6 +34,7 @@
* 6509039 6609737 6610748 6645271 6507067 6873931 6450945 6645268 6646611
* 6645405 6650730 6910489 6573250 6870908 6585666 6716626 6914413 6916787
* 6919624 6998391 7019267 7020960 7025837 7020583 7036905 7066203 7101495
+ * 7003124
* @summary Verify locale data
*
*/
--- a/langtools/.hgtags Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/.hgtags Wed Jan 04 10:57:39 2012 -0800
@@ -139,3 +139,5 @@
07599bd780cab1f40da7915e1dc6774629b0cf8c jdk8-b15
1cbe86c11ba69521875c0b0357d7540781eb334d jdk8-b17
ec2c0973cc31e143cffc05ceb63d98fae76f97d4 jdk8-b16
+ab1b1cc7857716914f2bb20b3128e5a8978290f7 jdk8-b18
+77b2c066084cbc75150efc6603a713c558329813 jdk8-b19
--- a/langtools/make/jprt.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/make/jprt.properties Wed Jan 04 10:57:39 2012 -0800
@@ -25,23 +25,38 @@
# Properties for jprt
-# The release to build
+# 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}, \
- solaris_sparcv9_5.10-{product|fastdebug}, \
- solaris_i586_5.10-{product|fastdebug}, \
- solaris_x64_5.10-{product|fastdebug}, \
- linux_i586_2.6-{product|fastdebug}, \
- linux_x64_2.6-{product|fastdebug}, \
- windows_i586_5.1-{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}, \
+ linux_i586_2.6-{product|fastdebug}, \
+ linux_x64_2.6-{product|fastdebug}, \
+ windows_i586_5.1-{product|fastdebug}, \
windows_x64_5.2-{product|fastdebug}
+# 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 test targets
+jprt.make.rule.test.targets= \
+ ${jprt.my.test.target.set:TESTNAME=jtreg}
+
# Directories to be excluded from the source bundles
jprt.bundle.exclude.src.dirs=build dist webrev
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Wed Jan 04 10:57:39 2012 -0800
@@ -216,6 +216,7 @@
doclet.Same_package_name_used=Package name format used twice: {0}
doclet.Serialization.Excluded_Class=Non-transient field {1} uses excluded class {0}.
doclet.Serialization.Nonexcluded_Class=Non-transient field {1} uses hidden, non-included class {0}.
+doclet.exception_encountered=Exception encountered while processing {1}\n{0}
doclet.usage=Provided by Standard doclet:\n\
-d <directory> Destination directory for output files\n\
-use Create class and package usage pages\n\
--- a/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/JavacTool.java Wed Jan 04 10:57:39 2012 -0800
@@ -25,18 +25,15 @@
package com.sun.tools.javac.api;
-import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Writer;
import java.nio.charset.Charset;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Iterator;
-import java.util.List;
import java.util.Locale;
import java.util.Set;
import javax.lang.model.SourceVersion;
@@ -44,17 +41,15 @@
import com.sun.source.util.JavacTask;
import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.JavacOption.OptionKind;
-import com.sun.tools.javac.main.JavacOption;
import com.sun.tools.javac.main.Main;
-import com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper;
-import com.sun.tools.javac.main.RecognizedOptions;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.main.OptionHelper;
+import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
import com.sun.tools.javac.util.ClientCodeException;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.util.Options;
-import com.sun.tools.javac.util.Pair;
/**
* TODO: describe com.sun.tools.javac.api.Tool
@@ -67,23 +62,10 @@
* @author Peter von der Ah\u00e9
*/
public final class JavacTool implements JavaCompiler {
- private final List<Pair<String,String>> options
- = new ArrayList<Pair<String,String>>();
- private final Context dummyContext = new Context();
-
- private final PrintWriter silent = new PrintWriter(new OutputStream(){
- public void write(int b) {}
- });
-
- private final Main sharedCompiler = new Main("javac", silent);
- {
- sharedCompiler.setOptions(Options.instance(dummyContext));
- }
-
/**
- * Constructor used by service provider mechanism. The correct way to
- * obtain an instance of this class is using create or the service provider
- * mechanism.
+ * Constructor used by service provider mechanism. The recommended way to
+ * obtain an instance of this class is by using {@link #create} or the
+ * service provider mechanism.
* @see javax.tools.JavaCompilerTool
* @see javax.tools.ToolProvider
* @see #create
@@ -99,49 +81,6 @@
return new JavacTool();
}
- private String argsToString(Object... args) {
- String newArgs = null;
- if (args.length > 0) {
- StringBuilder sb = new StringBuilder();
- String separator = "";
- for (Object arg : args) {
- sb.append(separator).append(arg.toString());
- separator = File.pathSeparator;
- }
- newArgs = sb.toString();
- }
- return newArgs;
- }
-
- private void setOption1(String name, OptionKind kind, Object... args) {
- String arg = argsToString(args);
- JavacOption option = sharedCompiler.getOption(name);
- if (option == null || !match(kind, option.getKind()))
- throw new IllegalArgumentException(name);
- if ((args.length != 0) != option.hasArg())
- throw new IllegalArgumentException(name);
- if (option.hasArg()) {
- if (option.process(null, name, arg)) // FIXME
- throw new IllegalArgumentException(name);
- } else {
- if (option.process(null, name)) // FIXME
- throw new IllegalArgumentException(name);
- }
- options.add(new Pair<String,String>(name,arg));
- }
-
- public void setOption(String name, Object... args) {
- setOption1(name, OptionKind.NORMAL, args);
- }
-
- public void setExtendedOption(String name, Object... args) {
- setOption1(name, OptionKind.EXTENDED, args);
- }
-
- private static boolean match(OptionKind clientKind, OptionKind optionKind) {
- return (clientKind == (optionKind == OptionKind.HIDDEN ? OptionKind.EXTENDED : optionKind));
- }
-
public JavacFileManager getStandardFileManager(
DiagnosticListener<? super JavaFileObject> diagnosticListener,
Locale locale,
@@ -209,7 +148,9 @@
if (fileManager == null)
fileManager = getStandardFileManager(diagnosticListener, null, null);
fileManager = ccw.wrap(fileManager);
+
context.put(JavaFileManager.class, fileManager);
+
processOptions(context, fileManager, options);
Main compiler = new Main("javacTask", context.get(Log.outKey));
return new JavacTaskImpl(compiler, options, context, classes, compilationUnits);
@@ -225,11 +166,28 @@
if (options == null)
return;
- Options optionTable = Options.instance(context);
+ final Options optionTable = Options.instance(context);
Log log = Log.instance(context);
- JavacOption[] recognizedOptions =
- RecognizedOptions.getJavacToolOptions(new GrumpyHelper(log));
+ Option[] recognizedOptions =
+ Option.getJavacToolOptions().toArray(new Option[0]);
+ OptionHelper optionHelper = new GrumpyHelper(log) {
+ @Override
+ public String get(Option option) {
+ return optionTable.get(option.getText());
+ }
+
+ @Override
+ public void put(String name, String value) {
+ optionTable.put(name, value);
+ }
+
+ @Override
+ public void remove(String name) {
+ optionTable.remove(name);
+ }
+ };
+
Iterator<String> flags = options.iterator();
while (flags.hasNext()) {
String flag = flags.next();
@@ -247,19 +205,19 @@
}
}
- JavacOption option = recognizedOptions[j];
+ Option option = recognizedOptions[j];
if (option.hasArg()) {
if (!flags.hasNext()) {
String msg = log.localize(PrefixKind.JAVAC, "err.req.arg", flag);
throw new IllegalArgumentException(msg);
}
String operand = flags.next();
- if (option.process(optionTable, flag, operand))
+ if (option.process(optionHelper, flag, operand))
// should not happen as the GrumpyHelper will throw exceptions
// in case of errors
throw new IllegalArgumentException(flag + " " + operand);
} else {
- if (option.process(optionTable, flag))
+ if (option.process(optionHelper, flag))
// should not happen as the GrumpyHelper will throw exceptions
// in case of errors
throw new IllegalArgumentException(flag);
@@ -283,9 +241,8 @@
}
public int isSupportedOption(String option) {
- JavacOption[] recognizedOptions =
- RecognizedOptions.getJavacToolOptions(new GrumpyHelper(null));
- for (JavacOption o : recognizedOptions) {
+ Set<Option> recognizedOptions = Option.getJavacToolOptions();
+ for (Option o : recognizedOptions) {
if (o.matches(option))
return o.hasArg() ? 1 : 0;
}
--- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Jan 04 10:57:39 2012 -0800
@@ -32,7 +32,7 @@
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.jvm.Target;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** The source language version accepted.
*
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Jan 04 10:57:39 2012 -0800
@@ -48,7 +48,6 @@
import static com.sun.tools.javac.code.TypeTags.*;
import static com.sun.tools.javac.code.TypeTags.WILDCARD;
-import static com.sun.tools.javac.main.OptionName.*;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
/** Type checking helper class for the attribution phase.
@@ -110,7 +109,7 @@
allowAnnotations = source.allowAnnotations();
allowCovariantReturns = source.allowCovariantReturns();
allowSimplifiedVarargs = source.allowSimplifiedVarargs();
- complexInference = options.isSet(COMPLEXINFERENCE);
+ complexInference = options.isSet("complexinference");
skipAnnotations = options.isSet("skipAnnotations");
warnOnSyntheticConflicts = options.isSet("warnOnSyntheticConflicts");
suppressAbortOnBadClassFile = options.isSet("suppressAbortOnBadClassFile");
@@ -2482,7 +2481,7 @@
warnDeprecated(pos, s);
}
});
- };
+ }
}
void checkSunAPI(final DiagnosticPosition pos, final Symbol s) {
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Enter.java Wed Jan 04 10:57:39 2012 -0800
@@ -34,7 +34,7 @@
import com.sun.tools.javac.code.Symbol.*;
import com.sun.tools.javac.code.Type.*;
import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.main.RecognizedOptions.PkgInfo;
+import com.sun.tools.javac.main.Option.PkgInfo;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.tree.JCTree.*;
import com.sun.tools.javac.util.*;
--- a/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed Jan 04 10:57:39 2012 -0800
@@ -29,7 +29,7 @@
import com.sun.tools.javac.code.*;
import com.sun.tools.javac.jvm.*;
-import com.sun.tools.javac.main.RecognizedOptions.PkgInfo;
+import com.sun.tools.javac.main.Option.PkgInfo;
import com.sun.tools.javac.tree.*;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/Locations.java Wed Jan 04 10:57:39 2012 -0800
@@ -47,14 +47,14 @@
import javax.tools.StandardLocation;
import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.main.OptionName;
+import com.sun.tools.javac.main.Option;
import com.sun.tools.javac.util.ListBuffer;
import com.sun.tools.javac.util.Log;
import com.sun.tools.javac.util.Options;
import javax.tools.JavaFileManager;
import static javax.tools.StandardLocation.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** This class converts command line arguments, environment variables
* and system properties (in File.pathSeparator-separated String form)
@@ -318,23 +318,23 @@
*/
protected abstract class LocationHandler {
final Location location;
- final Set<OptionName> options;
+ final Set<Option> options;
/**
* Create a handler. The location and options provide a way to map
* from a location or an option to the corresponding handler.
* @see #initHandlers
*/
- protected LocationHandler(Location location, OptionName... options) {
+ protected LocationHandler(Location location, Option... options) {
this.location = location;
this.options = options.length == 0 ?
- EnumSet.noneOf(OptionName.class):
+ EnumSet.noneOf(Option.class):
EnumSet.copyOf(Arrays.asList(options));
}
// TODO: TEMPORARY, while Options still used for command line options
void update(Options optionTable) {
- for (OptionName o: options) {
+ for (Option o: options) {
String v = optionTable.get(o);
if (v != null) {
handleOption(o, v);
@@ -343,7 +343,7 @@
}
/** @see JavaFileManager#handleOption. */
- abstract boolean handleOption(OptionName option, String value);
+ abstract boolean handleOption(Option option, String value);
/** @see JavaFileManager#getLocation. */
abstract Collection<File> getLocation();
/** @see JavaFileManager#setLocation. */
@@ -359,12 +359,12 @@
private class OutputLocationHandler extends LocationHandler {
private File outputDir;
- OutputLocationHandler(Location location, OptionName... options) {
+ OutputLocationHandler(Location location, Option... options) {
super(location, options);
}
@Override
- boolean handleOption(OptionName option, String value) {
+ boolean handleOption(Option option, String value) {
if (!options.contains(option))
return false;
@@ -410,12 +410,12 @@
private class SimpleLocationHandler extends LocationHandler {
protected Collection<File> searchPath;
- SimpleLocationHandler(Location location, OptionName... options) {
+ SimpleLocationHandler(Location location, Option... options) {
super(location, options);
}
@Override
- boolean handleOption(OptionName option, String value) {
+ boolean handleOption(Option option, String value) {
if (!options.contains(option))
return false;
searchPath = value == null ? null :
@@ -452,7 +452,7 @@
private class ClassPathLocationHandler extends SimpleLocationHandler {
ClassPathLocationHandler() {
super(StandardLocation.CLASS_PATH,
- OptionName.CLASSPATH, OptionName.CP);
+ Option.CLASSPATH, Option.CP);
}
@Override
@@ -500,7 +500,7 @@
*/
private class BootClassPathLocationHandler extends LocationHandler {
private Collection<File> searchPath;
- final Map<OptionName, String> optionValues = new EnumMap<OptionName,String>(OptionName.class);
+ final Map<Option, String> optionValues = new EnumMap<Option,String>(Option.class);
/**
* rt.jar as found on the default bootclasspath.
@@ -515,11 +515,11 @@
BootClassPathLocationHandler() {
super(StandardLocation.PLATFORM_CLASS_PATH,
- OptionName.BOOTCLASSPATH, OptionName.XBOOTCLASSPATH,
- OptionName.XBOOTCLASSPATH_PREPEND,
- OptionName.XBOOTCLASSPATH_APPEND,
- OptionName.ENDORSEDDIRS, OptionName.DJAVA_ENDORSED_DIRS,
- OptionName.EXTDIRS, OptionName.DJAVA_EXT_DIRS);
+ Option.BOOTCLASSPATH, Option.XBOOTCLASSPATH,
+ Option.XBOOTCLASSPATH_PREPEND,
+ Option.XBOOTCLASSPATH_APPEND,
+ Option.ENDORSEDDIRS, Option.DJAVA_ENDORSED_DIRS,
+ Option.EXTDIRS, Option.DJAVA_EXT_DIRS);
}
boolean isDefault() {
@@ -533,7 +533,7 @@
}
@Override
- boolean handleOption(OptionName option, String value) {
+ boolean handleOption(Option option, String value) {
if (!options.contains(option))
return false;
@@ -549,14 +549,14 @@
// where
// TODO: would be better if option aliasing was handled at a higher
// level
- private OptionName canonicalize(OptionName option) {
+ private Option canonicalize(Option option) {
switch (option) {
case XBOOTCLASSPATH:
- return OptionName.BOOTCLASSPATH;
+ return Option.BOOTCLASSPATH;
case DJAVA_ENDORSED_DIRS:
- return OptionName.ENDORSEDDIRS;
+ return Option.ENDORSEDDIRS;
case DJAVA_EXT_DIRS:
- return OptionName.EXTDIRS;
+ return Option.EXTDIRS;
default:
return option;
}
@@ -636,29 +636,29 @@
}
Map<Location, LocationHandler> handlersForLocation;
- Map<OptionName, LocationHandler> handlersForOption;
+ Map<Option, LocationHandler> handlersForOption;
void initHandlers() {
handlersForLocation = new HashMap<Location, LocationHandler>();
- handlersForOption = new EnumMap<OptionName, LocationHandler>(OptionName.class);
+ handlersForOption = new EnumMap<Option, LocationHandler>(Option.class);
LocationHandler[] handlers = {
new BootClassPathLocationHandler(),
new ClassPathLocationHandler(),
- new SimpleLocationHandler(StandardLocation.SOURCE_PATH, OptionName.SOURCEPATH),
- new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, OptionName.PROCESSORPATH),
- new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), OptionName.D),
- new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), OptionName.S)
+ new SimpleLocationHandler(StandardLocation.SOURCE_PATH, Option.SOURCEPATH),
+ new SimpleLocationHandler(StandardLocation.ANNOTATION_PROCESSOR_PATH, Option.PROCESSORPATH),
+ new OutputLocationHandler((StandardLocation.CLASS_OUTPUT), Option.D),
+ new OutputLocationHandler((StandardLocation.SOURCE_OUTPUT), Option.S)
};
for (LocationHandler h: handlers) {
handlersForLocation.put(h.location, h);
- for (OptionName o: h.options)
+ for (Option o: h.options)
handlersForOption.put(o, h);
}
}
- boolean handleOption(OptionName option, String value) {
+ boolean handleOption(Option option, String value) {
LocationHandler h = handlersForOption.get(option);
return (h == null ? false : h.handleOption(option, value));
}
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassReader.java Wed Jan 04 10:57:39 2012 -0800
@@ -59,7 +59,7 @@
import static com.sun.tools.javac.jvm.ClassFile.*;
import static com.sun.tools.javac.jvm.ClassFile.Version.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** This class provides operations to read a classfile into an internal
* representation. The internal representation is anchored in a
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/ClassWriter.java Wed Jan 04 10:57:39 2012 -0800
@@ -45,7 +45,7 @@
import static com.sun.tools.javac.code.Kinds.*;
import static com.sun.tools.javac.code.TypeTags.*;
import static com.sun.tools.javac.jvm.UninitializedType.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Gen.java Wed Jan 04 10:57:39 2012 -0800
@@ -45,7 +45,7 @@
import static com.sun.tools.javac.code.TypeTags.*;
import static com.sun.tools.javac.jvm.ByteCodes.*;
import static com.sun.tools.javac.jvm.CRTFlags.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
import static com.sun.tools.javac.tree.JCTree.Tag.*;
import static com.sun.tools.javac.tree.JCTree.Tag.BLOCK;
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/Target.java Wed Jan 04 10:57:39 2012 -0800
@@ -31,7 +31,7 @@
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.util.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** The classfile version target.
*
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java Wed Jan 04 10:57:39 2012 -0800
@@ -62,7 +62,7 @@
import com.sun.tools.javac.util.Log.WriterKind;
import static javax.tools.StandardLocation.CLASS_OUTPUT;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
import static com.sun.tools.javac.util.ListBuffer.lb;
@@ -817,8 +817,8 @@
// forcibly set the equivalent of -Xlint:-options, so that no further
// warnings about command line options are generated from this point on
- options.put(XLINT_CUSTOM + "-" + LintCategory.OPTIONS.option, "true");
- options.remove(XLINT_CUSTOM + LintCategory.OPTIONS.option);
+ options.put(XLINT_CUSTOM.text + "-" + LintCategory.OPTIONS.option, "true");
+ options.remove(XLINT_CUSTOM.text + LintCategory.OPTIONS.option);
start_msec = now();
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavacOption.java Wed Jan 04 03:49:35 2012 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,299 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, 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.javac.main;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Log.PrefixKind;
-import com.sun.tools.javac.util.Log.WriterKind;
-import com.sun.tools.javac.util.Options;
-
-/**
- * TODO: describe com.sun.tools.javac.main.JavacOption
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public interface JavacOption {
-
- OptionKind getKind();
-
- /** Does this option take a (separate) operand?
- * @return true if this option takes a separate operand
- */
- boolean hasArg();
-
- /** Does argument string match option pattern?
- * @param arg the command line argument string
- * @return true if {@code arg} matches this option
- */
- boolean matches(String arg);
-
- /** Process an option with an argument.
- * @param options the accumulated set of analyzed options
- * @param option the option to be processed
- * @param arg the arg for the option to be processed
- * @return true if an error was detected
- */
- boolean process(Options options, String option, String arg);
-
- /** Process the option with no argument.
- * @param options the accumulated set of analyzed options
- * @param option the option to be processed
- * @return true if an error was detected
- */
- boolean process(Options options, String option);
-
- OptionName getName();
-
- enum OptionKind {
- NORMAL,
- EXTENDED,
- HIDDEN,
- }
-
- enum ChoiceKind {
- ONEOF,
- ANYOF
- }
-
- /** This class represents an option recognized by the main program
- */
- static class Option implements JavacOption {
-
- /** Option string.
- */
- OptionName name;
-
- /** Documentation key for arguments.
- */
- String argsNameKey;
-
- /** Documentation key for description.
- */
- String descrKey;
-
- /** Suffix option (-foo=bar or -foo:bar)
- */
- boolean hasSuffix;
-
- /** The kind of choices for this option, if any.
- */
- ChoiceKind choiceKind;
-
- /** The choices for this option, if any, and whether or not the choices
- * are hidden
- */
- Map<String,Boolean> choices;
-
- Option(OptionName name, String argsNameKey, String descrKey) {
- this.name = name;
- this.argsNameKey = argsNameKey;
- this.descrKey = descrKey;
- char lastChar = name.optionName.charAt(name.optionName.length()-1);
- hasSuffix = lastChar == ':' || lastChar == '=';
- }
-
- Option(OptionName name, String descrKey) {
- this(name, null, descrKey);
- }
-
- Option(OptionName name, String descrKey, ChoiceKind choiceKind, String... choices) {
- this(name, descrKey, choiceKind, createChoices(choices));
- }
-
- private static Map<String,Boolean> createChoices(String... choices) {
- Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
- for (String c: choices)
- map.put(c, false);
- return map;
- }
-
- Option(OptionName name, String descrKey, ChoiceKind choiceKind,
- Map<String,Boolean> choices) {
- this(name, null, descrKey);
- if (choiceKind == null || choices == null)
- throw new NullPointerException();
- this.choiceKind = choiceKind;
- this.choices = choices;
- }
-
- @Override
- public String toString() {
- return name.optionName;
- }
-
- public boolean hasArg() {
- return argsNameKey != null && !hasSuffix;
- }
-
- public boolean matches(String option) {
- if (!hasSuffix)
- return option.equals(name.optionName);
-
- if (!option.startsWith(name.optionName))
- return false;
-
- if (choices != null) {
- String arg = option.substring(name.optionName.length());
- if (choiceKind == ChoiceKind.ONEOF)
- return choices.keySet().contains(arg);
- else {
- for (String a: arg.split(",+")) {
- if (!choices.keySet().contains(a))
- return false;
- }
- }
- }
-
- return true;
- }
-
- /** Print a line of documentation describing this option, if standard.
- * @param out the stream to which to write the documentation
- */
- void help(Log log) {
- log.printRawLines(WriterKind.NOTICE,
- String.format(" %-26s %s",
- helpSynopsis(log),
- log.localize(PrefixKind.JAVAC, descrKey)));
- }
-
- String helpSynopsis(Log log) {
- StringBuilder sb = new StringBuilder();
- sb.append(name);
- if (argsNameKey == null) {
- if (choices != null) {
- String sep = "{";
- for (Map.Entry<String,Boolean> e: choices.entrySet()) {
- if (!e.getValue()) {
- sb.append(sep);
- sb.append(e.getKey());
- sep = ",";
- }
- }
- sb.append("}");
- }
- } else {
- if (!hasSuffix)
- sb.append(" ");
- sb.append(log.localize(PrefixKind.JAVAC, argsNameKey));
- }
-
- return sb.toString();
- }
-
- /** Print a line of documentation describing this option, if non-standard.
- * @param out the stream to which to write the documentation
- */
- void xhelp(Log log) {}
-
- /** Process the option (with arg). Return true if error detected.
- */
- public boolean process(Options options, String option, String arg) {
- if (options != null) {
- if (choices != null) {
- if (choiceKind == ChoiceKind.ONEOF) {
- // some clients like to see just one of option+choice set
- for (String s: choices.keySet())
- options.remove(option + s);
- String opt = option + arg;
- options.put(opt, opt);
- // some clients like to see option (without trailing ":")
- // set to arg
- String nm = option.substring(0, option.length() - 1);
- options.put(nm, arg);
- } else {
- // set option+word for each word in arg
- for (String a: arg.split(",+")) {
- String opt = option + a;
- options.put(opt, opt);
- }
- }
- }
- options.put(option, arg);
- }
- return false;
- }
-
- /** Process the option (without arg). Return true if error detected.
- */
- public boolean process(Options options, String option) {
- if (hasSuffix)
- return process(options, name.optionName, option.substring(name.optionName.length()));
- else
- return process(options, option, option);
- }
-
- public OptionKind getKind() { return OptionKind.NORMAL; }
-
- public OptionName getName() { return name; }
- };
-
- /** A nonstandard or extended (-X) option
- */
- static class XOption extends Option {
- XOption(OptionName name, String argsNameKey, String descrKey) {
- super(name, argsNameKey, descrKey);
- }
- XOption(OptionName name, String descrKey) {
- this(name, null, descrKey);
- }
- XOption(OptionName name, String descrKey, ChoiceKind kind, String... choices) {
- super(name, descrKey, kind, choices);
- }
- XOption(OptionName name, String descrKey, ChoiceKind kind, Map<String,Boolean> choices) {
- super(name, descrKey, kind, choices);
- }
- @Override
- void help(Log log) {}
- @Override
- void xhelp(Log log) { super.help(log); }
- @Override
- public OptionKind getKind() { return OptionKind.EXTENDED; }
- };
-
- /** A hidden (implementor) option
- */
- static class HiddenOption extends Option {
- HiddenOption(OptionName name) {
- super(name, null, null);
- }
- HiddenOption(OptionName name, String argsNameKey) {
- super(name, argsNameKey, null);
- }
- @Override
- void help(Log log) {}
- @Override
- void xhelp(Log log) {}
- @Override
- public OptionKind getKind() { return OptionKind.HIDDEN; }
- };
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Wed Jan 04 10:57:39 2012 -0800
@@ -42,14 +42,12 @@
import com.sun.tools.javac.file.CacheFSInfo;
import com.sun.tools.javac.file.JavacFileManager;
import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.main.JavacOption.Option;
-import com.sun.tools.javac.main.RecognizedOptions.OptionHelper;
import com.sun.tools.javac.util.*;
import com.sun.tools.javac.util.Log.WriterKind;
import com.sun.tools.javac.util.Log.PrefixKind;
import com.sun.tools.javac.processing.AnnotationProcessingError;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** This class provides a commandline interface to the GJC compiler.
*
@@ -99,42 +97,51 @@
public final int exitCode;
}
- private Option[] recognizedOptions = RecognizedOptions.getJavaCompilerOptions(new OptionHelper() {
+ private Option[] recognizedOptions =
+ Option.getJavaCompilerOptions().toArray(new Option[0]);
- public void setOut(PrintWriter out) {
- Main.this.out = out;
- Main.this.log.setWriters(out);
+ private OptionHelper optionHelper = new OptionHelper() {
+ @Override
+ public String get(Option option) {
+ return options.get(option);
+ }
+
+ @Override
+ public void put(String name, String value) {
+ options.put(name, value);
}
+ @Override
+ public void remove(String name) {
+ options.remove(name);
+ }
+
+ @Override
+ public Log getLog() {
+ return log;
+ }
+
+ @Override
+ public String getOwnName() {
+ return ownName;
+ }
+
+ @Override
public void error(String key, Object... args) {
Main.this.error(key, args);
}
- public void printVersion() {
- log.printLines(PrefixKind.JAVAC, "version", ownName, JavaCompiler.version());
- }
-
- public void printFullVersion() {
- log.printLines(PrefixKind.JAVAC, "fullVersion", ownName, JavaCompiler.fullVersion());
- }
-
- public void printHelp() {
- help();
- }
-
- public void printXhelp() {
- xhelp();
- }
-
+ @Override
public void addFile(File f) {
filenames.add(f);
}
+ @Override
public void addClassName(String s) {
classnames.append(s);
}
- });
+ };
/**
* Construct a compiler instance.
@@ -161,26 +168,6 @@
*/
public ListBuffer<String> classnames = null; // XXX sb protected
- /** Print a string that explains usage.
- */
- void help() {
- log.printLines(PrefixKind.JAVAC, "msg.usage.header", ownName);
- for (int i=0; i<recognizedOptions.length; i++) {
- recognizedOptions[i].help(log);
- }
- log.printNewline();
- }
-
- /** Print a string that explains usage for X options.
- */
- void xhelp() {
- for (int i=0; i<recognizedOptions.length; i++) {
- recognizedOptions[i].xhelp(log);
- }
- log.printNewline();
- log.printLines(PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
- }
-
/** Report a usage error.
*/
void error(String key, Object... args) {
@@ -253,10 +240,10 @@
}
String operand = flags[ac];
ac++;
- if (option.process(options, flag, operand))
+ if (option.process(optionHelper, flag, operand))
return null;
} else {
- if (option.process(options, flag))
+ if (option.process(optionHelper, flag))
return null;
}
}
@@ -317,8 +304,8 @@
return filenames;
}
// where
- private boolean checkDirectory(OptionName optName) {
- String value = options.get(optName);
+ private boolean checkDirectory(Option option) {
+ String value = options.get(option);
if (value == null)
return true;
File file = new File(value);
@@ -375,7 +362,7 @@
*/
try {
if (args.length == 0 && fileObjects.isEmpty()) {
- help();
+ Option.HELP.process(optionHelper, "-help");
return Result.CMDERR;
}
@@ -407,8 +394,7 @@
boolean forceStdOut = options.isSet("stdout");
if (forceStdOut) {
log.flush();
- out = new PrintWriter(System.out, true);
- log.setWriters(out);
+ log.setWriters(new PrintWriter(System.out, true));
}
// allow System property in following line as a Mustang legacy
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Option.java Wed Jan 04 10:57:39 2012 -0800
@@ -0,0 +1,710 @@
+/*
+ * Copyright (c) 2006, 2011, 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.javac.main;
+
+import java.util.Collections;
+import com.sun.tools.javac.util.Log.PrefixKind;
+import com.sun.tools.javac.util.Log.WriterKind;
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.code.Lint;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.jvm.Target;
+import com.sun.tools.javac.util.Options;
+import com.sun.tools.javac.processing.JavacProcessingEnvironment;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.EnumSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+import javax.lang.model.SourceVersion;
+
+import static com.sun.tools.javac.main.Option.ChoiceKind.*;
+import static com.sun.tools.javac.main.Option.OptionKind.*;
+import static com.sun.tools.javac.main.Option.OptionGroup.*;
+
+/**
+ * Options for javac. The specific Option to handle a command-line option
+ * is identified by searching the members of this enum in order, looking
+ * the first {@link #matches match}. The action for an Option is performed
+ * by calling {@link #process process}, and by providing a suitable
+ * {@link OptionHelper} to provide access the compiler state.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk. This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public enum Option {
+ G("-g", "opt.g", STANDARD, BASIC),
+
+ G_NONE("-g:none", "opt.g.none", STANDARD, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ helper.put("-g:", "none");
+ return false;
+ }
+ },
+
+ G_CUSTOM("-g:", "opt.g.lines.vars.source",
+ STANDARD, BASIC, ANYOF, "lines", "vars", "source"),
+
+ XLINT("-Xlint", "opt.Xlint", EXTENDED, BASIC),
+
+ XLINT_CUSTOM("-Xlint:", "opt.Xlint.suboptlist",
+ EXTENDED, BASIC, ANYOF, getXLintChoices()),
+
+ // -nowarn is retained for command-line backward compatibility
+ NOWARN("-nowarn", "opt.nowarn", STANDARD, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ helper.put("-Xlint:none", option);
+ return false;
+ }
+ },
+
+ VERBOSE("-verbose", "opt.verbose", STANDARD, BASIC),
+
+ // -deprecation is retained for command-line backward compatibility
+ DEPRECATION("-deprecation", "opt.deprecation", STANDARD, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ helper.put("-Xlint:deprecation", option);
+ return false;
+ }
+ },
+
+ CLASSPATH("-classpath", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER),
+
+ CP("-cp", "opt.arg.path", "opt.classpath", STANDARD, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ return super.process(helper, "-classpath", arg);
+ }
+ },
+
+ SOURCEPATH("-sourcepath", "opt.arg.path", "opt.sourcepath", STANDARD, FILEMANAGER),
+
+ BOOTCLASSPATH("-bootclasspath", "opt.arg.path", "opt.bootclasspath", STANDARD, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ helper.remove("-Xbootclasspath/p:");
+ helper.remove("-Xbootclasspath/a:");
+ return super.process(helper, option, arg);
+ }
+ },
+
+ XBOOTCLASSPATH_PREPEND("-Xbootclasspath/p:", "opt.arg.path", "opt.Xbootclasspath.p", EXTENDED, FILEMANAGER),
+
+ XBOOTCLASSPATH_APPEND("-Xbootclasspath/a:", "opt.arg.path", "opt.Xbootclasspath.a", EXTENDED, FILEMANAGER),
+
+ XBOOTCLASSPATH("-Xbootclasspath:", "opt.arg.path", "opt.bootclasspath", EXTENDED, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ helper.remove("-Xbootclasspath/p:");
+ helper.remove("-Xbootclasspath/a:");
+ return super.process(helper, "-bootclasspath", arg);
+ }
+ },
+
+ EXTDIRS("-extdirs", "opt.arg.dirs", "opt.extdirs", STANDARD, FILEMANAGER),
+
+ DJAVA_EXT_DIRS("-Djava.ext.dirs=", "opt.arg.dirs", "opt.extdirs", EXTENDED, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ return super.process(helper, "-extdirs", arg);
+ }
+ },
+
+ ENDORSEDDIRS("-endorseddirs", "opt.arg.dirs", "opt.endorseddirs", STANDARD, FILEMANAGER),
+
+ DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs=", "opt.arg.dirs", "opt.endorseddirs", EXTENDED, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ return super.process(helper, "-endorseddirs", arg);
+ }
+ },
+
+ PROC("-proc:", "opt.proc.none.only", STANDARD, BASIC, ONEOF, "none", "only"),
+
+ PROCESSOR("-processor", "opt.arg.class.list", "opt.processor", STANDARD, BASIC),
+
+ PROCESSORPATH("-processorpath", "opt.arg.path", "opt.processorpath", STANDARD, FILEMANAGER),
+
+ D("-d", "opt.arg.directory", "opt.d", STANDARD, FILEMANAGER),
+
+ S("-s", "opt.arg.directory", "opt.sourceDest", STANDARD, FILEMANAGER),
+
+ IMPLICIT("-implicit:", "opt.implicit", STANDARD, BASIC, ONEOF, "none", "class"),
+
+ ENCODING("-encoding", "opt.arg.encoding", "opt.encoding", STANDARD, FILEMANAGER) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String operand) {
+// System.err.println("process encoding " + operand);
+ return super.process(helper, option, operand);
+ }
+
+ },
+
+ SOURCE("-source", "opt.arg.release", "opt.source", STANDARD, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String operand) {
+ Source source = Source.lookup(operand);
+ if (source == null) {
+ helper.error("err.invalid.source", operand);
+ return true;
+ }
+ return super.process(helper, option, operand);
+ }
+ },
+
+ TARGET("-target", "opt.arg.release", "opt.target", STANDARD, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String operand) {
+ Target target = Target.lookup(operand);
+ if (target == null) {
+ helper.error("err.invalid.target", operand);
+ return true;
+ }
+ return super.process(helper, option, operand);
+ }
+ },
+
+ VERSION("-version", "opt.version", STANDARD, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ Log log = helper.getLog();
+ String ownName = helper.getOwnName();
+ log.printLines(PrefixKind.JAVAC, "version", ownName, JavaCompiler.version());
+ return super.process(helper, option);
+ }
+ },
+
+ FULLVERSION("-fullversion", null, HIDDEN, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ Log log = helper.getLog();
+ String ownName = helper.getOwnName();
+ log.printLines(PrefixKind.JAVAC, "fullVersion", ownName, JavaCompiler.fullVersion());
+ return super.process(helper, option);
+ }
+ },
+
+ DIAGS("-XDdiags=", null, HIDDEN, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ option = option.substring(option.indexOf('=') + 1);
+ String diagsOption = option.contains("%") ?
+ "-XDdiagsFormat=" :
+ "-XDdiags=";
+ diagsOption += option;
+ if (XD.matches(diagsOption))
+ return XD.process(helper, diagsOption);
+ else
+ return false;
+ }
+ },
+
+ HELP("-help", "opt.help", STANDARD, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ Log log = helper.getLog();
+ String ownName = helper.getOwnName();
+ log.printLines(PrefixKind.JAVAC, "msg.usage.header", ownName);
+ for (Option o: getJavaCompilerOptions()) {
+ o.help(log, OptionKind.STANDARD);
+ }
+ log.printNewline();
+ return super.process(helper, option);
+ }
+ },
+
+ A("-A", "opt.arg.key.equals.value", "opt.A", STANDARD, BASIC) {
+ { hasSuffix = true; }
+
+ @Override
+ public boolean matches(String arg) {
+ return arg.startsWith("-A");
+ }
+
+ @Override
+ public boolean hasArg() {
+ return false;
+ }
+ // Mapping for processor options created in
+ // JavacProcessingEnvironment
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ int argLength = option.length();
+ if (argLength == 2) {
+ helper.error("err.empty.A.argument");
+ return true;
+ }
+ int sepIndex = option.indexOf('=');
+ String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
+ if (!JavacProcessingEnvironment.isValidOptionName(key)) {
+ helper.error("err.invalid.A.key", option);
+ return true;
+ }
+ return process(helper, option, option);
+ }
+ },
+
+ X("-X", "opt.X", STANDARD, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ Log log = helper.getLog();
+ for (Option o: getJavaCompilerOptions()) {
+ o.help(log, OptionKind.EXTENDED);
+ }
+ log.printNewline();
+ log.printLines(PrefixKind.JAVAC, "msg.usage.nonstandard.footer");
+ return super.process(helper, option);
+ }
+ },
+
+ // This option exists only for the purpose of documenting itself.
+ // It's actually implemented by the launcher.
+ J("-J", "opt.arg.flag", "opt.J", STANDARD, INFO) {
+ { hasSuffix = true; }
+
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ throw new AssertionError
+ ("the -J flag should be caught by the launcher.");
+ }
+ },
+
+ // stop after parsing and attributing.
+ // new HiddenOption("-attrparseonly"),
+
+ // new Option("-moreinfo", "opt.moreinfo") {
+ MOREINFO("-moreinfo", null, HIDDEN, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ Type.moreInfo = true;
+ return super.process(helper, option);
+ }
+ },
+
+ // treat warnings as errors
+ WERROR("-Werror", "opt.Werror", STANDARD, BASIC),
+
+// // use complex inference from context in the position of a method call argument
+// COMPLEXINFERENCE("-complexinference", null, HIDDEN, BASIC),
+
+ // generare source stubs
+ // new HiddenOption("-stubs"),
+
+ // relax some constraints to allow compiling from stubs
+ // new HiddenOption("-relax"),
+
+ // output source after translating away inner classes
+ // new Option("-printflat", "opt.printflat"),
+ // new HiddenOption("-printflat"),
+
+ // display scope search details
+ // new Option("-printsearch", "opt.printsearch"),
+ // new HiddenOption("-printsearch"),
+
+ // prompt after each error
+ // new Option("-prompt", "opt.prompt"),
+ PROMPT("-prompt", null, HIDDEN, BASIC),
+
+ // dump stack on error
+ DOE("-doe", null, HIDDEN, BASIC),
+
+ // output source after type erasure
+ // new Option("-s", "opt.s"),
+ PRINTSOURCE("-printsource", null, HIDDEN, BASIC),
+
+ // output shrouded class files
+ // new Option("-scramble", "opt.scramble"),
+ // new Option("-scrambleall", "opt.scrambleall"),
+
+ // display warnings for generic unchecked operations
+ WARNUNCHECKED("-warnunchecked", null, HIDDEN, BASIC) {
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ helper.put("-Xlint:unchecked", option);
+ return false;
+ }
+ },
+
+ XMAXERRS("-Xmaxerrs", "opt.arg.number", "opt.maxerrs", EXTENDED, BASIC),
+
+ XMAXWARNS("-Xmaxwarns", "opt.arg.number", "opt.maxwarns", EXTENDED, BASIC),
+
+ XSTDOUT("-Xstdout", "opt.arg.file", "opt.Xstdout", EXTENDED, INFO) {
+ @Override
+ public boolean process(OptionHelper helper, String option, String arg) {
+ try {
+ Log log = helper.getLog();
+ // TODO: this file should be closed at the end of compilation
+ log.setWriters(new PrintWriter(new FileWriter(arg), true));
+ } catch (java.io.IOException e) {
+ helper.error("err.error.writing.file", arg, e);
+ return true;
+ }
+ return super.process(helper, option, arg);
+ }
+ },
+
+ XPRINT("-Xprint", "opt.print", EXTENDED, BASIC),
+
+ XPRINTROUNDS("-XprintRounds", "opt.printRounds", EXTENDED, BASIC),
+
+ XPRINTPROCESSORINFO("-XprintProcessorInfo", "opt.printProcessorInfo", EXTENDED, BASIC),
+
+ XPREFER("-Xprefer:", "opt.prefer", EXTENDED, BASIC, ONEOF, "source", "newer"),
+
+ XPKGINFO("-Xpkginfo:", "opt.pkginfo", EXTENDED, BASIC, ONEOF, "always", "legacy", "nonempty"),
+
+ /* -O is a no-op, accepted for backward compatibility. */
+ O("-O", null, HIDDEN, BASIC),
+
+ /* -Xjcov produces tables to support the code coverage tool jcov. */
+ XJCOV("-Xjcov", null, HIDDEN, BASIC),
+
+ /* This is a back door to the compiler's option table.
+ * -XDx=y sets the option x to the value y.
+ * -XDx sets the option x to the value x.
+ */
+ XD("-XD", null, HIDDEN, BASIC) {
+ String s;
+ @Override
+ public boolean matches(String s) {
+ this.s = s;
+ return s.startsWith(text);
+ }
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ s = s.substring(text.length());
+ int eq = s.indexOf('=');
+ String key = (eq < 0) ? s : s.substring(0, eq);
+ String value = (eq < 0) ? s : s.substring(eq+1);
+ helper.put(key, value);
+ return false;
+ }
+ },
+
+ // This option exists only for the purpose of documenting itself.
+ // It's actually implemented by the CommandLine class.
+ AT("@", "opt.arg.file", "opt.AT", STANDARD, INFO) {
+ { hasSuffix = true; }
+
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ throw new AssertionError("the @ flag should be caught by CommandLine.");
+ }
+ },
+
+ /*
+ * TODO: With apt, the matches method accepts anything if
+ * -XclassAsDecls is used; code elsewhere does the lookup to
+ * see if the class name is both legal and found.
+ *
+ * In apt, the process method adds the candidate class file
+ * name to a separate list.
+ */
+ SOURCEFILE("sourcefile", null, HIDDEN, INFO) {
+ String s;
+ @Override
+ public boolean matches(String s) {
+ this.s = s;
+ return s.endsWith(".java") // Java source file
+ || SourceVersion.isName(s); // Legal type name
+ }
+ @Override
+ public boolean process(OptionHelper helper, String option) {
+ if (s.endsWith(".java") ) {
+ File f = new File(s);
+ if (!f.exists()) {
+ helper.error("err.file.not.found", f);
+ return true;
+ }
+ if (!f.isFile()) {
+ helper.error("err.file.not.file", f);
+ return true;
+ }
+ helper.addFile(f);
+ }
+ else
+ helper.addClassName(s);
+ return false;
+ }
+ };
+
+ /** The kind of an Option. This is used by the -help and -X options. */
+ public enum OptionKind {
+ /** A standard option, documented by -help. */
+ STANDARD,
+ /** An extended option, documented by -X. */
+ EXTENDED,
+ /** A hidden option, not documented. */
+ HIDDEN,
+ }
+
+ /** The group for an Option. This determines the situations in which the
+ * option is applicable. */
+ enum OptionGroup {
+ /** A basic option, available for use on the command line or via the
+ * Compiler API. */
+ BASIC,
+ /** An option for javac's standard JavaFileManager. Other file managers
+ * may or may not support these options. */
+ FILEMANAGER,
+ /** A command-line option that requests information, such as -help. */
+ INFO,
+ /** A command-line "option" representing a file or class name. */
+ OPERAND
+ }
+
+ /** The kind of choice for "choice" options. */
+ enum ChoiceKind {
+ /** The expected value is exactly one of the set of choices. */
+ ONEOF,
+ /** The expected value is one of more of the set of choices. */
+ ANYOF
+ }
+
+ public final String text;
+
+ final OptionKind kind;
+
+ final OptionGroup group;
+
+ /** Documentation key for arguments.
+ */
+ final String argsNameKey;
+
+ /** Documentation key for description.
+ */
+ final String descrKey;
+
+ /** Suffix option (-foo=bar or -foo:bar)
+ */
+ boolean hasSuffix;
+
+ /** The kind of choices for this option, if any.
+ */
+ final ChoiceKind choiceKind;
+
+ /** The choices for this option, if any, and whether or not the choices
+ * are hidden
+ */
+ final Map<String,Boolean> choices;
+
+
+ Option(String text, String descrKey,
+ OptionKind kind, OptionGroup group) {
+ this(text, null, descrKey, kind, group, null, null);
+ }
+
+ Option(String text, String argsNameKey, String descrKey,
+ OptionKind kind, OptionGroup group) {
+ this(text, argsNameKey, descrKey, kind, group, null, null);
+ }
+
+ Option(String text, String descrKey,
+ OptionKind kind, OptionGroup group,
+ ChoiceKind choiceKind, Map<String,Boolean> choices) {
+ this(text, null, descrKey, kind, group, choiceKind, choices);
+ }
+
+ Option(String text, String descrKey,
+ OptionKind kind, OptionGroup group,
+ ChoiceKind choiceKind, String... choices) {
+ this(text, null, descrKey, kind, group, choiceKind, createChoices(choices));
+ }
+ // where
+ private static Map<String,Boolean> createChoices(String... choices) {
+ Map<String,Boolean> map = new LinkedHashMap<String,Boolean>();
+ for (String c: choices)
+ map.put(c, false);
+ return map;
+ }
+
+ private Option(String text, String argsNameKey, String descrKey,
+ OptionKind kind, OptionGroup group,
+ ChoiceKind choiceKind, Map<String,Boolean> choices) {
+ this.text = text;
+ this.argsNameKey = argsNameKey;
+ this.descrKey = descrKey;
+ this.kind = kind;
+ this.group = group;
+ this.choiceKind = choiceKind;
+ this.choices = choices;
+ char lastChar = text.charAt(text.length()-1);
+ hasSuffix = lastChar == ':' || lastChar == '=';
+ }
+
+ public String getText() {
+ return text;
+ }
+
+ public OptionKind getKind() {
+ return kind;
+ }
+
+ public boolean hasArg() {
+ return argsNameKey != null && !hasSuffix;
+ }
+
+ public boolean matches(String option) {
+ if (!hasSuffix)
+ return option.equals(text);
+
+ if (!option.startsWith(text))
+ return false;
+
+ if (choices != null) {
+ String arg = option.substring(text.length());
+ if (choiceKind == ChoiceKind.ONEOF)
+ return choices.keySet().contains(arg);
+ else {
+ for (String a: arg.split(",+")) {
+ if (!choices.keySet().contains(a))
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public boolean process(OptionHelper helper, String option, String arg) {
+ if (choices != null) {
+ if (choiceKind == ChoiceKind.ONEOF) {
+ // some clients like to see just one of option+choice set
+ for (String s: choices.keySet())
+ helper.remove(option + s);
+ String opt = option + arg;
+ helper.put(opt, opt);
+ // some clients like to see option (without trailing ":")
+ // set to arg
+ String nm = option.substring(0, option.length() - 1);
+ helper.put(nm, arg);
+ } else {
+ // set option+word for each word in arg
+ for (String a: arg.split(",+")) {
+ String opt = option + a;
+ helper.put(opt, opt);
+ }
+ }
+ }
+ helper.put(option, arg);
+ return false;
+ }
+
+ public boolean process(OptionHelper helper, String option) {
+ if (hasSuffix)
+ return process(helper, text, option.substring(text.length()));
+ else
+ return process(helper, option, option);
+ }
+
+ void help(Log log, OptionKind kind) {
+ if (this.kind != kind)
+ return;
+
+ log.printRawLines(WriterKind.NOTICE,
+ String.format(" %-26s %s",
+ helpSynopsis(log),
+ log.localize(PrefixKind.JAVAC, descrKey)));
+
+ }
+
+ private String helpSynopsis(Log log) {
+ StringBuilder sb = new StringBuilder();
+ sb.append(text);
+ if (argsNameKey == null) {
+ if (choices != null) {
+ String sep = "{";
+ for (Map.Entry<String,Boolean> e: choices.entrySet()) {
+ if (!e.getValue()) {
+ sb.append(sep);
+ sb.append(e.getKey());
+ sep = ",";
+ }
+ }
+ sb.append("}");
+ }
+ } else {
+ if (!hasSuffix)
+ sb.append(" ");
+ sb.append(log.localize(PrefixKind.JAVAC, argsNameKey));
+
+ }
+
+ return sb.toString();
+ }
+
+ // For -XpkgInfo:value
+ public enum PkgInfo {
+ ALWAYS, LEGACY, NONEMPTY;
+ public static PkgInfo get(Options options) {
+ String v = options.get(XPKGINFO);
+ return (v == null
+ ? PkgInfo.LEGACY
+ : PkgInfo.valueOf(v.toUpperCase()));
+ }
+ }
+
+ private static Map<String,Boolean> getXLintChoices() {
+ Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
+ choices.put("all", false);
+ for (Lint.LintCategory c : Lint.LintCategory.values())
+ choices.put(c.option, c.hidden);
+ for (Lint.LintCategory c : Lint.LintCategory.values())
+ choices.put("-" + c.option, c.hidden);
+ choices.put("none", false);
+ return choices;
+ }
+
+ static Set<Option> getJavaCompilerOptions() {
+ return EnumSet.allOf(Option.class);
+ }
+
+ public static Set<Option> getJavacFileManagerOptions() {
+ return getOptions(EnumSet.of(FILEMANAGER));
+ }
+
+ public static Set<Option> getJavacToolOptions() {
+ return getOptions(EnumSet.of(BASIC));
+ }
+
+ static Set<Option> getOptions(Set<OptionGroup> desired) {
+ Set<Option> options = EnumSet.noneOf(Option.class);
+ for (Option option : Option.values())
+ if (desired.contains(option.group))
+ options.add(option);
+ return Collections.unmodifiableSet(options);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/OptionHelper.java Wed Jan 04 10:57:39 2012 -0800
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2006, 2011, 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.javac.main;
+
+import com.sun.tools.javac.util.Log;
+import com.sun.tools.javac.util.Log.PrefixKind;
+import java.io.File;
+
+/**
+ * Helper object to be used by {@link Option#process}, providing access to
+ * the compilation environment.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk. This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+
+public abstract class OptionHelper {
+
+ /** Get the current value of an option. */
+ public abstract String get(Option option);
+
+ /** Set the value of an option. */
+ public abstract void put(String name, String value);
+
+ /** Remove any prior value for an option. */
+ public abstract void remove(String name);
+
+ /** Get access to the Log for the compilation. */
+ public abstract Log getLog();
+
+ /** Get the name of the tool, such as "javac", to be used in info like -help. */
+ public abstract String getOwnName();
+
+ /** Report an error. */
+ abstract void error(String key, Object... args);
+
+ /** Record a file to be compiled. */
+ abstract void addFile(File f);
+
+ /** Record the name of a class for annotation processing. */
+ abstract void addClassName(String s);
+
+ /** An implementation of OptionHelper that mostly throws exceptions. */
+ public static class GrumpyHelper extends OptionHelper {
+ private final Log log;
+
+ public GrumpyHelper(Log log) {
+ this.log = log;
+ }
+
+ @Override
+ public Log getLog() {
+ return log;
+ }
+
+ @Override
+ public String getOwnName() {
+ throw new IllegalStateException();
+ }
+
+ @Override
+ public String get(Option option) {
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ public void put(String name, String value) {
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ public void remove(String name) {
+ throw new IllegalArgumentException();
+ }
+
+ @Override
+ void error(String key, Object... args) {
+ throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
+ }
+
+ @Override
+ public void addFile(File f) {
+ throw new IllegalArgumentException(f.getPath());
+ }
+
+ @Override
+ public void addClassName(String s) {
+ throw new IllegalArgumentException(s);
+ }
+ }
+
+}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/OptionName.java Wed Jan 04 03:49:35 2012 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, 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.javac.main;
-
-
-/**
- * TODO: describe com.sun.tools.javac.main.OptionName
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public enum OptionName {
- G("-g"),
- G_NONE("-g:none"),
- G_CUSTOM("-g:"),
- XLINT("-Xlint"),
- XLINT_CUSTOM("-Xlint:"),
- DIAGS("-XDdiags="),
- NOWARN("-nowarn"),
- VERBOSE("-verbose"),
- DEPRECATION("-deprecation"),
- CLASSPATH("-classpath"),
- CP("-cp"),
- SOURCEPATH("-sourcepath"),
- BOOTCLASSPATH("-bootclasspath"),
- XBOOTCLASSPATH_PREPEND("-Xbootclasspath/p:"),
- XBOOTCLASSPATH_APPEND("-Xbootclasspath/a:"),
- XBOOTCLASSPATH("-Xbootclasspath:"),
- EXTDIRS("-extdirs"),
- DJAVA_EXT_DIRS("-Djava.ext.dirs="),
- ENDORSEDDIRS("-endorseddirs"),
- DJAVA_ENDORSED_DIRS("-Djava.endorsed.dirs="),
- PROC("-proc:"),
- PROCESSOR("-processor"),
- PROCESSORPATH("-processorpath"),
- D("-d"),
- S("-s"),
- IMPLICIT("-implicit:"),
- ENCODING("-encoding"),
- SOURCE("-source"),
- TARGET("-target"),
- VERSION("-version"),
- FULLVERSION("-fullversion"),
- HELP("-help"),
- A("-A"),
- X("-X"),
- J("-J"),
- MOREINFO("-moreinfo"),
- WERROR("-Werror"),
- COMPLEXINFERENCE("-complexinference"),
- PROMPT("-prompt"),
- DOE("-doe"),
- PRINTSOURCE("-printsource"),
- WARNUNCHECKED("-warnunchecked"),
- XMAXERRS("-Xmaxerrs"),
- XMAXWARNS("-Xmaxwarns"),
- XSTDOUT("-Xstdout"),
- XPKGINFO("-Xpkginfo:"),
- XPRINT("-Xprint"),
- XPRINTROUNDS("-XprintRounds"),
- XPRINTPROCESSORINFO("-XprintProcessorInfo"),
- XPREFER("-Xprefer:"),
- O("-O"),
- XJCOV("-Xjcov"),
- XD("-XD"),
- AT("@"),
- SOURCEFILE("sourcefile");
-
- public final String optionName;
-
- OptionName(String optionName) {
- this.optionName = optionName;
- }
-
- @Override
- public String toString() {
- return optionName;
- }
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/main/RecognizedOptions.java Wed Jan 04 03:49:35 2012 -0800
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,651 +0,0 @@
-/*
- * Copyright (c) 2006, 2011, 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.javac.main;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.EnumSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-import javax.lang.model.SourceVersion;
-
-import com.sun.tools.javac.code.Lint;
-import com.sun.tools.javac.code.Source;
-import com.sun.tools.javac.code.Type;
-import com.sun.tools.javac.jvm.Target;
-import com.sun.tools.javac.main.JavacOption.HiddenOption;
-import com.sun.tools.javac.main.JavacOption.Option;
-import com.sun.tools.javac.main.JavacOption.XOption;
-import com.sun.tools.javac.processing.JavacProcessingEnvironment;
-import com.sun.tools.javac.util.ListBuffer;
-import com.sun.tools.javac.util.Log;
-import com.sun.tools.javac.util.Log.PrefixKind;
-import com.sun.tools.javac.util.Options;
-
-import static com.sun.tools.javac.main.OptionName.*;
-
-/**
- * TODO: describe com.sun.tools.javac.main.RecognizedOptions
- *
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own
- * risk. This code and its internal interfaces are subject to change
- * or deletion without notice.</b></p>
- */
-public class RecognizedOptions {
-
- private RecognizedOptions() {}
-
- public interface OptionHelper {
-
- void setOut(PrintWriter out);
-
- void error(String key, Object... args);
-
- void printVersion();
-
- void printFullVersion();
-
- void printHelp();
-
- void printXhelp();
-
- void addFile(File f);
-
- void addClassName(String s);
-
- }
-
- public static class GrumpyHelper implements OptionHelper {
- private Log log;
-
- public GrumpyHelper(Log log) {
- this.log = log;
- }
-
- public void setOut(PrintWriter out) {
- throw new IllegalArgumentException();
- }
-
- public void error(String key, Object... args) {
- throw new IllegalArgumentException(log.localize(PrefixKind.JAVAC, key, args));
- }
-
- public void printVersion() {
- throw new IllegalArgumentException();
- }
-
- public void printFullVersion() {
- throw new IllegalArgumentException();
- }
-
- public void printHelp() {
- throw new IllegalArgumentException();
- }
-
- public void printXhelp() {
- throw new IllegalArgumentException();
- }
-
- public void addFile(File f) {
- throw new IllegalArgumentException(f.getPath());
- }
-
- public void addClassName(String s) {
- throw new IllegalArgumentException(s);
- }
-
- }
-
- static Set<OptionName> javacOptions = EnumSet.of(
- G,
- G_NONE,
- G_CUSTOM,
- XLINT,
- XLINT_CUSTOM,
- NOWARN,
- VERBOSE,
- DEPRECATION,
- CLASSPATH,
- CP,
- SOURCEPATH,
- BOOTCLASSPATH,
- XBOOTCLASSPATH_PREPEND,
- XBOOTCLASSPATH_APPEND,
- XBOOTCLASSPATH,
- EXTDIRS,
- DJAVA_EXT_DIRS,
- ENDORSEDDIRS,
- DJAVA_ENDORSED_DIRS,
- PROC,
- PROCESSOR,
- PROCESSORPATH,
- D,
- S,
- IMPLICIT,
- ENCODING,
- SOURCE,
- TARGET,
- VERSION,
- FULLVERSION,
- DIAGS,
- HELP,
- A,
- X,
- J,
- MOREINFO,
- WERROR,
- // COMPLEXINFERENCE,
- PROMPT,
- DOE,
- PRINTSOURCE,
- WARNUNCHECKED,
- XMAXERRS,
- XMAXWARNS,
- XSTDOUT,
- XPKGINFO,
- XPRINT,
- XPRINTROUNDS,
- XPRINTPROCESSORINFO,
- XPREFER,
- O,
- XJCOV,
- XD,
- AT,
- SOURCEFILE);
-
- static Set<OptionName> javacFileManagerOptions = EnumSet.of(
- CLASSPATH,
- CP,
- SOURCEPATH,
- BOOTCLASSPATH,
- XBOOTCLASSPATH_PREPEND,
- XBOOTCLASSPATH_APPEND,
- XBOOTCLASSPATH,
- EXTDIRS,
- DJAVA_EXT_DIRS,
- ENDORSEDDIRS,
- DJAVA_ENDORSED_DIRS,
- PROCESSORPATH,
- D,
- S,
- ENCODING,
- SOURCE);
-
- static Set<OptionName> javacToolOptions = EnumSet.of(
- G,
- G_NONE,
- G_CUSTOM,
- XLINT,
- XLINT_CUSTOM,
- NOWARN,
- VERBOSE,
- DEPRECATION,
- PROC,
- PROCESSOR,
- IMPLICIT,
- SOURCE,
- TARGET,
- // VERSION,
- // FULLVERSION,
- // HELP,
- A,
- // X,
- // J,
- MOREINFO,
- WERROR,
- // COMPLEXINFERENCE,
- PROMPT,
- DOE,
- PRINTSOURCE,
- WARNUNCHECKED,
- XMAXERRS,
- XMAXWARNS,
- // XSTDOUT,
- XPKGINFO,
- XPRINT,
- XPRINTROUNDS,
- XPRINTPROCESSORINFO,
- XPREFER,
- O,
- XJCOV,
- XD);
-
- static Option[] getJavaCompilerOptions(OptionHelper helper) {
- return getOptions(helper, javacOptions);
- }
-
- public static Option[] getJavacFileManagerOptions(OptionHelper helper) {
- return getOptions(helper, javacFileManagerOptions);
- }
-
- public static Option[] getJavacToolOptions(OptionHelper helper) {
- return getOptions(helper, javacToolOptions);
- }
-
- static Option[] getOptions(OptionHelper helper, Set<OptionName> desired) {
- ListBuffer<Option> options = new ListBuffer<Option>();
- for (Option option : getAll(helper))
- if (desired.contains(option.getName()))
- options.append(option);
- return options.toArray(new Option[options.length()]);
- }
-
- /**
- * Get all the recognized options.
- * @param helper an {@code OptionHelper} to help when processing options
- * @return an array of options
- */
- public static Option[] getAll(final OptionHelper helper) {
- return new Option[] {
- new Option(G, "opt.g"),
- new Option(G_NONE, "opt.g.none") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-g:", "none");
- return false;
- }
- },
-
- new Option(G_CUSTOM, "opt.g.lines.vars.source",
- Option.ChoiceKind.ANYOF, "lines", "vars", "source"),
-
- new XOption(XLINT, "opt.Xlint"),
- new XOption(XLINT_CUSTOM, "opt.Xlint.suboptlist",
- Option.ChoiceKind.ANYOF, getXLintChoices()),
-
- // -nowarn is retained for command-line backward compatibility
- new Option(NOWARN, "opt.nowarn") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:none", option);
- return false;
- }
- },
-
- new Option(VERBOSE, "opt.verbose"),
-
- // -deprecation is retained for command-line backward compatibility
- new Option(DEPRECATION, "opt.deprecation") {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:deprecation", option);
- return false;
- }
- },
-
- new Option(CLASSPATH, "opt.arg.path", "opt.classpath"),
- new Option(CP, "opt.arg.path", "opt.classpath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-classpath", arg);
- }
- },
- new Option(SOURCEPATH, "opt.arg.path", "opt.sourcepath"),
- new Option(BOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- options.remove("-Xbootclasspath/p:");
- options.remove("-Xbootclasspath/a:");
- return super.process(options, option, arg);
- }
- },
- new XOption(XBOOTCLASSPATH_PREPEND,"opt.arg.path", "opt.Xbootclasspath.p"),
- new XOption(XBOOTCLASSPATH_APPEND, "opt.arg.path", "opt.Xbootclasspath.a"),
- new XOption(XBOOTCLASSPATH, "opt.arg.path", "opt.bootclasspath") {
- @Override
- public boolean process(Options options, String option, String arg) {
- options.remove("-Xbootclasspath/p:");
- options.remove("-Xbootclasspath/a:");
- return super.process(options, "-bootclasspath", arg);
- }
- },
- new Option(EXTDIRS, "opt.arg.dirs", "opt.extdirs"),
- new XOption(DJAVA_EXT_DIRS, "opt.arg.dirs", "opt.extdirs") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-extdirs", arg);
- }
- },
- new Option(ENDORSEDDIRS, "opt.arg.dirs", "opt.endorseddirs"),
- new XOption(DJAVA_ENDORSED_DIRS, "opt.arg.dirs", "opt.endorseddirs") {
- @Override
- public boolean process(Options options, String option, String arg) {
- return super.process(options, "-endorseddirs", arg);
- }
- },
- new Option(PROC, "opt.proc.none.only",
- Option.ChoiceKind.ONEOF, "none", "only"),
- new Option(PROCESSOR, "opt.arg.class.list", "opt.processor"),
- new Option(PROCESSORPATH, "opt.arg.path", "opt.processorpath"),
- new Option(D, "opt.arg.directory", "opt.d"),
- new Option(S, "opt.arg.directory", "opt.sourceDest"),
- new Option(IMPLICIT, "opt.implicit",
- Option.ChoiceKind.ONEOF, "none", "class"),
- new Option(ENCODING, "opt.arg.encoding", "opt.encoding"),
- new Option(SOURCE, "opt.arg.release", "opt.source") {
- @Override
- public boolean process(Options options, String option, String operand) {
- Source source = Source.lookup(operand);
- if (source == null) {
- helper.error("err.invalid.source", operand);
- return true;
- }
- return super.process(options, option, operand);
- }
- },
- new Option(TARGET, "opt.arg.release", "opt.target") {
- @Override
- public boolean process(Options options, String option, String operand) {
- Target target = Target.lookup(operand);
- if (target == null) {
- helper.error("err.invalid.target", operand);
- return true;
- }
- return super.process(options, option, operand);
- }
- },
- new Option(VERSION, "opt.version") {
- @Override
- public boolean process(Options options, String option) {
- helper.printVersion();
- return super.process(options, option);
- }
- },
- new HiddenOption(FULLVERSION) {
- @Override
- public boolean process(Options options, String option) {
- helper.printFullVersion();
- return super.process(options, option);
- }
- },
- new HiddenOption(DIAGS) {
- @Override
- public boolean process(Options options, String option) {
- Option xd = getOptions(helper, EnumSet.of(XD))[0];
- option = option.substring(option.indexOf('=') + 1);
- String diagsOption = option.contains("%") ?
- "-XDdiagsFormat=" :
- "-XDdiags=";
- diagsOption += option;
- if (xd.matches(diagsOption))
- return xd.process(options, diagsOption);
- else
- return false;
- }
- },
- new Option(HELP, "opt.help") {
- @Override
- public boolean process(Options options, String option) {
- helper.printHelp();
- return super.process(options, option);
- }
- },
- new Option(A, "opt.arg.key.equals.value","opt.A") {
- @Override
- String helpSynopsis(Log log) {
- hasSuffix = true;
- return super.helpSynopsis(log);
- }
-
- @Override
- public boolean matches(String arg) {
- return arg.startsWith("-A");
- }
-
- @Override
- public boolean hasArg() {
- return false;
- }
- // Mapping for processor options created in
- // JavacProcessingEnvironment
- @Override
- public boolean process(Options options, String option) {
- int argLength = option.length();
- if (argLength == 2) {
- helper.error("err.empty.A.argument");
- return true;
- }
- int sepIndex = option.indexOf('=');
- String key = option.substring(2, (sepIndex != -1 ? sepIndex : argLength) );
- if (!JavacProcessingEnvironment.isValidOptionName(key)) {
- helper.error("err.invalid.A.key", option);
- return true;
- }
- return process(options, option, option);
- }
- },
- new Option(X, "opt.X") {
- @Override
- public boolean process(Options options, String option) {
- helper.printXhelp();
- return super.process(options, option);
- }
- },
-
- // This option exists only for the purpose of documenting itself.
- // It's actually implemented by the launcher.
- new Option(J, "opt.arg.flag", "opt.J") {
- @Override
- String helpSynopsis(Log log) {
- hasSuffix = true;
- return super.helpSynopsis(log);
- }
- @Override
- public boolean process(Options options, String option) {
- throw new AssertionError
- ("the -J flag should be caught by the launcher.");
- }
- },
-
- // stop after parsing and attributing.
- // new HiddenOption("-attrparseonly"),
-
- // new Option("-moreinfo", "opt.moreinfo") {
- new HiddenOption(MOREINFO) {
- @Override
- public boolean process(Options options, String option) {
- Type.moreInfo = true;
- return super.process(options, option);
- }
- },
-
- // treat warnings as errors
- new Option(WERROR, "opt.Werror"),
-
- // use complex inference from context in the position of a method call argument
- new HiddenOption(COMPLEXINFERENCE),
-
- // generare source stubs
- // new HiddenOption("-stubs"),
-
- // relax some constraints to allow compiling from stubs
- // new HiddenOption("-relax"),
-
- // output source after translating away inner classes
- // new Option("-printflat", "opt.printflat"),
- // new HiddenOption("-printflat"),
-
- // display scope search details
- // new Option("-printsearch", "opt.printsearch"),
- // new HiddenOption("-printsearch"),
-
- // prompt after each error
- // new Option("-prompt", "opt.prompt"),
- new HiddenOption(PROMPT),
-
- // dump stack on error
- new HiddenOption(DOE),
-
- // output source after type erasure
- // new Option("-s", "opt.s"),
- new HiddenOption(PRINTSOURCE),
-
- // output shrouded class files
- // new Option("-scramble", "opt.scramble"),
- // new Option("-scrambleall", "opt.scrambleall"),
-
- // display warnings for generic unchecked operations
- new HiddenOption(WARNUNCHECKED) {
- @Override
- public boolean process(Options options, String option) {
- options.put("-Xlint:unchecked", option);
- return false;
- }
- },
-
- new XOption(XMAXERRS, "opt.arg.number", "opt.maxerrs"),
- new XOption(XMAXWARNS, "opt.arg.number", "opt.maxwarns"),
- new XOption(XSTDOUT, "opt.arg.file", "opt.Xstdout") {
- @Override
- public boolean process(Options options, String option, String arg) {
- try {
- helper.setOut(new PrintWriter(new FileWriter(arg), true));
- } catch (java.io.IOException e) {
- helper.error("err.error.writing.file", arg, e);
- return true;
- }
- return super.process(options, option, arg);
- }
- },
-
- new XOption(XPRINT, "opt.print"),
-
- new XOption(XPRINTROUNDS, "opt.printRounds"),
-
- new XOption(XPRINTPROCESSORINFO, "opt.printProcessorInfo"),
-
- new XOption(XPREFER, "opt.prefer",
- Option.ChoiceKind.ONEOF, "source", "newer"),
-
- new XOption(XPKGINFO, "opt.pkginfo",
- Option.ChoiceKind.ONEOF, "always", "legacy", "nonempty"),
-
- /* -O is a no-op, accepted for backward compatibility. */
- new HiddenOption(O),
-
- /* -Xjcov produces tables to support the code coverage tool jcov. */
- new HiddenOption(XJCOV),
-
- /* This is a back door to the compiler's option table.
- * -XDx=y sets the option x to the value y.
- * -XDx sets the option x to the value x.
- */
- new HiddenOption(XD) {
- String s;
- @Override
- public boolean matches(String s) {
- this.s = s;
- return s.startsWith(name.optionName);
- }
- @Override
- public boolean process(Options options, String option) {
- s = s.substring(name.optionName.length());
- int eq = s.indexOf('=');
- String key = (eq < 0) ? s : s.substring(0, eq);
- String value = (eq < 0) ? s : s.substring(eq+1);
- options.put(key, value);
- return false;
- }
- },
-
- // This option exists only for the purpose of documenting itself.
- // It's actually implemented by the CommandLine class.
- new Option(AT, "opt.arg.file", "opt.AT") {
- @Override
- String helpSynopsis(Log log) {
- hasSuffix = true;
- return super.helpSynopsis(log);
- }
- @Override
- public boolean process(Options options, String option) {
- throw new AssertionError
- ("the @ flag should be caught by CommandLine.");
- }
- },
-
- /*
- * TODO: With apt, the matches method accepts anything if
- * -XclassAsDecls is used; code elsewhere does the lookup to
- * see if the class name is both legal and found.
- *
- * In apt, the process method adds the candidate class file
- * name to a separate list.
- */
- new HiddenOption(SOURCEFILE) {
- String s;
- @Override
- public boolean matches(String s) {
- this.s = s;
- return s.endsWith(".java") // Java source file
- || SourceVersion.isName(s); // Legal type name
- }
- @Override
- public boolean process(Options options, String option) {
- if (s.endsWith(".java") ) {
- File f = new File(s);
- if (!f.exists()) {
- helper.error("err.file.not.found", f);
- return true;
- }
- if (!f.isFile()) {
- helper.error("err.file.not.file", f);
- return true;
- }
- helper.addFile(f);
- }
- else
- helper.addClassName(s);
- return false;
- }
- },
- };
- }
-
- public enum PkgInfo {
- ALWAYS, LEGACY, NONEMPTY;
- public static PkgInfo get(Options options) {
- String v = options.get(XPKGINFO);
- return (v == null
- ? PkgInfo.LEGACY
- : PkgInfo.valueOf(v.toUpperCase()));
- }
- }
-
- private static Map<String,Boolean> getXLintChoices() {
- Map<String,Boolean> choices = new LinkedHashMap<String,Boolean>();
- choices.put("all", false);
- for (Lint.LintCategory c : Lint.LintCategory.values())
- choices.put(c.option, c.hidden);
- for (Lint.LintCategory c : Lint.LintCategory.values())
- choices.put("-" + c.option, c.hidden);
- choices.put("none", false);
- return choices;
- }
-
-}
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java Wed Jan 04 10:57:39 2012 -0800
@@ -63,7 +63,7 @@
import com.sun.tools.javac.util.List;
import com.sun.tools.javac.util.ListBuffer;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
// NOTE the imports carefully for this compilation unit.
--- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Jan 04 10:57:39 2012 -0800
@@ -787,7 +787,7 @@
top++;
topOp = token;
nextToken();
- odStack[top] = (topOp.kind == INSTANCEOF) ? parseType() : term3NoParams();
+ odStack[top] = (topOp.kind == INSTANCEOF) ? parseType() : term3();
while (top > 0 && prec(topOp.kind) >= prec(token.kind)) {
odStack[top-1] = makeOp(topOp.pos, topOp.kind, odStack[top-1],
odStack[top]);
@@ -931,7 +931,7 @@
mode = EXPR;
t = literal(names.hyphen, pos);
} else {
- t = term3NoParams();
+ t = term3();
return F.at(pos).Unary(unoptag(tk), t);
}
} else return illegal();
@@ -947,8 +947,8 @@
break;
} else {
nextToken();
- mode = EXPR | TYPE;
- t = term3NoParams();
+ mode = EXPR | TYPE | NOPARAMS;
+ t = term3();
if ((mode & TYPE) != 0 && token.kind == LT) {
// Could be a cast to a parameterized type
JCTree.Tag op = JCTree.Tag.LT;
@@ -1011,7 +1011,7 @@
lastmode = mode;
mode = EXPR;
if ((lastmode & EXPR) == 0) {
- JCExpression t1 = term3NoParams();
+ JCExpression t1 = term3();
return F.at(pos).TypeCast(t, t1);
} else if ((lastmode & TYPE) != 0) {
switch (token.kind) {
@@ -1024,7 +1024,7 @@
case NEW: case IDENTIFIER: case ASSERT: case ENUM:
case BYTE: case SHORT: case CHAR: case INT:
case LONG: case FLOAT: case DOUBLE: case BOOLEAN: case VOID:
- JCExpression t1 = term3NoParams();
+ JCExpression t1 = term3();
return F.at(pos).TypeCast(t, t1);
}
}
@@ -1143,49 +1143,35 @@
// typeArgs saved for next loop iteration.
t = toP(F.at(pos).Select(t, ident()));
break;
-// case LT:
-// if ((mode & (TYPE | NOPARAMS)) == 0) {
-// //could be an unbound method reference whose qualifier
-// //is a generic type i.e. A<S>#m
-// mode = EXPR | TYPE;
-// JCTree.Tag op = JCTree.Tag.LT;
-// int pos1 = token.pos;
-// nextToken();
-// mode |= EXPR | TYPE | TYPEARG;
-// JCExpression t1 = term3();
-// if ((mode & TYPE) != 0 &&
-// (token.kind == COMMA || token.kind == GT)) {
-// mode = TYPE;
-// ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
-// args.append(t1);
-// while (token.kind == COMMA) {
-// nextToken();
-// args.append(typeArgument());
-// }
-// accept(GT);
-// t = toP(F.at(pos1).TypeApply(t, args.toList()));
-// checkGenerics();
-// while (token.kind == DOT) {
-// nextToken();
-// mode = TYPE;
-// t = toP(F.at(token.pos).Select(t, ident()));
-// t = typeArgumentsOpt(t);
-// }
-// if (token.kind != HASH) {
-// //method reference expected here
-// t = illegal();
-// }
-// mode = EXPR;
-// break;
-// } else if ((mode & EXPR) != 0) {
-// //rollback - it was a binary expression
-// mode = EXPR;
-// JCExpression e = term2Rest(t1, TreeInfo.shiftPrec);
-// t = F.at(pos1).Binary(op, t, e);
-// t = termRest(term1Rest(term2Rest(t, TreeInfo.orPrec)));
-// }
-// }
-// break loop;
+ case LT:
+ if ((mode & TYPE) == 0 && isUnboundMemberRef()) {
+ //this is an unbound method reference whose qualifier
+ //is a generic type i.e. A<S>#m
+ int pos1 = token.pos;
+ accept(LT);
+ ListBuffer<JCExpression> args = new ListBuffer<JCExpression>();
+ args.append(typeArgument());
+ while (token.kind == COMMA) {
+ nextToken();
+ args.append(typeArgument());
+ }
+ accept(GT);
+ t = toP(F.at(pos1).TypeApply(t, args.toList()));
+ checkGenerics();
+ while (token.kind == DOT) {
+ nextToken();
+ mode = TYPE;
+ t = toP(F.at(token.pos).Select(t, ident()));
+ t = typeArgumentsOpt(t);
+ }
+ if (token.kind != HASH) {
+ //method reference expected here
+ t = illegal();
+ }
+ mode = EXPR;
+ return term3Rest(t, typeArgs);
+ }
+ break loop;
default:
break loop;
}
@@ -1225,15 +1211,6 @@
return term3Rest(t, typeArgs);
}
- JCExpression term3NoParams() {
- try {
- mode |= NOPARAMS;
- return term3();
- } finally {
- mode &= ~NOPARAMS;
- }
- }
-
JCExpression term3Rest(JCExpression t, List<JCExpression> typeArgs) {
if (typeArgs != null) illegal();
while (true) {
@@ -1297,6 +1274,41 @@
return toP(t);
}
+ /**
+ * If we see an identifier followed by a '<' it could be an unbound
+ * method reference or a binary expression. To disambiguate, look for a
+ * matching '>' and see if the subsequent terminal is either '.' or '#'.
+ */
+ @SuppressWarnings("fallthrough")
+ boolean isUnboundMemberRef() {
+ int pos = 0, depth = 0;
+ for (Token t = S.token(pos) ; ; t = S.token(++pos)) {
+ switch (t.kind) {
+ case IDENTIFIER: case QUES: case EXTENDS: case SUPER:
+ case DOT: case RBRACKET: case LBRACKET: case COMMA:
+ case BYTE: case SHORT: case INT: case LONG: case FLOAT:
+ case DOUBLE: case BOOLEAN: case CHAR:
+ break;
+ case LT:
+ depth++; break;
+ case GTGTGT:
+ depth--;
+ case GTGT:
+ depth--;
+ case GT:
+ depth--;
+ if (depth == 0) {
+ return
+ S.token(pos + 1).kind == TokenKind.DOT ||
+ S.token(pos + 1).kind == TokenKind.HASH;
+ }
+ break;
+ default:
+ return false;
+ }
+ }
+ }
+
JCExpression lambdaExpressionOrStatement(JCVariableDecl firstParam, int pos) {
ListBuffer<JCVariableDecl> params = new ListBuffer<JCVariableDecl>();
params.append(firstParam);
--- a/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java Wed Jan 04 10:57:39 2012 -0800
@@ -82,7 +82,7 @@
import static javax.tools.StandardLocation.*;
import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag.*;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
import static com.sun.tools.javac.code.Lint.LintCategory.PROCESSING;
/**
@@ -1033,12 +1033,10 @@
Assert.checkNonNull(options);
next.put(Options.optionsKey, options);
- PrintWriter out = context.get(Log.outKey);
- Assert.checkNonNull(out);
- next.put(Log.outKey, out);
Locale locale = context.get(Locale.class);
if (locale != null)
next.put(Locale.class, locale);
+
Assert.checkNonNull(messages);
next.put(JavacMessages.messagesKey, messages);
@@ -1076,6 +1074,9 @@
Assert.checkNonNull(tokens);
next.put(Tokens.tokensKey, tokens);
+ // propogate the log's writers directly, instead of going through context
+ Log.instance(next).setWriters(log);
+
JavaCompiler oldCompiler = JavaCompiler.instance(context);
JavaCompiler nextCompiler = JavaCompiler.instance(next);
nextCompiler.initRound(oldCompiler);
@@ -1472,14 +1473,6 @@
return context;
}
- /**
- * Internal use method to return the writer being used by the
- * processing environment.
- */
- public PrintWriter getWriter() {
- return context.get(Log.outKey);
- }
-
public String toString() {
return "javac ProcessingEnvironment";
}
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BaseFileManager.java Wed Jan 04 10:57:39 2012 -0800
@@ -46,6 +46,7 @@
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
+import java.util.Set;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
@@ -53,9 +54,9 @@
import com.sun.tools.javac.code.Source;
import com.sun.tools.javac.file.FSInfo;
import com.sun.tools.javac.file.Locations;
-import com.sun.tools.javac.main.JavacOption;
-import com.sun.tools.javac.main.OptionName;
-import com.sun.tools.javac.main.RecognizedOptions;
+import com.sun.tools.javac.main.Option;
+import com.sun.tools.javac.main.OptionHelper;
+import com.sun.tools.javac.main.OptionHelper.GrumpyHelper;
import com.sun.tools.javac.util.JCDiagnostic.SimpleDiagnosticPosition;
/**
@@ -101,7 +102,7 @@
protected Locations locations;
protected Source getSource() {
- String sourceName = options.get(OptionName.SOURCE);
+ String sourceName = options.get(Option.SOURCE);
Source source = null;
if (sourceName != null)
source = Source.lookup(sourceName);
@@ -145,15 +146,31 @@
// <editor-fold defaultstate="collapsed" desc="Option handling">
public boolean handleOption(String current, Iterator<String> remaining) {
- for (JavacOption o: javacFileManagerOptions) {
+ OptionHelper helper = new GrumpyHelper(log) {
+ @Override
+ public String get(Option option) {
+ return options.get(option.getText());
+ }
+
+ @Override
+ public void put(String name, String value) {
+ options.put(name, value);
+ }
+
+ @Override
+ public void remove(String name) {
+ options.remove(name);
+ }
+ };
+ for (Option o: javacFileManagerOptions) {
if (o.matches(current)) {
if (o.hasArg()) {
if (remaining.hasNext()) {
- if (!o.process(options, current, remaining.next()))
+ if (!o.process(helper, current, remaining.next()))
return true;
}
} else {
- if (!o.process(options, current))
+ if (!o.process(helper, current))
return true;
}
// operand missing, or process returned false
@@ -164,12 +181,11 @@
return false;
}
// where
- private static JavacOption[] javacFileManagerOptions =
- RecognizedOptions.getJavacFileManagerOptions(
- new RecognizedOptions.GrumpyHelper(Log.instance(new Context())));
+ private static Set<Option> javacFileManagerOptions =
+ Option.getJavacFileManagerOptions();
public int isSupportedOption(String option) {
- for (JavacOption o : javacFileManagerOptions) {
+ for (Option o : javacFileManagerOptions) {
if (o.matches(option))
return o.hasArg() ? 1 : 0;
}
@@ -191,7 +207,7 @@
}
public String getEncodingName() {
- String encName = options.get(OptionName.ENCODING);
+ String encName = options.get(Option.ENCODING);
if (encName == null)
return getDefaultEncodingName();
else
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Log.java Wed Jan 04 10:57:39 2012 -0800
@@ -25,25 +25,23 @@
package com.sun.tools.javac.util;
-import com.sun.tools.javac.main.Main;
import java.io.*;
import java.util.Arrays;
import java.util.EnumSet;
import java.util.HashSet;
-import java.util.Map;
import java.util.Queue;
import java.util.Set;
import javax.tools.DiagnosticListener;
import javax.tools.JavaFileObject;
import com.sun.tools.javac.api.DiagnosticFormatter;
-import com.sun.tools.javac.main.OptionName;
+import com.sun.tools.javac.main.Main;
+import com.sun.tools.javac.main.Option;
import com.sun.tools.javac.parser.EndPosTable;
-import com.sun.tools.javac.tree.JCTree;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
-import static com.sun.tools.javac.main.OptionName.*;
+import static com.sun.tools.javac.main.Option.*;
/** A class for error logs. Reports errors and warnings, and
* keeps track of error numbers and positions.
@@ -137,7 +135,6 @@
/** Construct a log with given I/O redirections.
*/
- @Deprecated
protected Log(Context context, PrintWriter errWriter, PrintWriter warnWriter, PrintWriter noticeWriter) {
super(JCDiagnostic.Factory.instance(context));
context.put(logKey, this);
@@ -179,8 +176,8 @@
expectDiagKeys = new HashSet<String>(Arrays.asList(ek.split(", *")));
}
- private int getIntOption(Options options, OptionName optionName, int defaultValue) {
- String s = options.get(optionName);
+ private int getIntOption(Options options, Option option, int defaultValue) {
+ String s = options.get(option);
try {
if (s != null) {
int n = Integer.parseInt(s);
@@ -298,6 +295,12 @@
noticeWriter = warnWriter = errWriter = pw;
}
+ public void setWriters(Log other) {
+ this.noticeWriter = other.noticeWriter;
+ this.warnWriter = other.warnWriter;
+ this.errWriter = other.errWriter;
+ }
+
/** Flush the logs
*/
public void flush() {
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Options.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Options.java Wed Jan 04 10:57:39 2012 -0800
@@ -26,8 +26,8 @@
package com.sun.tools.javac.util;
import java.util.*;
-import com.sun.tools.javac.main.OptionName;
-import static com.sun.tools.javac.main.OptionName.*;
+import com.sun.tools.javac.main.Option;
+import static com.sun.tools.javac.main.Option.*;
/** A table of all command-line options.
* If an option has an argument, the option name is mapped to the argument.
@@ -71,8 +71,8 @@
/**
* Get the value for an option.
*/
- public String get(OptionName name) {
- return values.get(name.optionName);
+ public String get(Option option) {
+ return values.get(option.text);
}
/**
@@ -101,15 +101,15 @@
/**
* Check if the value for an option has been set.
*/
- public boolean isSet(OptionName name) {
- return (values.get(name.optionName) != null);
+ public boolean isSet(Option option) {
+ return (values.get(option.text) != null);
}
/**
* Check if the value for a choice option has been set to a specific value.
*/
- public boolean isSet(OptionName name, String value) {
- return (values.get(name.optionName + value) != null);
+ public boolean isSet(Option option, String value) {
+ return (values.get(option.text + value) != null);
}
/**
@@ -122,23 +122,23 @@
/**
* Check if the value for an option has not been set.
*/
- public boolean isUnset(OptionName name) {
- return (values.get(name.optionName) == null);
+ public boolean isUnset(Option option) {
+ return (values.get(option.text) == null);
}
/**
* Check if the value for a choice option has not been set to a specific value.
*/
- public boolean isUnset(OptionName name, String value) {
- return (values.get(name.optionName + value) == null);
+ public boolean isUnset(Option option, String value) {
+ return (values.get(option.text + value) == null);
}
public void put(String name, String value) {
values.put(name, value);
}
- public void put(OptionName name, String value) {
- values.put(name.optionName, value);
+ public void put(Option option, String value) {
+ values.put(option.text, value);
}
public void putAll(Options options) {
--- a/langtools/test/tools/javac/4846262/Test.sh Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/test/tools/javac/4846262/Test.sh Wed Jan 04 10:57:39 2012 -0800
@@ -1,7 +1,7 @@
#!/bin/sh -f
#
-# Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2011, 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
@@ -71,7 +71,7 @@
diff ${DIFFOPTS} -c "${TESTSRC}${FS}Test.out" Test.out
result=$?
-if [ $result -eq o ]
+if [ $result -eq 0 ]
then
echo "Passed"
else
--- a/langtools/test/tools/javac/api/T6838467.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/test/tools/javac/api/T6838467.java Wed Jan 04 10:57:39 2012 -0800
@@ -32,7 +32,6 @@
import java.util.zip.*;
import javax.tools.*;
import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.main.OptionName;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.Options;
--- a/langtools/test/tools/javac/diags/examples/UnsupportedEncoding.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/test/tools/javac/diags/examples/UnsupportedEncoding.java Wed Jan 04 10:57:39 2012 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -23,5 +23,6 @@
// key: compiler.err.unsupported.encoding
// options: -encoding UNSUPPORTED -doe
+// run: simple
class UnsupportedEncoding { }
--- a/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/test/tools/javac/lambda/MethodReferenceParserTest.java Wed Jan 04 10:57:39 2012 -0800
@@ -24,7 +24,6 @@
/*
* @test
* @bug 7115052
- * @ignore 7120266
* @summary Add parser support for method references
*/
@@ -45,6 +44,7 @@
enum ReferenceKind {
METHOD_REF("#Q##Gm"),
CONSTRUCTOR_REF("#Q##Gnew"),
+ FALSE_REF("min < max"),
ERR_SUPER("#Q##Gsuper"),
ERR_METH0("#Q##Gm()"),
ERR_METH1("#Q##Gm(X)"),
@@ -76,6 +76,21 @@
}
}
+ enum ContextKind {
+ ASSIGN("SAM s = #E;"),
+ METHOD("m(#E, i);");
+
+ String contextTemplate;
+
+ ContextKind(String contextTemplate) {
+ this.contextTemplate = contextTemplate;
+ }
+
+ String contextString(ExprKind ek, ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk) {
+ return contextTemplate.replaceAll("#E", ek.expressionString(rk, qk, gk, sk));
+ }
+ }
+
enum GenericKind {
NONE(""),
ONE("<X>"),
@@ -97,7 +112,10 @@
UBOUND_SIMPLE("A"),
UNBOUND_GENERIC1("A<X>"),
UNBOUND_GENERIC2("A<X, Y>"),
- UNBOUND_GENERIC3("A<? extends X, ? super Y>");
+ UNBOUND_GENERIC3("A<? extends X, ? super Y>"),
+ UNBOUND_GENERIC4("A<int[], short[][]>"),
+ NESTED_GENERIC1("A<A<X,Y>, A<X,Y>>"),
+ NESTED_GENERIC2("A<A<A<X,Y>,A<X,Y>>, A<A<X,Y>,A<X,Y>>>");
String qualifier;
@@ -153,7 +171,9 @@
for (GenericKind gk : GenericKind.values()) {
for (SubExprKind sk : SubExprKind.values()) {
for (ExprKind ek : ExprKind.values()) {
- new MethodReferenceParserTest(rk, qk, gk, sk, ek).run(comp, fm);
+ for (ContextKind ck : ContextKind.values()) {
+ new MethodReferenceParserTest(rk, qk, gk, sk, ek, ck).run(comp, fm);
+ }
}
}
}
@@ -167,15 +187,17 @@
GenericKind gk;
SubExprKind sk;
ExprKind ek;
+ ContextKind ck;
JavaSource source;
DiagnosticChecker diagChecker;
- MethodReferenceParserTest(ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk, ExprKind ek) {
+ MethodReferenceParserTest(ReferenceKind rk, QualifierKind qk, GenericKind gk, SubExprKind sk, ExprKind ek, ContextKind ck) {
this.rk = rk;
this.qk = qk;
this.gk = gk;
this.sk = sk;
this.ek = ek;
+ this.ck = ck;
this.source = new JavaSource();
this.diagChecker = new DiagnosticChecker();
}
@@ -183,14 +205,16 @@
class JavaSource extends SimpleJavaFileObject {
String template = "class Test {\n" +
- " SAM s = #E;\n" +
+ " void test() {\n" +
+ " #C\n" +
+ " }" +
"}";
String source;
public JavaSource() {
super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
- source = template.replaceAll("#E", ek.expressionString(rk, qk, gk, sk));
+ source = template.replaceAll("#C", ck.contextString(ek, rk, qk, gk, sk));
}
@Override
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java Wed Jan 04 10:57:39 2012 -0800
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6987384
+ * @summary -XprintProcessorRoundsInfo message printed with different timing than previous
+ * @library ../../../lib
+ * @build JavacTestingAbstractProcessor Test TestWithXstdout
+ * @run main TestWithXstdout
+ */
+
+import java.io.*;
+import java.nio.charset.*;
+import java.nio.file.*;
+import java.util.*;
+
+public class TestWithXstdout {
+ public static void main(String... args) throws Exception {
+ File testSrc = new File(System.getProperty("test.src"));
+ File testClasses = new File(System.getProperty("test.classes"));
+ File stdout = new File("stdout.out");
+ run_javac("-XDrawDiagnostics",
+ "-XprintProcessorInfo",
+ "-Werror",
+ "-proc:only",
+ "-processor", "Test",
+ "-Xstdout", stdout.getPath(),
+ "-classpath", testClasses.getPath(),
+ new File(testSrc, "Test.java").getPath());
+ boolean ok = compare(stdout, new File(testSrc, "Test.out"));
+ if (!ok)
+ throw new Exception("differences found");
+ }
+
+ static void run_javac(String... args) throws IOException, InterruptedException {
+ File javaHome = new File(System.getProperty("java.home"));
+ if (javaHome.getName().equals("jre"))
+ javaHome = javaHome.getParentFile();
+ File javac = new File(new File(javaHome, "bin"), "javac");
+
+ List<String> opts = new ArrayList<>();
+ opts.add(javac.getPath());
+
+ String toolOpts = System.getProperty("test.tool.vm.opts");
+ if (toolOpts != null && !"".equals(toolOpts.trim())) {
+ opts.addAll(Arrays.asList(toolOpts.trim().split("[\\s]+")));
+ }
+ opts.addAll(Arrays.asList(args));
+ System.out.println("exec: " + opts);
+ ProcessBuilder pb = new ProcessBuilder(opts);
+ pb.redirectErrorStream();
+ Process p = pb.start();
+ try (BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()))) {
+ String line;
+ while ((line = r.readLine()) != null)
+ System.out.println();
+ }
+ int rc = p.waitFor();
+ if (rc != 0)
+ System.out.println("javac exited, rc=" + rc);
+ }
+
+ static boolean compare(File a, File b) throws IOException {
+ List<String> aLines = Files.readAllLines(a.toPath(), Charset.defaultCharset());
+ List<String> bLines = Files.readAllLines(b.toPath(), Charset.defaultCharset());
+ System.out.println(a + ": " + aLines.size() + " lines");
+ System.out.println(b + ": " + bLines.size() + " lines");
+ return aLines.equals(bLines);
+ }
+}
--- a/langtools/test/tools/javac/util/T6597678.java Wed Jan 04 03:49:35 2012 -0800
+++ b/langtools/test/tools/javac/util/T6597678.java Wed Jan 04 10:57:39 2012 -0800
@@ -41,6 +41,7 @@
import com.sun.tools.javac.processing.JavacProcessingEnvironment;
import com.sun.tools.javac.util.Context;
import com.sun.tools.javac.util.JavacMessages;
+import com.sun.tools.javac.util.Log;
@SupportedOptions("WriterString")
public class T6597678 extends JavacTestingAbstractProcessor {
@@ -78,7 +79,10 @@
@Override
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
Context context = ((JavacProcessingEnvironment) processingEnv).getContext();
- PrintWriter out = ((JavacProcessingEnvironment) processingEnv).getWriter();
+ Log log = Log.instance(context);
+ PrintWriter noteOut = log.getWriter(Log.WriterKind.NOTICE);
+ PrintWriter warnOut = log.getWriter(Log.WriterKind.WARNING);
+ PrintWriter errOut = log.getWriter(Log.WriterKind.ERROR);
Locale locale = context.get(Locale.class);
JavacMessages messages = context.get(JavacMessages.messagesKey);
@@ -86,13 +90,20 @@
if (round == 1) {
initialLocale = locale;
initialMessages = messages;
- initialWriter = out;
+ initialNoteWriter = noteOut;
+ initialWarnWriter = warnOut;
+ initialErrWriter = errOut;
- checkEqual("writerString", out.toString().intern(), options.get("WriterString").intern());
+ String writerStringOpt = options.get("WriterString").intern();
+ checkEqual("noteWriterString", noteOut.toString().intern(), writerStringOpt);
+ checkEqual("warnWriterString", warnOut.toString().intern(), writerStringOpt);
+ checkEqual("errWriterString", errOut.toString().intern(), writerStringOpt);
} else {
checkEqual("locale", locale, initialLocale);
checkEqual("messages", messages, initialMessages);
- checkEqual("writer", out, initialWriter);
+ checkEqual("noteWriter", noteOut, initialNoteWriter);
+ checkEqual("warnWriter", warnOut, initialWarnWriter);
+ checkEqual("errWriter", errOut, initialErrWriter);
}
return true;
@@ -109,5 +120,7 @@
int round = 0;
Locale initialLocale;
JavacMessages initialMessages;
- PrintWriter initialWriter;
+ PrintWriter initialNoteWriter;
+ PrintWriter initialWarnWriter;
+ PrintWriter initialErrWriter;
}
--- a/make/jprt.properties Wed Jan 04 03:49:35 2012 -0800
+++ b/make/jprt.properties Wed Jan 04 10:57:39 2012 -0800
@@ -25,7 +25,7 @@
# Properties for jprt
-# Release to build
+# Locked down to jdk8
jprt.tools.default.release=jdk8
# The different build flavors we want, we override here so we just get these 2
@@ -45,284 +45,61 @@
# User can select the test set with jprt submit "-testset name" option
jprt.my.test.set=${jprt.test.set}
-# Default vm test targets (no fastdebug & limited c2 testing)
+# 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, \
- \
- solaris_sparc_5.10-product-c1-scimark, \
- solaris_sparcv9_5.10-product-c2-scimark, \
- solaris_i586_5.10-product-c1-scimark, \
- solaris_x64_5.10-product-c2-scimark, \
- linux_i586_2.6-product-{c1|c2}-scimark, \
- linux_x64_2.6-product-c2-scimark, \
- windows_i586_5.1-product-c1-scimark, \
- windows_x64_5.2-product-c2-scimark
+ ${jprt.my.test.target.set:TESTNAME=jvm98}, \
+ ${jprt.my.test.target.set:TESTNAME=scimark}
-# Default jdk test targets in test/Makefile (no fastdebug & limited c2 testing)
+# Default jdk test targets (testset=default)
jprt.make.rule.default.test.targets= \
- \
- solaris_sparc_5.10-product-c1-langtools_jtreg, \
- solaris_sparcv9_5.10-product-c2-langtools_jtreg, \
- solaris_i586_5.10-product-c1-langtools_jtreg, \
- solaris_x64_5.10-product-c2-langtools_jtreg, \
- linux_i586_2.6-product-{c1|c2}-langtools_jtreg, \
- linux_x64_2.6-product-c2-langtools_jtreg, \
- windows_i586_5.1-product-c1-langtools_jtreg, \
- windows_x64_5.2-product-c2-langtools_jtreg, \
- \
- 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=langtools_jtreg}, \
+ ${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 vm test targets (but still no fastdebug & limited c2 testing)
+# All vm test targets (testset=all)
jprt.vm.all.test.targets= \
- \
- ${jprt.vm.default.test.targets}, \
- \
- solaris_sparc_5.10-product-c1-runThese, \
- solaris_sparcv9_5.10-product-c2-runThese, \
- solaris_i586_5.10-product-c1-runThese, \
- solaris_x64_5.10-product-c2-runThese, \
- linux_i586_2.6-product-{c1|c2}-runThese, \
- linux_x64_2.6-product-c2-runThese, \
- windows_i586_5.1-product-c1-runThese, \
- windows_x64_5.2-product-c2-runThese, \
- \
- solaris_sparc_5.10-product-c1-jbb_default, \
- solaris_sparcv9_5.10-product-c2-jbb_default, \
- solaris_i586_5.10-product-c1-jbb_default, \
- solaris_x64_5.10-product-c2-jbb_default, \
- linux_i586_2.6-product-{c1|c2}-jbb_default, \
- linux_x64_2.6-product-c2-jbb_default, \
- windows_i586_5.1-product-c1-jbb_default, \
- windows_x64_5.2-product-c2-jbb_default
+ ${jprt.vm.default.test.targets}, \
+ ${jprt.my.test.target.set:TESTNAME=runThese}, \
+ ${jprt.my.test.target.set:TESTNAME=jbb_default}
-# All jdk test targets (but still no fastdebug & limited c2 testing)
+# 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, \
@@ -338,11 +115,10 @@
${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.vm..test.targets=${jprt.vm.default.test.targets}
-jprt.vm.test.targets=${jprt.vm.${jprt.my.test.set}.test.targets}
-jprt.test.targets=${jprt.vm.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
--- a/test/Makefile Wed Jan 04 03:49:35 2012 -0800
+++ b/test/Makefile Wed Jan 04 10:57:39 2012 -0800
@@ -53,36 +53,45 @@
LANGTOOLS_TEST_LIST = langtools_jtreg
# Test target list for jdk repository
-JDK_TEST_LIST = \
- jdk_beans1 jdk_beans2 jdk_beans3 \
+JDK_DEFAULT_TEST_LIST = \
+ jdk_beans1 \
jdk_io \
jdk_lang \
- jdk_management1 jdk_management2 \
jdk_math \
jdk_misc \
jdk_net \
jdk_nio1 jdk_nio2 jdk_nio3 \
- jdk_security1 jdk_security2 jdk_security3 \
+ jdk_security1 \
jdk_text \
- jdk_tools1 jdk_tools2 \
jdk_util
-# These tests need a DISPLAY and can create window interaction complications
-JDK_TEST_LIST2 = \
+# These tests are not part of the default testing list
+JDK_NONDEFAULT_TEST_LIST = \
jdk_awt \
+ jdk_beans2 jdk_beans3 \
+ jdk_management1 jdk_management2 \
+ jdk_security2 jdk_security3 \
jdk_rmi \
- jdk_swing
+ jdk_sound \
+ jdk_swing \
+ jdk_tools1 jdk_tools2
+
+# All jdk tests
+JDK_ALL_TEST_LIST = $(JDK_DEFAULT_TEST_LIST) $(JDK_NONDEFAULT_TEST_LIST)
# These are the current jck test targets in the jdk repository
JDK_JCK7_LIST = jck7devtools jck7compiler jck7runtime
# Default test target (everything)
-all: $(JDK_TEST_LIST) $(LANGTOOLS_TEST_LIST)
+default: $(JDK_DEFAULT_TEST_LIST) $(LANGTOOLS_TEST_LIST)
+
+# All testing
+all: $(JDK_ALL_TEST_LIST) $(LANGTOOLS_TEST_LIST)
# Test targets
$(LANGTOOLS_TEST_LIST):
@$(NO_STOPPING)$(call SUBDIR_TEST, $(LANGTOOLS_DIR), $(subst langtools_,,$@))
-$(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST):
+$(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST):
@$(NO_STOPPING)$(call SUBDIR_TEST, $(JDK_DIR), $@)
clean:
@@ -91,7 +100,7 @@
# Phony targets (e.g. these are not filenames)
.PHONY: all clean \
- $(JDK_TEST_LIST) $(JDK_TEST_LIST2) $(JDK_JCK7_LIST) \
+ $(JDK_ALL_TEST_LIST) $(JDK_JCK7_LIST) \
$(LANGTOOLS_TEST_LIST)
################################################################