This commit is contained in:
Yumin Qi 2014-12-03 20:32:33 -08:00
commit 9767fa7cb2
106 changed files with 652 additions and 415 deletions

View file

@ -226,18 +226,8 @@ SHARED_FLAG = -shared
# Allow no optimizations. # Allow no optimizations.
DEBUG_CFLAGS=-O0 DEBUG_CFLAGS=-O0
# Use the stabs format for debugging information (this is the default # Enable debug symbols
# on gcc-2.91). It's good enough, has all the information about line DEBUG_CFLAGS += -g
# numbers and local variables, and libjvm.so is only about 16M.
# Change this back to "-g" if you want the most expressive format.
# (warning: that could easily inflate libjvm.so to 150M!)
# Note: The Itanium gcc compiler crashes when using -gstabs.
DEBUG_CFLAGS/ia64 = -g
DEBUG_CFLAGS/amd64 = -g
DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
DEBUG_CFLAGS += -gstabs
endif
# Enable bounds checking. # Enable bounds checking.
ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1" ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"

View file

@ -496,15 +496,6 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
FASTDEBUG_CFLAGS += -xs FASTDEBUG_CFLAGS += -xs
endif endif
# Special global options for SS12
ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
# There appears to be multiple issues with the new Dwarf2 debug format, so
# we tell the compiler to use the older 'stabs' debug format all the time.
# Note that this needs to be used in optimized compiles too to be 100%.
# This is a workaround for SS12 (5.9) bug 6694600
CFLAGS += -xdebugformat=stabs
endif
# Enable the following CFLAGS additions if you need to compare the # Enable the following CFLAGS additions if you need to compare the
# built ELF objects. # built ELF objects.
# #

View file

@ -570,10 +570,12 @@ public:
static uint cores_per_cpu() { static uint cores_per_cpu() {
uint result = 1; uint result = 1;
if (is_intel()) { if (is_intel()) {
if (supports_processor_topology()) { bool supports_topology = supports_processor_topology();
if (supports_topology) {
result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus / result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
_cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus; _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
} else { }
if (!supports_topology || result == 0) {
result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1); result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
} }
} else if (is_amd()) { } else if (is_amd()) {

View file

@ -571,7 +571,7 @@ void os::init_system_properties_values() {
char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal); char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon); sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
Arguments::set_library_path(ld_library_path); Arguments::set_library_path(ld_library_path);
FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal); FREE_C_HEAP_ARRAY(char, ld_library_path);
// Extensions directories. // Extensions directories.
sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home()); sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
@ -581,7 +581,7 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home()); sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH #undef DEFAULT_LIBPATH
#undef EXTENSIONS_DIR #undef EXTENSIONS_DIR
@ -1307,11 +1307,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage // release the storage
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) { if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); FREE_C_HEAP_ARRAY(char, pelements[i]);
} }
} }
if (pelements != NULL) { if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); FREE_C_HEAP_ARRAY(char*, pelements);
} }
} else { } else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright 2012, 2013 SAP AG. All rights reserved. * Copyright 2012, 2013 SAP AG. 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.
* *
@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
} }
} }
} }
FREE_C_HEAP_ARRAY(char, destfile, mtInternal); FREE_C_HEAP_ARRAY(char, destfile);
} }
@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length"); "pw_name zero length");
} }
} }
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL; return NULL;
} }
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal); char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name); strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name; return user_name;
} }
@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name); DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) { if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
continue; continue;
} }
@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited. // symlink can be exploited.
// //
if (!is_directory_secure(usrdir_name)) { if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp); os::closedir(subdirp);
continue; continue;
} }
@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file // don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result); RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) { if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
// skip over files that are not regular files. // skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) { if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) { if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1; char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal); if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user); strcpy(oldest_user, user);
@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
} }
} }
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
} }
} }
os::closedir(subdirp); os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
} }
os::closedir(tmpdirp); os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user); return(oldest_user);
} }
@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path); remove_file(path);
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} }
@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0; errno = 0;
} }
os::closedir(dirp); os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
} }
// make the user specific temporary directory. Returns true if // make the user specific temporary directory. Returns true if
@ -703,11 +703,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size); fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal); FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) { if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -723,7 +723,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno)); warning("mmap failed - %s\n", strerror(errno));
} }
remove_file(filename); remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -769,7 +769,7 @@ static void delete_shared_memory(char* addr, size_t size) {
remove_file(backing_store_file_name); remove_file(backing_store_file_name);
// Don't.. Free heap memory could deadlock os::abort() if it is called // Don't.. Free heap memory could deadlock os::abort() if it is called
// from signal handler. OS will reclaim the heap memory. // from signal handler. OS will reclaim the heap memory.
// FREE_C_HEAP_ARRAY(char, backing_store_file_name, mtInternal); // FREE_C_HEAP_ARRAY(char, backing_store_file_name);
backing_store_file_name = NULL; backing_store_file_name = NULL;
} }
} }
@ -853,9 +853,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either. // store file, we don't follow them when attaching either.
// //
if (!is_directory_secure(dirname)) { if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) { if (luser != user) {
FREE_C_HEAP_ARRAY(char, luser, mtInternal); FREE_C_HEAP_ARRAY(char, luser);
} }
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found");
@ -871,9 +871,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename); strcpy(rfilename, filename);
// free the c heap resources that are no longer needed // free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid // open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK); fd = open_sharedmem_file(rfilename, file_flags, CHECK);

View file

@ -418,7 +418,7 @@ void os::init_system_properties_values() {
mtInternal); mtInternal);
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch); sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
Arguments::set_library_path(ld_library_path); Arguments::set_library_path(ld_library_path);
FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal); FREE_C_HEAP_ARRAY(char, ld_library_path);
} }
// Extensions directories. // Extensions directories.
@ -429,7 +429,7 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home()); sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#else // __APPLE__ #else // __APPLE__
@ -513,7 +513,7 @@ void os::init_system_properties_values() {
sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.", sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.",
v, v_colon, l, l_colon, user_home_dir); v, v_colon, l, l_colon, user_home_dir);
Arguments::set_library_path(ld_library_path); Arguments::set_library_path(ld_library_path);
FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal); FREE_C_HEAP_ARRAY(char, ld_library_path);
} }
// Extensions directories. // Extensions directories.
@ -529,7 +529,7 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home()); sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXTENSIONS_DIR #undef SYS_EXTENSIONS_DIR
#undef SYS_EXTENSIONS_DIRS #undef SYS_EXTENSIONS_DIRS
@ -1315,11 +1315,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage // release the storage
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) { if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); FREE_C_HEAP_ARRAY(char, pelements[i]);
} }
} }
if (pelements != NULL) { if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); FREE_C_HEAP_ARRAY(char*, pelements);
} }
} else { } else {
snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname); snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);

View file

@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
} }
} }
} }
FREE_C_HEAP_ARRAY(char, destfile, mtInternal); FREE_C_HEAP_ARRAY(char, destfile);
} }
@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length"); "pw_name zero length");
} }
} }
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL; return NULL;
} }
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal); char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name); strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name; return user_name;
} }
@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name); DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) { if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
continue; continue;
} }
@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited. // symlink can be exploited.
// //
if (!is_directory_secure(usrdir_name)) { if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp); os::closedir(subdirp);
continue; continue;
} }
@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file // don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result); RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) { if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
// skip over files that are not regular files. // skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) { if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) { if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1; char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal); if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user); strcpy(oldest_user, user);
@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
} }
} }
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
} }
} }
os::closedir(subdirp); os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
} }
os::closedir(tmpdirp); os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user); return(oldest_user);
} }
@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path); remove_file(path);
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} }
@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0; errno = 0;
} }
os::closedir(dirp); os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
} }
// make the user specific temporary directory. Returns true if // make the user specific temporary directory. Returns true if
@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size); fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal); FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) { if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno)); warning("mmap failed - %s\n", strerror(errno));
} }
remove_file(filename); remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either. // store file, we don't follow them when attaching either.
// //
if (!is_directory_secure(dirname)) { if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) { if (luser != user) {
FREE_C_HEAP_ARRAY(char, luser, mtInternal); FREE_C_HEAP_ARRAY(char, luser);
} }
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found");
@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename); strcpy(rfilename, filename);
// free the c heap resources that are no longer needed // free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid // open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK); fd = open_sharedmem_file(rfilename, file_flags, CHECK);

View file

@ -404,7 +404,7 @@ void os::init_system_properties_values() {
mtInternal); mtInternal);
sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch); sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
Arguments::set_library_path(ld_library_path); Arguments::set_library_path(ld_library_path);
FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal); FREE_C_HEAP_ARRAY(char, ld_library_path);
} }
// Extensions directories. // Extensions directories.
@ -415,7 +415,7 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home()); sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#undef DEFAULT_LIBPATH #undef DEFAULT_LIBPATH
#undef SYS_EXT_DIR #undef SYS_EXT_DIR
@ -1621,11 +1621,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage // release the storage
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) { if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); FREE_C_HEAP_ARRAY(char, pelements[i]);
} }
} }
if (pelements != NULL) { if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); FREE_C_HEAP_ARRAY(char*, pelements);
} }
} else { } else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@ -2936,7 +2936,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
} }
} }
} }
FREE_C_HEAP_ARRAY(unsigned long, cpu_map, mtInternal); FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
} }
int os::Linux::get_node_by_cpu(int cpu_id) { int os::Linux::get_node_by_cpu(int cpu_id) {

View file

@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
} }
} }
} }
FREE_C_HEAP_ARRAY(char, destfile, mtInternal); FREE_C_HEAP_ARRAY(char, destfile);
} }
@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length"); "pw_name zero length");
} }
} }
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL; return NULL;
} }
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal); char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name); strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name; return user_name;
} }
@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name); DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) { if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
continue; continue;
} }
@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited. // symlink can be exploited.
// //
if (!is_directory_secure(usrdir_name)) { if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp); os::closedir(subdirp);
continue; continue;
} }
@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file // don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result); RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) { if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
// skip over files that are not regular files. // skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) { if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) { if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1; char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal); if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user); strcpy(oldest_user, user);
@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
} }
} }
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
} }
} }
os::closedir(subdirp); os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
} }
os::closedir(tmpdirp); os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user); return(oldest_user);
} }
@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path); remove_file(path);
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} }
@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0; errno = 0;
} }
os::closedir(dirp); os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
} }
// make the user specific temporary directory. Returns true if // make the user specific temporary directory. Returns true if
@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size); fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal); FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) { if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno)); warning("mmap failed - %s\n", strerror(errno));
} }
remove_file(filename); remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either. // store file, we don't follow them when attaching either.
// //
if (!is_directory_secure(dirname)) { if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) { if (luser != user) {
FREE_C_HEAP_ARRAY(char, luser, mtInternal); FREE_C_HEAP_ARRAY(char, luser);
} }
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found");
@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename); strcpy(rfilename, filename);
// free the c heap resources that are no longer needed // free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid // open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, THREAD); fd = open_sharedmem_file(rfilename, file_flags, THREAD);

View file

@ -506,7 +506,7 @@ static bool assign_distribution(processorid_t* id_array,
} }
} }
if (available_id != NULL) { if (available_id != NULL) {
FREE_C_HEAP_ARRAY(bool, available_id, mtInternal); FREE_C_HEAP_ARRAY(bool, available_id);
} }
return true; return true;
} }
@ -538,7 +538,7 @@ bool os::distribute_processes(uint length, uint* distribution) {
} }
} }
if (id_array != NULL) { if (id_array != NULL) {
FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal); FREE_C_HEAP_ARRAY(processorid_t, id_array);
} }
return result; return result;
} }
@ -675,7 +675,7 @@ void os::init_system_properties_values() {
// Determine search path count and required buffer size. // Determine search path count and required buffer size.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) { if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror()); vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
} }
@ -686,8 +686,8 @@ void os::init_system_properties_values() {
// Obtain search path information. // Obtain search path information.
if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) { if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
FREE_C_HEAP_ARRAY(char, info, mtInternal); FREE_C_HEAP_ARRAY(char, info);
vm_exit_during_initialization("dlinfo SERINFO request", dlerror()); vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
} }
@ -757,8 +757,8 @@ void os::init_system_properties_values() {
// Callee copies into its own buffer. // Callee copies into its own buffer.
Arguments::set_library_path(library_path); Arguments::set_library_path(library_path);
FREE_C_HEAP_ARRAY(char, library_path, mtInternal); FREE_C_HEAP_ARRAY(char, library_path);
FREE_C_HEAP_ARRAY(char, info, mtInternal); FREE_C_HEAP_ARRAY(char, info);
} }
// Extensions directories. // Extensions directories.
@ -769,7 +769,7 @@ void os::init_system_properties_values() {
sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home()); sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#undef SYS_EXT_DIR #undef SYS_EXT_DIR
#undef EXTENSIONS_DIR #undef EXTENSIONS_DIR
@ -1599,11 +1599,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
// release the storage // release the storage
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) { if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); FREE_C_HEAP_ARRAY(char, pelements[i]);
} }
} }
if (pelements != NULL) { if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); FREE_C_HEAP_ARRAY(char*, pelements);
} }
} else { } else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname); snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@ -4681,7 +4681,7 @@ jint os::init_2(void) {
size_t lgrp_limit = os::numa_get_groups_num(); size_t lgrp_limit = os::numa_get_groups_num();
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal); int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit); size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal); FREE_C_HEAP_ARRAY(int, lgrp_ids);
if (lgrp_num < 2) { if (lgrp_num < 2) {
// There's only one locality group, disable NUMA. // There's only one locality group, disable NUMA.
UseNUMA = false; UseNUMA = false;

View file

@ -129,7 +129,7 @@ static void save_memory_to_file(char* addr, size_t size) {
} }
} }
} }
FREE_C_HEAP_ARRAY(char, destfile, mtInternal); FREE_C_HEAP_ARRAY(char, destfile);
} }
@ -270,14 +270,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length"); "pw_name zero length");
} }
} }
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return NULL; return NULL;
} }
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal); char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name); strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal); FREE_C_HEAP_ARRAY(char, pwbuf);
return user_name; return user_name;
} }
@ -338,7 +338,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name); DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) { if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
continue; continue;
} }
@ -349,7 +349,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited. // symlink can be exploited.
// //
if (!is_directory_secure(usrdir_name)) { if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp); os::closedir(subdirp);
continue; continue;
} }
@ -373,13 +373,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file // don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result); RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) { if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
// skip over files that are not regular files. // skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) { if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
@ -389,7 +389,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) { if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1; char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal); if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user); strcpy(oldest_user, user);
@ -397,15 +397,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
} }
} }
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
} }
} }
os::closedir(subdirp); os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
} }
os::closedir(tmpdirp); os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); FREE_C_HEAP_ARRAY(char, tdbuf);
return(oldest_user); return(oldest_user);
} }
@ -520,7 +520,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path); remove_file(path);
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} }
@ -597,7 +597,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0; errno = 0;
} }
os::closedir(dirp); os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
} }
// make the user specific temporary directory. Returns true if // make the user specific temporary directory. Returns true if
@ -742,11 +742,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size); fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal); FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (fd == -1) { if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -760,7 +760,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno)); warning("mmap failed - %s\n", strerror(errno));
} }
remove_file(filename); remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
return NULL; return NULL;
} }
@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either. // store file, we don't follow them when attaching either.
// //
if (!is_directory_secure(dirname)) { if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (luser != user) { if (luser != user) {
FREE_C_HEAP_ARRAY(char, luser, mtInternal); FREE_C_HEAP_ARRAY(char, luser);
} }
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found");
@ -908,9 +908,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename); strcpy(rfilename, filename);
// free the c heap resources that are no longer needed // free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
// open the shared memory file for the give vmid // open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, THREAD); fd = open_sharedmem_file(rfilename, file_flags, THREAD);

View file

@ -211,7 +211,7 @@ void os::init_system_properties_values() {
} }
strcpy(home_path, home_dir); strcpy(home_path, home_dir);
Arguments::set_java_home(home_path); Arguments::set_java_home(home_path);
FREE_C_HEAP_ARRAY(char, home_path, mtInternal); FREE_C_HEAP_ARRAY(char, home_path);
dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1, dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
mtInternal); mtInternal);
@ -221,7 +221,7 @@ void os::init_system_properties_values() {
strcpy(dll_path, home_dir); strcpy(dll_path, home_dir);
strcat(dll_path, bin); strcat(dll_path, bin);
Arguments::set_dll_dir(dll_path); Arguments::set_dll_dir(dll_path);
FREE_C_HEAP_ARRAY(char, dll_path, mtInternal); FREE_C_HEAP_ARRAY(char, dll_path);
if (!set_boot_path('\\', ';')) { if (!set_boot_path('\\', ';')) {
return; return;
@ -276,7 +276,7 @@ void os::init_system_properties_values() {
strcat(library_path, ";."); strcat(library_path, ";.");
Arguments::set_library_path(library_path); Arguments::set_library_path(library_path);
FREE_C_HEAP_ARRAY(char, library_path, mtInternal); FREE_C_HEAP_ARRAY(char, library_path);
} }
// Default extensions directory // Default extensions directory
@ -301,7 +301,7 @@ void os::init_system_properties_values() {
Arguments::set_endorsed_dirs(buf); Arguments::set_endorsed_dirs(buf);
// (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
// duplicates the input.) // duplicates the input.)
FREE_C_HEAP_ARRAY(char, buf, mtInternal); FREE_C_HEAP_ARRAY(char, buf);
#undef ENDORSED_DIR #undef ENDORSED_DIR
} }
@ -1136,7 +1136,7 @@ DIR * os::opendir(const char *dirname) {
dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal); dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
if (dirp->path == 0) { if (dirp->path == 0) {
free(dirp, mtInternal); free(dirp);
errno = ENOMEM; errno = ENOMEM;
return 0; return 0;
} }
@ -1144,13 +1144,13 @@ DIR * os::opendir(const char *dirname) {
fattr = GetFileAttributes(dirp->path); fattr = GetFileAttributes(dirp->path);
if (fattr == 0xffffffff) { if (fattr == 0xffffffff) {
free(dirp->path, mtInternal); free(dirp->path);
free(dirp, mtInternal); free(dirp);
errno = ENOENT; errno = ENOENT;
return 0; return 0;
} else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) { } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
free(dirp->path, mtInternal); free(dirp->path);
free(dirp, mtInternal); free(dirp);
errno = ENOTDIR; errno = ENOTDIR;
return 0; return 0;
} }
@ -1168,8 +1168,8 @@ DIR * os::opendir(const char *dirname) {
dirp->handle = FindFirstFile(dirp->path, &dirp->find_data); dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
if (dirp->handle == INVALID_HANDLE_VALUE) { if (dirp->handle == INVALID_HANDLE_VALUE) {
if (GetLastError() != ERROR_FILE_NOT_FOUND) { if (GetLastError() != ERROR_FILE_NOT_FOUND) {
free(dirp->path, mtInternal); free(dirp->path);
free(dirp, mtInternal); free(dirp);
errno = EACCES; errno = EACCES;
return 0; return 0;
} }
@ -1207,8 +1207,8 @@ int os::closedir(DIR *dirp) {
} }
dirp->handle = INVALID_HANDLE_VALUE; dirp->handle = INVALID_HANDLE_VALUE;
} }
free(dirp->path, mtInternal); free(dirp->path);
free(dirp, mtInternal); free(dirp);
return 0; return 0;
} }
@ -1275,11 +1275,11 @@ bool os::dll_build_name(char *buffer, size_t buflen,
// release the storage // release the storage
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
if (pelements[i] != NULL) { if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal); FREE_C_HEAP_ARRAY(char, pelements[i]);
} }
} }
if (pelements != NULL) { if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal); FREE_C_HEAP_ARRAY(char*, pelements);
} }
} else { } else {
jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname); jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
@ -2745,7 +2745,7 @@ class NUMANodeListHolder {
void free_node_list() { void free_node_list() {
if (_numa_used_node_list != NULL) { if (_numa_used_node_list != NULL) {
FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal); FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
} }
} }
@ -3781,8 +3781,8 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf,
return NULL; return NULL;
} }
#define MAX_EXIT_HANDLES 16 #define MAX_EXIT_HANDLES PRODUCT_ONLY(32) NOT_PRODUCT(128)
#define EXIT_TIMEOUT 1000 /* 1 sec */ #define EXIT_TIMEOUT PRODUCT_ONLY(1000) NOT_PRODUCT(4000) /* 1 sec in product, 4 sec in debug */
static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) { static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) {
InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect); InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect);
@ -3833,6 +3833,9 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
// If there's no free slot in the array of the kept handles, we'll have to // If there's no free slot in the array of the kept handles, we'll have to
// wait until at least one thread completes exiting. // wait until at least one thread completes exiting.
if ((handle_count = j) == MAX_EXIT_HANDLES) { if ((handle_count = j) == MAX_EXIT_HANDLES) {
// Raise the priority of the oldest exiting thread to increase its chances
// to complete sooner.
SetThreadPriority(handles[0], THREAD_PRIORITY_ABOVE_NORMAL);
res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT); res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT);
if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) { if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
i = (res - WAIT_OBJECT_0); i = (res - WAIT_OBJECT_0);
@ -3841,7 +3844,8 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
handles[i] = handles[i + 1]; handles[i] = handles[i + 1];
} }
} else { } else {
warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__); warning("WaitForMultipleObjects %s in %s: %d\n",
(res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
// Don't keep handles, if we failed waiting for them. // Don't keep handles, if we failed waiting for them.
for (i = 0; i < MAX_EXIT_HANDLES; ++i) { for (i = 0; i < MAX_EXIT_HANDLES; ++i) {
CloseHandle(handles[i]); CloseHandle(handles[i]);
@ -3867,9 +3871,20 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
if (handle_count > 0) { if (handle_count > 0) {
// Before ending the process, make sure all the threads that had called // Before ending the process, make sure all the threads that had called
// _endthreadex() completed. // _endthreadex() completed.
// Set the priority level of the current thread to the same value as
// the priority level of exiting threads.
// This is to ensure it will be given a fair chance to execute if
// the timeout expires.
hthr = GetCurrentThread();
SetThreadPriority(hthr, THREAD_PRIORITY_ABOVE_NORMAL);
for (i = 0; i < handle_count; ++i) {
SetThreadPriority(handles[i], THREAD_PRIORITY_ABOVE_NORMAL);
}
res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT); res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT);
if (res == WAIT_FAILED) { if (res < WAIT_OBJECT_0 || res >= (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__); warning("WaitForMultipleObjects %s in %s: %d\n",
(res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
} }
for (i = 0; i < handle_count; ++i) { for (i = 0; i < handle_count; ++i) {
CloseHandle(handles[i]); CloseHandle(handles[i]);
@ -4627,7 +4642,7 @@ static int stdinAvailable(int fd, long *pbytes) {
error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead); error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
if (error == 0) { if (error == 0) {
os::free(lpBuffer, mtInternal); os::free(lpBuffer);
return FALSE; return FALSE;
} }
@ -4648,7 +4663,7 @@ static int stdinAvailable(int fd, long *pbytes) {
} }
if (lpBuffer != NULL) { if (lpBuffer != NULL) {
os::free(lpBuffer, mtInternal); os::free(lpBuffer);
} }
*pbytes = (long) actualLength; *pbytes = (long) actualLength;

View file

@ -122,7 +122,7 @@ static void save_memory_to_file(char* addr, size_t size) {
} }
} }
FREE_C_HEAP_ARRAY(char, destfile, mtInternal); FREE_C_HEAP_ARRAY(char, destfile);
} }
// Shared Memory Implementation Details // Shared Memory Implementation Details
@ -335,7 +335,7 @@ static char* get_user_name_slow(int vmid) {
DIR* subdirp = os::opendir(usrdir_name); DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) { if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
continue; continue;
} }
@ -346,7 +346,7 @@ static char* get_user_name_slow(int vmid) {
// symlink can be exploited. // symlink can be exploited.
// //
if (!is_directory_secure(usrdir_name)) { if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
os::closedir(subdirp); os::closedir(subdirp);
continue; continue;
} }
@ -367,13 +367,13 @@ static char* get_user_name_slow(int vmid) {
strcat(filename, udentry->d_name); strcat(filename, udentry->d_name);
if (::stat(filename, &statbuf) == OS_ERR) { if (::stat(filename, &statbuf) == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
// skip over files that are not regular files. // skip over files that are not regular files.
if ((statbuf.st_mode & S_IFMT) != S_IFREG) { if ((statbuf.st_mode & S_IFMT) != S_IFREG) {
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
continue; continue;
} }
@ -395,22 +395,22 @@ static char* get_user_name_slow(int vmid) {
if (statbuf.st_ctime > latest_ctime) { if (statbuf.st_ctime > latest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1; char* user = strchr(dentry->d_name, '_') + 1;
if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user, mtInternal); if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal); latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(latest_user, user); strcpy(latest_user, user);
latest_ctime = statbuf.st_ctime; latest_ctime = statbuf.st_ctime;
} }
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
} }
} }
os::closedir(subdirp); os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal); FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal); FREE_C_HEAP_ARRAY(char, usrdir_name);
} }
os::closedir(tmpdirp); os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal); FREE_C_HEAP_ARRAY(char, tdbuf);
return(latest_user); return(latest_user);
} }
@ -502,7 +502,7 @@ static void remove_file(const char* dirname, const char* filename) {
} }
} }
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} }
// returns true if the process represented by pid is alive, otherwise // returns true if the process represented by pid is alive, otherwise
@ -683,7 +683,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0; errno = 0;
} }
os::closedir(dirp); os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
} }
// create a file mapping object with the requested name, and size // create a file mapping object with the requested name, and size
@ -749,11 +749,11 @@ static void free_security_desc(PSECURITY_DESCRIPTOR pSD) {
// be an ACL we enlisted. free the resources. // be an ACL we enlisted. free the resources.
// //
if (success && exists && pACL != NULL && !isdefault) { if (success && exists && pACL != NULL && !isdefault) {
FREE_C_HEAP_ARRAY(char, pACL, mtInternal); FREE_C_HEAP_ARRAY(char, pACL);
} }
// free the security descriptor // free the security descriptor
FREE_C_HEAP_ARRAY(char, pSD, mtInternal); FREE_C_HEAP_ARRAY(char, pSD);
} }
} }
@ -768,7 +768,7 @@ static void free_security_attr(LPSECURITY_ATTRIBUTES lpSA) {
lpSA->lpSecurityDescriptor = NULL; lpSA->lpSecurityDescriptor = NULL;
// free the security attributes structure // free the security attributes structure
FREE_C_HEAP_ARRAY(char, lpSA, mtInternal); FREE_C_HEAP_ARRAY(char, lpSA);
} }
} }
@ -815,7 +815,7 @@ static PSID get_user_sid(HANDLE hProcess) {
warning("GetTokenInformation failure: lasterror = %d," warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize); " rsize = %d\n", GetLastError(), rsize);
} }
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal); FREE_C_HEAP_ARRAY(char, token_buf);
CloseHandle(hAccessToken); CloseHandle(hAccessToken);
return NULL; return NULL;
} }
@ -828,15 +828,15 @@ static PSID get_user_sid(HANDLE hProcess) {
warning("GetTokenInformation failure: lasterror = %d," warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize); " rsize = %d\n", GetLastError(), rsize);
} }
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal); FREE_C_HEAP_ARRAY(char, token_buf);
FREE_C_HEAP_ARRAY(char, pSID, mtInternal); FREE_C_HEAP_ARRAY(char, pSID);
CloseHandle(hAccessToken); CloseHandle(hAccessToken);
return NULL; return NULL;
} }
// close the access token. // close the access token.
CloseHandle(hAccessToken); CloseHandle(hAccessToken);
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal); FREE_C_HEAP_ARRAY(char, token_buf);
return pSID; return pSID;
} }
@ -920,7 +920,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError()); warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
@ -933,7 +933,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError()); warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) { if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) {
@ -960,7 +960,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError()); warning("AddAce failure: lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
} }
@ -976,7 +976,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("AddAccessAllowedAce failure: lasterror = %d \n", warning("AddAccessAllowedAce failure: lasterror = %d \n",
GetLastError()); GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
} }
@ -991,7 +991,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError()); warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace, if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace,
@ -999,7 +999,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError()); warning("AddAce failure: lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
ace_index++; ace_index++;
@ -1012,7 +1012,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorDacl failure:" warning("SetSecurityDescriptorDacl failure:"
" lasterror = %d \n", GetLastError()); " lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
@ -1032,7 +1032,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorControl failure:" warning("SetSecurityDescriptorControl failure:"
" lasterror = %d \n", GetLastError()); " lasterror = %d \n", GetLastError());
} }
FREE_C_HEAP_ARRAY(char, newACL, mtInternal); FREE_C_HEAP_ARRAY(char, newACL);
return false; return false;
} }
} }
@ -1149,7 +1149,7 @@ static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
// create a security attributes structure with access control // create a security attributes structure with access control
// entries as initialized above. // entries as initialized above.
LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3); LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3);
FREE_C_HEAP_ARRAY(char, aces[0].pSid, mtInternal); FREE_C_HEAP_ARRAY(char, aces[0].pSid);
FreeSid(everybodySid); FreeSid(everybodySid);
FreeSid(administratorsSid); FreeSid(administratorsSid);
return(lpSA); return(lpSA);
@ -1464,15 +1464,15 @@ static char* mapping_create_shared(size_t size) {
assert(((size != 0) && (size % os::vm_page_size() == 0)), assert(((size != 0) && (size % os::vm_page_size() == 0)),
"unexpected PerfMemry region size"); "unexpected PerfMemry region size");
FREE_C_HEAP_ARRAY(char, user, mtInternal); FREE_C_HEAP_ARRAY(char, user);
// create the shared memory resources // create the shared memory resources
sharedmem_fileMapHandle = sharedmem_fileMapHandle =
create_sharedmem_resources(dirname, filename, objectname, size); create_sharedmem_resources(dirname, filename, objectname, size);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, objectname, mtInternal); FREE_C_HEAP_ARRAY(char, objectname);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
if (sharedmem_fileMapHandle == NULL) { if (sharedmem_fileMapHandle == NULL) {
return NULL; return NULL;
@ -1627,7 +1627,7 @@ static void open_file_mapping(const char* user, int vmid,
// store file, we also don't following them when attaching // store file, we also don't following them when attaching
// //
if (!is_directory_secure(dirname)) { if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found"); "Process not found");
} }
@ -1646,10 +1646,10 @@ static void open_file_mapping(const char* user, int vmid,
strcpy(robjectname, objectname); strcpy(robjectname, objectname);
// free the c heap resources that are no longer needed // free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal); if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal); FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal); FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, objectname, mtInternal); FREE_C_HEAP_ARRAY(char, objectname);
if (*sizep == 0) { if (*sizep == 0) {
size = sharedmem_filesize(rfilename, CHECK); size = sharedmem_filesize(rfilename, CHECK);

View file

@ -1025,7 +1025,7 @@ class CodeString: public CHeapObj<mtCode> {
~CodeString() { ~CodeString() {
assert(_next == NULL, "wrong interface for freeing list"); assert(_next == NULL, "wrong interface for freeing list");
os::free((void*)_string, mtCode); os::free((void*)_string);
} }
bool is_comment() const { return _offset >= 0; } bool is_comment() const { return _offset >= 0; }

View file

@ -162,7 +162,7 @@ MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) {
MetaIndex::~MetaIndex() { MetaIndex::~MetaIndex() {
FREE_C_HEAP_ARRAY(char*, _meta_package_names, mtClass); FREE_C_HEAP_ARRAY(char*, _meta_package_names);
} }
@ -248,7 +248,7 @@ ClassPathZipEntry::~ClassPathZipEntry() {
if (ZipClose != NULL) { if (ZipClose != NULL) {
(*ZipClose)(_zip); (*ZipClose)(_zip);
} }
FREE_C_HEAP_ARRAY(char, _zip_name, mtClass); FREE_C_HEAP_ARRAY(char, _zip_name);
} }
u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) { u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2014, 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
@ -164,7 +164,7 @@ void LoaderConstraintTable::purge_loader_constraints() {
// Purge entry // Purge entry
*p = probe->next(); *p = probe->next();
FREE_C_HEAP_ARRAY(oop, probe->loaders(), mtClass); FREE_C_HEAP_ARRAY(oop, probe->loaders());
free_entry(probe); free_entry(probe);
} else { } else {
#ifdef ASSERT #ifdef ASSERT
@ -340,7 +340,7 @@ void LoaderConstraintTable::ensure_loader_constraint_capacity(
ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass); ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass);
memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders()); memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders());
p->set_max_loaders(n); p->set_max_loaders(n);
FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders(), mtClass); FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders());
p->set_loaders(new_loaders); p->set_loaders(new_loaders);
} }
} }
@ -422,7 +422,7 @@ void LoaderConstraintTable::merge_loader_constraints(
} }
*pp2 = p2->next(); *pp2 = p2->next();
FREE_C_HEAP_ARRAY(oop, p2->loaders(), mtClass); FREE_C_HEAP_ARRAY(oop, p2->loaders());
free_entry(p2); free_entry(p2);
return; return;
} }

View file

@ -89,7 +89,7 @@ public:
} }
~SharedPathsMiscInfo() { ~SharedPathsMiscInfo() {
if (_allocated) { if (_allocated) {
FREE_C_HEAP_ARRAY(char, _buf_start, mtClass); FREE_C_HEAP_ARRAY(char, _buf_start);
} }
} }
int get_used_bytes() { int get_used_bytes() {

View file

@ -168,7 +168,7 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam
void CodeBlob::flush() { void CodeBlob::flush() {
if (_oop_maps) { if (_oop_maps) {
FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode); FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
_oop_maps = NULL; _oop_maps = NULL;
} }
_strings.free(); _strings.free();

View file

@ -1190,7 +1190,7 @@ void CodeCache::print_internals() {
} }
} }
FREE_C_HEAP_ARRAY(int, buckets, mtCode); FREE_C_HEAP_ARRAY(int, buckets);
print_memory_overhead(); print_memory_overhead();
} }

View file

@ -58,10 +58,8 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
CompileLog::~CompileLog() { CompileLog::~CompileLog() {
delete _out; // Close fd in fileStream::~fileStream() delete _out; // Close fd in fileStream::~fileStream()
_out = NULL; _out = NULL;
// Remove partial file after merging in CompileLog::finish_log_on_error FREE_C_HEAP_ARRAY(char, _identities);
unlink(_file); FREE_C_HEAP_ARRAY(char, _file);
FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
} }

View file

@ -650,15 +650,15 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
|| _cursor == NULL) { || _cursor == NULL) {
warning("Failed to allocate survivor plab/chunk array"); warning("Failed to allocate survivor plab/chunk array");
if (_survivor_plab_array != NULL) { if (_survivor_plab_array != NULL) {
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC); FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
_survivor_plab_array = NULL; _survivor_plab_array = NULL;
} }
if (_survivor_chunk_array != NULL) { if (_survivor_chunk_array != NULL) {
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC); FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
_survivor_chunk_array = NULL; _survivor_chunk_array = NULL;
} }
if (_cursor != NULL) { if (_cursor != NULL) {
FREE_C_HEAP_ARRAY(size_t, _cursor, mtGC); FREE_C_HEAP_ARRAY(size_t, _cursor);
_cursor = NULL; _cursor = NULL;
} }
} else { } else {
@ -668,10 +668,10 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
if (vec == NULL) { if (vec == NULL) {
warning("Failed to allocate survivor plab array"); warning("Failed to allocate survivor plab array");
for (int j = i; j > 0; j--) { for (int j = i; j > 0; j--) {
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array(), mtGC); FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
} }
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC); FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC); FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
_survivor_plab_array = NULL; _survivor_plab_array = NULL;
_survivor_chunk_array = NULL; _survivor_chunk_array = NULL;
_survivor_chunk_capacity = 0; _survivor_chunk_capacity = 0;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, 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
@ -107,7 +107,7 @@ ConcurrentG1Refine::~ConcurrentG1Refine() {
for (uint i = 0; i < _n_threads; i++) { for (uint i = 0; i < _n_threads; i++) {
delete _threads[i]; delete _threads[i];
} }
FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC); FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads);
} }
} }

View file

@ -111,13 +111,13 @@ CodeRootSetTable::~CodeRootSetTable() {
// read next before freeing. // read next before freeing.
e = e->next(); e = e->next();
unlink_entry(to_remove); unlink_entry(to_remove);
FREE_C_HEAP_ARRAY(char, to_remove, mtGC); FREE_C_HEAP_ARRAY(char, to_remove);
} }
} }
assert(number_of_entries() == 0, "should have removed all entries"); assert(number_of_entries() == 0, "should have removed all entries");
free_buckets(); free_buckets();
for (BasicHashtableEntry<mtGC>* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) { for (BasicHashtableEntry<mtGC>* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) {
FREE_C_HEAP_ARRAY(char, e, mtGC); FREE_C_HEAP_ARRAY(char, e);
} }
} }

View file

@ -3561,7 +3561,7 @@ G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
void void
G1CollectedHeap::cleanup_surviving_young_words() { G1CollectedHeap::cleanup_surviving_young_words() {
guarantee( _surviving_young_words != NULL, "pre-condition" ); guarantee( _surviving_young_words != NULL, "pre-condition" );
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words, mtGC); FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
_surviving_young_words = NULL; _surviving_young_words = NULL;
} }

View file

@ -53,7 +53,7 @@ class WorkerDataArray : public CHeapObj<mtGC> {
} }
~WorkerDataArray() { ~WorkerDataArray() {
FREE_C_HEAP_ARRAY(T, _data, mtGC); FREE_C_HEAP_ARRAY(T, _data);
} }
void set(uint worker_i, T value) { void set(uint worker_i, T value) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, 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
@ -53,7 +53,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
G1HotCardCache::~G1HotCardCache() { G1HotCardCache::~G1HotCardCache() {
if (default_use_cache()) { if (default_use_cache()) {
assert(_hot_cache != NULL, "Logic"); assert(_hot_cache != NULL, "Logic");
FREE_C_HEAP_ARRAY(jbyte*, _hot_cache, mtGC); FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
} }
} }

View file

@ -65,7 +65,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num,
G1ParScanThreadState::~G1ParScanThreadState() { G1ParScanThreadState::~G1ParScanThreadState() {
_g1_par_allocator->retire_alloc_buffers(); _g1_par_allocator->retire_alloc_buffers();
delete _g1_par_allocator; delete _g1_par_allocator;
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC); FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
} }
void void

View file

@ -94,7 +94,7 @@ G1RemSet::~G1RemSet() {
for (uint i = 0; i < n_workers(); i++) { for (uint i = 0; i < n_workers(); i++) {
assert(_cset_rs_update_cl[i] == NULL, "it should be"); assert(_cset_rs_update_cl[i] == NULL, "it should be");
} }
FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC); FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
} }
class ScanRSClosure : public HeapRegionClosure { class ScanRSClosure : public HeapRegionClosure {
@ -353,7 +353,7 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() {
for (uint i = 0; i < n_workers(); ++i) { for (uint i = 0; i < n_workers(); ++i) {
_total_cards_scanned += _cards_scanned[i]; _total_cards_scanned += _cards_scanned[i];
} }
FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC); FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
_cards_scanned = NULL; _cards_scanned = NULL;
// Cleanup after copy // Cleanup after copy
_g1->set_refine_cte_cl_concurrency(true); _g1->set_refine_cte_cl_concurrency(true);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013, 2014, 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
@ -59,7 +59,7 @@ private:
void free_and_null() { void free_and_null() {
if (_rs_threads_vtimes) { if (_rs_threads_vtimes) {
FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes, mtGC); FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
_rs_threads_vtimes = NULL; _rs_threads_vtimes = NULL;
_num_vtimes = 0; _num_vtimes = 0;
} }

View file

@ -187,7 +187,7 @@ G1StringDedupTable::G1StringDedupTable(size_t size, jint hash_seed) :
} }
G1StringDedupTable::~G1StringDedupTable() { G1StringDedupTable::~G1StringDedupTable() {
FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets, mtGC); FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets);
} }
void G1StringDedupTable::create() { void G1StringDedupTable::create() {

View file

@ -449,7 +449,7 @@ HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
HeapRegionClaimer::~HeapRegionClaimer() { HeapRegionClaimer::~HeapRegionClaimer() {
if (_claims != NULL) { if (_claims != NULL) {
FREE_C_HEAP_ARRAY(uint, _claims, mtGC); FREE_C_HEAP_ARRAY(uint, _claims);
} }
} }

View file

@ -449,5 +449,5 @@ void FreeRegionList_test() {
bot_storage->uncommit_regions(0, num_regions_in_test); bot_storage->uncommit_regions(0, num_regions_in_test);
delete bot_storage; delete bot_storage;
FREE_C_HEAP_ARRAY(HeapWord, bot_data, mtGC); FREE_C_HEAP_ARRAY(HeapWord, bot_data);
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, 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
@ -129,7 +129,7 @@ void PtrQueueSet::reduce_free_list() {
assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong."); assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
void* b = BufferNode::make_block_from_node(_buf_free_list); void* b = BufferNode::make_block_from_node(_buf_free_list);
_buf_free_list = _buf_free_list->next(); _buf_free_list = _buf_free_list->next();
FREE_C_HEAP_ARRAY(char, b, mtGC); FREE_C_HEAP_ARRAY(char, b);
_buf_free_list_sz --; _buf_free_list_sz --;
n--; n--;
} }

View file

@ -154,11 +154,11 @@ RSHashTable::RSHashTable(size_t capacity) :
RSHashTable::~RSHashTable() { RSHashTable::~RSHashTable() {
if (_entries != NULL) { if (_entries != NULL) {
FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries, mtGC); FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
_entries = NULL; _entries = NULL;
} }
if (_buckets != NULL) { if (_buckets != NULL) {
FREE_C_HEAP_ARRAY(int, _buckets, mtGC); FREE_C_HEAP_ARRAY(int, _buckets);
_buckets = NULL; _buckets = NULL;
} }
} }

View file

@ -106,13 +106,13 @@ SurvRateGroup::stop_adding_regions() {
_stats_arrays_length = _region_num; _stats_arrays_length = _region_num;
if (old_surv_rate != NULL) { if (old_surv_rate != NULL) {
FREE_C_HEAP_ARRAY(double, old_surv_rate, mtGC); FREE_C_HEAP_ARRAY(double, old_surv_rate);
} }
if (old_accum_surv_rate_pred != NULL) { if (old_accum_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred, mtGC); FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
} }
if (old_surv_rate_pred != NULL) { if (old_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred, mtGC); FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
} }
} }

View file

@ -462,7 +462,7 @@ get_LNC_array_for_space(Space* sp,
if (_lowest_non_clean[i] != NULL) { if (_lowest_non_clean[i] != NULL) {
assert(n_chunks != _lowest_non_clean_chunk_size[i], assert(n_chunks != _lowest_non_clean_chunk_size[i],
"logical consequence"); "logical consequence");
FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC); FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i]);
_lowest_non_clean[i] = NULL; _lowest_non_clean[i] = NULL;
} }
// Now allocate a new one if necessary. // Now allocate a new one if necessary.

View file

@ -1609,7 +1609,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
// This can become a scaling bottleneck when there is work queue overflow coincident // This can become a scaling bottleneck when there is work queue overflow coincident
// with promotion failure. // with promotion failure.
oopDesc* f = cur; oopDesc* f = cur;
FREE_C_HEAP_ARRAY(oopDesc, f, mtGC); FREE_C_HEAP_ARRAY(oopDesc, f);
} else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) { } else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) {
assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned"); assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
obj_to_push = cur; obj_to_push = cur;

View file

@ -429,7 +429,7 @@ void GCTaskManager::initialize() {
} }
tty->cr(); tty->cr();
} }
FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC); FREE_C_HEAP_ARRAY(uint, processor_assignment);
} }
reset_busy_workers(); reset_busy_workers();
set_unblocked(); set_unblocked();
@ -458,11 +458,11 @@ GCTaskManager::~GCTaskManager() {
GCTaskThread::destroy(thread(i)); GCTaskThread::destroy(thread(i));
set_thread(i, NULL); set_thread(i, NULL);
} }
FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC); FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
_thread = NULL; _thread = NULL;
} }
if (_resource_flag != NULL) { if (_resource_flag != NULL) {
FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC); FREE_C_HEAP_ARRAY(bool, _resource_flag);
_resource_flag = NULL; _resource_flag = NULL;
} }
if (queue() != NULL) { if (queue() != NULL) {

View file

@ -58,7 +58,7 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
GCTaskThread::~GCTaskThread() { GCTaskThread::~GCTaskThread() {
if (_time_stamps != NULL) { if (_time_stamps != NULL) {
FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps, mtGC); FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, 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
@ -53,7 +53,7 @@ class CSpaceCounters: public CHeapObj<mtGC> {
ContiguousSpace* s, GenerationCounters* gc); ContiguousSpace* s, GenerationCounters* gc);
~CSpaceCounters() { ~CSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtInternal); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
virtual inline void update_capacity() { virtual inline void update_capacity() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, 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
@ -50,7 +50,7 @@ class CollectorCounters: public CHeapObj<mtGC> {
CollectorCounters(const char* name, int ordinal); CollectorCounters(const char* name, int ordinal);
~CollectorCounters() { ~CollectorCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
inline PerfCounter* invocation_counter() const { return _invocations; } inline PerfCounter* invocation_counter() const { return _invocations; }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, 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
@ -55,7 +55,7 @@ class GSpaceCounters: public CHeapObj<mtGC> {
GenerationCounters* gc, bool sampled=true); GenerationCounters* gc, bool sampled=true);
~GSpaceCounters() { ~GSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
inline void update_capacity() { inline void update_capacity() {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, 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
@ -69,7 +69,7 @@ private:
size_t min_capacity, size_t max_capacity, VirtualSpace* v); size_t min_capacity, size_t max_capacity, VirtualSpace* v);
~GenerationCounters() { ~GenerationCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
virtual void update_all(); virtual void update_all();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2014, 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
@ -54,7 +54,7 @@ class HSpaceCounters: public CHeapObj<mtGC> {
size_t initial_capacity, GenerationCounters* gc); size_t initial_capacity, GenerationCounters* gc);
~HSpaceCounters() { ~HSpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
inline void update_capacity(size_t v) { inline void update_capacity(size_t v) {

View file

@ -276,7 +276,7 @@ bool MutableNUMASpace::update_layout(bool force) {
} }
} }
FREE_C_HEAP_ARRAY(int, lgrp_ids, mtGC); FREE_C_HEAP_ARRAY(int, lgrp_ids);
if (changed) { if (changed) {
for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) { for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2002, 2014, 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
@ -56,7 +56,7 @@ class SpaceCounters: public CHeapObj<mtGC> {
MutableSpace* m, GenerationCounters* gc); MutableSpace* m, GenerationCounters* gc);
~SpaceCounters() { ~SpaceCounters() {
if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC); if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
} }
inline void update_capacity() { inline void update_capacity() {

View file

@ -334,7 +334,7 @@ void OopMapCacheEntry::deallocate_bit_mask() {
if (mask_size() > small_mask_limit && _bit_mask[0] != 0) { if (mask_size() > small_mask_limit && _bit_mask[0] != 0) {
assert(!Thread::current()->resource_area()->contains((void*)_bit_mask[0]), assert(!Thread::current()->resource_area()->contains((void*)_bit_mask[0]),
"This bit mask should not be in the resource area"); "This bit mask should not be in the resource area");
FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0], mtClass); FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0]);
debug_only(_bit_mask[0] = 0;) debug_only(_bit_mask[0] = 0;)
} }
} }
@ -492,7 +492,7 @@ OopMapCache::~OopMapCache() {
flush(); flush();
// Deallocate array // Deallocate array
NOT_PRODUCT(_total_memory_usage -= sizeof(OopMapCache) + (sizeof(OopMapCacheEntry) * _size);) NOT_PRODUCT(_total_memory_usage -= sizeof(OopMapCache) + (sizeof(OopMapCacheEntry) * _size);)
FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array, mtClass); FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array);
} }
OopMapCacheEntry* OopMapCache::entry_at(int i) const { OopMapCacheEntry* OopMapCache::entry_at(int i) const {
@ -603,5 +603,5 @@ void OopMapCache::compute_one_oop_map(methodHandle method, int bci, InterpreterO
tmp->initialize(); tmp->initialize();
tmp->fill(method, bci); tmp->fill(method, bci);
entry->resource_copy(tmp); entry->resource_copy(tmp);
FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp, mtInternal); FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp);
} }

View file

@ -296,7 +296,7 @@ class ChunkPool: public CHeapObj<mtInternal> {
// to avoid deadlock with NMT // to avoid deadlock with NMT
while(cur != NULL) { while(cur != NULL) {
next = cur->next(); next = cur->next();
os::free(cur, mtChunk); os::free(cur);
cur = next; cur = next;
} }
} }
@ -384,7 +384,7 @@ void Chunk::operator delete(void* p) {
case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break; case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
case Chunk::init_size: ChunkPool::small_pool()->free(c); break; case Chunk::init_size: ChunkPool::small_pool()->free(c); break;
case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break; case Chunk::tiny_size: ChunkPool::tiny_pool()->free(c); break;
default: os::free(c, mtChunk); default: os::free(c);
} }
} }

View file

@ -101,7 +101,7 @@ typedef AllocFailStrategy::AllocFailEnum AllocFailType;
// NEW_RESOURCE_OBJ(type) // NEW_RESOURCE_OBJ(type)
// NEW_C_HEAP_ARRAY(type, size) // NEW_C_HEAP_ARRAY(type, size)
// NEW_C_HEAP_OBJ(type, memflags) // NEW_C_HEAP_OBJ(type, memflags)
// FREE_C_HEAP_ARRAY(type, old, memflags) // FREE_C_HEAP_ARRAY(type, old)
// FREE_C_HEAP_OBJ(objname, type, memflags) // FREE_C_HEAP_OBJ(objname, type, memflags)
// char* AllocateHeap(size_t size, const char* name); // char* AllocateHeap(size_t size, const char* name);
// void FreeHeap(void* p); // void FreeHeap(void* p);
@ -669,8 +669,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
#define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\ #define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\
(type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL)) (type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL))
#define FREE_C_HEAP_ARRAY(type, old, memflags) \ #define FREE_C_HEAP_ARRAY(type, old) \
FreeHeap((char*)(old), memflags) FreeHeap((char*)(old))
// allocate type in heap without calling ctor // allocate type in heap without calling ctor
#define NEW_C_HEAP_OBJ(type, memflags)\ #define NEW_C_HEAP_OBJ(type, memflags)\
@ -680,8 +680,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags) NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags)
// deallocate obj of type in heap without calling dtor // deallocate obj of type in heap without calling dtor
#define FREE_C_HEAP_OBJ(objname, memflags)\ #define FREE_C_HEAP_OBJ(objname)\
FreeHeap((char*)objname, memflags); FreeHeap((char*)objname);
// for statistics // for statistics
#ifndef PRODUCT #ifndef PRODUCT

View file

@ -79,11 +79,11 @@ inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
return p; return p;
} }
inline void FreeHeap(void* p, MEMFLAGS memflags = mtInternal) { inline void FreeHeap(void* p) {
#ifdef ASSERT #ifdef ASSERT
if (PrintMallocFree) trace_heap_free(p); if (PrintMallocFree) trace_heap_free(p);
#endif #endif
os::free(p, memflags); os::free(p);
} }
@ -136,11 +136,11 @@ template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
} }
template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){ template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
FreeHeap(p, F); FreeHeap(p);
} }
template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){ template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
FreeHeap(p, F); FreeHeap(p);
} }
template <class E, MEMFLAGS F> template <class E, MEMFLAGS F>
@ -199,7 +199,7 @@ template<class E, MEMFLAGS F>
void ArrayAllocator<E, F>::free() { void ArrayAllocator<E, F>::free() {
if (_addr != NULL) { if (_addr != NULL) {
if (_use_malloc) { if (_use_malloc) {
FreeHeap(_addr, F); FreeHeap(_addr);
} else { } else {
os::release_memory(_addr, _size); os::release_memory(_addr, _size);
} }

View file

@ -171,19 +171,19 @@ CardTableModRefBS::~CardTableModRefBS() {
_committed = NULL; _committed = NULL;
} }
if (_lowest_non_clean) { if (_lowest_non_clean) {
FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC); FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
_lowest_non_clean = NULL; _lowest_non_clean = NULL;
} }
if (_lowest_non_clean_chunk_size) { if (_lowest_non_clean_chunk_size) {
FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC); FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
_lowest_non_clean_chunk_size = NULL; _lowest_non_clean_chunk_size = NULL;
} }
if (_lowest_non_clean_base_chunk_index) { if (_lowest_non_clean_base_chunk_index) {
FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC); FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
_lowest_non_clean_base_chunk_index = NULL; _lowest_non_clean_base_chunk_index = NULL;
} }
if (_last_LNC_resizing_collection) { if (_last_LNC_resizing_collection) {
FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC); FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
_last_LNC_resizing_collection = NULL; _last_LNC_resizing_collection = NULL;
} }
} }

View file

@ -70,7 +70,7 @@ CardTableRS::~CardTableRS() {
_ct_bs = NULL; _ct_bs = NULL;
} }
if (_last_cur_val_in_gen) { if (_last_cur_val_in_gen) {
FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal); FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
} }
} }

View file

@ -326,7 +326,7 @@ bool FileMapInfo::init_from_file(int fd) {
n = os::read(fd, _paths_misc_info, (unsigned int)info_size); n = os::read(fd, _paths_misc_info, (unsigned int)info_size);
if (n != info_size) { if (n != info_size) {
fail_continue("Unable to read the shared path info header."); fail_continue("Unable to read the shared path info header.");
FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass); FREE_C_HEAP_ARRAY(char, _paths_misc_info);
_paths_misc_info = NULL; _paths_misc_info = NULL;
return false; return false;
} }
@ -709,7 +709,7 @@ bool FileMapInfo::validate_header() {
} }
if (_paths_misc_info != NULL) { if (_paths_misc_info != NULL) {
FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass); FREE_C_HEAP_ARRAY(char, _paths_misc_info);
_paths_misc_info = NULL; _paths_misc_info = NULL;
} }
return status; return status;

View file

@ -153,7 +153,7 @@ KlassInfoTable::~KlassInfoTable() {
for (int index = 0; index < _size; index++) { for (int index = 0; index < _size; index++) {
_buckets[index].empty(); _buckets[index].empty();
} }
FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal); FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets);
_size = 0; _size = 0;
} }
} }

View file

@ -112,10 +112,10 @@ void* MemRegion::operator new [](size_t size) throw() {
AllocFailStrategy::RETURN_NULL); AllocFailStrategy::RETURN_NULL);
} }
void MemRegion::operator delete(void* p) { void MemRegion::operator delete(void* p) {
FreeHeap(p, mtGC); FreeHeap(p);
} }
void MemRegion::operator delete [](void* p) { void MemRegion::operator delete [](void* p) {
FreeHeap(p, mtGC); FreeHeap(p);
} }

View file

@ -1365,7 +1365,7 @@ void InstanceKlass::do_nonstatic_fields(FieldClosure* cl) {
cl->do_field(&fd); cl->do_field(&fd);
} }
} }
FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass); FREE_C_HEAP_ARRAY(int, fields_sorted);
} }
@ -2473,7 +2473,7 @@ void InstanceKlass::release_C_heap_structures() {
// deallocate the cached class file // deallocate the cached class file
if (_cached_class_file != NULL) { if (_cached_class_file != NULL) {
os::free(_cached_class_file, mtClass); os::free(_cached_class_file);
_cached_class_file = NULL; _cached_class_file = NULL;
} }
@ -2482,7 +2482,7 @@ void InstanceKlass::release_C_heap_structures() {
// unreference array name derived from this class name (arrays of an unloaded // unreference array name derived from this class name (arrays of an unloaded
// class can't be referenced anymore). // class can't be referenced anymore).
if (_array_name != NULL) _array_name->decrement_refcount(); if (_array_name != NULL) _array_name->decrement_refcount();
if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass); if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension);
assert(_total_instanceKlass_count >= 1, "Sanity check"); assert(_total_instanceKlass_count >= 1, "Sanity check");
Atomic::dec(&_total_instanceKlass_count); Atomic::dec(&_total_instanceKlass_count);

View file

@ -1757,7 +1757,7 @@ class JNIMethodBlockNode : public CHeapObj<mtClass> {
JNIMethodBlockNode(int num_methods = min_block_size); JNIMethodBlockNode(int num_methods = min_block_size);
~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods, mtInternal); } ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods); }
void ensure_methods(int num_addl_methods) { void ensure_methods(int num_addl_methods) {
if (_top < _number_of_methods) { if (_top < _number_of_methods) {

View file

@ -1554,7 +1554,7 @@ JNI_ENTRY_CHECKED(const char *,
} }
// Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
// Note that the dtrace arguments for the allocated memory will not match up with this solution. // Note that the dtrace arguments for the allocated memory will not match up with this solution.
FreeHeap((char*)result, mtInternal); FreeHeap((char*)result);
} }
functionExit(thr); functionExit(thr);
return new_result; return new_result;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2014, 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
@ -68,11 +68,11 @@ class JvmtiConstantPoolReconstituter : public StackObj {
~JvmtiConstantPoolReconstituter() { ~JvmtiConstantPoolReconstituter() {
if (_symmap != NULL) { if (_symmap != NULL) {
os::free(_symmap, mtClass); os::free(_symmap);
_symmap = NULL; _symmap = NULL;
} }
if (_classmap != NULL) { if (_classmap != NULL) {
os::free(_classmap, mtClass); os::free(_classmap);
_classmap = NULL; _classmap = NULL;
} }
} }

View file

@ -192,7 +192,7 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
jvmtiError deallocate(unsigned char* mem) { jvmtiError deallocate(unsigned char* mem) {
if (mem != NULL) { if (mem != NULL) {
os::free(mem, mtInternal); os::free(mem);
} }
return JVMTI_ERROR_NONE; return JVMTI_ERROR_NONE;
} }

View file

@ -727,7 +727,7 @@ class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length); JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
} }
~JvmtiCompiledMethodLoadEventMark() { ~JvmtiCompiledMethodLoadEventMark() {
FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map, mtInternal); FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map);
} }
jint code_size() { return _code_size; } jint code_size() { return _code_size; }

View file

@ -88,7 +88,7 @@ JvmtiAgentThread::call_start_function() {
void GrowableCache::recache() { void GrowableCache::recache() {
int len = _elements->length(); int len = _elements->length();
FREE_C_HEAP_ARRAY(address, _cache, mtInternal); FREE_C_HEAP_ARRAY(address, _cache);
_cache = NEW_C_HEAP_ARRAY(address,len+1, mtInternal); _cache = NEW_C_HEAP_ARRAY(address,len+1, mtInternal);
for (int i=0; i<len; i++) { for (int i=0; i<len; i++) {
@ -132,7 +132,7 @@ GrowableCache::GrowableCache() {
GrowableCache::~GrowableCache() { GrowableCache::~GrowableCache() {
clear(); clear();
delete _elements; delete _elements;
FREE_C_HEAP_ARRAY(address, _cache, mtInternal); FREE_C_HEAP_ARRAY(address, _cache);
} }
void GrowableCache::initialize(void *this_obj, void listener_fun(void *, address*) ) { void GrowableCache::initialize(void *this_obj, void listener_fun(void *, address*) ) {

View file

@ -262,10 +262,33 @@ UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject
UNSAFE_END UNSAFE_END
#ifndef SUPPORTS_NATIVE_CX8 #ifndef SUPPORTS_NATIVE_CX8
// Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
// Volatile long versions must use locks if !VM_Version::supports_cx8(). // VM_Version::supports_cx8() is a surrogate for 'supports atomic long memory ops'.
// support_cx8 is a surrogate for 'supports atomic long memory ops'. //
// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
// values we have to use a lock-based scheme to enforce atomicity. This has to be
// applied to all Unsafe operations that set the value of a jlong field. Even so
// the compareAndSwapLong operation will not be atomic with respect to direct stores
// to the field from Java code. It is important therefore that any Java code that
// utilizes these Unsafe jlong operations does not perform direct stores. To permit
// direct loads of the field from Java code we must also use Atomic::store within the
// locked regions. And for good measure, in case there are direct stores, we also
// employ Atomic::load within those regions. Note that the field in question must be
// volatile and so must have atomic load/store accesses applied at the Java level.
//
// The locking scheme could utilize a range of strategies for controlling the locking
// granularity: from a lock per-field through to a single global lock. The latter is
// the simplest and is used for the current implementation. Note that the Java object
// that contains the field, can not, in general, be used for locking. To do so can lead
// to deadlocks as we may introduce locking into what appears to the Java code to be a
// lock-free path.
//
// As all the locked-regions are very short and themselves non-blocking we can treat
// them as leaf routines and elide safepoint checks (ie we don't perform any thread
// state transitions even when blocking for the lock). Note that if we do choose to
// add safepoint checks and thread state transitions, we must ensure that we calculate
// the address of the field _after_ we have acquired the lock, else the object may have
// been moved by the GC
UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset)) UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
UnsafeWrapper("Unsafe_GetLongVolatile"); UnsafeWrapper("Unsafe_GetLongVolatile");
@ -277,8 +300,8 @@ UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject
else { else {
Handle p (THREAD, JNIHandles::resolve(obj)); Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
ObjectLocker ol(p, THREAD); MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
jlong value = *addr; jlong value = Atomic::load(addr);
return value; return value;
} }
} }
@ -293,8 +316,8 @@ UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject o
else { else {
Handle p (THREAD, JNIHandles::resolve(obj)); Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
ObjectLocker ol(p, THREAD); MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
*addr = x; Atomic::store(x, addr);
} }
} }
UNSAFE_END UNSAFE_END
@ -403,8 +426,8 @@ UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject ob
else { else {
Handle p (THREAD, JNIHandles::resolve(obj)); Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
ObjectLocker ol(p, THREAD); MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
*addr = x; Atomic::store(x, addr);
} }
} }
#endif #endif
@ -875,10 +898,10 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
result = JVM_DefineClass(env, utfName, loader, body, length, pd); result = JVM_DefineClass(env, utfName, loader, body, length, pd);
if (utfName && utfName != buf) if (utfName && utfName != buf)
FREE_C_HEAP_ARRAY(char, utfName, mtInternal); FREE_C_HEAP_ARRAY(char, utfName);
free_body: free_body:
FREE_C_HEAP_ARRAY(jbyte, body, mtInternal); FREE_C_HEAP_ARRAY(jbyte, body);
return result; return result;
} }
} }
@ -1063,7 +1086,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jc
// try/finally clause: // try/finally clause:
if (temp_alloc != NULL) { if (temp_alloc != NULL) {
FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal); FREE_C_HEAP_ARRAY(HeapWord, temp_alloc);
} }
// The anonymous class loader data has been artificially been kept alive to // The anonymous class loader data has been artificially been kept alive to
@ -1152,14 +1175,19 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jo
UnsafeWrapper("Unsafe_CompareAndSwapLong"); UnsafeWrapper("Unsafe_CompareAndSwapLong");
Handle p (THREAD, JNIHandles::resolve(obj)); Handle p (THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset)); jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
#ifdef SUPPORTS_NATIVE_CX8
return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
#else
if (VM_Version::supports_cx8()) if (VM_Version::supports_cx8())
return (jlong)(Atomic::cmpxchg(x, addr, e)) == e; return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
else { else {
jboolean success = false; jboolean success = false;
ObjectLocker ol(p, THREAD); MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
if (*addr == e) { *addr = x; success = true; } jlong val = Atomic::load(addr);
if (val == e) { Atomic::store(x, addr); success = true; }
return success; return success;
} }
#endif
UNSAFE_END UNSAFE_END
UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time)) UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time))

View file

@ -70,39 +70,64 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
const char* desc = WhiteBox::lookup_jstring("desc", argument); const char* desc = WhiteBox::lookup_jstring("desc", argument);
const char* default_value = WhiteBox::lookup_jstring("defaultValue", argument); const char* default_value = WhiteBox::lookup_jstring("defaultValue", argument);
bool mandatory = WhiteBox::lookup_bool("mandatory", argument); bool mandatory = WhiteBox::lookup_bool("mandatory", argument);
bool isarg = WhiteBox::lookup_bool("argument", argument);
const char* type = lookup_diagnosticArgumentEnum("type", argument); const char* type = lookup_diagnosticArgumentEnum("type", argument);
if (strcmp(type, "STRING") == 0) { if (strcmp(type, "STRING") == 0) {
DCmdArgument<char*>* argument = new DCmdArgument<char*>( DCmdArgument<char*>* argument = new DCmdArgument<char*>(
name, desc, name, desc,
"STRING", mandatory, default_value); "STRING", mandatory, default_value);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
}
} else if (strcmp(type, "NANOTIME") == 0) { } else if (strcmp(type, "NANOTIME") == 0) {
DCmdArgument<NanoTimeArgument>* argument = new DCmdArgument<NanoTimeArgument>( DCmdArgument<NanoTimeArgument>* argument = new DCmdArgument<NanoTimeArgument>(
name, desc, name, desc,
"NANOTIME", mandatory, default_value); "NANOTIME", mandatory, default_value);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
}
} else if (strcmp(type, "JLONG") == 0) { } else if (strcmp(type, "JLONG") == 0) {
DCmdArgument<jlong>* argument = new DCmdArgument<jlong>( DCmdArgument<jlong>* argument = new DCmdArgument<jlong>(
name, desc, name, desc,
"JLONG", mandatory, default_value); "JLONG", mandatory, default_value);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
}
} else if (strcmp(type, "BOOLEAN") == 0) { } else if (strcmp(type, "BOOLEAN") == 0) {
DCmdArgument<bool>* argument = new DCmdArgument<bool>( DCmdArgument<bool>* argument = new DCmdArgument<bool>(
name, desc, name, desc,
"BOOLEAN", mandatory, default_value); "BOOLEAN", mandatory, default_value);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
}
} else if (strcmp(type, "MEMORYSIZE") == 0) { } else if (strcmp(type, "MEMORYSIZE") == 0) {
DCmdArgument<MemorySizeArgument>* argument = new DCmdArgument<MemorySizeArgument>( DCmdArgument<MemorySizeArgument>* argument = new DCmdArgument<MemorySizeArgument>(
name, desc, name, desc,
"MEMORY SIZE", mandatory, default_value); "MEMORY SIZE", mandatory, default_value);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
}
} else if (strcmp(type, "STRINGARRAY") == 0) { } else if (strcmp(type, "STRINGARRAY") == 0) {
DCmdArgument<StringArrayArgument*>* argument = new DCmdArgument<StringArrayArgument*>( DCmdArgument<StringArrayArgument*>* argument = new DCmdArgument<StringArrayArgument*>(
name, desc, name, desc,
"STRING SET", mandatory); "STRING SET", mandatory);
if (isarg) {
parser->add_dcmd_argument(argument);
} else {
parser->add_dcmd_option(argument); parser->add_dcmd_option(argument);
} }
}
} }
/* /*
@ -111,11 +136,12 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
* { name, value, name, value ... } * { name, value, name, value ... }
* This can then be checked from java. * This can then be checked from java.
*/ */
WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jobjectArray arguments)) WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jchar j_delim, jobjectArray arguments))
ResourceMark rm; ResourceMark rm;
DCmdParser parser; DCmdParser parser;
const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline)); const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline));
const char c_delim = j_delim & 0xff;
objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments)); objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments));
objArrayHandle argumentArray_ah(THREAD, argumentArray); objArrayHandle argumentArray_ah(THREAD, argumentArray);
@ -127,20 +153,29 @@ WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmd
} }
CmdLine cmdline(c_cmdline, strlen(c_cmdline), true); CmdLine cmdline(c_cmdline, strlen(c_cmdline), true);
parser.parse(&cmdline,',',CHECK_NULL); parser.parse(&cmdline,c_delim,CHECK_NULL);
Klass* k = SystemDictionary::Object_klass(); Klass* k = SystemDictionary::Object_klass();
objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL); objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL);
objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array); objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array);
GrowableArray<const char *>*parsedArgNames = parser.argument_name_array(); GrowableArray<const char *>*parsedArgNames = parser.argument_name_array();
GenDCmdArgument* arglist = parser.arguments_list();
for (int i = 0; i < parser.num_arguments(); i++) { for (int i = 0; i < parser.num_arguments(); i++) {
oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL); oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL);
returnvalue_array_ah->obj_at_put(i*2, parsedName); returnvalue_array_ah->obj_at_put(i*2, parsedName);
GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i))); GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i)));
if (!arg) {
arg = arglist;
arglist = arglist->next();
}
char buf[VALUE_MAXLEN]; char buf[VALUE_MAXLEN];
if (arg) {
arg->value_as_str(buf, sizeof(buf)); arg->value_as_str(buf, sizeof(buf));
} else {
sprintf(buf, "<null>");
}
oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL); oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL);
returnvalue_array_ah->obj_at_put(i*2+1, parsedValue); returnvalue_array_ah->obj_at_put(i*2+1, parsedValue);
} }

View file

@ -27,6 +27,6 @@
#include "prims/jni.h" #include "prims/jni.h"
#include "prims/whitebox.hpp" #include "prims/whitebox.hpp"
WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments); WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jchar delim, jobjectArray arguments);
#endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H #endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H

View file

@ -75,6 +75,9 @@ WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
return heapOopSize; return heapOopSize;
WB_END WB_END
WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
return os::vm_page_size();
WB_END
class WBIsKlassAliveClosure : public KlassClosure { class WBIsKlassAliveClosure : public KlassClosure {
Symbol* _name; Symbol* _name;
@ -318,7 +321,7 @@ WB_END
// Free the memory allocated by NMTAllocTest // Free the memory allocated by NMTAllocTest
WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem)) WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
os::free((void*)(uintptr_t)mem, mtTest); os::free((void*)(uintptr_t)mem);
WB_END WB_END
WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size)) WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
@ -744,7 +747,7 @@ WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring
env->ReleaseStringUTFChars(value, ccstrValue); env->ReleaseStringUTFChars(value, ccstrValue);
} }
if (needFree) { if (needFree) {
FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal); FREE_C_HEAP_ARRAY(char, ccstrResult);
} }
WB_END WB_END
@ -1124,9 +1127,10 @@ static JNINativeMethod methods[] = {
{CC"getObjectSize", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize }, {CC"getObjectSize", CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize },
{CC"isObjectInOldGen", CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen }, {CC"isObjectInOldGen", CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen },
{CC"getHeapOopSize", CC"()I", (void*)&WB_GetHeapOopSize }, {CC"getHeapOopSize", CC"()I", (void*)&WB_GetHeapOopSize },
{CC"getVMPageSize", CC"()I", (void*)&WB_GetVMPageSize },
{CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive }, {CC"isClassAlive0", CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive },
{CC"parseCommandLine", {CC"parseCommandLine",
CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;", CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
(void*) &WB_ParseCommandLine (void*) &WB_ParseCommandLine
}, },
{CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V", {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",

View file

@ -437,7 +437,7 @@ inline void SysClassPath::add_suffix(const char* suffix) {
inline void SysClassPath::reset_item_at(int index) { inline void SysClassPath::reset_item_at(int index) {
assert(index < _scp_nitems && index != _scp_base, "just checking"); assert(index < _scp_nitems && index != _scp_base, "just checking");
if (_items[index] != NULL) { if (_items[index] != NULL) {
FREE_C_HEAP_ARRAY(char, _items[index], mtInternal); FREE_C_HEAP_ARRAY(char, _items[index]);
_items[index] = NULL; _items[index] = NULL;
} }
} }
@ -473,7 +473,7 @@ void SysClassPath::expand_endorsed() {
memcpy(dirpath, path, tmp_end - path); memcpy(dirpath, path, tmp_end - path);
dirpath[tmp_end - path] = '\0'; dirpath[tmp_end - path] = '\0';
expanded_path = add_jars_to_path(expanded_path, dirpath); expanded_path = add_jars_to_path(expanded_path, dirpath);
FREE_C_HEAP_ARRAY(char, dirpath, mtInternal); FREE_C_HEAP_ARRAY(char, dirpath);
path = tmp_end + 1; path = tmp_end + 1;
} }
} }
@ -540,7 +540,7 @@ SysClassPath::add_to_path(const char* path, const char* str, bool prepend) {
cp_tmp += str_len; cp_tmp += str_len;
*cp_tmp = separator; *cp_tmp = separator;
memcpy(++cp_tmp, path, old_len + 1); // copy the trailing null memcpy(++cp_tmp, path, old_len + 1); // copy the trailing null
FREE_C_HEAP_ARRAY(char, path, mtInternal); FREE_C_HEAP_ARRAY(char, path);
} else { } else {
cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal); cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal);
char* cp_tmp = cp + old_len; char* cp_tmp = cp + old_len;
@ -575,10 +575,10 @@ char* SysClassPath::add_jars_to_path(char* path, const char* directory) {
char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal); char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal);
sprintf(jarpath, "%s%s%s", directory, dir_sep, name); sprintf(jarpath, "%s%s%s", directory, dir_sep, name);
path = add_to_path(path, jarpath, false); path = add_to_path(path, jarpath, false);
FREE_C_HEAP_ARRAY(char, jarpath, mtInternal); FREE_C_HEAP_ARRAY(char, jarpath);
} }
} }
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir); os::closedir(dir);
return path; return path;
} }
@ -713,7 +713,7 @@ static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
static bool set_string_flag(char* name, const char* value, Flag::Flags origin) { static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false; if (!CommandLineFlags::ccstrAtPut(name, &value, origin)) return false;
// Contract: CommandLineFlags always returns a pointer that needs freeing. // Contract: CommandLineFlags always returns a pointer that needs freeing.
FREE_C_HEAP_ARRAY(char, value, mtInternal); FREE_C_HEAP_ARRAY(char, value);
return true; return true;
} }
@ -737,10 +737,10 @@ static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags
} }
(void) CommandLineFlags::ccstrAtPut(name, &value, origin); (void) CommandLineFlags::ccstrAtPut(name, &value, origin);
// CommandLineFlags always returns a pointer that needs freeing. // CommandLineFlags always returns a pointer that needs freeing.
FREE_C_HEAP_ARRAY(char, value, mtInternal); FREE_C_HEAP_ARRAY(char, value);
if (free_this_too != NULL) { if (free_this_too != NULL) {
// CommandLineFlags made its own copy, so I must delete my own temp. buffer. // CommandLineFlags made its own copy, so I must delete my own temp. buffer.
FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal); FREE_C_HEAP_ARRAY(char, free_this_too);
} }
return true; return true;
} }

View file

@ -82,9 +82,9 @@ Deoptimization::UnrollBlock::UnrollBlock(int size_of_deoptimized_frame,
Deoptimization::UnrollBlock::~UnrollBlock() { Deoptimization::UnrollBlock::~UnrollBlock() {
FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes, mtCompiler); FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs, mtCompiler); FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
FREE_C_HEAP_ARRAY(intptr_t, _register_block, mtCompiler); FREE_C_HEAP_ARRAY(intptr_t, _register_block);
} }

View file

@ -66,7 +66,7 @@ class RegisteredProbes : public CHeapObj<mtInternal> {
_nmethods[i]->make_not_entrant(); _nmethods[i]->make_not_entrant();
_nmethods[i]->method()->clear_code(); _nmethods[i]->method()->clear_code();
} }
FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal); FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
_nmethods = NULL; _nmethods = NULL;
_count = 0; _count = 0;
} }

View file

@ -936,7 +936,7 @@ void FlatProfiler::record_thread_ticks() {
FlatProfiler::interval_reset(); FlatProfiler::interval_reset();
} }
FREE_C_HEAP_ARRAY(JavaThread *, threadsList, mtInternal); FREE_C_HEAP_ARRAY(JavaThread *, threadsList);
} else { } else {
// Couldn't get the threads lock, just record that rather than blocking // Couldn't get the threads lock, just record that rather than blocking
FlatProfiler::threads_lock_ticks += 1; FlatProfiler::threads_lock_ticks += 1;

View file

@ -840,7 +840,7 @@ void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, F
faddr->set_ccstr(new_value); faddr->set_ccstr(new_value);
if (!faddr->is_default() && old_value != NULL) { if (!faddr->is_default() && old_value != NULL) {
// Prior value is heap allocated so free it. // Prior value is heap allocated so free it.
FREE_C_HEAP_ARRAY(char, old_value, mtInternal); FREE_C_HEAP_ARRAY(char, old_value);
} }
faddr->set_origin(origin); faddr->set_origin(origin);
} }
@ -874,7 +874,7 @@ void CommandLineFlags::printSetFlags(outputStream* out) {
} }
} }
out->cr(); out->cr();
FREE_C_HEAP_ARRAY(Flag*, array, mtInternal); FREE_C_HEAP_ARRAY(Flag*, array);
} }
#ifndef PRODUCT #ifndef PRODUCT
@ -908,5 +908,5 @@ void CommandLineFlags::printFlags(outputStream* out, bool withComments) {
array[i]->print_on(out, withComments); array[i]->print_on(out, withComments);
} }
} }
FREE_C_HEAP_ARRAY(Flag*, array, mtInternal); FREE_C_HEAP_ARRAY(Flag*, array);
} }

View file

@ -179,11 +179,11 @@ void* HandleMark::operator new [] (size_t size) throw() {
} }
void HandleMark::operator delete(void* p) { void HandleMark::operator delete(void* p) {
FreeHeap(p, mtThread); FreeHeap(p);
} }
void HandleMark::operator delete[](void* p) { void HandleMark::operator delete[](void* p) {
FreeHeap(p, mtThread); FreeHeap(p);
} }
#ifdef ASSERT #ifdef ASSERT

View file

@ -136,6 +136,10 @@ Mutex* JfrStream_lock = NULL;
Mutex* JfrThreadGroups_lock = NULL; Mutex* JfrThreadGroups_lock = NULL;
#endif #endif
#ifndef SUPPORTS_NATIVE_CX8
Mutex* UnsafeJlong_lock = NULL;
#endif
#define MAX_NUM_MUTEX 128 #define MAX_NUM_MUTEX 128
static Monitor * _mutex_array[MAX_NUM_MUTEX]; static Monitor * _mutex_array[MAX_NUM_MUTEX];
static int _num_mutex; static int _num_mutex;
@ -286,6 +290,9 @@ void mutex_init() {
def(JfrStacktrace_lock , Mutex, special, true); def(JfrStacktrace_lock , Mutex, special, true);
#endif #endif
#ifndef SUPPORTS_NATIVE_CX8
def(UnsafeJlong_lock , Mutex, special, false);
#endif
} }
GCMutexLocker::GCMutexLocker(Monitor * mutex) { GCMutexLocker::GCMutexLocker(Monitor * mutex) {

View file

@ -136,6 +136,10 @@ extern Mutex* JfrStream_lock; // protects JFR stream access
extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups extern Mutex* JfrThreadGroups_lock; // protects JFR access to Thread Groups
#endif #endif
#ifndef SUPPORTS_NATIVE_CX8
extern Mutex* UnsafeJlong_lock; // provides Unsafe atomic updates to jlongs on platforms that don't support cx8
#endif
// A MutexLocker provides mutual exclusion with respect to a given mutex // A MutexLocker provides mutual exclusion with respect to a given mutex
// for the scope which contains the locker. The lock is an OS lock, not // for the scope which contains the locker. The lock is an OS lock, not
// an object lock, and the two do not interoperate. Do not use Mutex-based // an object lock, and the two do not interoperate. Do not use Mutex-based

View file

@ -207,7 +207,7 @@ class ObjectMonitor {
return operator new (size); return operator new (size);
} }
void operator delete(void* p) { void operator delete(void* p) {
FreeHeap(p, mtInternal); FreeHeap(p);
} }
void operator delete[] (void *p) { void operator delete[] (void *p) {
operator delete(p); operator delete(p);

View file

@ -473,7 +473,7 @@ void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
break; break;
} }
entryName = dll_lookup(handle, agent_function_name); entryName = dll_lookup(handle, agent_function_name);
FREE_C_HEAP_ARRAY(char, agent_function_name, mtThread); FREE_C_HEAP_ARRAY(char, agent_function_name);
if (entryName != NULL) { if (entryName != NULL) {
break; break;
} }
@ -689,7 +689,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
} }
void os::free(void *memblock, MEMFLAGS memflags) { void os::free(void *memblock) {
NOT_PRODUCT(inc_stat_counter(&num_frees, 1)); NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
#ifdef ASSERT #ifdef ASSERT
if (memblock == NULL) return; if (memblock == NULL) return;
@ -1211,7 +1211,7 @@ static char* expand_entries_to_path(char* directory, char fileSep, char pathSep)
path_len = new_len; path_len = new_len;
} }
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal); FREE_C_HEAP_ARRAY(char, dbuf);
os::closedir(dir); os::closedir(dir);
return path; return path;
@ -1236,7 +1236,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
if (rt_jar == NULL) return false; if (rt_jar == NULL) return false;
struct stat st; struct stat st;
bool has_rt_jar = (os::stat(rt_jar, &st) == 0); bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal); FREE_C_HEAP_ARRAY(char, rt_jar);
if (has_rt_jar) { if (has_rt_jar) {
// Any modification to the JAR-file list, for the boot classpath must be // Any modification to the JAR-file list, for the boot classpath must be
@ -1320,7 +1320,7 @@ char** os::split_path(const char* path, int* n) {
opath[i] = s; opath[i] = s;
p += len + 1; p += len + 1;
} }
FREE_C_HEAP_ARRAY(char, inpath, mtInternal); FREE_C_HEAP_ARRAY(char, inpath);
*n = count; *n = count;
return opath; return opath;
} }

View file

@ -663,7 +663,7 @@ class os: AllStatic {
static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack); static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
static void* realloc (void *memblock, size_t size, MEMFLAGS flag); static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
static void free (void *memblock, MEMFLAGS flags = mtNone); static void free (void *memblock);
static bool check_heap(bool force = false); // verify C heap integrity static bool check_heap(bool force = false); // verify C heap integrity
static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup static char* strdup(const char *, MEMFLAGS flags = mtInternal); // Like strdup
// Like strdup, but exit VM when strdup() returns NULL // Like strdup, but exit VM when strdup() returns NULL

View file

@ -113,10 +113,10 @@ PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v)
PerfData::~PerfData() { PerfData::~PerfData() {
if (_name != NULL) { if (_name != NULL) {
FREE_C_HEAP_ARRAY(char, _name, mtInternal); FREE_C_HEAP_ARRAY(char, _name);
} }
if (is_on_c_heap()) { if (is_on_c_heap()) {
FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep, mtInternal); FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep);
} }
} }

View file

@ -250,7 +250,7 @@ char* PerfMemory::get_perfdata_file_path() {
dest_file = NEW_C_HEAP_ARRAY(char, JVM_MAXPATHLEN, mtInternal); dest_file = NEW_C_HEAP_ARRAY(char, JVM_MAXPATHLEN, mtInternal);
if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile), if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
dest_file, JVM_MAXPATHLEN)) { dest_file, JVM_MAXPATHLEN)) {
FREE_C_HEAP_ARRAY(char, dest_file, mtInternal); FREE_C_HEAP_ARRAY(char, dest_file);
if (PrintMiscellaneous && Verbose) { if (PrintMiscellaneous && Verbose) {
warning("Invalid performance data file path name specified, "\ warning("Invalid performance data file path name specified, "\
"fall back to a default name"); "fall back to a default name");

View file

@ -2084,7 +2084,7 @@ class AdapterFingerPrint : public CHeapObj<mtCode> {
~AdapterFingerPrint() { ~AdapterFingerPrint() {
if (_length > 0) { if (_length > 0) {
FREE_C_HEAP_ARRAY(int, _value._fingerprint, mtCode); FREE_C_HEAP_ARRAY(int, _value._fingerprint);
} }
} }
@ -2491,7 +2491,7 @@ void AdapterHandlerEntry::relocate(address new_base) {
void AdapterHandlerEntry::deallocate() { void AdapterHandlerEntry::deallocate() {
delete _fingerprint; delete _fingerprint;
#ifdef ASSERT #ifdef ASSERT
if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode); if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
#endif #endif
} }
@ -2902,7 +2902,7 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
JRT_END JRT_END
JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) ) JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode); FREE_C_HEAP_ARRAY(intptr_t, buf);
JRT_END JRT_END
bool AdapterHandlerLibrary::contains(CodeBlob* b) { bool AdapterHandlerLibrary::contains(CodeBlob* b) {

View file

@ -171,9 +171,9 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
void Thread::operator delete(void* p) { void Thread::operator delete(void* p) {
if (UseBiasedLocking) { if (UseBiasedLocking) {
void* real_malloc_addr = ((Thread*) p)->_real_malloc_address; void* real_malloc_addr = ((Thread*) p)->_real_malloc_address;
FreeHeap(real_malloc_addr, mtThread); FreeHeap(real_malloc_addr);
} else { } else {
FreeHeap(p, mtThread); FreeHeap(p);
} }
} }
@ -1146,7 +1146,7 @@ NamedThread::NamedThread() : Thread() {
NamedThread::~NamedThread() { NamedThread::~NamedThread() {
if (_name != NULL) { if (_name != NULL) {
FREE_C_HEAP_ARRAY(char, _name, mtThread); FREE_C_HEAP_ARRAY(char, _name);
_name = NULL; _name = NULL;
} }
} }
@ -2998,7 +2998,7 @@ WordSize JavaThread::popframe_preserved_args_size_in_words() {
void JavaThread::popframe_free_preserved_args() { void JavaThread::popframe_free_preserved_args() {
assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice"); assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice");
FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args, mtThread); FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args);
_popframe_preserved_args = NULL; _popframe_preserved_args = NULL;
_popframe_preserved_args_size = 0; _popframe_preserved_args_size = 0;
} }
@ -3608,7 +3608,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
// If we can't find the agent, exit. // If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL); vm_exit_during_initialization(buf, NULL);
FREE_C_HEAP_ARRAY(char, buf, mtThread); FREE_C_HEAP_ARRAY(char, buf);
} }
} else { } else {
// Try to load the agent from the standard dll directory // Try to load the agent from the standard dll directory
@ -3628,7 +3628,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf); jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
// If we can't find the agent, exit. // If we can't find the agent, exit.
vm_exit_during_initialization(buf, NULL); vm_exit_during_initialization(buf, NULL);
FREE_C_HEAP_ARRAY(char, buf, mtThread); FREE_C_HEAP_ARRAY(char, buf);
} }
} }
} }

View file

@ -3268,10 +3268,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0'; s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) { if (recursiveFindType(origtypes, s, true) == 1) {
FREE_C_HEAP_ARRAY(char, s, mtInternal); FREE_C_HEAP_ARRAY(char, s);
return 1; return 1;
} }
FREE_C_HEAP_ARRAY(char, s, mtInternal); FREE_C_HEAP_ARRAY(char, s);
} }
const char* start = NULL; const char* start = NULL;
if (strstr(typeName, "GrowableArray<") == typeName) { if (strstr(typeName, "GrowableArray<") == typeName) {
@ -3287,10 +3287,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0'; s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) { if (recursiveFindType(origtypes, s, true) == 1) {
FREE_C_HEAP_ARRAY(char, s, mtInternal); FREE_C_HEAP_ARRAY(char, s);
return 1; return 1;
} }
FREE_C_HEAP_ARRAY(char, s, mtInternal); FREE_C_HEAP_ARRAY(char, s);
} }
if (strstr(typeName, "const ") == typeName) { if (strstr(typeName, "const ") == typeName) {
const char * s = typeName + strlen("const "); const char * s = typeName + strlen("const ");

View file

@ -348,7 +348,7 @@ static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream*
} }
bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND); bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
if (res) { if (res) {
FREE_C_HEAP_ARRAY(char, value, mtInternal); FREE_C_HEAP_ARRAY(char, value);
} else { } else {
out->print_cr("setting flag %s failed", name); out->print_cr("setting flag %s failed", name);
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2011, 2014, 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
@ -174,7 +174,7 @@ template <> void DCmdArgument<char*>::init_value(TRAPS) {
template <> void DCmdArgument<char*>::destroy_value() { template <> void DCmdArgument<char*>::destroy_value() {
if (_value != NULL) { if (_value != NULL) {
FREE_C_HEAP_ARRAY(char, _value, mtInternal); FREE_C_HEAP_ARRAY(char, _value);
set_value(NULL); set_value(NULL);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2014, 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
@ -53,7 +53,7 @@ public:
~StringArrayArgument() { ~StringArrayArgument() {
for (int i=0; i<_array->length(); i++) { for (int i=0; i<_array->length(); i++) {
if(_array->at(i) != NULL) { // Safety check if(_array->at(i) != NULL) { // Safety check
FREE_C_HEAP_ARRAY(char, _array->at(i), mtInternal); FREE_C_HEAP_ARRAY(char, _array->at(i));
} }
} }
delete _array; delete _array;

View file

@ -60,16 +60,15 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) {
bool DCmdArgIter::next(TRAPS) { bool DCmdArgIter::next(TRAPS) {
if (_len == 0) return false; if (_len == 0) return false;
// skipping spaces // skipping delimiters
while (_cursor < _len - 1 && _buffer[_cursor] == _delim) { while (_cursor < _len - 1 && _buffer[_cursor] == _delim) {
_cursor++; _cursor++;
} }
// handling end of command line // handling end of command line
if (_cursor >= _len - 1) { if (_cursor == _len - 1 && _buffer[_cursor] == _delim) {
_cursor = _len - 1; _key_addr = &_buffer[_cursor];
_key_addr = &_buffer[_len - 1];
_key_len = 0; _key_len = 0;
_value_addr = &_buffer[_len - 1]; _value_addr = &_buffer[_cursor];
_value_len = 0; _value_len = 0;
return false; return false;
} }

View file

@ -1404,7 +1404,7 @@ class VM_HeapDumper : public VM_GC_Operation {
for (int i=0; i < _num_threads; i++) { for (int i=0; i < _num_threads; i++) {
delete _stack_traces[i]; delete _stack_traces[i];
} }
FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces, mtInternal); FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces);
} }
delete _klass_map; delete _klass_map;
} }

View file

@ -1744,7 +1744,7 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value
ccstr svalue = java_lang_String::as_utf8_string(str); ccstr svalue = java_lang_String::as_utf8_string(str);
succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT); succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
if (succeed) { if (succeed) {
FREE_C_HEAP_ARRAY(char, svalue, mtInternal); FREE_C_HEAP_ARRAY(char, svalue);
} }
} }
assert(succeed, "Setting flag should succeed"); assert(succeed, "Setting flag should succeed");
@ -1819,7 +1819,7 @@ ThreadTimesClosure::~ThreadTimesClosure() {
for (int i = 0; i < _count; i++) { for (int i = 0; i < _count; i++) {
os::free(_names_chars[i]); os::free(_names_chars[i]);
} }
FREE_C_HEAP_ARRAY(char *, _names_chars, mtInternal); FREE_C_HEAP_ARRAY(char *, _names_chars);
} }
// Fills names with VM internal thread names and times with the corresponding // Fills names with VM internal thread names and times with the corresponding

View file

@ -171,8 +171,8 @@ GCStatInfo::GCStatInfo(int num_pools) {
} }
GCStatInfo::~GCStatInfo() { GCStatInfo::~GCStatInfo() {
FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array, mtInternal); FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array, mtInternal); FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
} }
void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) { void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2000, 2014, 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
@ -66,7 +66,7 @@ template <MEMFLAGS F> void CHeapArray<F>::expand(size_t esize, int i, int& size)
// allocate and initialize new data section // allocate and initialize new data section
void* data = NEW_C_HEAP_ARRAY(char*, esize * size, F); void* data = NEW_C_HEAP_ARRAY(char*, esize * size, F);
memcpy(data, _data, esize * length()); memcpy(data, _data, esize * length());
FREE_C_HEAP_ARRAY(char*, _data, F); FREE_C_HEAP_ARRAY(char*, _data);
_data = data; _data = data;
} }

View file

@ -468,7 +468,7 @@ void BitMap::init_pop_count_table() {
(intptr_t) NULL_WORD); (intptr_t) NULL_WORD);
if (res != NULL_WORD) { if (res != NULL_WORD) {
guarantee( _pop_count_table == (void*) res, "invariant" ); guarantee( _pop_count_table == (void*) res, "invariant" );
FREE_C_HEAP_ARRAY(idx_t, table, mtInternal); FREE_C_HEAP_ARRAY(idx_t, table);
} }
} }
} }

View file

@ -149,7 +149,7 @@ template <MEMFLAGS F> void BasicHashtable<F>::free_buckets() {
// allocated by os::malloc // allocated by os::malloc
if (!UseSharedSpaces || if (!UseSharedSpaces ||
!FileMapInfo::current_info()->is_in_shared_space(_buckets)) { !FileMapInfo::current_info()->is_in_shared_space(_buckets)) {
FREE_C_HEAP_ARRAY(HashtableBucket, _buckets, F); FREE_C_HEAP_ARRAY(HashtableBucket, _buckets);
} }
_buckets = NULL; _buckets = NULL;
} }

View file

@ -139,7 +139,7 @@ TruncatedSeq::TruncatedSeq(int length, double alpha):
} }
TruncatedSeq::~TruncatedSeq() { TruncatedSeq::~TruncatedSeq() {
FREE_C_HEAP_ARRAY(double, _sequence, mtGC); FREE_C_HEAP_ARRAY(double, _sequence);
} }
void TruncatedSeq::add(double val) { void TruncatedSeq::add(double val) {

View file

@ -498,37 +498,37 @@ void test_loggc_filename() {
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test.log", tms); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test.log", tms);
o_result = make_log_name_internal("test.log", NULL, pid, tms); o_result = make_log_name_internal("test.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
// test-%t-%p.log // test-%t-%p.log
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%s-pid%u.log", tms, pid); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%s-pid%u.log", tms, pid);
o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms); o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
// test-%t%p.log // test-%t%p.log
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%spid%u.log", tms, pid); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%spid%u.log", tms, pid);
o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms); o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
// %p%t.log // %p%t.log
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u%s.log", pid, tms); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u%s.log", pid, tms);
o_result = make_log_name_internal("%p%t.log", NULL, pid, tms); o_result = make_log_name_internal("%p%t.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
// %p-test.log // %p-test.log
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u-test.log", pid); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u-test.log", pid);
o_result = make_log_name_internal("%p-test.log", NULL, pid, tms); o_result = make_log_name_internal("%p-test.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
// %t.log // %t.log
jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "%s.log", tms); jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "%s.log", tms);
o_result = make_log_name_internal("%t.log", NULL, pid, tms); o_result = make_log_name_internal("%t.log", NULL, pid, tms);
assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)"); assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)");
FREE_C_HEAP_ARRAY(char, o_result, mtInternal); FREE_C_HEAP_ARRAY(char, o_result);
} }
#endif // PRODUCT #endif // PRODUCT
@ -627,7 +627,7 @@ gcLogFileStream::~gcLogFileStream() {
_file = NULL; _file = NULL;
} }
if (_file_name != NULL) { if (_file_name != NULL) {
FREE_C_HEAP_ARRAY(char, _file_name, mtInternal); FREE_C_HEAP_ARRAY(char, _file_name);
_file_name = NULL; _file_name = NULL;
} }
} }
@ -829,7 +829,7 @@ void defaultStream::init_log() {
"Warning: Cannot open log file: %s\n", try_name); "Warning: Cannot open log file: %s\n", try_name);
// Note: This feature is for maintainer use only. No need for L10N. // Note: This feature is for maintainer use only. No need for L10N.
jio_print(warnbuf); jio_print(warnbuf);
FREE_C_HEAP_ARRAY(char, try_name, mtInternal); FREE_C_HEAP_ARRAY(char, try_name);
try_name = make_log_name(log_name, os::get_temp_directory()); try_name = make_log_name(log_name, os::get_temp_directory());
jio_snprintf(warnbuf, sizeof(warnbuf), jio_snprintf(warnbuf, sizeof(warnbuf),
"Warning: Forcing option -XX:LogFile=%s\n", try_name); "Warning: Forcing option -XX:LogFile=%s\n", try_name);
@ -837,7 +837,7 @@ void defaultStream::init_log() {
delete file; delete file;
file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name); file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
} }
FREE_C_HEAP_ARRAY(char, try_name, mtInternal); FREE_C_HEAP_ARRAY(char, try_name);
if (file->is_open()) { if (file->is_open()) {
_log_file = file; _log_file = file;
@ -1121,7 +1121,7 @@ void ostream_init_log() {
const char* list_name = make_log_name(DumpLoadedClassList, NULL); const char* list_name = make_log_name(DumpLoadedClassList, NULL);
classlist_file = new(ResourceObj::C_HEAP, mtInternal) classlist_file = new(ResourceObj::C_HEAP, mtInternal)
fileStream(list_name); fileStream(list_name);
FREE_C_HEAP_ARRAY(char, list_name, mtInternal); FREE_C_HEAP_ARRAY(char, list_name);
} }
#endif #endif
@ -1274,7 +1274,7 @@ char* bufferedStream::as_string() {
bufferedStream::~bufferedStream() { bufferedStream::~bufferedStream() {
if (!buffer_fixed) { if (!buffer_fixed) {
FREE_C_HEAP_ARRAY(char, buffer, mtInternal); FREE_C_HEAP_ARRAY(char, buffer);
} }
} }

View file

@ -214,8 +214,8 @@ void QuickSort::test_quick_sort() {
sort(test_array, length, test_even_odd_comparator, true); sort(test_array, length, test_even_odd_comparator, true);
assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent"); assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
FREE_C_HEAP_ARRAY(int, test_array, mtInternal); FREE_C_HEAP_ARRAY(int, test_array);
FREE_C_HEAP_ARRAY(int, expected_array, mtInternal); FREE_C_HEAP_ARRAY(int, expected_array);
} }
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2014, 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
@ -145,7 +145,7 @@ E* Stack<E, F>::alloc(size_t bytes)
template <class E, MEMFLAGS F> template <class E, MEMFLAGS F>
void Stack<E, F>::free(E* addr, size_t bytes) void Stack<E, F>::free(E* addr, size_t bytes)
{ {
FREE_C_HEAP_ARRAY(char, (char*) addr, F); FREE_C_HEAP_ARRAY(char, (char*) addr);
} }
template <class E, MEMFLAGS F> template <class E, MEMFLAGS F>

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2001, 2014, 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
@ -427,7 +427,7 @@ bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
template<class E, MEMFLAGS F, unsigned int N> template<class E, MEMFLAGS F, unsigned int N>
GenericTaskQueue<E, F, N>::~GenericTaskQueue() { GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
FREE_C_HEAP_ARRAY(E, _elems, F); FREE_C_HEAP_ARRAY(E, _elems);
} }
// OverflowTaskQueue is a TaskQueue that also includes an overflow stack for // OverflowTaskQueue is a TaskQueue that also includes an overflow stack for

View file

@ -489,7 +489,7 @@ void SubTasksDone::all_tasks_completed() {
SubTasksDone::~SubTasksDone() { SubTasksDone::~SubTasksDone() {
if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks, mtInternal); if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks);
} }
// *** SequentialSubTasksDone // *** SequentialSubTasksDone
@ -560,7 +560,7 @@ FreeIdSet::FreeIdSet(int sz, Monitor* mon) :
FreeIdSet::~FreeIdSet() { FreeIdSet::~FreeIdSet() {
_sets[_index] = NULL; _sets[_index] = NULL;
FREE_C_HEAP_ARRAY(int, _ids, mtInternal); FREE_C_HEAP_ARRAY(int, _ids);
} }
void FreeIdSet::set_safepoint(bool b) { void FreeIdSet::set_safepoint(bool b) {

View file

@ -58,7 +58,7 @@ void xmlStream::initialize(outputStream* out) {
#ifdef ASSERT #ifdef ASSERT
xmlStream::~xmlStream() { xmlStream::~xmlStream() {
FREE_C_HEAP_ARRAY(char, _element_close_stack_low, mtInternal); FREE_C_HEAP_ARRAY(char, _element_close_stack_low);
} }
#endif #endif
@ -162,7 +162,7 @@ void xmlStream::see_tag(const char* tag, bool push) {
_element_close_stack_high = new_high; _element_close_stack_high = new_high;
_element_close_stack_low = new_low; _element_close_stack_low = new_low;
_element_close_stack_ptr = new_ptr; _element_close_stack_ptr = new_ptr;
FREE_C_HEAP_ARRAY(char, old_low, mtInternal); FREE_C_HEAP_ARRAY(char, old_low);
push_ptr = new_ptr - (tag_len+1); push_ptr = new_ptr - (tag_len+1);
} }
assert(push_ptr >= _element_close_stack_low, "in range"); assert(push_ptr >= _element_close_stack_low, "in range");

View file

@ -0,0 +1,46 @@
/*
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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
* @summary Using WhiteBox to get VM page size
* @library /testlibrary /testlibrary/whitebox
* @build ReadVMPageSize
* @run main ClassFileInstaller sun.hotspot.WhiteBox
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI ReadVMPageSize
*/
import com.oracle.java.testlibrary.*;
import sun.hotspot.WhiteBox;
public class ReadVMPageSize {
public static void main(String args[]) throws Exception {
WhiteBox wb = WhiteBox.getWhiteBox();
int pageSize = wb.getVMPageSize();
if (pageSize < 0) {
throw new Exception("pageSize < 0");
} else {
System.out.println("Page size = " + pageSize);
}
}
}

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