This commit is contained in:
J. Duke 2017-07-05 18:50:02 +02:00
commit 37e4aa7317
322 changed files with 10433 additions and 3575 deletions

View File

@ -206,3 +206,4 @@ fd1a5574cf68af24bfd52decc37ac6361afb278a jdk8-b78
29153d0df68f84162ffe8c2cf4f402a3f2245e85 jdk8-b82 29153d0df68f84162ffe8c2cf4f402a3f2245e85 jdk8-b82
466685ba01bfb7bc1e1ac61490fd8c0f3cc18763 jdk8-b83 466685ba01bfb7bc1e1ac61490fd8c0f3cc18763 jdk8-b83
01f631f89fa392b4e484d0812c40ea8f9d2353aa jdk8-b84 01f631f89fa392b4e484d0812c40ea8f9d2353aa jdk8-b84
7fc358f5943676b82f1dccd3152b1ac07d92e38b jdk8-b85

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# #
# Copyright (c) 2012, 2013 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it

View File

@ -30,7 +30,7 @@ pull_extra_base="$2"
# Python always buffers stdout significantly, thus we will not see any output from hg clone jdk, # Python always buffers stdout significantly, thus we will not see any output from hg clone jdk,
# until a lot of time has passed! By passing -u to python, we get incremental updates # until a lot of time has passed! By passing -u to python, we get incremental updates
# on stdout. Much nicer. # on stdout. Much nicer.
whichhg="`which hg`" whichhg="`which hg 2> /dev/null | grep -v '^no hg in'`"
if [ "${whichhg}" = "" ] ; then if [ "${whichhg}" = "" ] ; then
echo Cannot find hg! echo Cannot find hg!
@ -51,7 +51,7 @@ if [ "#!" = "$has_hash_bang" ] ; then
bpython="`basename "$python"`" bpython="`basename "$python"`"
fi fi
if [ "python" = "$bpython" -a -x "$python" ] ; then if [ -x "$python" -a ! -d "$python" -a "`${python} -V 2>&1 | cut -f 1 -d ' '`" = "Python" ] ; then
hg="${python} -u ${whichhg}" hg="${python} -u ${whichhg}"
else else
echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout. echo Cannot find python from hg launcher. Running plain hg, which probably has buffered stdout.

View File

@ -196,7 +196,7 @@ $(OUTPUT_ROOT)/source_tips: FRC
# Remove everything, except the output from configure. # Remove everything, except the output from configure.
clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs clean: clean-langtools clean-corba clean-jaxp clean-jaxws clean-hotspot clean-jdk clean-nashorn clean-images clean-overlay-images clean-bootcycle-build clean-docs clean-test
@($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*) @($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
@$(ECHO) Cleaned all build artifacts. @$(ECHO) Cleaned all build artifacts.
@ -237,6 +237,8 @@ clean-bootcycle-build:
clean-docs: clean-docs:
$(call CleanComponent,docs) $(call CleanComponent,docs)
$(call CleanComponent,docstemp) $(call CleanComponent,docstemp)
clean-test:
$(call CleanComponent,testoutput)
.PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install .PHONY: langtools corba jaxp jaxws hotspot jdk nashorn images overlay-images install
.PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only .PHONY: langtools-only corba-only jaxp-only jaxws-only hotspot-only jdk-only nashorn-only images-only overlay-images-only install-only

View File

@ -330,3 +330,6 @@ e3a41fc0234895eba4f272b984f7dacff495f8eb hs25-b24
8d0f263a370c5f3e61791bb06054560804117288 hs25-b25 8d0f263a370c5f3e61791bb06054560804117288 hs25-b25
af788b85010ebabbc1e8f52c6766e08c7a95cf99 jdk8-b84 af788b85010ebabbc1e8f52c6766e08c7a95cf99 jdk8-b84
a947f40fb536e5b9e0aa210cf26abb430f80887a hs25-b26 a947f40fb536e5b9e0aa210cf26abb430f80887a hs25-b26
42fe530cd478744a4d12a0cbf803f0fc804bab1a jdk8-b85
09b0d3e9ba6cdf7da07d4010d2d1df14596f6864 hs25-b27
6d88a566d369f6a1f86912cad7d0912686b2fda1 hs25-b28

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2013
HS_MAJOR_VER=25 HS_MAJOR_VER=25
HS_MINOR_VER=0 HS_MINOR_VER=0
HS_BUILD_NUMBER=26 HS_BUILD_NUMBER=28
JDK_MAJOR_VER=1 JDK_MAJOR_VER=1
JDK_MINOR_VER=8 JDK_MINOR_VER=8

View File

@ -126,14 +126,12 @@ endif
# Compiler warnings are treated as errors # Compiler warnings are treated as errors
WARNINGS_ARE_ERRORS = -Werror WARNINGS_ARE_ERRORS = -Werror
# Except for a few acceptable ones WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function
# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
# conversions which might affect the values. To avoid that, we need to turn # conversions which might affect the values. Only enable it in earlier versions.
# it off explicitly. ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0" WARNING_FLAGS += -Wconversion
WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
else
WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef
endif endif
CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS) CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)

View File

@ -214,14 +214,6 @@ static int encode(Register r) {
return enc; return enc;
} }
static int encode(XMMRegister r) {
int enc = r->encoding();
if (enc >= 8) {
enc -= 8;
}
return enc;
}
void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) { void Assembler::emit_arith_b(int op1, int op2, Register dst, int imm8) {
assert(dst->has_byte_register(), "must have byte register"); assert(dst->has_byte_register(), "must have byte register");
assert(isByte(op1) && isByte(op2), "wrong opcode"); assert(isByte(op1) && isByte(op2), "wrong opcode");

View File

@ -41,11 +41,6 @@
#define BIND(label) bind(label); BLOCK_COMMENT(#label ":") #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
// Workaround for C++ overloading nastiness on '0' for RegisterOrConstant.
static RegisterOrConstant constant(int value) {
return RegisterOrConstant(value);
}
void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) { void MethodHandles::load_klass_from_Class(MacroAssembler* _masm, Register klass_reg) {
if (VerifyMethodHandles) if (VerifyMethodHandles)
verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class), verify_klass(_masm, klass_reg, SystemDictionary::WK_KLASS_ENUM_NAME(java_lang_Class),

View File

@ -1693,17 +1693,6 @@ const RegMask Matcher::method_handle_invoke_SP_save_mask() {
return PTR_RBP_REG_mask(); return PTR_RBP_REG_mask();
} }
static Address build_address(int b, int i, int s, int d) {
Register index = as_Register(i);
Address::ScaleFactor scale = (Address::ScaleFactor)s;
if (index == rsp) {
index = noreg;
scale = Address::no_scale;
}
Address addr(as_Register(b), index, scale, d);
return addr;
}
%} %}
//----------ENCODING BLOCK----------------------------------------------------- //----------ENCODING BLOCK-----------------------------------------------------

View File

@ -152,7 +152,6 @@ sigset_t SR_sigset;
// utility functions // utility functions
static int SR_initialize(); static int SR_initialize();
static int SR_finalize();
julong os::available_memory() { julong os::available_memory() {
return Bsd::available_memory(); return Bsd::available_memory();
@ -1200,6 +1199,9 @@ bool os::dll_build_name(char* buffer, size_t buflen,
} else if (strchr(pname, *os::path_separator()) != NULL) { } else if (strchr(pname, *os::path_separator()) != NULL) {
int n; int n;
char** pelements = split_path(pname, &n); char** pelements = split_path(pname, &n);
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) { for (int i = 0 ; i < n ; i++) {
// Really shouldn't be NULL, but check can't hurt // Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) { if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
@ -2766,10 +2768,6 @@ static int SR_initialize() {
return 0; return 0;
} }
static int SR_finalize() {
return 0;
}
// returns true on success and false on error - really an error is fatal // returns true on success and false on error - really an error is fatal
// but this seems the normal response to library errors // but this seems the normal response to library errors
@ -3578,16 +3576,6 @@ int os::Bsd::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mutex,
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// debug support // debug support
static address same_page(address x, address y) {
int page_bits = -os::vm_page_size();
if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
return x;
else if (x > y)
return (address)(intptr_t(y) | ~page_bits) + 1;
else
return (address)(intptr_t(y) & page_bits);
}
bool os::find(address addr, outputStream* st) { bool os::find(address addr, outputStream* st) {
Dl_info dlinfo; Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo)); memset(&dlinfo, 0, sizeof(dlinfo));
@ -3611,8 +3599,8 @@ bool os::find(address addr, outputStream* st) {
if (Verbose) { if (Verbose) {
// decode some bytes around the PC // decode some bytes around the PC
address begin = same_page(addr-40, addr); address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
address end = same_page(addr+40, addr); address end = clamp_address_in_page(addr+40, addr, os::vm_page_size());
address lowest = (address) dlinfo.dli_sname; address lowest = (address) dlinfo.dli_sname;
if (!lowest) lowest = (address) dlinfo.dli_fbase; if (!lowest) lowest = (address) dlinfo.dli_fbase;
if (begin < lowest) begin = lowest; if (begin < lowest) begin = lowest;

View File

@ -672,15 +672,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
RESTARTABLE(::open(filename, oflags), result); RESTARTABLE(::open(filename, oflags), result);
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied"); "Permission denied", OS_ERR);
} }
else { else {
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno)); THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
} }
} }
@ -828,7 +828,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
char* mapAddress; char* mapAddress;
int result; int result;
int fd; int fd;
size_t size; size_t size = 0;
const char* luser = NULL; const char* luser = NULL;
int mmap_prot; int mmap_prot;
@ -899,9 +899,12 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
if (*sizep == 0) { if (*sizep == 0) {
size = sharedmem_filesize(fd, CHECK); size = sharedmem_filesize(fd, CHECK);
assert(size != 0, "unexpected size"); } else {
size = *sizep;
} }
assert(size > 0, "unexpected size <= 0");
mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
// attempt to close the file - restart if it gets interrupted, // attempt to close the file - restart if it gets interrupted,

View File

@ -176,7 +176,6 @@ class MemNotifyThread: public Thread {
// utility functions // utility functions
static int SR_initialize(); static int SR_initialize();
static int SR_finalize();
julong os::available_memory() { julong os::available_memory() {
return Linux::available_memory(); return Linux::available_memory();
@ -1633,6 +1632,9 @@ bool os::dll_build_name(char* buffer, size_t buflen,
} else if (strchr(pname, *os::path_separator()) != NULL) { } else if (strchr(pname, *os::path_separator()) != NULL) {
int n; int n;
char** pelements = split_path(pname, &n); char** pelements = split_path(pname, &n);
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) { for (int i = 0 ; i < n ; i++) {
// Really shouldn't be NULL, but check can't hurt // Really shouldn't be NULL, but check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) { if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
@ -3655,10 +3657,6 @@ static int SR_initialize() {
return 0; return 0;
} }
static int SR_finalize() {
return 0;
}
// returns true on success and false on error - really an error is fatal // returns true on success and false on error - really an error is fatal
// but this seems the normal response to library errors // but this seems the normal response to library errors
@ -4500,16 +4498,6 @@ int os::Linux::safe_cond_timedwait(pthread_cond_t *_cond, pthread_mutex_t *_mute
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// debug support // debug support
static address same_page(address x, address y) {
int page_bits = -os::vm_page_size();
if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
return x;
else if (x > y)
return (address)(intptr_t(y) | ~page_bits) + 1;
else
return (address)(intptr_t(y) & page_bits);
}
bool os::find(address addr, outputStream* st) { bool os::find(address addr, outputStream* st) {
Dl_info dlinfo; Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo)); memset(&dlinfo, 0, sizeof(dlinfo));
@ -4533,8 +4521,8 @@ bool os::find(address addr, outputStream* st) {
if (Verbose) { if (Verbose) {
// decode some bytes around the PC // decode some bytes around the PC
address begin = same_page(addr-40, addr); address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
address end = same_page(addr+40, addr); address end = clamp_address_in_page(addr+40, addr, os::vm_page_size());
address lowest = (address) dlinfo.dli_sname; address lowest = (address) dlinfo.dli_sname;
if (!lowest) lowest = (address) dlinfo.dli_fbase; if (!lowest) lowest = (address) dlinfo.dli_fbase;
if (begin < lowest) begin = lowest; if (begin < lowest) begin = lowest;

View File

@ -672,15 +672,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
RESTARTABLE(::open(filename, oflags), result); RESTARTABLE(::open(filename, oflags), result);
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied"); "Permission denied", OS_ERR);
} }
else { else {
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno)); THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
} }
} }
@ -828,7 +828,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
char* mapAddress; char* mapAddress;
int result; int result;
int fd; int fd;
size_t size; size_t size = 0;
const char* luser = NULL; const char* luser = NULL;
int mmap_prot; int mmap_prot;
@ -899,9 +899,12 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
if (*sizep == 0) { if (*sizep == 0) {
size = sharedmem_filesize(fd, CHECK); size = sharedmem_filesize(fd, CHECK);
assert(size != 0, "unexpected size"); } else {
size = *sizep;
} }
assert(size > 0, "unexpected size <= 0");
mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
// attempt to close the file - restart if it gets interrupted, // attempt to close the file - restart if it gets interrupted,

View File

@ -1885,6 +1885,9 @@ bool os::dll_build_name(char* buffer, size_t buflen,
} else if (strchr(pname, *os::path_separator()) != NULL) { } else if (strchr(pname, *os::path_separator()) != NULL) {
int n; int n;
char** pelements = split_path(pname, &n); char** pelements = split_path(pname, &n);
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) { for (int i = 0 ; i < n ; i++) {
// really shouldn't be NULL but what the heck, check can't hurt // really shouldn't be NULL but what the heck, check can't hurt
if (pelements[i] == NULL || strlen(pelements[i]) == 0) { if (pelements[i] == NULL || strlen(pelements[i]) == 0) {
@ -5787,16 +5790,6 @@ int os::loadavg(double loadavg[], int nelem) {
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
static address same_page(address x, address y) {
intptr_t page_bits = -os::vm_page_size();
if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits))
return x;
else if (x > y)
return (address)(intptr_t(y) | ~page_bits) + 1;
else
return (address)(intptr_t(y) & page_bits);
}
bool os::find(address addr, outputStream* st) { bool os::find(address addr, outputStream* st) {
Dl_info dlinfo; Dl_info dlinfo;
memset(&dlinfo, 0, sizeof(dlinfo)); memset(&dlinfo, 0, sizeof(dlinfo));
@ -5822,8 +5815,8 @@ bool os::find(address addr, outputStream* st) {
if (Verbose) { if (Verbose) {
// decode some bytes around the PC // decode some bytes around the PC
address begin = same_page(addr-40, addr); address begin = clamp_address_in_page(addr-40, addr, os::vm_page_size());
address end = same_page(addr+40, addr); address end = clamp_address_in_page(addr+40, addr, os::vm_page_size());
address lowest = (address) dlinfo.dli_sname; address lowest = (address) dlinfo.dli_sname;
if (!lowest) lowest = (address) dlinfo.dli_fbase; if (!lowest) lowest = (address) dlinfo.dli_fbase;
if (begin < lowest) begin = lowest; if (begin < lowest) begin = lowest;

View File

@ -687,15 +687,15 @@ static int open_sharedmem_file(const char* filename, int oflags, TRAPS) {
RESTARTABLE(::open(filename, oflags), result); RESTARTABLE(::open(filename, oflags), result);
if (result == OS_ERR) { if (result == OS_ERR) {
if (errno == ENOENT) { if (errno == ENOENT) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found", OS_ERR);
} }
else if (errno == EACCES) { else if (errno == EACCES) {
THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG_(vmSymbols::java_lang_IllegalArgumentException(),
"Permission denied"); "Permission denied", OS_ERR);
} }
else { else {
THROW_MSG_0(vmSymbols::java_io_IOException(), strerror(errno)); THROW_MSG_(vmSymbols::java_io_IOException(), strerror(errno), OS_ERR);
} }
} }
@ -843,7 +843,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
char* mapAddress; char* mapAddress;
int result; int result;
int fd; int fd;
size_t size; size_t size = 0;
const char* luser = NULL; const char* luser = NULL;
int mmap_prot; int mmap_prot;
@ -914,9 +914,12 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
if (*sizep == 0) { if (*sizep == 0) {
size = sharedmem_filesize(fd, CHECK); size = sharedmem_filesize(fd, CHECK);
assert(size != 0, "unexpected size"); } else {
size = *sizep;
} }
assert(size > 0, "unexpected size <= 0");
mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0); mapAddress = (char*)::mmap((char*)0, size, mmap_prot, MAP_SHARED, fd, 0);
// attempt to close the file - restart if it gets interrupted, // attempt to close the file - restart if it gets interrupted,

View File

@ -1182,6 +1182,9 @@ bool os::dll_build_name(char *buffer, size_t buflen,
} else if (strchr(pname, *os::path_separator()) != NULL) { } else if (strchr(pname, *os::path_separator()) != NULL) {
int n; int n;
char** pelements = split_path(pname, &n); char** pelements = split_path(pname, &n);
if (pelements == NULL) {
return false;
}
for (int i = 0 ; i < n ; i++) { for (int i = 0 ; i < n ; i++) {
char* path = pelements[i]; char* path = pelements[i];
// Really shouldn't be NULL, but check can't hurt // Really shouldn't be NULL, but check can't hurt

View File

@ -1581,7 +1581,7 @@ static void open_file_mapping(const char* user, int vmid,
ResourceMark rm; ResourceMark rm;
void *mapAddress = 0; void *mapAddress = 0;
size_t size; size_t size = 0;
HANDLE fmh; HANDLE fmh;
DWORD ofm_access; DWORD ofm_access;
DWORD mv_access; DWORD mv_access;
@ -1652,9 +1652,12 @@ static void open_file_mapping(const char* user, int vmid,
if (*sizep == 0) { if (*sizep == 0) {
size = sharedmem_filesize(rfilename, CHECK); size = sharedmem_filesize(rfilename, CHECK);
assert(size != 0, "unexpected size"); } else {
size = *sizep;
} }
assert(size > 0, "unexpected size <= 0");
// Open the file mapping object with the given name // Open the file mapping object with the given name
fmh = open_sharedmem_object(robjectname, ofm_access, CHECK); fmh = open_sharedmem_object(robjectname, ofm_access, CHECK);

View File

@ -368,8 +368,10 @@ wildcardFileList(const char *wildcard)
const char *basename; const char *basename;
FileList fl = FileList_new(16); FileList fl = FileList_new(16);
WildcardIterator it = WildcardIterator_for(wildcard); WildcardIterator it = WildcardIterator_for(wildcard);
if (it == NULL) if (it == NULL) {
FileList_free(fl);
return NULL; return NULL;
}
while ((basename = WildcardIterator_next(it)) != NULL) while ((basename = WildcardIterator_next(it)) != NULL)
if (isJarFileName(basename)) if (isJarFileName(basename))
FileList_add(fl, wildcardConcat(wildcard, basename)); FileList_add(fl, wildcardConcat(wildcard, basename));

View File

@ -63,11 +63,10 @@ static void defineRegNames(FILE *fp, RegisterForm *registers) {
RegDef *reg_def = NULL; RegDef *reg_def = NULL;
RegDef *next = NULL; RegDef *next = NULL;
registers->reset_RegDefs(); registers->reset_RegDefs();
for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) {
next = registers->iter_RegDefs(); next = registers->iter_RegDefs();
const char *comma = (next != NULL) ? "," : " // no trailing comma"; const char *comma = (next != NULL) ? "," : " // no trailing comma";
fprintf(fp," \"%s\"%s\n", fprintf(fp," \"%s\"%s\n", reg_def->_regname, comma);
reg_def->_regname, comma );
} }
// Finish defining enumeration // Finish defining enumeration
@ -79,10 +78,10 @@ static void defineRegNames(FILE *fp, RegisterForm *registers) {
reg_def = NULL; reg_def = NULL;
next = NULL; next = NULL;
registers->reset_RegDefs(); registers->reset_RegDefs();
for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) {
next = registers->iter_RegDefs(); next = registers->iter_RegDefs();
const char *comma = (next != NULL) ? "," : " // no trailing comma"; const char *comma = (next != NULL) ? "," : " // no trailing comma";
fprintf(fp,"\t%s%s\n", reg_def->_concrete, comma ); fprintf(fp,"\t%s%s\n", reg_def->_concrete, comma);
} }
// Finish defining array // Finish defining array
fprintf(fp,"\t};\n"); fprintf(fp,"\t};\n");
@ -104,19 +103,17 @@ static void defineRegEncodes(FILE *fp, RegisterForm *registers) {
RegDef *reg_def = NULL; RegDef *reg_def = NULL;
RegDef *next = NULL; RegDef *next = NULL;
registers->reset_RegDefs(); registers->reset_RegDefs();
for( reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next ) { for (reg_def = registers->iter_RegDefs(); reg_def != NULL; reg_def = next) {
next = registers->iter_RegDefs(); next = registers->iter_RegDefs();
const char* register_encode = reg_def->register_encode(); const char* register_encode = reg_def->register_encode();
const char *comma = (next != NULL) ? "," : " // no trailing comma"; const char *comma = (next != NULL) ? "," : " // no trailing comma";
int encval; int encval;
if (!ADLParser::is_int_token(register_encode, encval)) { if (!ADLParser::is_int_token(register_encode, encval)) {
fprintf(fp," %s%s // %s\n", fprintf(fp," %s%s // %s\n", register_encode, comma, reg_def->_regname);
register_encode, comma, reg_def->_regname );
} else { } else {
// Output known constants in hex char format (backward compatibility). // Output known constants in hex char format (backward compatibility).
assert(encval < 256, "Exceeded supported width for register encoding"); assert(encval < 256, "Exceeded supported width for register encoding");
fprintf(fp," (unsigned char)'\\x%X'%s // %s\n", fprintf(fp," (unsigned char)'\\x%X'%s // %s\n", encval, comma, reg_def->_regname);
encval, comma, reg_def->_regname );
} }
} }
// Finish defining enumeration // Finish defining enumeration
@ -133,9 +130,10 @@ static void defineRegClassEnum(FILE *fp, RegisterForm *registers) {
fprintf(fp,"// Enumeration of register class names\n"); fprintf(fp,"// Enumeration of register class names\n");
fprintf(fp, "enum machRegisterClass {\n"); fprintf(fp, "enum machRegisterClass {\n");
registers->_rclasses.reset(); registers->_rclasses.reset();
for( const char *class_name = NULL; for (const char *class_name = NULL; (class_name = registers->_rclasses.iter()) != NULL;) {
(class_name = registers->_rclasses.iter()) != NULL; ) { const char * class_name_to_upper = toUpper(class_name);
fprintf(fp," %s,\n", toUpper( class_name )); fprintf(fp," %s,\n", class_name_to_upper);
delete[] class_name_to_upper;
} }
// Finish defining enumeration // Finish defining enumeration
fprintf(fp, " _last_Mach_Reg_Class\n"); fprintf(fp, " _last_Mach_Reg_Class\n");
@ -148,7 +146,7 @@ static void defineRegClassEnum(FILE *fp, RegisterForm *registers) {
void ArchDesc::declare_register_masks(FILE *fp_hpp) { void ArchDesc::declare_register_masks(FILE *fp_hpp) {
const char *rc_name; const char *rc_name;
if( _register ) { if (_register) {
// Build enumeration of user-defined register classes. // Build enumeration of user-defined register classes.
defineRegClassEnum(fp_hpp, _register); defineRegClassEnum(fp_hpp, _register);
@ -156,24 +154,27 @@ void ArchDesc::declare_register_masks(FILE *fp_hpp) {
fprintf(fp_hpp,"\n"); fprintf(fp_hpp,"\n");
fprintf(fp_hpp,"// Register masks, one for each register class.\n"); fprintf(fp_hpp,"// Register masks, one for each register class.\n");
_register->_rclasses.reset(); _register->_rclasses.reset();
for( rc_name = NULL; for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) {
(rc_name = _register->_rclasses.iter()) != NULL; ) { const char *prefix = "";
const char *prefix = ""; RegClass *reg_class = _register->getRegClass(rc_name);
RegClass *reg_class = _register->getRegClass(rc_name); assert(reg_class, "Using an undefined register class");
assert( reg_class, "Using an undefined register class");
const char* rc_name_to_upper = toUpper(rc_name);
if (reg_class->_user_defined == NULL) { if (reg_class->_user_defined == NULL) {
fprintf(fp_hpp, "extern const RegMask _%s%s_mask;\n", prefix, toUpper( rc_name ) ); fprintf(fp_hpp, "extern const RegMask _%s%s_mask;\n", prefix, rc_name_to_upper);
fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, toUpper( rc_name ), prefix, toUpper( rc_name )); fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { return _%s%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper);
} else { } else {
fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, toUpper( rc_name ), reg_class->_user_defined); fprintf(fp_hpp, "inline const RegMask &%s%s_mask() { %s }\n", prefix, rc_name_to_upper, reg_class->_user_defined);
} }
if( reg_class->_stack_or_reg ) { if (reg_class->_stack_or_reg) {
assert(reg_class->_user_defined == NULL, "no user defined reg class here"); assert(reg_class->_user_defined == NULL, "no user defined reg class here");
fprintf(fp_hpp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, toUpper( rc_name ) ); fprintf(fp_hpp, "extern const RegMask _%sSTACK_OR_%s_mask;\n", prefix, rc_name_to_upper);
fprintf(fp_hpp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, toUpper( rc_name ), prefix, toUpper( rc_name ) ); fprintf(fp_hpp, "inline const RegMask &%sSTACK_OR_%s_mask() { return _%sSTACK_OR_%s_mask; }\n", prefix, rc_name_to_upper, prefix, rc_name_to_upper);
} }
delete[] rc_name_to_upper;
} }
} }
} }
@ -183,34 +184,41 @@ void ArchDesc::declare_register_masks(FILE *fp_hpp) {
void ArchDesc::build_register_masks(FILE *fp_cpp) { void ArchDesc::build_register_masks(FILE *fp_cpp) {
const char *rc_name; const char *rc_name;
if( _register ) { if (_register) {
// Generate a list of register masks, one for each class. // Generate a list of register masks, one for each class.
fprintf(fp_cpp,"\n"); fprintf(fp_cpp,"\n");
fprintf(fp_cpp,"// Register masks, one for each register class.\n"); fprintf(fp_cpp,"// Register masks, one for each register class.\n");
_register->_rclasses.reset(); _register->_rclasses.reset();
for( rc_name = NULL; for (rc_name = NULL; (rc_name = _register->_rclasses.iter()) != NULL;) {
(rc_name = _register->_rclasses.iter()) != NULL; ) { const char *prefix = "";
const char *prefix = ""; RegClass *reg_class = _register->getRegClass(rc_name);
RegClass *reg_class = _register->getRegClass(rc_name); assert(reg_class, "Using an undefined register class");
assert( reg_class, "Using an undefined register class");
if (reg_class->_user_defined != NULL) continue; if (reg_class->_user_defined != NULL) {
continue;
}
int len = RegisterForm::RegMask_Size(); int len = RegisterForm::RegMask_Size();
fprintf(fp_cpp, "const RegMask _%s%s_mask(", prefix, toUpper( rc_name ) ); const char* rc_name_to_upper = toUpper(rc_name);
{ int i; fprintf(fp_cpp, "const RegMask _%s%s_mask(", prefix, rc_name_to_upper);
for( i = 0; i < len-1; i++ )
fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i,false)); {
fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i,false)); int i;
for(i = 0; i < len - 1; i++) {
fprintf(fp_cpp," 0x%x,", reg_class->regs_in_word(i, false));
}
fprintf(fp_cpp," 0x%x );\n", reg_class->regs_in_word(i, false));
} }
if( reg_class->_stack_or_reg ) { if (reg_class->_stack_or_reg) {
int i; int i;
fprintf(fp_cpp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, toUpper( rc_name ) ); fprintf(fp_cpp, "const RegMask _%sSTACK_OR_%s_mask(", prefix, rc_name_to_upper);
for( i = 0; i < len-1; i++ ) for(i = 0; i < len - 1; i++) {
fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i,true)); fprintf(fp_cpp," 0x%x,",reg_class->regs_in_word(i, true));
fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i,true)); }
fprintf(fp_cpp," 0x%x );\n",reg_class->regs_in_word(i, true));
} }
delete[] rc_name_to_upper;
} }
} }
} }
@ -2676,7 +2684,9 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) {
if (strcmp(first_reg_class, "stack_slots") == 0) { if (strcmp(first_reg_class, "stack_slots") == 0) {
fprintf(fp," return &(Compile::current()->FIRST_STACK_mask());\n"); fprintf(fp," return &(Compile::current()->FIRST_STACK_mask());\n");
} else { } else {
fprintf(fp," return &%s_mask();\n", toUpper(first_reg_class)); const char* first_reg_class_to_upper = toUpper(first_reg_class);
fprintf(fp," return &%s_mask();\n", first_reg_class_to_upper);
delete[] first_reg_class_to_upper;
} }
} else { } else {
// Build a switch statement to return the desired mask. // Build a switch statement to return the desired mask.
@ -2688,7 +2698,9 @@ static void defineIn_RegMask(FILE *fp, FormDict &globals, OperandForm &oper) {
if( !strcmp(reg_class, "stack_slots") ) { if( !strcmp(reg_class, "stack_slots") ) {
fprintf(fp, " case %d: return &(Compile::current()->FIRST_STACK_mask());\n", index); fprintf(fp, " case %d: return &(Compile::current()->FIRST_STACK_mask());\n", index);
} else { } else {
fprintf(fp, " case %d: return &%s_mask();\n", index, toUpper(reg_class)); const char* reg_class_to_upper = toUpper(reg_class);
fprintf(fp, " case %d: return &%s_mask();\n", index, reg_class_to_upper);
delete[] reg_class_to_upper;
} }
} }
fprintf(fp," }\n"); fprintf(fp," }\n");

View File

@ -2069,9 +2069,21 @@ public:
void closing() { fprintf(_cpp, " _LAST_MACH_OPER\n"); void closing() { fprintf(_cpp, " _LAST_MACH_OPER\n");
OutputMap::closing(); OutputMap::closing();
} }
void map(OpClassForm &opc) { fprintf(_cpp, " %s", _AD.machOperEnum(opc._ident) ); } void map(OpClassForm &opc) {
void map(OperandForm &oper) { fprintf(_cpp, " %s", _AD.machOperEnum(oper._ident) ); } const char* opc_ident_to_upper = _AD.machOperEnum(opc._ident);
void map(char *name) { fprintf(_cpp, " %s", _AD.machOperEnum(name)); } fprintf(_cpp, " %s", opc_ident_to_upper);
delete[] opc_ident_to_upper;
}
void map(OperandForm &oper) {
const char* oper_ident_to_upper = _AD.machOperEnum(oper._ident);
fprintf(_cpp, " %s", oper_ident_to_upper);
delete[] oper_ident_to_upper;
}
void map(char *name) {
const char* name_to_upper = _AD.machOperEnum(name);
fprintf(_cpp, " %s", name_to_upper);
delete[] name_to_upper;
}
bool do_instructions() { return false; } bool do_instructions() { return false; }
void map(InstructForm &inst){ assert( false, "ShouldNotCallThis()"); } void map(InstructForm &inst){ assert( false, "ShouldNotCallThis()"); }

View File

@ -711,25 +711,6 @@ static ciArrayKlass* as_array_klass(ciType* type) {
} }
} }
static Value maxvalue(IfOp* ifop) {
switch (ifop->cond()) {
case If::eql: return NULL;
case If::neq: return NULL;
case If::lss: // x < y ? x : y
case If::leq: // x <= y ? x : y
if (ifop->x() == ifop->tval() &&
ifop->y() == ifop->fval()) return ifop->y();
return NULL;
case If::gtr: // x > y ? y : x
case If::geq: // x >= y ? y : x
if (ifop->x() == ifop->tval() &&
ifop->y() == ifop->fval()) return ifop->y();
return NULL;
}
}
static ciType* phi_declared_type(Phi* phi) { static ciType* phi_declared_type(Phi* phi) {
ciType* t = phi->operand_at(0)->declared_type(); ciType* t = phi->operand_at(0)->declared_type();
if (t == NULL) { if (t == NULL) {

View File

@ -316,6 +316,7 @@ class LoopInvariantCodeMotion : public StackObj {
ShortLoopOptimizer* _short_loop_optimizer; ShortLoopOptimizer* _short_loop_optimizer;
Instruction* _insertion_point; Instruction* _insertion_point;
ValueStack * _state; ValueStack * _state;
bool _insert_is_pred;
void set_invariant(Value v) const { _gvn->set_processed(v); } void set_invariant(Value v) const { _gvn->set_processed(v); }
bool is_invariant(Value v) const { return _gvn->is_processed(v); } bool is_invariant(Value v) const { return _gvn->is_processed(v); }
@ -339,6 +340,7 @@ LoopInvariantCodeMotion::LoopInvariantCodeMotion(ShortLoopOptimizer *slo, Global
assert(insertion_block->end()->as_Base() == NULL, "cannot insert into entry block"); assert(insertion_block->end()->as_Base() == NULL, "cannot insert into entry block");
_insertion_point = insertion_block->end()->prev(); _insertion_point = insertion_block->end()->prev();
_insert_is_pred = loop_header->is_predecessor(insertion_block);
BlockEnd *block_end = insertion_block->end(); BlockEnd *block_end = insertion_block->end();
_state = block_end->state_before(); _state = block_end->state_before();
@ -379,13 +381,13 @@ void LoopInvariantCodeMotion::process_block(BlockBegin* block) {
} else if (cur->as_LoadField() != NULL) { } else if (cur->as_LoadField() != NULL) {
LoadField* lf = (LoadField*)cur; LoadField* lf = (LoadField*)cur;
// deoptimizes on NullPointerException // deoptimizes on NullPointerException
cur_invariant = !lf->needs_patching() && !lf->field()->is_volatile() && !_short_loop_optimizer->has_field_store(lf->field()->type()->basic_type()) && is_invariant(lf->obj()); cur_invariant = !lf->needs_patching() && !lf->field()->is_volatile() && !_short_loop_optimizer->has_field_store(lf->field()->type()->basic_type()) && is_invariant(lf->obj()) && _insert_is_pred;
} else if (cur->as_ArrayLength() != NULL) { } else if (cur->as_ArrayLength() != NULL) {
ArrayLength *length = cur->as_ArrayLength(); ArrayLength *length = cur->as_ArrayLength();
cur_invariant = is_invariant(length->array()); cur_invariant = is_invariant(length->array());
} else if (cur->as_LoadIndexed() != NULL) { } else if (cur->as_LoadIndexed() != NULL) {
LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed(); LoadIndexed *li = (LoadIndexed *)cur->as_LoadIndexed();
cur_invariant = !_short_loop_optimizer->has_indexed_store(as_BasicType(cur->type())) && is_invariant(li->array()) && is_invariant(li->index()); cur_invariant = !_short_loop_optimizer->has_indexed_store(as_BasicType(cur->type())) && is_invariant(li->array()) && is_invariant(li->index()) && _insert_is_pred;
} }
if (cur_invariant) { if (cur_invariant) {

View File

@ -1723,9 +1723,6 @@ void ClassFileParser::parse_annotations(u1* buffer, int limit,
} else { } else {
coll->set_contended_group(0); // default contended group coll->set_contended_group(0); // default contended group
} }
coll->set_contended(true);
} else {
coll->set_contended(false);
} }
} }
} }

View File

@ -150,7 +150,6 @@ class ClassFileParser VALUE_OBJ_CLASS_SPEC {
void set_contended_group(u2 group) { _contended_group = group; } void set_contended_group(u2 group) { _contended_group = group; }
u2 contended_group() { return _contended_group; } u2 contended_group() { return _contended_group; }
void set_contended(bool contended) { set_annotation(_sun_misc_Contended); }
bool is_contended() { return has_annotation(_sun_misc_Contended); } bool is_contended() { return has_annotation(_sun_misc_Contended); }
}; };

View File

@ -70,15 +70,19 @@ ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous) :
_is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially _is_anonymous(is_anonymous), _keep_alive(is_anonymous), // initially
_metaspace(NULL), _unloading(false), _klasses(NULL), _metaspace(NULL), _unloading(false), _klasses(NULL),
_claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL), _claimed(0), _jmethod_ids(NULL), _handles(NULL), _deallocate_list(NULL),
_next(NULL), _dependencies(NULL), _next(NULL), _dependencies(),
_metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) { _metaspace_lock(new Mutex(Monitor::leaf+1, "Metaspace allocation lock", true)) {
// empty // empty
} }
void ClassLoaderData::init_dependencies(TRAPS) { void ClassLoaderData::init_dependencies(TRAPS) {
_dependencies.init(CHECK);
}
void ClassLoaderData::Dependencies::init(TRAPS) {
// Create empty dependencies array to add to. CMS requires this to be // Create empty dependencies array to add to. CMS requires this to be
// an oop so that it can track additions via card marks. We think. // an oop so that it can track additions via card marks. We think.
_dependencies = (oop)oopFactory::new_objectArray(2, CHECK); _list_head = oopFactory::new_objectArray(2, CHECK);
} }
bool ClassLoaderData::claim() { bool ClassLoaderData::claim() {
@ -95,13 +99,17 @@ void ClassLoaderData::oops_do(OopClosure* f, KlassClosure* klass_closure, bool m
} }
f->do_oop(&_class_loader); f->do_oop(&_class_loader);
f->do_oop(&_dependencies); _dependencies.oops_do(f);
_handles->oops_do(f); _handles->oops_do(f);
if (klass_closure != NULL) { if (klass_closure != NULL) {
classes_do(klass_closure); classes_do(klass_closure);
} }
} }
void ClassLoaderData::Dependencies::oops_do(OopClosure* f) {
f->do_oop((oop*)&_list_head);
}
void ClassLoaderData::classes_do(KlassClosure* klass_closure) { void ClassLoaderData::classes_do(KlassClosure* klass_closure) {
for (Klass* k = _klasses; k != NULL; k = k->next_link()) { for (Klass* k = _klasses; k != NULL; k = k->next_link()) {
klass_closure->do_klass(k); klass_closure->do_klass(k);
@ -154,14 +162,14 @@ void ClassLoaderData::record_dependency(Klass* k, TRAPS) {
// It's a dependency we won't find through GC, add it. This is relatively rare // It's a dependency we won't find through GC, add it. This is relatively rare
// Must handle over GC point. // Must handle over GC point.
Handle dependency(THREAD, to); Handle dependency(THREAD, to);
from_cld->add_dependency(dependency, CHECK); from_cld->_dependencies.add(dependency, CHECK);
} }
void ClassLoaderData::add_dependency(Handle dependency, TRAPS) { void ClassLoaderData::Dependencies::add(Handle dependency, TRAPS) {
// Check first if this dependency is already in the list. // Check first if this dependency is already in the list.
// Save a pointer to the last to add to under the lock. // Save a pointer to the last to add to under the lock.
objArrayOop ok = (objArrayOop)_dependencies; objArrayOop ok = _list_head;
objArrayOop last = NULL; objArrayOop last = NULL;
while (ok != NULL) { while (ok != NULL) {
last = ok; last = ok;
@ -184,16 +192,17 @@ void ClassLoaderData::add_dependency(Handle dependency, TRAPS) {
objArrayHandle new_dependency(THREAD, deps); objArrayHandle new_dependency(THREAD, deps);
// Add the dependency under lock // Add the dependency under lock
locked_add_dependency(last_handle, new_dependency); locked_add(last_handle, new_dependency, THREAD);
} }
void ClassLoaderData::locked_add_dependency(objArrayHandle last_handle, void ClassLoaderData::Dependencies::locked_add(objArrayHandle last_handle,
objArrayHandle new_dependency) { objArrayHandle new_dependency,
Thread* THREAD) {
// Have to lock and put the new dependency on the end of the dependency // Have to lock and put the new dependency on the end of the dependency
// array so the card mark for CMS sees that this dependency is new. // array so the card mark for CMS sees that this dependency is new.
// Can probably do this lock free with some effort. // Can probably do this lock free with some effort.
MutexLockerEx ml(metaspace_lock(), Mutex::_no_safepoint_check_flag); ObjectLocker ol(Handle(THREAD, _list_head), THREAD);
oop loader_or_mirror = new_dependency->obj_at(0); oop loader_or_mirror = new_dependency->obj_at(0);

View File

@ -93,6 +93,18 @@ class ClassLoaderDataGraph : public AllStatic {
class ClassLoaderData : public CHeapObj<mtClass> { class ClassLoaderData : public CHeapObj<mtClass> {
friend class VMStructs; friend class VMStructs;
private: private:
class Dependencies VALUE_OBJ_CLASS_SPEC {
objArrayOop _list_head;
void locked_add(objArrayHandle last,
objArrayHandle new_dependency,
Thread* THREAD);
public:
Dependencies() : _list_head(NULL) {}
void add(Handle dependency, TRAPS);
void init(TRAPS);
void oops_do(OopClosure* f);
};
friend class ClassLoaderDataGraph; friend class ClassLoaderDataGraph;
friend class ClassLoaderDataGraphMetaspaceIterator; friend class ClassLoaderDataGraphMetaspaceIterator;
friend class MetaDataFactory; friend class MetaDataFactory;
@ -100,10 +112,11 @@ class ClassLoaderData : public CHeapObj<mtClass> {
static ClassLoaderData * _the_null_class_loader_data; static ClassLoaderData * _the_null_class_loader_data;
oop _class_loader; // oop used to uniquely identify a class loader oop _class_loader; // oop used to uniquely identify a class loader
// class loader or a canonical class path // class loader or a canonical class path
oop _dependencies; // oop to hold dependencies from this class loader Dependencies _dependencies; // holds dependencies from this class loader
// data to others. // data to others.
Metaspace * _metaspace; // Meta-space where meta-data defined by the Metaspace * _metaspace; // Meta-space where meta-data defined by the
// classes in the class loader are allocated. // classes in the class loader are allocated.
Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup. Mutex* _metaspace_lock; // Locks the metaspace for allocations and setup.
@ -134,9 +147,6 @@ class ClassLoaderData : public CHeapObj<mtClass> {
static Metaspace* _ro_metaspace; static Metaspace* _ro_metaspace;
static Metaspace* _rw_metaspace; static Metaspace* _rw_metaspace;
void add_dependency(Handle dependency, TRAPS);
void locked_add_dependency(objArrayHandle last, objArrayHandle new_dependency);
void set_next(ClassLoaderData* next) { _next = next; } void set_next(ClassLoaderData* next) { _next = next; }
ClassLoaderData* next() const { return _next; } ClassLoaderData* next() const { return _next; }

View File

@ -1592,9 +1592,10 @@ Symbol* SystemDictionary::find_placeholder(Symbol* class_name,
// Used for assertions and verification only // Used for assertions and verification only
Klass* SystemDictionary::find_class(Symbol* class_name, ClassLoaderData* loader_data) { Klass* SystemDictionary::find_class(Symbol* class_name, ClassLoaderData* loader_data) {
#ifndef ASSERT #ifndef ASSERT
guarantee(VerifyBeforeGC || guarantee(VerifyBeforeGC ||
VerifyDuringGC || VerifyDuringGC ||
VerifyBeforeExit || VerifyBeforeExit ||
VerifyDuringStartup ||
VerifyAfterGC, "too expensive"); VerifyAfterGC, "too expensive");
#endif #endif
assert_locked_or_safepoint(SystemDictionary_lock); assert_locked_or_safepoint(SystemDictionary_lock);

View File

@ -63,6 +63,7 @@
#define NOFAILOVER_MAJOR_VERSION 51 #define NOFAILOVER_MAJOR_VERSION 51
#define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51 #define NONZERO_PADDING_BYTES_IN_SWITCH_MAJOR_VERSION 51
#define STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION 52
// Access to external entry for VerifyClassCodes - old byte code verifier // Access to external entry for VerifyClassCodes - old byte code verifier
@ -2320,6 +2321,11 @@ void ClassVerifier::verify_invoke_instructions(
types = (1 << JVM_CONSTANT_InterfaceMethodref) | types = (1 << JVM_CONSTANT_InterfaceMethodref) |
(1 << JVM_CONSTANT_Methodref); (1 << JVM_CONSTANT_Methodref);
break; break;
case Bytecodes::_invokestatic:
types = (_klass->major_version() < STATIC_METHOD_IN_INTERFACE_MAJOR_VERSION) ?
(1 << JVM_CONSTANT_Methodref) :
((1 << JVM_CONSTANT_InterfaceMethodref) | (1 << JVM_CONSTANT_Methodref));
break;
default: default:
types = 1 << JVM_CONSTANT_Methodref; types = 1 << JVM_CONSTANT_Methodref;
} }

View File

@ -1206,11 +1206,8 @@ nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range"); assert(osr_bci == InvocationEntryBci || (0 <= osr_bci && osr_bci < method->code_size()), "bci out of range");
assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods"); assert(!method->is_abstract() && (osr_bci == InvocationEntryBci || !method->is_native()), "cannot compile abstract/native methods");
assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized"); assert(!method->method_holder()->is_not_initialized(), "method holder must be initialized");
// allow any levels for WhiteBox
if (!TieredCompilation) { assert(WhiteBoxAPI || TieredCompilation || comp_level == CompLevel_highest_tier, "only CompLevel_highest_tier must be used in non-tiered");
comp_level = CompLevel_highest_tier;
}
// return quickly if possible // return quickly if possible
// lock, make sure that the compilation // lock, make sure that the compilation

View File

@ -60,28 +60,6 @@ CompileLog::~CompileLog() {
} }
// Advance kind up to a null or space, return this tail.
// Make sure kind is null-terminated, not space-terminated.
// Use the buffer if necessary.
static const char* split_attrs(const char* &kind, char* buffer) {
const char* attrs = strchr(kind, ' ');
// Tease apart the first word from the rest:
if (attrs == NULL) {
return ""; // no attrs, no split
} else if (kind == buffer) {
((char*) attrs)[-1] = 0;
return attrs;
} else {
// park it in the buffer, so we can put a null on the end
assert(!(kind >= buffer && kind < buffer+100), "not obviously in buffer");
int klen = attrs - kind;
strncpy(buffer, kind, klen);
buffer[klen] = 0;
kind = buffer; // return by reference
return attrs;
}
}
// see_tag, pop_tag: Override the default do-nothing methods on xmlStream. // see_tag, pop_tag: Override the default do-nothing methods on xmlStream.
// These methods provide a hook for managing the the extra context markup. // These methods provide a hook for managing the the extra context markup.
void CompileLog::see_tag(const char* tag, bool push) { void CompileLog::see_tag(const char* tag, bool push) {

View File

@ -237,13 +237,6 @@ static const char * command_names[] = {
"help" "help"
}; };
static const char * command_name(OracleCommand command) {
if (command < OracleFirstCommand || command >= OracleCommandCount) {
return "unknown command";
}
return command_names[command];
}
class MethodMatcher; class MethodMatcher;
static MethodMatcher* lists[OracleCommandCount] = { 0, }; static MethodMatcher* lists[OracleCommandCount] = { 0, };

View File

@ -48,6 +48,7 @@
#include "memory/iterator.hpp" #include "memory/iterator.hpp"
#include "memory/referencePolicy.hpp" #include "memory/referencePolicy.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "memory/tenuredGeneration.hpp"
#include "oops/oop.inline.hpp" #include "oops/oop.inline.hpp"
#include "prims/jvmtiExport.hpp" #include "prims/jvmtiExport.hpp"
#include "runtime/globals_extension.hpp" #include "runtime/globals_extension.hpp"
@ -916,7 +917,31 @@ void ConcurrentMarkSweepGeneration::compute_new_size() {
return; return;
} }
size_t expand_bytes = 0; // Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
CardGeneration::compute_new_size();
// Reset again after a possible resizing
cmsSpace()->reset_after_compaction();
assert(used() == used_after_gc && used_after_gc <= capacity(),
err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
" capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
}
void ConcurrentMarkSweepGeneration::compute_new_size_free_list() {
assert_locked_or_safepoint(Heap_lock);
// If incremental collection failed, we just want to expand
// to the limit.
if (incremental_collection_failed()) {
clear_incremental_collection_failed();
grow_to_reserved();
return;
}
double free_percentage = ((double) free()) / capacity(); double free_percentage = ((double) free()) / capacity();
double desired_free_percentage = (double) MinHeapFreeRatio / 100; double desired_free_percentage = (double) MinHeapFreeRatio / 100;
double maximum_free_percentage = (double) MaxHeapFreeRatio / 100; double maximum_free_percentage = (double) MaxHeapFreeRatio / 100;
@ -925,9 +950,7 @@ void ConcurrentMarkSweepGeneration::compute_new_size() {
if (free_percentage < desired_free_percentage) { if (free_percentage < desired_free_percentage) {
size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
assert(desired_capacity >= capacity(), "invalid expansion size"); assert(desired_capacity >= capacity(), "invalid expansion size");
expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes); size_t expand_bytes = MAX2(desired_capacity - capacity(), MinHeapDeltaBytes);
}
if (expand_bytes > 0) {
if (PrintGCDetails && Verbose) { if (PrintGCDetails && Verbose) {
size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage)); size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
gclog_or_tty->print_cr("\nFrom compute_new_size: "); gclog_or_tty->print_cr("\nFrom compute_new_size: ");
@ -961,6 +984,14 @@ void ConcurrentMarkSweepGeneration::compute_new_size() {
gclog_or_tty->print_cr(" Expanded free fraction %f", gclog_or_tty->print_cr(" Expanded free fraction %f",
((double) free()) / capacity()); ((double) free()) / capacity());
} }
} else {
size_t desired_capacity = (size_t)(used() / ((double) 1 - desired_free_percentage));
assert(desired_capacity <= capacity(), "invalid expansion size");
size_t shrink_bytes = capacity() - desired_capacity;
// Don't shrink unless the delta is greater than the minimum shrink we want
if (shrink_bytes >= MinHeapDeltaBytes) {
shrink_free_list_by(shrink_bytes);
}
} }
} }
@ -1872,7 +1903,7 @@ void CMSCollector::compute_new_size() {
assert_locked_or_safepoint(Heap_lock); assert_locked_or_safepoint(Heap_lock);
FreelistLocker z(this); FreelistLocker z(this);
MetaspaceGC::compute_new_size(); MetaspaceGC::compute_new_size();
_cmsGen->compute_new_size(); _cmsGen->compute_new_size_free_list();
} }
// A work method used by foreground collection to determine // A work method used by foreground collection to determine
@ -2601,6 +2632,10 @@ void CMSCollector::gc_prologue(bool full) {
} }
void ConcurrentMarkSweepGeneration::gc_prologue(bool full) { void ConcurrentMarkSweepGeneration::gc_prologue(bool full) {
_capacity_at_prologue = capacity();
_used_at_prologue = used();
// Delegate to CMScollector which knows how to coordinate between // Delegate to CMScollector which knows how to coordinate between
// this and any other CMS generations that it is responsible for // this and any other CMS generations that it is responsible for
// collecting. // collecting.
@ -2774,6 +2809,23 @@ bool CMSCollector::is_cms_reachable(HeapWord* addr) {
} }
} }
void
CMSCollector::print_on_error(outputStream* st) {
CMSCollector* collector = ConcurrentMarkSweepGeneration::_collector;
if (collector != NULL) {
CMSBitMap* bitmap = &collector->_markBitMap;
st->print_cr("Marking Bits: (CMSBitMap*) " PTR_FORMAT, bitmap);
bitmap->print_on_error(st, " Bits: ");
st->cr();
CMSBitMap* mut_bitmap = &collector->_modUnionTable;
st->print_cr("Mod Union Table: (CMSBitMap*) " PTR_FORMAT, mut_bitmap);
mut_bitmap->print_on_error(st, " Bits: ");
}
}
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
// CMS Verification Support // CMS Verification Support
//////////////////////////////////////////////////////// ////////////////////////////////////////////////////////
@ -3300,6 +3352,26 @@ bool ConcurrentMarkSweepGeneration::expand_and_ensure_spooling_space(
} }
void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) {
assert_locked_or_safepoint(ExpandHeap_lock);
// Shrink committed space
_virtual_space.shrink_by(bytes);
// Shrink space; this also shrinks the space's BOT
_cmsSpace->set_end((HeapWord*) _virtual_space.high());
size_t new_word_size = heap_word_size(_cmsSpace->capacity());
// Shrink the shared block offset array
_bts->resize(new_word_size);
MemRegion mr(_cmsSpace->bottom(), new_word_size);
// Shrink the card table
Universe::heap()->barrier_set()->resize_covered_region(mr);
if (Verbose && PrintGC) {
size_t new_mem_size = _virtual_space.committed_size();
size_t old_mem_size = new_mem_size + bytes;
gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
name(), old_mem_size/K, new_mem_size/K);
}
}
void ConcurrentMarkSweepGeneration::shrink(size_t bytes) { void ConcurrentMarkSweepGeneration::shrink(size_t bytes) {
assert_locked_or_safepoint(Heap_lock); assert_locked_or_safepoint(Heap_lock);
@ -3351,7 +3423,7 @@ bool ConcurrentMarkSweepGeneration::grow_to_reserved() {
return success; return success;
} }
void ConcurrentMarkSweepGeneration::shrink_by(size_t bytes) { void ConcurrentMarkSweepGeneration::shrink_free_list_by(size_t bytes) {
assert_locked_or_safepoint(Heap_lock); assert_locked_or_safepoint(Heap_lock);
assert_lock_strong(freelistLock()); assert_lock_strong(freelistLock());
// XXX Fix when compaction is implemented. // XXX Fix when compaction is implemented.
@ -6476,6 +6548,10 @@ void CMSBitMap::dirty_range_iterate_clear(MemRegion mr, MemRegionClosure* cl) {
} }
} }
void CMSBitMap::print_on_error(outputStream* st, const char* prefix) const {
_bm.print_on_error(st, prefix);
}
#ifndef PRODUCT #ifndef PRODUCT
void CMSBitMap::assert_locked() const { void CMSBitMap::assert_locked() const {
CMSLockVerifier::assert_locked(lock()); CMSLockVerifier::assert_locked(lock());
@ -9074,51 +9150,6 @@ void ASConcurrentMarkSweepGeneration::update_counters(size_t used) {
} }
} }
// The desired expansion delta is computed so that:
// . desired free percentage or greater is used
void ASConcurrentMarkSweepGeneration::compute_new_size() {
assert_locked_or_safepoint(Heap_lock);
GenCollectedHeap* gch = (GenCollectedHeap*) GenCollectedHeap::heap();
// If incremental collection failed, we just want to expand
// to the limit.
if (incremental_collection_failed()) {
clear_incremental_collection_failed();
grow_to_reserved();
return;
}
assert(UseAdaptiveSizePolicy, "Should be using adaptive sizing");
assert(gch->kind() == CollectedHeap::GenCollectedHeap,
"Wrong type of heap");
int prev_level = level() - 1;
assert(prev_level >= 0, "The cms generation is the lowest generation");
Generation* prev_gen = gch->get_gen(prev_level);
assert(prev_gen->kind() == Generation::ASParNew,
"Wrong type of young generation");
ParNewGeneration* younger_gen = (ParNewGeneration*) prev_gen;
size_t cur_eden = younger_gen->eden()->capacity();
CMSAdaptiveSizePolicy* size_policy = cms_size_policy();
size_t cur_promo = free();
size_policy->compute_tenured_generation_free_space(cur_promo,
max_available(),
cur_eden);
resize(cur_promo, size_policy->promo_size());
// Record the new size of the space in the cms generation
// that is available for promotions. This is temporary.
// It should be the desired promo size.
size_policy->avg_cms_promo()->sample(free());
size_policy->avg_old_live()->sample(used());
if (UsePerfData) {
CMSGCAdaptivePolicyCounters* counters = gc_adaptive_policy_counters();
counters->update_cms_capacity_counter(capacity());
}
}
void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) { void ASConcurrentMarkSweepGeneration::shrink_by(size_t desired_bytes) {
assert_locked_or_safepoint(Heap_lock); assert_locked_or_safepoint(Heap_lock);
assert_lock_strong(freelistLock()); assert_lock_strong(freelistLock());

View File

@ -60,6 +60,7 @@ class CompactibleFreeListSpace;
class FreeChunk; class FreeChunk;
class PromotionInfo; class PromotionInfo;
class ScanMarkedObjectsAgainCarefullyClosure; class ScanMarkedObjectsAgainCarefullyClosure;
class TenuredGeneration;
// A generic CMS bit map. It's the basis for both the CMS marking bit map // A generic CMS bit map. It's the basis for both the CMS marking bit map
// as well as for the mod union table (in each case only a subset of the // as well as for the mod union table (in each case only a subset of the
@ -150,6 +151,8 @@ class CMSBitMap VALUE_OBJ_CLASS_SPEC {
size_t heapWordToOffset(HeapWord* addr) const; size_t heapWordToOffset(HeapWord* addr) const;
size_t heapWordDiffToOffsetDiff(size_t diff) const; size_t heapWordDiffToOffsetDiff(size_t diff) const;
void print_on_error(outputStream* st, const char* prefix) const;
// debugging // debugging
// is this address range covered by the bit-map? // is this address range covered by the bit-map?
NOT_PRODUCT( NOT_PRODUCT(
@ -810,9 +813,6 @@ class CMSCollector: public CHeapObj<mtGC> {
// used regions of each generation to limit the extent of sweep // used regions of each generation to limit the extent of sweep
void save_sweep_limits(); void save_sweep_limits();
// Resize the generations included in the collector.
void compute_new_size();
// A work method used by foreground collection to determine // A work method used by foreground collection to determine
// what type of collection (compacting or not, continuing or fresh) // what type of collection (compacting or not, continuing or fresh)
// it should do. // it should do.
@ -909,6 +909,9 @@ class CMSCollector: public CHeapObj<mtGC> {
void releaseFreelistLocks() const; void releaseFreelistLocks() const;
bool haveFreelistLocks() const; bool haveFreelistLocks() const;
// Adjust size of underlying generation
void compute_new_size();
// GC prologue and epilogue // GC prologue and epilogue
void gc_prologue(bool full); void gc_prologue(bool full);
void gc_epilogue(bool full); void gc_epilogue(bool full);
@ -983,6 +986,8 @@ class CMSCollector: public CHeapObj<mtGC> {
CMSAdaptiveSizePolicy* size_policy(); CMSAdaptiveSizePolicy* size_policy();
CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters(); CMSGCAdaptivePolicyCounters* gc_adaptive_policy_counters();
static void print_on_error(outputStream* st);
// debugging // debugging
void verify(); void verify();
bool verify_after_remark(); bool verify_after_remark();
@ -1082,7 +1087,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
protected: protected:
// Shrink generation by specified size (returns false if unable to shrink) // Shrink generation by specified size (returns false if unable to shrink)
virtual void shrink_by(size_t bytes); void shrink_free_list_by(size_t bytes);
// Update statistics for GC // Update statistics for GC
virtual void update_gc_stats(int level, bool full); virtual void update_gc_stats(int level, bool full);
@ -1233,6 +1238,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
CMSExpansionCause::Cause cause); CMSExpansionCause::Cause cause);
virtual bool expand(size_t bytes, size_t expand_bytes); virtual bool expand(size_t bytes, size_t expand_bytes);
void shrink(size_t bytes); void shrink(size_t bytes);
void shrink_by(size_t bytes);
HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz); HeapWord* expand_and_par_lab_allocate(CMSParGCThreadState* ps, size_t word_sz);
bool expand_and_ensure_spooling_space(PromotionInfo* promo); bool expand_and_ensure_spooling_space(PromotionInfo* promo);
@ -1293,7 +1299,13 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
bool must_be_youngest() const { return false; } bool must_be_youngest() const { return false; }
bool must_be_oldest() const { return true; } bool must_be_oldest() const { return true; }
void compute_new_size(); // Resize the generation after a compacting GC. The
// generation can be treated as a contiguous space
// after the compaction.
virtual void compute_new_size();
// Resize the generation after a non-compacting
// collection.
void compute_new_size_free_list();
CollectionTypes debug_collection_type() { return _debug_collection_type; } CollectionTypes debug_collection_type() { return _debug_collection_type; }
void rotate_debug_collection_type(); void rotate_debug_collection_type();
@ -1315,7 +1327,6 @@ class ASConcurrentMarkSweepGeneration : public ConcurrentMarkSweepGeneration {
virtual void shrink_by(size_t bytes); virtual void shrink_by(size_t bytes);
public: public:
virtual void compute_new_size();
ASConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size, ASConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
int level, CardTableRS* ct, int level, CardTableRS* ct,
bool use_adaptive_freelists, bool use_adaptive_freelists,

View File

@ -101,6 +101,10 @@ bool CMBitMapRO::covers(ReservedSpace heap_rs) const {
} }
#endif #endif
void CMBitMapRO::print_on_error(outputStream* st, const char* prefix) const {
_bm.print_on_error(st, prefix);
}
bool CMBitMap::allocate(ReservedSpace heap_rs) { bool CMBitMap::allocate(ReservedSpace heap_rs) {
_bmStartWord = (HeapWord*)(heap_rs.base()); _bmStartWord = (HeapWord*)(heap_rs.base());
_bmWordSize = heap_rs.size()/HeapWordSize; // heap_rs.size() is in bytes _bmWordSize = heap_rs.size()/HeapWordSize; // heap_rs.size() is in bytes
@ -3277,6 +3281,13 @@ void ConcurrentMark::print_worker_threads_on(outputStream* st) const {
} }
} }
void ConcurrentMark::print_on_error(outputStream* st) const {
st->print_cr("Marking Bits (Prev, Next): (CMBitMap*) " PTR_FORMAT ", (CMBitMap*) " PTR_FORMAT,
_prevMarkBitMap, _nextMarkBitMap);
_prevMarkBitMap->print_on_error(st, " Prev Bits: ");
_nextMarkBitMap->print_on_error(st, " Next Bits: ");
}
// We take a break if someone is trying to stop the world. // We take a break if someone is trying to stop the world.
bool ConcurrentMark::do_yield_check(uint worker_id) { bool ConcurrentMark::do_yield_check(uint worker_id) {
if (should_yield()) { if (should_yield()) {

View File

@ -113,6 +113,8 @@ class CMBitMapRO VALUE_OBJ_CLASS_SPEC {
return res; return res;
} }
void print_on_error(outputStream* st, const char* prefix) const;
// debugging // debugging
NOT_PRODUCT(bool covers(ReservedSpace rs) const;) NOT_PRODUCT(bool covers(ReservedSpace rs) const;)
}; };
@ -829,6 +831,8 @@ public:
void print_worker_threads_on(outputStream* st) const; void print_worker_threads_on(outputStream* st) const;
void print_on_error(outputStream* st) const;
// The following indicate whether a given verbose level has been // The following indicate whether a given verbose level has been
// set. Notice that anything above stats is conditional to // set. Notice that anything above stats is conditional to
// _MARKING_VERBOSE_ having been set to 1 // _MARKING_VERBOSE_ having been set to 1

View File

@ -3427,6 +3427,15 @@ void G1CollectedHeap::print_extended_on(outputStream* st) const {
heap_region_iterate(&blk); heap_region_iterate(&blk);
} }
void G1CollectedHeap::print_on_error(outputStream* st) const {
this->CollectedHeap::print_on_error(st);
if (_cm != NULL) {
st->cr();
_cm->print_on_error(st);
}
}
void G1CollectedHeap::print_gc_threads_on(outputStream* st) const { void G1CollectedHeap::print_gc_threads_on(outputStream* st) const {
if (G1CollectedHeap::use_parallel_gc_threads()) { if (G1CollectedHeap::use_parallel_gc_threads()) {
workers()->print_worker_threads_on(st); workers()->print_worker_threads_on(st);

View File

@ -1575,6 +1575,7 @@ public:
virtual void verify(bool silent); virtual void verify(bool silent);
virtual void print_on(outputStream* st) const; virtual void print_on(outputStream* st) const;
virtual void print_extended_on(outputStream* st) const; virtual void print_extended_on(outputStream* st) const;
virtual void print_on_error(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;

View File

@ -1359,18 +1359,6 @@ void G1CollectorPolicy::print_yg_surv_rate_info() const {
#endif // PRODUCT #endif // PRODUCT
} }
#ifndef PRODUCT
// for debugging, bit of a hack...
static char*
region_num_to_mbs(int length) {
static char buffer[64];
double bytes = (double) (length * HeapRegion::GrainBytes);
double mbs = bytes / (double) (1024 * 1024);
sprintf(buffer, "%7.2lfMB", mbs);
return buffer;
}
#endif // PRODUCT
uint G1CollectorPolicy::max_regions(int purpose) { uint G1CollectorPolicy::max_regions(int purpose) {
switch (purpose) { switch (purpose) {
case GCAllocForSurvived: case GCAllocForSurvived:

View File

@ -53,15 +53,6 @@ void PtrQueue::flush() {
} }
static int byte_index_to_index(int ind) {
assert((ind % oopSize) == 0, "Invariant.");
return ind / oopSize;
}
static int index_to_byte_index(int byte_ind) {
return byte_ind * oopSize;
}
void PtrQueue::enqueue_known_active(void* ptr) { void PtrQueue::enqueue_known_active(void* ptr) {
assert(0 <= _index && _index <= _sz, "Invariant."); assert(0 <= _index && _index <= _sz, "Invariant.");
assert(_index == 0 || _buf != NULL, "invariant"); assert(_index == 0 || _buf != NULL, "invariant");

View File

@ -173,6 +173,12 @@ public:
void reset_counters(); void reset_counters();
#endif // #ifndef PRODUCT #endif // #ifndef PRODUCT
void print_on_error(outputStream* st) const {
st->print_cr("Marking Bits: (ParMarkBitMap*) " PTR_FORMAT, this);
_beg_bits.print_on_error(st, " Begin Bits: ");
_end_bits.print_on_error(st, " End Bits: ");
}
#ifdef ASSERT #ifdef ASSERT
void verify_clear() const; void verify_clear() const;
inline void verify_bit(idx_t bit) const; inline void verify_bit(idx_t bit) const;

View File

@ -648,6 +648,15 @@ void ParallelScavengeHeap::print_on(outputStream* st) const {
MetaspaceAux::print_on(st); MetaspaceAux::print_on(st);
} }
void ParallelScavengeHeap::print_on_error(outputStream* st) const {
this->CollectedHeap::print_on_error(st);
if (UseParallelOldGC) {
st->cr();
PSParallelCompact::print_on_error(st);
}
}
void ParallelScavengeHeap::gc_threads_do(ThreadClosure* tc) const { void ParallelScavengeHeap::gc_threads_do(ThreadClosure* tc) const {
PSScavenge::gc_task_manager()->threads_do(tc); PSScavenge::gc_task_manager()->threads_do(tc);
} }

View File

@ -220,6 +220,7 @@ class ParallelScavengeHeap : public CollectedHeap {
void prepare_for_verify(); void prepare_for_verify();
virtual void print_on(outputStream* st) const; virtual void print_on(outputStream* st) const;
virtual void print_on_error(outputStream* st) const;
virtual void print_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const; virtual void print_tracing_info() const;

View File

@ -165,6 +165,10 @@ void SplitInfo::verify_clear()
#endif // #ifdef ASSERT #endif // #ifdef ASSERT
void PSParallelCompact::print_on_error(outputStream* st) {
_mark_bitmap.print_on_error(st);
}
#ifndef PRODUCT #ifndef PRODUCT
const char* PSParallelCompact::space_names[] = { const char* PSParallelCompact::space_names[] = {
"old ", "eden", "from", "to " "old ", "eden", "from", "to "

View File

@ -1163,6 +1163,8 @@ class PSParallelCompact : AllStatic {
// Time since last full gc (in milliseconds). // Time since last full gc (in milliseconds).
static jlong millis_since_last_gc(); static jlong millis_since_last_gc();
static void print_on_error(outputStream* st);
#ifndef PRODUCT #ifndef PRODUCT
// Debugging support. // Debugging support.
static const char* space_names[last_space_id]; static const char* space_names[last_space_id];

View File

@ -567,6 +567,14 @@ class CollectedHeap : public CHeapObj<mtInternal> {
print_on(st); print_on(st);
} }
virtual void print_on_error(outputStream* st) const {
st->print_cr("Heap:");
print_extended_on(st);
st->cr();
_barrier_set->print_on(st);
}
// Print all GC threads (other than the VM thread) // Print all GC threads (other than the VM thread)
// used by this heap. // used by this heap.
virtual void print_gc_threads_on(outputStream* st) const = 0; virtual void print_gc_threads_on(outputStream* st) const = 0;

View File

@ -557,11 +557,6 @@ IRT_END
// be shared by method invocation and synchronized blocks. // be shared by method invocation and synchronized blocks.
//%note synchronization_3 //%note synchronization_3
static void trace_locking(Handle& h_locking_obj, bool is_locking) {
ObjectSynchronizer::trace_locking(h_locking_obj, false, true, is_locking);
}
//%note monitor_1 //%note monitor_1
IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem)) IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem))
#ifdef ASSERT #ifdef ASSERT

View File

@ -217,6 +217,7 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
TRAPS) { TRAPS) {
vmIntrinsics::ID iid = MethodHandles::signature_polymorphic_name_id(name); vmIntrinsics::ID iid = MethodHandles::signature_polymorphic_name_id(name);
if (TraceMethodHandles) { if (TraceMethodHandles) {
ResourceMark rm(THREAD);
tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s", tty->print_cr("lookup_polymorphic_method iid=%s %s.%s%s",
vmIntrinsics::name_at(iid), klass->external_name(), vmIntrinsics::name_at(iid), klass->external_name(),
name->as_C_string(), full_signature->as_C_string()); name->as_C_string(), full_signature->as_C_string());
@ -231,6 +232,7 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
TempNewSymbol basic_signature = TempNewSymbol basic_signature =
MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg, CHECK); MethodHandles::lookup_basic_type_signature(full_signature, keep_last_arg, CHECK);
if (TraceMethodHandles) { if (TraceMethodHandles) {
ResourceMark rm(THREAD);
tty->print_cr("lookup_polymorphic_method %s %s => basic %s", tty->print_cr("lookup_polymorphic_method %s %s => basic %s",
name->as_C_string(), name->as_C_string(),
full_signature->as_C_string(), full_signature->as_C_string(),
@ -283,6 +285,8 @@ void LinkResolver::lookup_polymorphic_method(methodHandle& result,
} }
if (result.not_null()) { if (result.not_null()) {
#ifdef ASSERT #ifdef ASSERT
ResourceMark rm(THREAD);
TempNewSymbol basic_signature = TempNewSymbol basic_signature =
MethodHandles::lookup_basic_type_signature(full_signature, CHECK); MethodHandles::lookup_basic_type_signature(full_signature, CHECK);
int actual_size_of_params = result->size_of_parameters(); int actual_size_of_params = result->size_of_parameters();
@ -1222,8 +1226,10 @@ void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle poo
Symbol* method_signature = NULL; Symbol* method_signature = NULL;
KlassHandle current_klass; KlassHandle current_klass;
resolve_pool(resolved_klass, method_name, method_signature, current_klass, pool, index, CHECK); resolve_pool(resolved_klass, method_name, method_signature, current_klass, pool, index, CHECK);
if (TraceMethodHandles) if (TraceMethodHandles) {
ResourceMark rm(THREAD);
tty->print_cr("resolve_invokehandle %s %s", method_name->as_C_string(), method_signature->as_C_string()); tty->print_cr("resolve_invokehandle %s %s", method_name->as_C_string(), method_signature->as_C_string());
}
resolve_handle_call(result, resolved_klass, method_name, method_signature, current_klass, CHECK); resolve_handle_call(result, resolved_klass, method_name, method_signature, current_klass, CHECK);
} }

View File

@ -611,4 +611,23 @@ public:
void check() PRODUCT_RETURN; void check() PRODUCT_RETURN;
}; };
// Helper class to allocate arrays that may become large.
// Uses the OS malloc for allocations smaller than ArrayAllocatorMallocLimit
// and uses mapped memory for larger allocations.
// Most OS mallocs do something similar but Solaris malloc does not revert
// to mapped memory for large allocations. By default ArrayAllocatorMallocLimit
// is set so that we always use malloc except for Solaris where we set the
// limit to get mapped memory.
template <class E, MEMFLAGS F>
class ArrayAllocator : StackObj {
char* _addr;
bool _use_malloc;
size_t _size;
public:
ArrayAllocator() : _addr(NULL), _use_malloc(false), _size(0) { }
~ArrayAllocator() { free(); }
E* allocate(size_t length);
void free();
};
#endif // SHARE_VM_MEMORY_ALLOCATION_HPP #endif // SHARE_VM_MEMORY_ALLOCATION_HPP

View File

@ -108,5 +108,49 @@ template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
FreeHeap(p, F); FreeHeap(p, F);
} }
template <class E, MEMFLAGS F>
E* ArrayAllocator<E, F>::allocate(size_t length) {
assert(_addr == NULL, "Already in use");
_size = sizeof(E) * length;
_use_malloc = _size < ArrayAllocatorMallocLimit;
if (_use_malloc) {
_addr = AllocateHeap(_size, F);
if (_addr == NULL && _size >= (size_t)os::vm_allocation_granularity()) {
// malloc failed let's try with mmap instead
_use_malloc = false;
} else {
return (E*)_addr;
}
}
int alignment = os::vm_allocation_granularity();
_size = align_size_up(_size, alignment);
_addr = os::reserve_memory(_size, NULL, alignment);
if (_addr == NULL) {
vm_exit_out_of_memory(_size, "Allocator (reserve)");
}
bool success = os::commit_memory(_addr, _size, false /* executable */);
if (!success) {
vm_exit_out_of_memory(_size, "Allocator (commit)");
}
return (E*)_addr;
}
template<class E, MEMFLAGS F>
void ArrayAllocator<E, F>::free() {
if (_addr != NULL) {
if (_use_malloc) {
FreeHeap(_addr, F);
} else {
os::release_memory(_addr, _size);
}
_addr = NULL;
}
}
#endif // SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP #endif // SHARE_VM_MEMORY_ALLOCATION_INLINE_HPP

View File

@ -819,12 +819,13 @@ bool GenCollectedHeap::is_in_young(oop p) {
// Returns "TRUE" iff "p" points into the committed areas of the heap. // Returns "TRUE" iff "p" points into the committed areas of the heap.
bool GenCollectedHeap::is_in(const void* p) const { bool GenCollectedHeap::is_in(const void* p) const {
#ifndef ASSERT #ifndef ASSERT
guarantee(VerifyBeforeGC || guarantee(VerifyBeforeGC ||
VerifyDuringGC || VerifyDuringGC ||
VerifyBeforeExit || VerifyBeforeExit ||
PrintAssembly || VerifyDuringStartup ||
tty->count() != 0 || // already printing PrintAssembly ||
VerifyAfterGC || tty->count() != 0 || // already printing
VerifyAfterGC ||
VMError::fatal_error_in_progress(), "too expensive"); VMError::fatal_error_in_progress(), "too expensive");
#endif #endif
@ -1132,6 +1133,17 @@ void GenCollectedHeap::print_gc_threads_on(outputStream* st) const {
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
} }
void GenCollectedHeap::print_on_error(outputStream* st) const {
this->CollectedHeap::print_on_error(st);
#if INCLUDE_ALL_GCS
if (UseConcMarkSweepGC) {
st->cr();
CMSCollector::print_on_error(st);
}
#endif // INCLUDE_ALL_GCS
}
void GenCollectedHeap::print_tracing_info() const { void GenCollectedHeap::print_tracing_info() const {
if (TraceGen0Time) { if (TraceGen0Time) {
get_gen(0)->print_summary_info(); get_gen(0)->print_summary_info();

View File

@ -344,6 +344,7 @@ public:
virtual void print_gc_threads_on(outputStream* st) const; virtual void print_gc_threads_on(outputStream* st) const;
virtual void gc_threads_do(ThreadClosure* tc) const; virtual void gc_threads_do(ThreadClosure* tc) const;
virtual void print_tracing_info() const; virtual void print_tracing_info() const;
virtual void print_on_error(outputStream* st) const;
// PrintGC, PrintGCDetails support // PrintGC, PrintGCDetails support
void print_heap_change(size_t prev_used) const; void print_heap_change(size_t prev_used) const;

View File

@ -382,7 +382,9 @@ void Generation::compact() {
CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size, CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size,
int level, int level,
GenRemSet* remset) : GenRemSet* remset) :
Generation(rs, initial_byte_size, level), _rs(remset) Generation(rs, initial_byte_size, level), _rs(remset),
_shrink_factor(0), _min_heap_delta_bytes(), _capacity_at_prologue(),
_used_at_prologue()
{ {
HeapWord* start = (HeapWord*)rs.base(); HeapWord* start = (HeapWord*)rs.base();
size_t reserved_byte_size = rs.size(); size_t reserved_byte_size = rs.size();
@ -406,6 +408,9 @@ CardGeneration::CardGeneration(ReservedSpace rs, size_t initial_byte_size,
// the end if we try. // the end if we try.
guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned"); guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned");
} }
_min_heap_delta_bytes = MinHeapDeltaBytes;
_capacity_at_prologue = initial_byte_size;
_used_at_prologue = 0;
} }
bool CardGeneration::expand(size_t bytes, size_t expand_bytes) { bool CardGeneration::expand(size_t bytes, size_t expand_bytes) {
@ -457,6 +462,160 @@ void CardGeneration::invalidate_remembered_set() {
} }
void CardGeneration::compute_new_size() {
assert(_shrink_factor <= 100, "invalid shrink factor");
size_t current_shrink_factor = _shrink_factor;
_shrink_factor = 0;
// We don't have floating point command-line arguments
// Note: argument processing ensures that MinHeapFreeRatio < 100.
const double minimum_free_percentage = MinHeapFreeRatio / 100.0;
const double maximum_used_percentage = 1.0 - minimum_free_percentage;
// Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
const double min_tmp = used_after_gc / maximum_used_percentage;
size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
// Don't shrink less than the initial generation size
minimum_desired_capacity = MAX2(minimum_desired_capacity,
spec()->init_size());
assert(used_after_gc <= minimum_desired_capacity, "sanity check");
if (PrintGC && Verbose) {
const size_t free_after_gc = free();
const double free_percentage = ((double)free_after_gc) / capacity_after_gc;
gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: ");
gclog_or_tty->print_cr(" "
" minimum_free_percentage: %6.2f"
" maximum_used_percentage: %6.2f",
minimum_free_percentage,
maximum_used_percentage);
gclog_or_tty->print_cr(" "
" free_after_gc : %6.1fK"
" used_after_gc : %6.1fK"
" capacity_after_gc : %6.1fK",
free_after_gc / (double) K,
used_after_gc / (double) K,
capacity_after_gc / (double) K);
gclog_or_tty->print_cr(" "
" free_percentage: %6.2f",
free_percentage);
}
if (capacity_after_gc < minimum_desired_capacity) {
// If we have less free space than we want then expand
size_t expand_bytes = minimum_desired_capacity - capacity_after_gc;
// Don't expand unless it's significant
if (expand_bytes >= _min_heap_delta_bytes) {
expand(expand_bytes, 0); // safe if expansion fails
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" expanding:"
" minimum_desired_capacity: %6.1fK"
" expand_bytes: %6.1fK"
" _min_heap_delta_bytes: %6.1fK",
minimum_desired_capacity / (double) K,
expand_bytes / (double) K,
_min_heap_delta_bytes / (double) K);
}
return;
}
// No expansion, now see if we want to shrink
size_t shrink_bytes = 0;
// We would never want to shrink more than this
size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity;
if (MaxHeapFreeRatio < 100) {
const double maximum_free_percentage = MaxHeapFreeRatio / 100.0;
const double minimum_used_percentage = 1.0 - maximum_free_percentage;
const double max_tmp = used_after_gc / minimum_used_percentage;
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
maximum_desired_capacity = MAX2(maximum_desired_capacity,
spec()->init_size());
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" maximum_free_percentage: %6.2f"
" minimum_used_percentage: %6.2f",
maximum_free_percentage,
minimum_used_percentage);
gclog_or_tty->print_cr(" "
" _capacity_at_prologue: %6.1fK"
" minimum_desired_capacity: %6.1fK"
" maximum_desired_capacity: %6.1fK",
_capacity_at_prologue / (double) K,
minimum_desired_capacity / (double) K,
maximum_desired_capacity / (double) K);
}
assert(minimum_desired_capacity <= maximum_desired_capacity,
"sanity check");
if (capacity_after_gc > maximum_desired_capacity) {
// Capacity too large, compute shrinking size
shrink_bytes = capacity_after_gc - maximum_desired_capacity;
// We don't want shrink all the way back to initSize if people call
// System.gc(), because some programs do that between "phases" and then
// we'd just have to grow the heap up again for the next phase. So we
// damp the shrinking: 0% on the first call, 10% on the second call, 40%
// on the third call, and 100% by the fourth call. But if we recompute
// size without shrinking, it goes back to 0%.
shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (current_shrink_factor == 0) {
_shrink_factor = 10;
} else {
_shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100);
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" shrinking:"
" initSize: %.1fK"
" maximum_desired_capacity: %.1fK",
spec()->init_size() / (double) K,
maximum_desired_capacity / (double) K);
gclog_or_tty->print_cr(" "
" shrink_bytes: %.1fK"
" current_shrink_factor: %d"
" new shrink factor: %d"
" _min_heap_delta_bytes: %.1fK",
shrink_bytes / (double) K,
current_shrink_factor,
_shrink_factor,
_min_heap_delta_bytes / (double) K);
}
}
}
if (capacity_after_gc > _capacity_at_prologue) {
// We might have expanded for promotions, in which case we might want to
// take back that expansion if there's room after GC. That keeps us from
// stretching the heap with promotions when there's plenty of room.
size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue;
expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes);
// We have two shrinking computations, take the largest
shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion);
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" aggressive shrinking:"
" _capacity_at_prologue: %.1fK"
" capacity_after_gc: %.1fK"
" expansion_for_promotion: %.1fK"
" shrink_bytes: %.1fK",
capacity_after_gc / (double) K,
_capacity_at_prologue / (double) K,
expansion_for_promotion / (double) K,
shrink_bytes / (double) K);
}
}
// Don't shrink unless it's significant
if (shrink_bytes >= _min_heap_delta_bytes) {
shrink(shrink_bytes);
}
}
// Currently nothing to do. // Currently nothing to do.
void CardGeneration::prepare_for_verify() {} void CardGeneration::prepare_for_verify() {}

View File

@ -634,6 +634,17 @@ class CardGeneration: public Generation {
// This is local to this generation. // This is local to this generation.
BlockOffsetSharedArray* _bts; BlockOffsetSharedArray* _bts;
// current shrinking effect: this damps shrinking when the heap gets empty.
size_t _shrink_factor;
size_t _min_heap_delta_bytes; // Minimum amount to expand.
// Some statistics from before gc started.
// These are gathered in the gc_prologue (and should_collect)
// to control growing/shrinking policy in spite of promotions.
size_t _capacity_at_prologue;
size_t _used_at_prologue;
CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level, CardGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
GenRemSet* remset); GenRemSet* remset);
@ -644,6 +655,11 @@ class CardGeneration: public Generation {
// necessarily the full "bytes") was done. // necessarily the full "bytes") was done.
virtual bool expand(size_t bytes, size_t expand_bytes); virtual bool expand(size_t bytes, size_t expand_bytes);
// Shrink generation with specified size (returns false if unable to shrink)
virtual void shrink(size_t bytes) = 0;
virtual void compute_new_size();
virtual void clear_remembered_set(); virtual void clear_remembered_set();
virtual void invalidate_remembered_set(); virtual void invalidate_remembered_set();
@ -667,7 +683,6 @@ class OneContigSpaceCardGeneration: public CardGeneration {
friend class VM_PopulateDumpSharedSpace; friend class VM_PopulateDumpSharedSpace;
protected: protected:
size_t _min_heap_delta_bytes; // Minimum amount to expand.
ContiguousSpace* _the_space; // actual space holding objects ContiguousSpace* _the_space; // actual space holding objects
WaterMark _last_gc; // watermark between objects allocated before WaterMark _last_gc; // watermark between objects allocated before
// and after last GC. // and after last GC.
@ -688,11 +703,10 @@ class OneContigSpaceCardGeneration: public CardGeneration {
public: public:
OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size, OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size,
size_t min_heap_delta_bytes,
int level, GenRemSet* remset, int level, GenRemSet* remset,
ContiguousSpace* space) : ContiguousSpace* space) :
CardGeneration(rs, initial_byte_size, level, remset), CardGeneration(rs, initial_byte_size, level, remset),
_the_space(space), _min_heap_delta_bytes(min_heap_delta_bytes) _the_space(space)
{} {}
inline bool is_in(const void* p) const; inline bool is_in(const void* p) const;

View File

@ -79,13 +79,6 @@ static size_t align_to_page_size(size_t size) {
} }
static size_t align_to_allocation_size(size_t size) {
const size_t alignment = (size_t)os::vm_allocation_granularity();
assert(is_power_of_2(alignment), "no kidding ???");
return (size + alignment - 1) & ~(alignment - 1);
}
void CodeHeap::on_code_mapping(char* base, size_t size) { void CodeHeap::on_code_mapping(char* base, size_t size) {
#ifdef LINUX #ifdef LINUX
extern void linux_wrap_code(char* base, size_t size); extern void linux_wrap_code(char* base, size_t size);

View File

@ -39,7 +39,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
size_t initial_byte_size, int level, size_t initial_byte_size, int level,
GenRemSet* remset) : GenRemSet* remset) :
OneContigSpaceCardGeneration(rs, initial_byte_size, OneContigSpaceCardGeneration(rs, initial_byte_size,
MinHeapDeltaBytes, level, remset, NULL) level, remset, NULL)
{ {
HeapWord* bottom = (HeapWord*) _virtual_space.low(); HeapWord* bottom = (HeapWord*) _virtual_space.low();
HeapWord* end = (HeapWord*) _virtual_space.high(); HeapWord* end = (HeapWord*) _virtual_space.high();
@ -86,162 +86,6 @@ const char* TenuredGeneration::name() const {
return "tenured generation"; return "tenured generation";
} }
void TenuredGeneration::compute_new_size() {
assert(_shrink_factor <= 100, "invalid shrink factor");
size_t current_shrink_factor = _shrink_factor;
_shrink_factor = 0;
// We don't have floating point command-line arguments
// Note: argument processing ensures that MinHeapFreeRatio < 100.
const double minimum_free_percentage = MinHeapFreeRatio / 100.0;
const double maximum_used_percentage = 1.0 - minimum_free_percentage;
// Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
const double min_tmp = used_after_gc / maximum_used_percentage;
size_t minimum_desired_capacity = (size_t)MIN2(min_tmp, double(max_uintx));
// Don't shrink less than the initial generation size
minimum_desired_capacity = MAX2(minimum_desired_capacity,
spec()->init_size());
assert(used_after_gc <= minimum_desired_capacity, "sanity check");
if (PrintGC && Verbose) {
const size_t free_after_gc = free();
const double free_percentage = ((double)free_after_gc) / capacity_after_gc;
gclog_or_tty->print_cr("TenuredGeneration::compute_new_size: ");
gclog_or_tty->print_cr(" "
" minimum_free_percentage: %6.2f"
" maximum_used_percentage: %6.2f",
minimum_free_percentage,
maximum_used_percentage);
gclog_or_tty->print_cr(" "
" free_after_gc : %6.1fK"
" used_after_gc : %6.1fK"
" capacity_after_gc : %6.1fK",
free_after_gc / (double) K,
used_after_gc / (double) K,
capacity_after_gc / (double) K);
gclog_or_tty->print_cr(" "
" free_percentage: %6.2f",
free_percentage);
}
if (capacity_after_gc < minimum_desired_capacity) {
// If we have less free space than we want then expand
size_t expand_bytes = minimum_desired_capacity - capacity_after_gc;
// Don't expand unless it's significant
if (expand_bytes >= _min_heap_delta_bytes) {
expand(expand_bytes, 0); // safe if expansion fails
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" expanding:"
" minimum_desired_capacity: %6.1fK"
" expand_bytes: %6.1fK"
" _min_heap_delta_bytes: %6.1fK",
minimum_desired_capacity / (double) K,
expand_bytes / (double) K,
_min_heap_delta_bytes / (double) K);
}
return;
}
// No expansion, now see if we want to shrink
size_t shrink_bytes = 0;
// We would never want to shrink more than this
size_t max_shrink_bytes = capacity_after_gc - minimum_desired_capacity;
if (MaxHeapFreeRatio < 100) {
const double maximum_free_percentage = MaxHeapFreeRatio / 100.0;
const double minimum_used_percentage = 1.0 - maximum_free_percentage;
const double max_tmp = used_after_gc / minimum_used_percentage;
size_t maximum_desired_capacity = (size_t)MIN2(max_tmp, double(max_uintx));
maximum_desired_capacity = MAX2(maximum_desired_capacity,
spec()->init_size());
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" maximum_free_percentage: %6.2f"
" minimum_used_percentage: %6.2f",
maximum_free_percentage,
minimum_used_percentage);
gclog_or_tty->print_cr(" "
" _capacity_at_prologue: %6.1fK"
" minimum_desired_capacity: %6.1fK"
" maximum_desired_capacity: %6.1fK",
_capacity_at_prologue / (double) K,
minimum_desired_capacity / (double) K,
maximum_desired_capacity / (double) K);
}
assert(minimum_desired_capacity <= maximum_desired_capacity,
"sanity check");
if (capacity_after_gc > maximum_desired_capacity) {
// Capacity too large, compute shrinking size
shrink_bytes = capacity_after_gc - maximum_desired_capacity;
// We don't want shrink all the way back to initSize if people call
// System.gc(), because some programs do that between "phases" and then
// we'd just have to grow the heap up again for the next phase. So we
// damp the shrinking: 0% on the first call, 10% on the second call, 40%
// on the third call, and 100% by the fourth call. But if we recompute
// size without shrinking, it goes back to 0%.
shrink_bytes = shrink_bytes / 100 * current_shrink_factor;
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (current_shrink_factor == 0) {
_shrink_factor = 10;
} else {
_shrink_factor = MIN2(current_shrink_factor * 4, (size_t) 100);
}
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" shrinking:"
" initSize: %.1fK"
" maximum_desired_capacity: %.1fK",
spec()->init_size() / (double) K,
maximum_desired_capacity / (double) K);
gclog_or_tty->print_cr(" "
" shrink_bytes: %.1fK"
" current_shrink_factor: %d"
" new shrink factor: %d"
" _min_heap_delta_bytes: %.1fK",
shrink_bytes / (double) K,
current_shrink_factor,
_shrink_factor,
_min_heap_delta_bytes / (double) K);
}
}
}
if (capacity_after_gc > _capacity_at_prologue) {
// We might have expanded for promotions, in which case we might want to
// take back that expansion if there's room after GC. That keeps us from
// stretching the heap with promotions when there's plenty of room.
size_t expansion_for_promotion = capacity_after_gc - _capacity_at_prologue;
expansion_for_promotion = MIN2(expansion_for_promotion, max_shrink_bytes);
// We have two shrinking computations, take the largest
shrink_bytes = MAX2(shrink_bytes, expansion_for_promotion);
assert(shrink_bytes <= max_shrink_bytes, "invalid shrink size");
if (PrintGC && Verbose) {
gclog_or_tty->print_cr(" "
" aggressive shrinking:"
" _capacity_at_prologue: %.1fK"
" capacity_after_gc: %.1fK"
" expansion_for_promotion: %.1fK"
" shrink_bytes: %.1fK",
capacity_after_gc / (double) K,
_capacity_at_prologue / (double) K,
expansion_for_promotion / (double) K,
shrink_bytes / (double) K);
}
}
// Don't shrink unless it's significant
if (shrink_bytes >= _min_heap_delta_bytes) {
shrink(shrink_bytes);
}
assert(used() == used_after_gc && used_after_gc <= capacity(),
"sanity check");
}
void TenuredGeneration::gc_prologue(bool full) { void TenuredGeneration::gc_prologue(bool full) {
_capacity_at_prologue = capacity(); _capacity_at_prologue = capacity();
_used_at_prologue = used(); _used_at_prologue = used();
@ -312,6 +156,19 @@ void TenuredGeneration::collect(bool full,
size, is_tlab); size, is_tlab);
} }
void TenuredGeneration::compute_new_size() {
assert_locked_or_safepoint(Heap_lock);
// Compute some numbers about the state of the heap.
const size_t used_after_gc = used();
const size_t capacity_after_gc = capacity();
CardGeneration::compute_new_size();
assert(used() == used_after_gc && used_after_gc <= capacity(),
err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
" capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
}
void TenuredGeneration::update_gc_stats(int current_level, void TenuredGeneration::update_gc_stats(int current_level,
bool full) { bool full) {
// If the next lower level(s) has been collected, gather any statistics // If the next lower level(s) has been collected, gather any statistics

View File

@ -38,13 +38,6 @@ class ParGCAllocBufferWithBOT;
class TenuredGeneration: public OneContigSpaceCardGeneration { class TenuredGeneration: public OneContigSpaceCardGeneration {
friend class VMStructs; friend class VMStructs;
protected: protected:
// current shrinking effect: this damps shrinking when the heap gets empty.
size_t _shrink_factor;
// Some statistics from before gc started.
// These are gathered in the gc_prologue (and should_collect)
// to control growing/shrinking policy in spite of promotions.
size_t _capacity_at_prologue;
size_t _used_at_prologue;
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
// To support parallel promotion: an array of parallel allocation // To support parallel promotion: an array of parallel allocation
@ -80,9 +73,6 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
return !CollectGen0First; return !CollectGen0First;
} }
// Mark sweep support
void compute_new_size();
virtual void gc_prologue(bool full); virtual void gc_prologue(bool full);
virtual void gc_epilogue(bool full); virtual void gc_epilogue(bool full);
bool should_collect(bool full, bool should_collect(bool full,
@ -93,6 +83,7 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
bool clear_all_soft_refs, bool clear_all_soft_refs,
size_t size, size_t size,
bool is_tlab); bool is_tlab);
virtual void compute_new_size();
#if INCLUDE_ALL_GCS #if INCLUDE_ALL_GCS
// Overrides. // Overrides.

View File

@ -1326,6 +1326,8 @@ static uintptr_t _verify_oop_data[2] = {0, (uintptr_t)-1};
static uintptr_t _verify_klass_data[2] = {0, (uintptr_t)-1}; static uintptr_t _verify_klass_data[2] = {0, (uintptr_t)-1};
#ifndef PRODUCT
static void calculate_verify_data(uintptr_t verify_data[2], static void calculate_verify_data(uintptr_t verify_data[2],
HeapWord* low_boundary, HeapWord* low_boundary,
HeapWord* high_boundary) { HeapWord* high_boundary) {
@ -1360,9 +1362,7 @@ static void calculate_verify_data(uintptr_t verify_data[2],
verify_data[1] = bits; verify_data[1] = bits;
} }
// Oop verification (see MacroAssembler::verify_oop) // Oop verification (see MacroAssembler::verify_oop)
#ifndef PRODUCT
uintptr_t Universe::verify_oop_mask() { uintptr_t Universe::verify_oop_mask() {
MemRegion m = heap()->reserved_region(); MemRegion m = heap()->reserved_region();

View File

@ -1378,12 +1378,13 @@ const char* ConstantPool::printable_name_at(int which) {
// JVMTI GetConstantPool support // JVMTI GetConstantPool support
// For temporary use until code is stable. // For debugging of constant pool
#define DBG(code) const bool debug_cpool = false;
static const char* WARN_MSG = "Must not be such entry!"; #define DBG(code) do { if (debug_cpool) { (code); } } while(0)
static void print_cpool_bytes(jint cnt, u1 *bytes) { static void print_cpool_bytes(jint cnt, u1 *bytes) {
const char* WARN_MSG = "Must not be such entry!";
jint size = 0; jint size = 0;
u2 idx1, idx2; u2 idx1, idx2;
@ -1669,8 +1670,7 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
idx1 = tbl->symbol_to_value(sym); idx1 = tbl->symbol_to_value(sym);
assert(idx1 != 0, "Have not found a hashtable entry"); assert(idx1 != 0, "Have not found a hashtable entry");
Bytes::put_Java_u2((address) (bytes+1), idx1); Bytes::put_Java_u2((address) (bytes+1), idx1);
DBG(char *str = sym->as_utf8()); DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, sym->as_utf8()));
DBG(printf("JVM_CONSTANT_String: idx=#%03hd, %s", idx1, str));
break; break;
} }
case JVM_CONSTANT_Fieldref: case JVM_CONSTANT_Fieldref:
@ -1745,6 +1745,8 @@ int ConstantPool::copy_cpool_bytes(int cpool_size,
return (int)(bytes - start_bytes); return (int)(bytes - start_bytes);
} /* end copy_cpool_bytes */ } /* end copy_cpool_bytes */
#undef DBG
void ConstantPool::set_on_stack(const bool value) { void ConstantPool::set_on_stack(const bool value) {
if (value) { if (value) {

View File

@ -3157,7 +3157,7 @@ void InstanceKlass::verify_on(outputStream* st) {
Array<int>* method_ordering = this->method_ordering(); Array<int>* method_ordering = this->method_ordering();
int length = method_ordering->length(); int length = method_ordering->length();
if (JvmtiExport::can_maintain_original_method_order() || if (JvmtiExport::can_maintain_original_method_order() ||
(UseSharedSpaces && length != 0)) { ((UseSharedSpaces || DumpSharedSpaces) && length != 0)) {
guarantee(length == methods()->length(), "invalid method ordering length"); guarantee(length == methods()->length(), "invalid method ordering length");
jlong sum = 0; jlong sum = 0;
for (int j = 0; j < length; j++) { for (int j = 0; j < length; j++) {

View File

@ -758,15 +758,19 @@ class Method : public Metadata {
void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason); void print_made_not_compilable(int comp_level, bool is_osr, bool report, const char* reason);
public: public:
bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); } bool is_not_c1_compilable() const { return access_flags().is_not_c1_compilable(); }
void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); } void set_not_c1_compilable() { _access_flags.set_not_c1_compilable(); }
bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); } void clear_not_c1_compilable() { _access_flags.clear_not_c1_compilable(); }
void set_not_c2_compilable() { _access_flags.set_not_c2_compilable(); } bool is_not_c2_compilable() const { return access_flags().is_not_c2_compilable(); }
void set_not_c2_compilable() { _access_flags.set_not_c2_compilable(); }
void clear_not_c2_compilable() { _access_flags.clear_not_c2_compilable(); }
bool is_not_c1_osr_compilable() const { return is_not_c1_compilable(); } // don't waste an accessFlags bit bool is_not_c1_osr_compilable() const { return is_not_c1_compilable(); } // don't waste an accessFlags bit
void set_not_c1_osr_compilable() { set_not_c1_compilable(); } // don't waste an accessFlags bit void set_not_c1_osr_compilable() { set_not_c1_compilable(); } // don't waste an accessFlags bit
bool is_not_c2_osr_compilable() const { return access_flags().is_not_c2_osr_compilable(); } void clear_not_c1_osr_compilable() { clear_not_c1_compilable(); } // don't waste an accessFlags bit
void set_not_c2_osr_compilable() { _access_flags.set_not_c2_osr_compilable(); } bool is_not_c2_osr_compilable() const { return access_flags().is_not_c2_osr_compilable(); }
void set_not_c2_osr_compilable() { _access_flags.set_not_c2_osr_compilable(); }
void clear_not_c2_osr_compilable() { _access_flags.clear_not_c2_osr_compilable(); }
// Background compilation support // Background compilation support
bool queued_for_compilation() const { return access_flags().queued_for_compilation(); } bool queued_for_compilation() const { return access_flags().queued_for_compilation(); }

View File

@ -660,29 +660,9 @@ MethodData::MethodData(methodHandle method, int size, TRAPS) {
// Set the method back-pointer. // Set the method back-pointer.
_method = method(); _method = method();
_invocation_counter.init(); init();
_backedge_counter.init();
_invocation_counter_start = 0;
_backedge_counter_start = 0;
_num_loops = 0;
_num_blocks = 0;
_highest_comp_level = 0;
_highest_osr_comp_level = 0;
_would_profile = true;
set_creation_mileage(mileage_of(method())); set_creation_mileage(mileage_of(method()));
// Initialize flags and trap history.
_nof_decompiles = 0;
_nof_overflow_recompiles = 0;
_nof_overflow_traps = 0;
_eflags = 0;
_arg_local = 0;
_arg_stack = 0;
_arg_returned = 0;
assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
Copy::zero_to_words((HeapWord*) &_trap_hist,
sizeof(_trap_hist) / sizeof(HeapWord));
// Go through the bytecodes and allocate and initialize the // Go through the bytecodes and allocate and initialize the
// corresponding data cells. // corresponding data cells.
int data_size = 0; int data_size = 0;
@ -721,7 +701,27 @@ MethodData::MethodData(methodHandle method, int size, TRAPS) {
post_initialize(&stream); post_initialize(&stream);
set_size(object_size); set_size(object_size);
}
void MethodData::init() {
_invocation_counter.init();
_backedge_counter.init();
_invocation_counter_start = 0;
_backedge_counter_start = 0;
_num_loops = 0;
_num_blocks = 0;
_highest_comp_level = 0;
_highest_osr_comp_level = 0;
_would_profile = true;
// Initialize flags and trap history.
_nof_decompiles = 0;
_nof_overflow_recompiles = 0;
_nof_overflow_traps = 0;
clear_escape_info();
assert(sizeof(_trap_hist) % sizeof(HeapWord) == 0, "align");
Copy::zero_to_words((HeapWord*) &_trap_hist,
sizeof(_trap_hist) / sizeof(HeapWord));
} }
// Get a measure of how much mileage the method has on it. // Get a measure of how much mileage the method has on it.

View File

@ -1284,8 +1284,8 @@ public:
return bytecode_cell_count(code) != no_profile_data; return bytecode_cell_count(code) != no_profile_data;
} }
// Perform initialization of a new MethodData* // reset into original state
void initialize(methodHandle method); void init();
// My size // My size
int size_in_bytes() const { return _size; } int size_in_bytes() const { return _size; }
@ -1365,6 +1365,7 @@ public:
intx arg_stack() { return _arg_stack; } intx arg_stack() { return _arg_stack; }
intx arg_returned() { return _arg_returned; } intx arg_returned() { return _arg_returned; }
uint arg_modified(int a) { ArgInfoData *aid = arg_info(); uint arg_modified(int a) { ArgInfoData *aid = arg_info();
assert(aid != NULL, "arg_info must be not null");
assert(a >= 0 && a < aid->number_of_args(), "valid argument number"); assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
return aid->arg_modified(a); } return aid->arg_modified(a); }
@ -1373,8 +1374,8 @@ public:
void set_arg_stack(intx v) { _arg_stack = v; } void set_arg_stack(intx v) { _arg_stack = v; }
void set_arg_returned(intx v) { _arg_returned = v; } void set_arg_returned(intx v) { _arg_returned = v; }
void set_arg_modified(int a, uint v) { ArgInfoData *aid = arg_info(); void set_arg_modified(int a, uint v) { ArgInfoData *aid = arg_info();
assert(aid != NULL, "arg_info must be not null");
assert(a >= 0 && a < aid->number_of_args(), "valid argument number"); assert(a >= 0 && a < aid->number_of_args(), "valid argument number");
aid->set_arg_modified(a, v); } aid->set_arg_modified(a, v); }
void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; } void clear_escape_info() { _eflags = _arg_local = _arg_stack = _arg_returned = 0; }

View File

@ -1028,26 +1028,6 @@ void UnionFind::Union( uint idx1, uint idx2 ) {
} }
#ifndef PRODUCT #ifndef PRODUCT
static void edge_dump(GrowableArray<CFGEdge *> *edges) {
tty->print_cr("---- Edges ----");
for (int i = 0; i < edges->length(); i++) {
CFGEdge *e = edges->at(i);
if (e != NULL) {
edges->at(i)->dump();
}
}
}
static void trace_dump(Trace *traces[], int count) {
tty->print_cr("---- Traces ----");
for (int i = 0; i < count; i++) {
Trace *tr = traces[i];
if (tr != NULL) {
tr->dump();
}
}
}
void Trace::dump( ) const { void Trace::dump( ) const {
tty->print_cr("Trace (freq %f)", first_block()->_freq); tty->print_cr("Trace (freq %f)", first_block()->_freq);
for (Block *b = first_block(); b != NULL; b = next(b)) { for (Block *b = first_block(); b != NULL; b = next(b)) {

View File

@ -2326,12 +2326,14 @@ struct Final_Reshape_Counts : public StackObj {
int get_inner_loop_count() const { return _inner_loop_count; } int get_inner_loop_count() const { return _inner_loop_count; }
}; };
#ifdef ASSERT
static bool oop_offset_is_sane(const TypeInstPtr* tp) { static bool oop_offset_is_sane(const TypeInstPtr* tp) {
ciInstanceKlass *k = tp->klass()->as_instance_klass(); ciInstanceKlass *k = tp->klass()->as_instance_klass();
// Make sure the offset goes inside the instance layout. // Make sure the offset goes inside the instance layout.
return k->contains_field_offset(tp->offset()); return k->contains_field_offset(tp->offset());
// Note that OffsetBot and OffsetTop are very negative. // Note that OffsetBot and OffsetTop are very negative.
} }
#endif
// Eliminate trivially redundant StoreCMs and accumulate their // Eliminate trivially redundant StoreCMs and accumulate their
// precedence edges. // precedence edges.

View File

@ -465,29 +465,6 @@ Node *CheckCastPPNode::Identity( PhaseTransform *phase ) {
return (phase->type(in(1)) == phase->type(this)) ? in(1) : this; return (phase->type(in(1)) == phase->type(this)) ? in(1) : this;
} }
// Determine whether "n" is a node which can cause an alias of one of its inputs. Node types
// which can create aliases are: CheckCastPP, Phi, and any store (if there is also a load from
// the location.)
// Note: this checks for aliases created in this compilation, not ones which may
// be potentially created at call sites.
static bool can_cause_alias(Node *n, PhaseTransform *phase) {
bool possible_alias = false;
if (n->is_Store()) {
possible_alias = !n->as_Store()->value_never_loaded(phase);
} else {
int opc = n->Opcode();
possible_alias = n->is_Phi() ||
opc == Op_CheckCastPP ||
opc == Op_StorePConditional ||
opc == Op_CompareAndSwapP ||
opc == Op_CompareAndSwapN ||
opc == Op_GetAndSetP ||
opc == Op_GetAndSetN;
}
return possible_alias;
}
//------------------------------Value------------------------------------------ //------------------------------Value------------------------------------------
// Take 'join' of input and cast-up type, unless working with an Interface // Take 'join' of input and cast-up type, unless working with an Interface
const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const { const Type *CheckCastPPNode::Value( PhaseTransform *phase ) const {

View File

@ -1078,16 +1078,6 @@ uint BoolNode::cmp( const Node &n ) const {
return (_test._test == b->_test._test); return (_test._test == b->_test._test);
} }
//------------------------------clone_cmp--------------------------------------
// Clone a compare/bool tree
static Node *clone_cmp( Node *cmp, Node *cmp1, Node *cmp2, PhaseGVN *gvn, BoolTest::mask test ) {
Node *ncmp = cmp->clone();
ncmp->set_req(1,cmp1);
ncmp->set_req(2,cmp2);
ncmp = gvn->transform( ncmp );
return new (gvn->C) BoolNode( ncmp, test );
}
//-------------------------------make_predicate-------------------------------- //-------------------------------make_predicate--------------------------------
Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) { Node* BoolNode::make_predicate(Node* test_value, PhaseGVN* phase) {
if (test_value->is_Con()) return test_value; if (test_value->is_Con()) return test_value;

View File

@ -1289,32 +1289,6 @@ enum JNICallType {
JNI_NONVIRTUAL JNI_NONVIRTUAL
}; };
static methodHandle jni_resolve_interface_call(Handle recv, methodHandle method, TRAPS) {
assert(!method.is_null() , "method should not be null");
KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
KlassHandle spec_klass (THREAD, method->method_holder());
Symbol* name = method->name();
Symbol* signature = method->signature();
CallInfo info;
LinkResolver::resolve_interface_call(info, recv, recv_klass, spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
return info.selected_method();
}
static methodHandle jni_resolve_virtual_call(Handle recv, methodHandle method, TRAPS) {
assert(!method.is_null() , "method should not be null");
KlassHandle recv_klass; // Default to NULL (use of ?: can confuse gcc)
if (recv.not_null()) recv_klass = KlassHandle(THREAD, recv->klass());
KlassHandle spec_klass (THREAD, method->method_holder());
Symbol* name = method->name();
Symbol* signature = method->signature();
CallInfo info;
LinkResolver::resolve_virtual_call(info, recv, recv_klass, spec_klass, name, signature, KlassHandle(), false, true, CHECK_(methodHandle()));
return info.selected_method();
}
static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) { static void jni_invoke_static(JNIEnv *env, JavaValue* result, jobject receiver, JNICallType call_type, jmethodID method_id, JNI_ArgumentPusher *args, TRAPS) {
@ -5053,6 +5027,7 @@ _JNI_IMPORT_OR_EXPORT_ jint JNICALL JNI_GetDefaultJavaVMInitArgs(void *args_) {
void execute_internal_vm_tests() { void execute_internal_vm_tests() {
if (ExecuteInternalVMTests) { if (ExecuteInternalVMTests) {
tty->print_cr("Running internal VM tests"); tty->print_cr("Running internal VM tests");
run_unit_test(GlobalDefinitions::test_globals());
run_unit_test(arrayOopDesc::test_max_array_length()); run_unit_test(arrayOopDesc::test_max_array_length());
run_unit_test(CollectedHeap::test_is_in()); run_unit_test(CollectedHeap::test_is_in());
run_unit_test(QuickSort::test_quick_sort()); run_unit_test(QuickSort::test_quick_sort());

View File

@ -33,7 +33,7 @@ extern "C" {
// within IN_VM macro), one to be called when in NATIVE state. // within IN_VM macro), one to be called when in NATIVE state.
// When in VM state: // When in VM state:
static void ReportJNIFatalError(JavaThread* thr, const char *msg) { static inline void ReportJNIFatalError(JavaThread* thr, const char *msg) {
tty->print_cr("FATAL ERROR in native method: %s", msg); tty->print_cr("FATAL ERROR in native method: %s", msg);
thr->print_stack(); thr->print_stack();
os::abort(true); os::abort(true);

View File

@ -49,6 +49,7 @@
#endif // INCLUDE_NMT #endif // INCLUDE_NMT
#include "compiler/compileBroker.hpp" #include "compiler/compileBroker.hpp"
#include "runtime/compilationPolicy.hpp"
bool WhiteBox::_used = false; bool WhiteBox::_used = false;
@ -118,45 +119,46 @@ WB_END
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
#ifdef INCLUDE_NMT #ifdef INCLUDE_NMT
// Keep track of the 3 allocations in NMTAllocTest so we can free them later
// on and verify that they're not visible anymore
static void* nmtMtTest1 = NULL, *nmtMtTest2 = NULL, *nmtMtTest3 = NULL;
// Alloc memory using the test memory type so that we can use that to see if // Alloc memory using the test memory type so that we can use that to see if
// NMT picks it up correctly // NMT picks it up correctly
WB_ENTRY(jboolean, WB_NMTAllocTest(JNIEnv* env)) WB_ENTRY(jlong, WB_NMTMalloc(JNIEnv* env, jobject o, jlong size))
void *mem; jlong addr = 0;
if (!MemTracker::is_on() || MemTracker::shutdown_in_progress()) { if (MemTracker::is_on() && !MemTracker::shutdown_in_progress()) {
return false; addr = (jlong)(uintptr_t)os::malloc(size, mtTest);
} }
// Allocate 2 * 128k + 256k + 1024k and free the 1024k one to make sure we track return addr;
// everything correctly. Total should be 512k held alive.
nmtMtTest1 = os::malloc(128 * 1024, mtTest);
mem = os::malloc(1024 * 1024, mtTest);
nmtMtTest2 = os::malloc(256 * 1024, mtTest);
os::free(mem, mtTest);
nmtMtTest3 = os::malloc(128 * 1024, mtTest);
return true;
WB_END WB_END
// Free the memory allocated by NMTAllocTest // Free the memory allocated by NMTAllocTest
WB_ENTRY(jboolean, WB_NMTFreeTestMemory(JNIEnv* env)) WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
os::free((void*)(uintptr_t)mem, mtTest);
WB_END
if (nmtMtTest1 == NULL || nmtMtTest2 == NULL || nmtMtTest3 == NULL) { WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
return false; jlong addr = 0;
if (MemTracker::is_on() && !MemTracker::shutdown_in_progress()) {
addr = (jlong)(uintptr_t)os::reserve_memory(size);
MemTracker::record_virtual_memory_type((address)addr, mtTest);
} }
os::free(nmtMtTest1, mtTest); return addr;
nmtMtTest1 = NULL; WB_END
os::free(nmtMtTest2, mtTest);
nmtMtTest2 = NULL;
os::free(nmtMtTest3, mtTest);
nmtMtTest3 = NULL;
return true;
WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
os::commit_memory((char *)(uintptr_t)addr, size);
MemTracker::record_virtual_memory_type((address)(uintptr_t)addr, mtTest);
WB_END
WB_ENTRY(void, WB_NMTUncommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
os::uncommit_memory((char *)(uintptr_t)addr, size);
WB_END
WB_ENTRY(void, WB_NMTReleaseMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
os::release_memory((char *)(uintptr_t)addr, size);
WB_END WB_END
// Block until the current generation of NMT data to be merged, used to reliably test the NMT feature // Block until the current generation of NMT data to be merged, used to reliably test the NMT feature
@ -213,11 +215,11 @@ WB_ENTRY(jboolean, WB_IsMethodCompiled(JNIEnv* env, jobject o, jobject method))
return (code->is_alive() && !code->is_marked_for_deoptimization()); return (code->is_alive() && !code->is_marked_for_deoptimization());
WB_END WB_END
WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method)) WB_ENTRY(jboolean, WB_IsMethodCompilable(JNIEnv* env, jobject o, jobject method, jint comp_level))
jmethodID jmid = reflected_method_to_jmid(thread, env, method); jmethodID jmid = reflected_method_to_jmid(thread, env, method);
MutexLockerEx mu(Compile_lock); MutexLockerEx mu(Compile_lock);
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
return !mh->is_not_compilable(); return CompilationPolicy::can_be_compiled(mh, comp_level);
WB_END WB_END
WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method)) WB_ENTRY(jboolean, WB_IsMethodQueuedForCompilation(JNIEnv* env, jobject o, jobject method))
@ -241,7 +243,7 @@ WB_ENTRY(void, WB_MakeMethodNotCompilable(JNIEnv* env, jobject o, jobject method
mh->set_not_compilable(); mh->set_not_compilable();
WB_END WB_END
WB_ENTRY(jboolean, WB_SetDontInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value)) WB_ENTRY(jboolean, WB_TestSetDontInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value))
jmethodID jmid = reflected_method_to_jmid(thread, env, method); jmethodID jmid = reflected_method_to_jmid(thread, env, method);
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid)); methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
bool result = mh->dont_inline(); bool result = mh->dont_inline();
@ -254,6 +256,54 @@ WB_ENTRY(jint, WB_GetCompileQueuesSize(JNIEnv* env, jobject o))
CompileBroker::queue_size(CompLevel_full_profile) /* C1 */; CompileBroker::queue_size(CompLevel_full_profile) /* C1 */;
WB_END WB_END
WB_ENTRY(jboolean, WB_TestSetForceInlineMethod(JNIEnv* env, jobject o, jobject method, jboolean value))
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
bool result = mh->force_inline();
mh->set_force_inline(value == JNI_TRUE);
return result;
WB_END
WB_ENTRY(jboolean, WB_EnqueueMethodForCompilation(JNIEnv* env, jobject o, jobject method, jint comp_level))
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
nmethod* nm = CompileBroker::compile_method(mh, InvocationEntryBci, comp_level, mh, mh->invocation_count(), "WhiteBox", THREAD);
MutexLockerEx mu(Compile_lock);
return (mh->queued_for_compilation() || nm != NULL);
WB_END
WB_ENTRY(void, WB_ClearMethodState(JNIEnv* env, jobject o, jobject method))
jmethodID jmid = reflected_method_to_jmid(thread, env, method);
methodHandle mh(THREAD, Method::checked_resolve_jmethod_id(jmid));
MutexLockerEx mu(Compile_lock);
MethodData* mdo = mh->method_data();
if (mdo != NULL) {
mdo->init();
ResourceMark rm;
int arg_count = mdo->method()->size_of_parameters();
for (int i = 0; i < arg_count; i++) {
mdo->set_arg_modified(i, 0);
}
}
mh->backedge_counter()->init();
mh->invocation_counter()->init();
mh->set_interpreter_invocation_count(0);
mh->set_interpreter_throwout_count(0);
mh->clear_not_c1_compilable();
mh->clear_not_c2_compilable();
mh->clear_not_c2_osr_compilable();
NOT_PRODUCT(mh->set_compiled_invocation_count(0));
#ifdef TIERED
mh->set_rate(0.0F);
mh->set_prev_event_count(0);
mh->set_prev_time(0);
#endif
WB_END
WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString)) WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
int len; int len;
@ -271,7 +321,6 @@ WB_ENTRY(void, WB_FullGC(JNIEnv* env, jobject o))
Universe::heap()->collect(GCCause::_last_ditch_collection); Universe::heap()->collect(GCCause::_last_ditch_collection);
WB_END WB_END
//Some convenience methods to deal with objects from java //Some convenience methods to deal with objects from java
int WhiteBox::offset_for_field(const char* field_name, oop object, int WhiteBox::offset_for_field(const char* field_name, oop object,
Symbol* signature_symbol) { Symbol* signature_symbol) {
@ -340,27 +389,37 @@ static JNINativeMethod methods[] = {
{CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize }, {CC"g1RegionSize", CC"()I", (void*)&WB_G1RegionSize },
#endif // INCLUDE_ALL_GCS #endif // INCLUDE_ALL_GCS
#ifdef INCLUDE_NMT #ifdef INCLUDE_NMT
{CC"NMTAllocTest", CC"()Z", (void*)&WB_NMTAllocTest }, {CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
{CC"NMTFreeTestMemory", CC"()Z", (void*)&WB_NMTFreeTestMemory }, {CC"NMTFree", CC"(J)V", (void*)&WB_NMTFree },
{CC"NMTWaitForDataMerge",CC"()Z", (void*)&WB_NMTWaitForDataMerge}, {CC"NMTReserveMemory", CC"(J)J", (void*)&WB_NMTReserveMemory },
{CC"NMTCommitMemory", CC"(JJ)V", (void*)&WB_NMTCommitMemory },
{CC"NMTUncommitMemory", CC"(JJ)V", (void*)&WB_NMTUncommitMemory },
{CC"NMTReleaseMemory", CC"(JJ)V", (void*)&WB_NMTReleaseMemory },
{CC"NMTWaitForDataMerge", CC"()Z", (void*)&WB_NMTWaitForDataMerge},
#endif // INCLUDE_NMT #endif // INCLUDE_NMT
{CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll }, {CC"deoptimizeAll", CC"()V", (void*)&WB_DeoptimizeAll },
{CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Method;)I", {CC"deoptimizeMethod", CC"(Ljava/lang/reflect/Method;)I",
(void*)&WB_DeoptimizeMethod }, (void*)&WB_DeoptimizeMethod },
{CC"isMethodCompiled", CC"(Ljava/lang/reflect/Method;)Z", {CC"isMethodCompiled", CC"(Ljava/lang/reflect/Method;)Z",
(void*)&WB_IsMethodCompiled }, (void*)&WB_IsMethodCompiled },
{CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;)Z", {CC"isMethodCompilable", CC"(Ljava/lang/reflect/Method;I)Z",
(void*)&WB_IsMethodCompilable}, (void*)&WB_IsMethodCompilable},
{CC"isMethodQueuedForCompilation", {CC"isMethodQueuedForCompilation",
CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodQueuedForCompilation}, CC"(Ljava/lang/reflect/Method;)Z", (void*)&WB_IsMethodQueuedForCompilation},
{CC"makeMethodNotCompilable", {CC"makeMethodNotCompilable",
CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_MakeMethodNotCompilable}, CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_MakeMethodNotCompilable},
{CC"setDontInlineMethod", {CC"testSetDontInlineMethod",
CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_SetDontInlineMethod}, CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_TestSetDontInlineMethod},
{CC"getMethodCompilationLevel", {CC"getMethodCompilationLevel",
CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_GetMethodCompilationLevel}, CC"(Ljava/lang/reflect/Method;)I", (void*)&WB_GetMethodCompilationLevel},
{CC"getCompileQueuesSize", {CC"getCompileQueuesSize",
CC"()I", (void*)&WB_GetCompileQueuesSize}, CC"()I", (void*)&WB_GetCompileQueuesSize},
{CC"testSetForceInlineMethod",
CC"(Ljava/lang/reflect/Method;Z)Z", (void*)&WB_TestSetForceInlineMethod},
{CC"enqueueMethodForCompilation",
CC"(Ljava/lang/reflect/Method;I)Z", (void*)&WB_EnqueueMethodForCompilation},
{CC"clearMethodState",
CC"(Ljava/lang/reflect/Method;)V", (void*)&WB_ClearMethodState},
{CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable },
{CC"fullGC", CC"()V", (void*)&WB_FullGC }, {CC"fullGC", CC"()V", (void*)&WB_FullGC },
}; };

View File

@ -1754,11 +1754,15 @@ bool Arguments::verify_percentage(uintx value, const char* name) {
return false; return false;
} }
#if !INCLUDE_ALL_GCS
#ifdef ASSERT
static bool verify_serial_gc_flags() { static bool verify_serial_gc_flags() {
return (UseSerialGC && return (UseSerialGC &&
!(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC || !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
UseParallelGC || UseParallelOldGC)); UseParallelGC || UseParallelOldGC));
} }
#endif // ASSERT
#endif // INCLUDE_ALL_GCS
// check if do gclog rotation // check if do gclog rotation
// +UseGCLogFileRotation is a must, // +UseGCLogFileRotation is a must,
@ -2006,11 +2010,12 @@ bool Arguments::check_vm_args_consistency() {
// than just disable the lock verification. This will be fixed under // than just disable the lock verification. This will be fixed under
// bug 4788986. // bug 4788986.
if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) { if (UseConcMarkSweepGC && FLSVerifyAllHeapReferences) {
if (VerifyGCStartAt == 0) { if (VerifyDuringStartup) {
warning("Heap verification at start-up disabled " warning("Heap verification at start-up disabled "
"(due to current incompatibility with FLSVerifyAllHeapReferences)"); "(due to current incompatibility with FLSVerifyAllHeapReferences)");
VerifyGCStartAt = 1; // Disable verification at start-up VerifyDuringStartup = false; // Disable verification at start-up
} }
if (VerifyBeforeExit) { if (VerifyBeforeExit) {
warning("Heap verification at shutdown disabled " warning("Heap verification at shutdown disabled "
"(due to current incompatibility with FLSVerifyAllHeapReferences)"); "(due to current incompatibility with FLSVerifyAllHeapReferences)");
@ -3092,6 +3097,7 @@ do { \
} \ } \
} while(0) } while(0)
#if !INCLUDE_ALL_GCS
static void force_serial_gc() { static void force_serial_gc() {
FLAG_SET_DEFAULT(UseSerialGC, true); FLAG_SET_DEFAULT(UseSerialGC, true);
FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption FLAG_SET_DEFAULT(CMSIncrementalMode, false); // special CMS suboption
@ -3101,6 +3107,7 @@ static void force_serial_gc() {
UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC); UNSUPPORTED_GC_OPTION(UseConcMarkSweepGC);
UNSUPPORTED_GC_OPTION(UseParNewGC); UNSUPPORTED_GC_OPTION(UseParNewGC);
} }
#endif // INCLUDE_ALL_GCS
// Parse entry point called from JNI_CreateJavaVM // Parse entry point called from JNI_CreateJavaVM

View File

@ -123,9 +123,10 @@ bool CompilationPolicy::can_be_compiled(methodHandle m, int comp_level) {
} }
if (comp_level == CompLevel_all) { if (comp_level == CompLevel_all) {
return !m->is_not_compilable(CompLevel_simple) && !m->is_not_compilable(CompLevel_full_optimization); return !m->is_not_compilable(CompLevel_simple) && !m->is_not_compilable(CompLevel_full_optimization);
} else { } else if (is_compile(comp_level)) {
return !m->is_not_compilable(comp_level); return !m->is_not_compilable(comp_level);
} }
return false;
} }
bool CompilationPolicy::is_compilation_enabled() { bool CompilationPolicy::is_compilation_enabled() {

View File

@ -96,7 +96,7 @@ protected:
void reset_counter_for_back_branch_event(methodHandle method); void reset_counter_for_back_branch_event(methodHandle method);
public: public:
NonTieredCompPolicy() : _compiler_count(0) { } NonTieredCompPolicy() : _compiler_count(0) { }
virtual CompLevel initial_compile_level() { return CompLevel_initial_compile; } virtual CompLevel initial_compile_level() { return CompLevel_highest_tier; }
virtual int compiler_count(CompLevel comp_level); virtual int compiler_count(CompLevel comp_level);
virtual void do_safepoint_work(); virtual void do_safepoint_work();
virtual void reprofile(ScopeDesc* trap_scope, bool is_osr); virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);

View File

@ -2123,6 +2123,10 @@ class CommandLineFlags {
product(intx, PrefetchFieldsAhead, -1, \ product(intx, PrefetchFieldsAhead, -1, \
"How many fields ahead to prefetch in oop scan (<= 0 means off)") \ "How many fields ahead to prefetch in oop scan (<= 0 means off)") \
\ \
diagnostic(bool, VerifyDuringStartup, false, \
"Verify memory system before executing any Java code " \
"during VM initialization") \
\
diagnostic(bool, VerifyBeforeExit, trueInDebug, \ diagnostic(bool, VerifyBeforeExit, trueInDebug, \
"Verify system before exiting") \ "Verify system before exiting") \
\ \
@ -3664,8 +3668,13 @@ class CommandLineFlags {
product(bool, PrintGCCause, true, \ product(bool, PrintGCCause, true, \
"Include GC cause in GC logging") \ "Include GC cause in GC logging") \
\ \
product(bool, AllowNonVirtualCalls, false, \ product(bool , AllowNonVirtualCalls, false, \
"Obey the ACC_SUPER flag and allow invokenonvirtual calls") "Obey the ACC_SUPER flag and allow invokenonvirtual calls") \
\
experimental(uintx, ArrayAllocatorMallocLimit, \
SOLARIS_ONLY(64*K) NOT_SOLARIS(max_uintx), \
"Allocation less than this value will be allocated " \
"using malloc. Larger allocations will use mmap.")
/* /*
* Macros for factoring of globals * Macros for factoring of globals

View File

@ -735,6 +735,9 @@ void SafepointSynchronize::block(JavaThread *thread) {
// Exception handlers // Exception handlers
#ifndef PRODUCT #ifndef PRODUCT
#ifdef SPARC
#ifdef _LP64 #ifdef _LP64
#define PTR_PAD "" #define PTR_PAD ""
#else #else
@ -755,7 +758,6 @@ static void print_longs(jlong oldptr, jlong newptr, bool wasoop) {
newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" ")); newptr, is_oop?"oop":" ", (wasoop && !is_oop) ? "STALE" : ((wasoop==false&&is_oop==false&&oldptr !=newptr)?"STOMP":" "));
} }
#ifdef SPARC
static void print_me(intptr_t *new_sp, intptr_t *old_sp, bool *was_oops) { static void print_me(intptr_t *new_sp, intptr_t *old_sp, bool *was_oops) {
#ifdef _LP64 #ifdef _LP64
tty->print_cr("--------+------address-----+------before-----------+-------after----------+"); tty->print_cr("--------+------address-----+------before-----------+-------after----------+");

View File

@ -449,8 +449,6 @@ void ObjectSynchronizer::notifyall(Handle obj, TRAPS) {
// and explicit fences (barriers) to control for architectural reordering performed // and explicit fences (barriers) to control for architectural reordering performed
// by the CPU(s) or platform. // by the CPU(s) or platform.
static int MBFence (int x) { OrderAccess::fence(); return x; }
struct SharedGlobals { struct SharedGlobals {
// These are highly shared mostly-read variables. // These are highly shared mostly-read variables.
// To avoid false-sharing they need to be the sole occupants of a $ line. // To avoid false-sharing they need to be the sole occupants of a $ line.
@ -1639,11 +1637,6 @@ void ObjectSynchronizer::release_monitors_owned_by_thread(TRAPS) {
#ifndef PRODUCT #ifndef PRODUCT
void ObjectSynchronizer::trace_locking(Handle locking_obj, bool is_compiled,
bool is_method, bool is_locking) {
// Don't know what to do here
}
// Verify all monitors in the monitor cache, the verification is weak. // Verify all monitors in the monitor cache, the verification is weak.
void ObjectSynchronizer::verify() { void ObjectSynchronizer::verify() {
ObjectMonitor* block = gBlockList; ObjectMonitor* block = gBlockList;

View File

@ -121,7 +121,6 @@ class ObjectSynchronizer : AllStatic {
static void oops_do(OopClosure* f); static void oops_do(OopClosure* f);
// debugging // debugging
static void trace_locking(Handle obj, bool is_compiled, bool is_method, bool is_locking) PRODUCT_RETURN;
static void verify() PRODUCT_RETURN; static void verify() PRODUCT_RETURN;
static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0; static int verify_objmon_isinpool(ObjectMonitor *addr) PRODUCT_RETURN0;

View File

@ -3446,9 +3446,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
} }
assert (Universe::is_fully_initialized(), "not initialized"); assert (Universe::is_fully_initialized(), "not initialized");
if (VerifyBeforeGC && VerifyGCStartAt == 0) { if (VerifyDuringStartup) {
Universe::heap()->prepare_for_verify(); VM_Verify verify_op(false /* silent */); // make sure we're starting with a clean slate
Universe::verify(); // make sure we're starting with a clean slate VMThread::execute(&verify_op);
} }
EXCEPTION_MARK; EXCEPTION_MARK;

View File

@ -478,6 +478,9 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
\ \
nonstatic_field(CardGeneration, _rs, GenRemSet*) \ nonstatic_field(CardGeneration, _rs, GenRemSet*) \
nonstatic_field(CardGeneration, _bts, BlockOffsetSharedArray*) \ nonstatic_field(CardGeneration, _bts, BlockOffsetSharedArray*) \
nonstatic_field(CardGeneration, _shrink_factor, size_t) \
nonstatic_field(CardGeneration, _capacity_at_prologue, size_t) \
nonstatic_field(CardGeneration, _used_at_prologue, size_t) \
\ \
nonstatic_field(CardTableModRefBS, _whole_heap, const MemRegion) \ nonstatic_field(CardTableModRefBS, _whole_heap, const MemRegion) \
nonstatic_field(CardTableModRefBS, _guard_index, const size_t) \ nonstatic_field(CardTableModRefBS, _guard_index, const size_t) \
@ -548,8 +551,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(Space, _bottom, HeapWord*) \ nonstatic_field(Space, _bottom, HeapWord*) \
nonstatic_field(Space, _end, HeapWord*) \ nonstatic_field(Space, _end, HeapWord*) \
\ \
nonstatic_field(TenuredGeneration, _shrink_factor, size_t) \
nonstatic_field(TenuredGeneration, _capacity_at_prologue, size_t) \
nonstatic_field(ThreadLocalAllocBuffer, _start, HeapWord*) \ nonstatic_field(ThreadLocalAllocBuffer, _start, HeapWord*) \
nonstatic_field(ThreadLocalAllocBuffer, _top, HeapWord*) \ nonstatic_field(ThreadLocalAllocBuffer, _top, HeapWord*) \
nonstatic_field(ThreadLocalAllocBuffer, _end, HeapWord*) \ nonstatic_field(ThreadLocalAllocBuffer, _end, HeapWord*) \

View File

@ -175,7 +175,8 @@ void VM_HandleFullCodeCache::doit() {
} }
void VM_Verify::doit() { void VM_Verify::doit() {
Universe::verify(); Universe::heap()->prepare_for_verify();
Universe::verify(_silent);
} }
bool VM_PrintThreads::doit_prologue() { bool VM_PrintThreads::doit_prologue() {

View File

@ -300,9 +300,9 @@ class VM_UnlinkSymbols: public VM_Operation {
class VM_Verify: public VM_Operation { class VM_Verify: public VM_Operation {
private: private:
KlassHandle _dependee; bool _silent;
public: public:
VM_Verify() {} VM_Verify(bool silent) : _silent(silent) {}
VMOp_Type type() const { return VMOp_Verify; } VMOp_Type type() const { return VMOp_Verify; }
void doit(); void doit();
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2013 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -127,12 +127,15 @@ void MemTracker::start() {
assert(_state == NMT_bootstrapping_multi_thread, "wrong state"); assert(_state == NMT_bootstrapping_multi_thread, "wrong state");
_snapshot = new (std::nothrow)MemSnapshot(); _snapshot = new (std::nothrow)MemSnapshot();
if (_snapshot != NULL && !_snapshot->out_of_memory()) { if (_snapshot != NULL) {
if (start_worker()) { if (!_snapshot->out_of_memory() && start_worker()) {
_state = NMT_started; _state = NMT_started;
NMT_track_callsite = (_tracking_level == NMT_detail && can_walk_stack()); NMT_track_callsite = (_tracking_level == NMT_detail && can_walk_stack());
return; return;
} }
delete _snapshot;
_snapshot = NULL;
} }
// fail to start native memory tracking, shut it down // fail to start native memory tracking, shut it down
@ -544,7 +547,10 @@ bool MemTracker::start_worker() {
assert(_worker_thread == NULL, "Just Check"); assert(_worker_thread == NULL, "Just Check");
_worker_thread = new (std::nothrow) MemTrackWorker(); _worker_thread = new (std::nothrow) MemTrackWorker();
if (_worker_thread == NULL || _worker_thread->has_error()) { if (_worker_thread == NULL || _worker_thread->has_error()) {
shutdown(NMT_initialization); if (_worker_thread != NULL) {
delete _worker_thread;
_worker_thread = NULL;
}
return false; return false;
} }
_worker_thread->start(); _worker_thread->start();

View File

@ -194,6 +194,9 @@ class AccessFlags VALUE_OBJ_CLASS_SPEC {
void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); } void set_is_obsolete() { atomic_set_bits(JVM_ACC_IS_OBSOLETE); }
void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); } void set_is_prefixed_native() { atomic_set_bits(JVM_ACC_IS_PREFIXED_NATIVE); }
void clear_not_c1_compilable() { atomic_clear_bits(JVM_ACC_NOT_C1_COMPILABLE); }
void clear_not_c2_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_COMPILABLE); }
void clear_not_c2_osr_compilable() { atomic_clear_bits(JVM_ACC_NOT_C2_OSR_COMPILABLE); }
// Klass* flags // Klass* flags
void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); } void set_has_vanilla_constructor() { atomic_set_bits(JVM_ACC_HAS_VANILLA_CONSTRUCTOR); }
void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); } void set_has_finalizer() { atomic_set_bits(JVM_ACC_HAS_FINALIZER); }

View File

@ -516,6 +516,10 @@ BitMap::idx_t BitMap::count_one_bits() const {
return sum; return sum;
} }
void BitMap::print_on_error(outputStream* st, const char* prefix) const {
st->print_cr("%s[" PTR_FORMAT ", " PTR_FORMAT ")",
prefix, map(), (char*)map() + (size() >> LogBitsPerByte));
}
#ifndef PRODUCT #ifndef PRODUCT

View File

@ -262,6 +262,7 @@ class BitMap VALUE_OBJ_CLASS_SPEC {
bool is_full() const; bool is_full() const;
bool is_empty() const; bool is_empty() const;
void print_on_error(outputStream* st, const char* prefix) const;
#ifndef PRODUCT #ifndef PRODUCT
public: public:

View File

@ -608,18 +608,6 @@ extern "C" nmethod* findnm(intptr_t addr) {
return CodeCache::find_nmethod((address)addr); return CodeCache::find_nmethod((address)addr);
} }
static address same_page(address x, address y) {
intptr_t page_bits = -os::vm_page_size();
if ((intptr_t(x) & page_bits) == (intptr_t(y) & page_bits)) {
return x;
} else if (x > y) {
return (address)(intptr_t(y) | ~page_bits) + 1;
} else {
return (address)(intptr_t(y) & page_bits);
}
}
// Another interface that isn't ambiguous in dbx. // Another interface that isn't ambiguous in dbx.
// Can we someday rename the other find to hsfind? // Can we someday rename the other find to hsfind?
extern "C" void hsfind(intptr_t x) { extern "C" void hsfind(intptr_t x) {

View File

@ -355,3 +355,33 @@ size_t lcm(size_t a, size_t b) {
return size_t(result); return size_t(result);
} }
#ifndef PRODUCT
void GlobalDefinitions::test_globals() {
intptr_t page_sizes[] = { os::vm_page_size(), 4096, 8192, 65536, 2*1024*1024 };
const int num_page_sizes = sizeof(page_sizes) / sizeof(page_sizes[0]);
for (int i = 0; i < num_page_sizes; i++) {
intptr_t page_size = page_sizes[i];
address a_page = (address)(10*page_size);
// Check that address within page is returned as is
assert(clamp_address_in_page(a_page, a_page, page_size) == a_page, "incorrect");
assert(clamp_address_in_page(a_page + 128, a_page, page_size) == a_page + 128, "incorrect");
assert(clamp_address_in_page(a_page + page_size - 1, a_page, page_size) == a_page + page_size - 1, "incorrect");
// Check that address above page returns start of next page
assert(clamp_address_in_page(a_page + page_size, a_page, page_size) == a_page + page_size, "incorrect");
assert(clamp_address_in_page(a_page + page_size + 1, a_page, page_size) == a_page + page_size, "incorrect");
assert(clamp_address_in_page(a_page + page_size*5 + 1, a_page, page_size) == a_page + page_size, "incorrect");
// Check that address below page returns start of page
assert(clamp_address_in_page(a_page - 1, a_page, page_size) == a_page, "incorrect");
assert(clamp_address_in_page(a_page - 2*page_size - 1, a_page, page_size) == a_page, "incorrect");
assert(clamp_address_in_page(a_page - 5*page_size - 1, a_page, page_size) == a_page, "incorrect");
}
}
#endif // PRODUCT

View File

@ -419,6 +419,24 @@ inline intptr_t align_object_offset(intptr_t offset) {
return align_size_up(offset, HeapWordsPerLong); return align_size_up(offset, HeapWordsPerLong);
} }
// Clamp an address to be within a specific page
// 1. If addr is on the page it is returned as is
// 2. If addr is above the page_address the start of the *next* page will be returned
// 3. Otherwise, if addr is below the page_address the start of the page will be returned
inline address clamp_address_in_page(address addr, address page_address, intptr_t page_size) {
if (align_size_down(intptr_t(addr), page_size) == align_size_down(intptr_t(page_address), page_size)) {
// address is in the specified page, just return it as is
return addr;
} else if (addr > page_address) {
// address is above specified page, return start of next page
return (address)align_size_down(intptr_t(page_address), page_size) + page_size;
} else {
// address is below specified page, return start of page
return (address)align_size_down(intptr_t(page_address), page_size);
}
}
// The expected size in bytes of a cache line, used to pad data structures. // The expected size in bytes of a cache line, used to pad data structures.
#define DEFAULT_CACHE_LINE_SIZE 64 #define DEFAULT_CACHE_LINE_SIZE 64
@ -827,6 +845,10 @@ inline bool is_highest_tier_compile(int comp_level) {
return comp_level == CompLevel_highest_tier; return comp_level == CompLevel_highest_tier;
} }
inline bool is_compile(int comp_level) {
return is_c1_compile(comp_level) || is_c2_compile(comp_level);
}
//---------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------
// 'Forward' declarations of frequently used classes // 'Forward' declarations of frequently used classes
// (in order to reduce interface dependencies & reduce // (in order to reduce interface dependencies & reduce
@ -1296,4 +1318,15 @@ static inline void* dereference_vptr(void* addr) {
return *(void**)addr; return *(void**)addr;
} }
#ifndef PRODUCT
// For unit testing only
class GlobalDefinitions {
public:
static void test_globals();
};
#endif // PRODUCT
#endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP #endif // SHARE_VM_UTILITIES_GLOBALDEFINITIONS_HPP

View File

@ -253,6 +253,7 @@ public:
template <class E, MEMFLAGS F, unsigned int N = TASKQUEUE_SIZE> template <class E, MEMFLAGS F, unsigned int N = TASKQUEUE_SIZE>
class GenericTaskQueue: public TaskQueueSuper<N, F> { class GenericTaskQueue: public TaskQueueSuper<N, F> {
ArrayAllocator<E, F> _array_allocator;
protected: protected:
typedef typename TaskQueueSuper<N, F>::Age Age; typedef typename TaskQueueSuper<N, F>::Age Age;
typedef typename TaskQueueSuper<N, F>::idx_t idx_t; typedef typename TaskQueueSuper<N, F>::idx_t idx_t;
@ -314,7 +315,7 @@ GenericTaskQueue<E, F, N>::GenericTaskQueue() {
template<class E, MEMFLAGS F, unsigned int N> template<class E, MEMFLAGS F, unsigned int N>
void GenericTaskQueue<E, F, N>::initialize() { void GenericTaskQueue<E, F, N>::initialize() {
_elems = NEW_C_HEAP_ARRAY(E, N, F); _elems = _array_allocator.allocate(N);
} }
template<class E, MEMFLAGS F, unsigned int N> template<class E, MEMFLAGS F, unsigned int N>

View File

@ -685,13 +685,7 @@ void VMError::report(outputStream* st) {
STEP(190, "(printing heap information)" ) STEP(190, "(printing heap information)" )
if (_verbose && Universe::is_fully_initialized()) { if (_verbose && Universe::is_fully_initialized()) {
// Print heap information before vm abort. As we'd like as much Universe::heap()->print_on_error(st);
// information as possible in the report we ask for the
// extended (i.e., more detailed) version.
Universe::print_on(st, true /* extended */);
st->cr();
Universe::heap()->barrier_set()->print_on(st);
st->cr(); st->cr();
st->print_cr("Polling page: " INTPTR_FORMAT, os::get_polling_page()); st->print_cr("Polling page: " INTPTR_FORMAT, os::get_polling_page());

View File

@ -27,17 +27,35 @@
* @bug 6863420 * @bug 6863420
* @summary os::javaTimeNanos() go backward on Solaris x86 * @summary os::javaTimeNanos() go backward on Solaris x86
* *
* @run main/othervm Test * Notice the internal timeout in timeout thread Test.TOT.
* @run main/othervm/timeout=300 Test
*/ */
public class Test { public class Test {
static final int INTERNAL_TIMEOUT=240;
static class TOT extends Thread {
public void run() {
try {
Thread.sleep(INTERNAL_TIMEOUT*1000);
} catch (InterruptedException ex) {
}
done = true;
}
}
static long value = 0; static long value = 0;
static boolean got_backward_time = false; static boolean got_backward_time = false;
static volatile boolean done = false;
public static void main(String args[]) { public static void main(String args[]) {
final int count = 100000; final int count = 100000;
for (int numThreads = 1; numThreads <= 32; numThreads++) { TOT tot = new TOT();
tot.setDaemon(true);
tot.start();
for (int numThreads = 1; !done && numThreads <= 32; numThreads++) {
final int numRuns = 1; final int numRuns = 1;
for (int t=1; t <= numRuns; t++) { for (int t=1; t <= numRuns; t++) {
final int curRun = t; final int curRun = t;
@ -48,7 +66,7 @@ public class Test {
Runnable thread = Runnable thread =
new Runnable() { new Runnable() {
public void run() { public void run() {
for (long l = 0; l < 100000; l++) { for (long l = 0; !done && l < 100000; l++) {
final long start = System.nanoTime(); final long start = System.nanoTime();
if (value == 12345678) { if (value == 12345678) {
System.out.println("Wow!"); System.out.println("Wow!");

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8011706
* @summary loop invariant code motion may move load before store to the same field
* @run main/othervm -XX:-UseOnStackReplacement -XX:-BackgroundCompilation Test8011706
*
*/
public class Test8011706 {
int[] array;
void m(boolean test, int[] array1, int[] array2) {
int i = 0;
if (test) {
array = array1;
} else {
array = array2;
}
while(true) {
int v = array[i];
i++;
if (i >= 10) return;
}
}
static public void main(String[] args) {
int[] new_array = new int[10];
Test8011706 ti = new Test8011706();
boolean failed = false;
try {
for (int i = 0; i < 10000; i++) {
ti.array = null;
ti.m(true, new_array, new_array);
}
} catch(NullPointerException ex) {
throw new RuntimeException("TEST FAILED", ex);
}
System.out.println("TEST PASSED");
}
}

View File

@ -0,0 +1,71 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test ClearMethodStateTest
* @library /testlibrary /testlibrary/whitebox
* @build ClearMethodStateTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ClearMethodStateTest
* @author igor.ignatyev@oracle.com
*/
public class ClearMethodStateTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
// to prevent inlining #method into #compile() and #test()
WHITE_BOX.testSetDontInlineMethod(METHOD, true);
new ClearMethodStateTest().runTest();
}
protected void test() throws Exception {
checkNotCompiled(METHOD);
compile();
checkCompiled(METHOD);
WHITE_BOX.clearMethodState(METHOD);
WHITE_BOX.deoptimizeMethod(METHOD);
checkNotCompiled(METHOD);
if (!TIERED_COMPILATION) {
WHITE_BOX.clearMethodState(METHOD);
compile(COMPILE_THRESHOLD);
checkCompiled(METHOD);
WHITE_BOX.deoptimizeMethod(METHOD);
checkNotCompiled(METHOD);
WHITE_BOX.clearMethodState(METHOD);
if (COMPILE_THRESHOLD > 1) {
compile(COMPILE_THRESHOLD - 1);
checkNotCompiled(METHOD);
} else {
System.err.println("Warning: 'CompileThreshold' <= 1");
}
method();
checkCompiled(METHOD);
} else {
System.err.println(
"Warning: part of test is not applicable in Tiered");
}
}
}

View File

@ -37,6 +37,8 @@ public abstract class CompilerWhiteBoxTest {
= Integer.parseInt(getVMOption("CompileThreshold", "10000")); = Integer.parseInt(getVMOption("CompileThreshold", "10000"));
protected static final boolean BACKGROUND_COMPILATION protected static final boolean BACKGROUND_COMPILATION
= Boolean.valueOf(getVMOption("BackgroundCompilation", "true")); = Boolean.valueOf(getVMOption("BackgroundCompilation", "true"));
protected static final boolean TIERED_COMPILATION
= Boolean.valueOf(getVMOption("TieredCompilation", "false"));
protected static Method getMethod(String name) { protected static Method getMethod(String name) {
try { try {
@ -81,6 +83,9 @@ public abstract class CompilerWhiteBoxTest {
} }
protected static void checkNotCompiled(Method method) { protected static void checkNotCompiled(Method method) {
if (WHITE_BOX.isMethodQueuedForCompilation(method)) {
throw new RuntimeException(method + " must not be in queue");
}
if (WHITE_BOX.isMethodCompiled(method)) { if (WHITE_BOX.isMethodCompiled(method)) {
throw new RuntimeException(method + " must be not compiled"); throw new RuntimeException(method + " must be not compiled");
} }
@ -139,8 +144,11 @@ public abstract class CompilerWhiteBoxTest {
protected abstract void test() throws Exception; protected abstract void test() throws Exception;
protected final int compile() { protected final int compile() {
return compile(Math.max(COMPILE_THRESHOLD, 150000));
}
protected final int compile(int count) {
int result = 0; int result = 0;
int count = Math.max(COMPILE_THRESHOLD, 150000);
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
result += method(); result += method();
} }

View File

@ -33,7 +33,7 @@ public class DeoptimizeAllTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// to prevent inlining #method into #compile() // to prevent inlining #method into #compile()
WHITE_BOX.setDontInlineMethod(METHOD, true); WHITE_BOX.testSetDontInlineMethod(METHOD, true);
new DeoptimizeAllTest().runTest(); new DeoptimizeAllTest().runTest();
} }

View File

@ -33,7 +33,7 @@ public class DeoptimizeMethodTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
// to prevent inlining #method into #compile() // to prevent inlining #method into #compile()
WHITE_BOX.setDontInlineMethod(METHOD, true); WHITE_BOX.testSetDontInlineMethod(METHOD, true);
new DeoptimizeMethodTest().runTest(); new DeoptimizeMethodTest().runTest();
} }

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test EnqueueMethodForCompilationTest
* @library /testlibrary /testlibrary/whitebox
* @build EnqueueMethodForCompilationTest
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI EnqueueMethodForCompilationTest
* @author igor.ignatyev@oracle.com
*/
public class EnqueueMethodForCompilationTest extends CompilerWhiteBoxTest {
public static void main(String[] args) throws Exception {
// to prevent inlining #method into #compile()
WHITE_BOX.testSetDontInlineMethod(METHOD, true);
new EnqueueMethodForCompilationTest().runTest();
}
protected void test() throws Exception {
checkNotCompiled(METHOD);
WHITE_BOX.enqueueMethodForCompilation(METHOD, 0);
if (WHITE_BOX.isMethodCompilable(METHOD, 0)) {
throw new RuntimeException(METHOD + " is compilable at level 0");
}
checkNotCompiled(METHOD);
WHITE_BOX.enqueueMethodForCompilation(METHOD, -1);
checkNotCompiled(METHOD);
WHITE_BOX.enqueueMethodForCompilation(METHOD, 5);
if (!WHITE_BOX.isMethodCompilable(METHOD, 5)) {
checkNotCompiled(METHOD);
compile();
checkCompiled(METHOD);
} else {
checkCompiled(METHOD);
}
int compLevel = WHITE_BOX.getMethodCompilationLevel(METHOD);
WHITE_BOX.deoptimizeMethod(METHOD);
checkNotCompiled(METHOD);
WHITE_BOX.enqueueMethodForCompilation(METHOD, compLevel);
checkCompiled(METHOD);
WHITE_BOX.deoptimizeMethod(METHOD);
checkNotCompiled(METHOD);
compile();
checkCompiled(METHOD);
WHITE_BOX.deoptimizeMethod(METHOD);
checkNotCompiled(METHOD);
}
}

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