This commit is contained in:
J. Duke 2017-07-05 18:16:35 +02:00
commit 60632a1c47
336 changed files with 8020 additions and 1670 deletions

View File

@ -168,3 +168,4 @@ a2b2d435f1d275fa8010774c653197c64e326d3a jdk8-b40
e4f81a817447c3a4f6868f083c81c2fb1b15d44c jdk8-b44
633f2378c904c92bb922a6e19e9f62fe8eac14af jdk8-b45
27fa766a2298ba8347dc198f0cf85ba6618e17db jdk8-b46
1dcb4b7b9373e64e135c12fe1f8699f1f80e51e8 jdk8-b47

View File

@ -259,3 +259,5 @@ e77b8e0ed1f84e3e268239e276c7ab64fa573baa jdk8-b43
9d5f20961bc5846fa8d098d534effafbbdae0a58 jdk8-b45
40e5a3f2907ed02b335c7caa8ecf068cc801380d hs24-b15
cf37a594c38db2ea926954154636f9f81da2e032 jdk8-b46
0c7bb1f4f9c8062b5c5bfa56b3bdca44839b4109 jdk8-b47
66b0450071c1534e014b131892cc86b63f1d009c hs24-b16

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2002, 2012, 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
@ -688,8 +688,7 @@ implements ReferenceType {
if (sde == null) {
String extension = null;
if (saKlass instanceof InstanceKlass) {
Symbol sdeSym = ((InstanceKlass)saKlass).getSourceDebugExtension();
extension = (sdeSym != null)? sdeSym.asString() : null;
extension = ((InstanceKlass)saKlass).getSourceDebugExtension();
}
if (extension == null) {
sde = NO_SDE_INFO_MARK;

View File

@ -342,7 +342,7 @@ public class InstanceKlass extends Klass {
public Oop getProtectionDomain() { return protectionDomain.getValue(this); }
public ObjArray getSigners() { return (ObjArray) signers.getValue(this); }
public Symbol getSourceFileName() { return getSymbol(sourceFileName); }
public Symbol getSourceDebugExtension(){ return getSymbol(sourceDebugExtension); }
public String getSourceDebugExtension(){ return CStringUtilities.getString(sourceDebugExtension.getValue(getHandle())); }
public TypeArray getInnerClasses() { return (TypeArray) innerClasses.getValue(this); }
public long getNonstaticFieldSize() { return nonstaticFieldSize.getValue(this); }
public long getStaticOopFieldCount() { return staticOopFieldCount.getValue(this); }

View File

@ -41,10 +41,10 @@ public class BasicHashtable extends VMObject {
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("BasicHashtable");
Type type = db.lookupType("BasicHashtable<mtInternal>");
tableSizeField = type.getCIntegerField("_table_size");
bucketsField = type.getAddressField("_buckets");
bucketSize = db.lookupType("HashtableBucket").getSize();
bucketSize = db.lookupType("HashtableBucket<mtInternal>").getSize();
}
// Fields

View File

@ -41,7 +41,7 @@ public class BasicHashtableEntry extends VMObject {
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("BasicHashtableEntry");
Type type = db.lookupType("BasicHashtableEntry<mtInternal>");
hashField = type.getCIntegerField("_hash");
nextField = type.getAddressField("_next");
}

View File

@ -40,7 +40,7 @@ public class Hashtable extends BasicHashtable {
private static synchronized void initialize(TypeDataBase db) {
// just to confirm that type exists
Type type = db.lookupType("Hashtable<intptr_t>");
Type type = db.lookupType("IntptrHashtable");
}
// derived class may return Class<? extends HashtableEntry>

View File

@ -39,7 +39,7 @@ public class HashtableBucket extends VMObject {
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HashtableBucket");
Type type = db.lookupType("HashtableBucket<mtInternal>");
entryField = type.getAddressField("_entry");
}

View File

@ -41,7 +41,7 @@ public class HashtableEntry extends BasicHashtableEntry {
}
private static synchronized void initialize(TypeDataBase db) {
Type type = db.lookupType("HashtableEntry<intptr_t>");
Type type = db.lookupType("IntptrHashtableEntry");
literalField = type.getAddressField("_literal");
}

View File

@ -27,7 +27,9 @@
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS)
DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@))
CFLAGS += $(DEBUG_CFLAGS/BYFILE)
# _NMT_NOINLINE_ informs NMT that no inlining by Compiler
CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_
# Set the environment variable HOTSPARC_GENERIC to "true"
# to inhibit the effect of the previous line on CFLAGS.

View File

@ -35,7 +35,7 @@ HOTSPOT_VM_COPYRIGHT=Copyright 2012
HS_MAJOR_VER=24
HS_MINOR_VER=0
HS_BUILD_NUMBER=15
HS_BUILD_NUMBER=16
JDK_MAJOR_VER=1
JDK_MINOR_VER=8

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,7 +27,9 @@
# Compiler specific DEBUG_CFLAGS are passed in from gcc.make, sparcWorks.make
DEBUG_CFLAGS/DEFAULT= $(DEBUG_CFLAGS)
DEBUG_CFLAGS/BYFILE = $(DEBUG_CFLAGS/$@)$(DEBUG_CFLAGS/DEFAULT$(DEBUG_CFLAGS/$@))
CFLAGS += $(DEBUG_CFLAGS/BYFILE)
# _NMT_NOINLINE_ informs NMT that no inlining by Compiler
CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_
# Set the environment variable HOTSPARC_GENERIC to "true"
# to inhibit the effect of the previous line on CFLAGS.

View File

@ -37,7 +37,8 @@ ifeq ($(COMPILER_REV_NUMERIC),508)
endif
endif
CFLAGS += $(DEBUG_CFLAGS/BYFILE)
# _NMT_NOINLINE_ informs NMT that no inlining by Compiler
CFLAGS += $(DEBUG_CFLAGS/BYFILE) -D_NMT_NOINLINE_
# Set the environment variable HOTSPARC_GENERIC to "true"
# to inhibit the effect of the previous line on CFLAGS.

View File

@ -38,7 +38,8 @@ default:: $(BUILD_PCH_FILE) $(AOUT) launcher checkAndBuildSA wb
!include ../local.make
!include compile.make
CXX_FLAGS=$(CXX_FLAGS) $(DEBUG_OPT_OPTION)
# _NMT_NOINLINE_ informs NMT that no inlining by Compiler
CXX_FLAGS=$(CXX_FLAGS) $(DEBUG_OPT_OPTION) /D "_NMT_NOINLINE_"
!include $(WorkSpace)/make/windows/makefiles/vm.make
!include local.make

View File

@ -440,7 +440,7 @@ void os::init_system_properties_values() {
// code needs to be changed accordingly.
// The next few definitions allow the code to be verbatim:
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n))
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal)
#define getenv(n) ::getenv(n)
/*
@ -1913,11 +1913,11 @@ void os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0 ; i < n ; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i]);
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
}
if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements);
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
}
} else {
snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
@ -2766,7 +2766,7 @@ void bsd_wrap_code(char* base, size_t size) {
// All it does is to check if there are enough free pages
// left at the time of mmap(). This could be a potential
// problem.
bool os::commit_memory(char* addr, size_t size, bool exec) {
bool os::pd_commit_memory(char* addr, size_t size, bool exec) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
#ifdef __OpenBSD__
// XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD
@ -2790,7 +2790,7 @@ bool os::commit_memory(char* addr, size_t size, bool exec) {
#endif
#endif
bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
bool os::pd_commit_memory(char* addr, size_t size, size_t alignment_hint,
bool exec) {
#ifndef _ALLBSD_SOURCE
if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
@ -2806,7 +2806,7 @@ bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
return commit_memory(addr, size, exec);
}
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
#ifndef _ALLBSD_SOURCE
if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
// We don't check the return value: madvise(MADV_HUGEPAGE) may not
@ -2816,7 +2816,7 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
#endif
}
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
void os::pd_free_memory(char *addr, size_t bytes, size_t alignment_hint) {
::madvise(addr, bytes, MADV_DONTNEED);
}
@ -2958,7 +2958,7 @@ os::Bsd::numa_interleave_memory_func_t os::Bsd::_numa_interleave_memory;
unsigned long* os::Bsd::_numa_all_nodes;
#endif
bool os::uncommit_memory(char* addr, size_t size) {
bool os::pd_uncommit_memory(char* addr, size_t size) {
#ifdef __OpenBSD__
// XXX: Work-around mmap/MAP_FIXED bug temporarily on OpenBSD
return ::mprotect(addr, size, PROT_NONE) == 0;
@ -2969,7 +2969,7 @@ bool os::uncommit_memory(char* addr, size_t size) {
#endif
}
bool os::create_stack_guard_pages(char* addr, size_t size) {
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
return os::commit_memory(addr, size);
}
@ -3023,12 +3023,12 @@ static int anon_munmap(char * addr, size_t size) {
return ::munmap(addr, size) == 0;
}
char* os::reserve_memory(size_t bytes, char* requested_addr,
char* os::pd_reserve_memory(size_t bytes, char* requested_addr,
size_t alignment_hint) {
return anon_mmap(requested_addr, bytes, (requested_addr != NULL));
}
bool os::release_memory(char* addr, size_t size) {
bool os::pd_release_memory(char* addr, size_t size) {
return anon_munmap(addr, size);
}
@ -3331,7 +3331,7 @@ bool os::can_execute_large_page_memory() {
// Reserve memory at an arbitrary address, only if that area is
// available (and not reserved for something else).
char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
const int max_tries = 10;
char* base[max_tries];
size_t size[max_tries];
@ -4987,7 +4987,7 @@ int os::socket_available(int fd, jint *pbytes) {
}
// Map a block of memory.
char* os::map_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
int prot;
@ -5019,7 +5019,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset,
// Remap a block of memory.
char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
// same as map_memory() on this OS
@ -5029,7 +5029,7 @@ char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
// Unmap a block of memory.
bool os::unmap_memory(char* addr, size_t bytes) {
bool os::pd_unmap_memory(char* addr, size_t bytes) {
return munmap(addr, bytes) == 0;
}
@ -5801,3 +5801,14 @@ bool os::is_headless_jre() {
return true;
}
// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
int n = jio_snprintf(buffer, bufferSize, "/cores");
// Truncate if theoretical string was longer than bufferSize
n = MIN2(n, (int)bufferSize);
return n;
}

View File

@ -312,7 +312,7 @@ public:
};
class PlatformEvent : public CHeapObj {
class PlatformEvent : public CHeapObj<mtInternal> {
private:
double CachePad [4] ; // increase odds that _mutex is sole occupant of cache line
volatile int _Event ;
@ -347,7 +347,7 @@ class PlatformEvent : public CHeapObj {
void SetAssociation (Thread * a) { _Assoc = a ; }
} ;
class PlatformParker : public CHeapObj {
class PlatformParker : public CHeapObj<mtInternal> {
protected:
pthread_mutex_t _mutex [1] ;
pthread_cond_t _cond [1] ;

View File

@ -95,7 +95,7 @@ inline bool os::allocate_stack_guard_pages() {
// On Bsd, reservations are made on a page by page basis, nothing to do.
inline void os::split_reserved_memory(char *base, size_t size,
inline void os::pd_split_reserved_memory(char *base, size_t size,
size_t split, bool realloc) {
}

View File

@ -126,7 +126,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
FREE_C_HEAP_ARRAY(char, destfile);
FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
}
@ -153,7 +153,7 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
// construct the path name to user specific tmp directory
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
@ -246,7 +246,7 @@ static char* get_user_name(uid_t uid) {
if (bufsize == -1)
bufsize = 1024;
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize);
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// POSIX interface to getpwuid_r is used on LINUX
struct passwd* p;
@ -278,14 +278,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1);
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return user_name;
}
@ -328,7 +328,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// to determine the user name for the process id.
//
struct dirent* dentry;
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname));
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
errno = 0;
while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
@ -338,7 +338,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strlen(tmpdirname) + strlen(dentry->d_name) + 2, mtInternal);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "/");
strcat(usrdir_name, dentry->d_name);
@ -346,7 +346,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
continue;
}
@ -357,13 +357,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
os::closedir(subdirp);
continue;
}
struct dirent* udentry;
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name));
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
errno = 0;
while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
@ -372,7 +372,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
int result;
char* filename = NEW_C_HEAP_ARRAY(char,
strlen(usrdir_name) + strlen(udentry->d_name) + 2);
strlen(usrdir_name) + strlen(udentry->d_name) + 2, mtInternal);
strcpy(filename, usrdir_name);
strcat(filename, "/");
@ -381,13 +381,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
@ -397,23 +397,23 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
oldest_ctime = statbuf.st_ctime;
}
}
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
}
}
os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
}
os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
return(oldest_user);
}
@ -434,7 +434,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
// add 2 for the file separator and a null terminator.
size_t nbytes = strlen(dirname) + UINT_CHARS + 2;
char* name = NEW_C_HEAP_ARRAY(char, nbytes);
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
snprintf(name, nbytes, "%s/%d", dirname, vmid);
return name;
@ -472,7 +472,7 @@ static void remove_file(const char* path) {
static void remove_file(const char* dirname, const char* filename) {
size_t nbytes = strlen(dirname) + strlen(filename) + 2;
char* path = NEW_C_HEAP_ARRAY(char, nbytes);
char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
strcpy(path, dirname);
strcat(path, "/");
@ -480,7 +480,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
FREE_C_HEAP_ARRAY(char, path);
FREE_C_HEAP_ARRAY(char, path, mtInternal);
}
@ -517,7 +517,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
// opendir/readdir.
//
struct dirent* entry;
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname));
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
errno = 0;
while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
@ -556,7 +556,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
}
// make the user specific temporary directory. Returns true if
@ -723,11 +723,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -869,7 +869,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}
@ -884,9 +884,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename);
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);

View File

@ -371,7 +371,7 @@ void os::init_system_properties_values() {
// code needs to be changed accordingly.
// The next few definitions allow the code to be verbatim:
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n))
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal)
#define getenv(n) ::getenv(n)
/*
@ -639,7 +639,7 @@ void os::Linux::libpthread_init() {
size_t n = confstr(_CS_GNU_LIBC_VERSION, NULL, 0);
if (n > 0) {
char *str = (char *)malloc(n);
char *str = (char *)malloc(n, mtInternal);
confstr(_CS_GNU_LIBC_VERSION, str, n);
os::Linux::set_glibc_version(str);
} else {
@ -652,7 +652,7 @@ void os::Linux::libpthread_init() {
n = confstr(_CS_GNU_LIBPTHREAD_VERSION, NULL, 0);
if (n > 0) {
char *str = (char *)malloc(n);
char *str = (char *)malloc(n, mtInternal);
confstr(_CS_GNU_LIBPTHREAD_VERSION, str, n);
// Vanilla RH-9 (glibc 2.3.2) has a bug that confstr() always tells
// us "NPTL-0.29" even we are running with LinuxThreads. Check if this
@ -1685,11 +1685,11 @@ void os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0 ; i < n ; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i]);
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
}
if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements);
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
}
} else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@ -2469,7 +2469,7 @@ void linux_wrap_code(char* base, size_t size) {
// All it does is to check if there are enough free pages
// left at the time of mmap(). This could be a potential
// problem.
bool os::commit_memory(char* addr, size_t size, bool exec) {
bool os::pd_commit_memory(char* addr, size_t size, bool exec) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
uintptr_t res = (uintptr_t) ::mmap(addr, size, prot,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0);
@ -2492,7 +2492,7 @@ bool os::commit_memory(char* addr, size_t size, bool exec) {
#define MADV_HUGEPAGE 14
#endif
bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
bool os::pd_commit_memory(char* addr, size_t size, size_t alignment_hint,
bool exec) {
if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
@ -2516,7 +2516,7 @@ bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
return false;
}
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
if (UseHugeTLBFS && alignment_hint > (size_t)vm_page_size()) {
// We don't check the return value: madvise(MADV_HUGEPAGE) may not
// be supported or the memory may already be backed by huge pages.
@ -2524,7 +2524,7 @@ void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
}
}
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) {
void os::pd_free_memory(char *addr, size_t bytes, size_t alignment_hint) {
// This method works by doing an mmap over an existing mmaping and effectively discarding
// the existing pages. However it won't work for SHM-based large pages that cannot be
// uncommitted at all. We don't do anything in this case to avoid creating a segment with
@ -2646,7 +2646,7 @@ bool os::Linux::libnuma_init() {
if (numa_available() != -1) {
set_numa_all_nodes((unsigned long*)libnuma_dlsym(handle, "numa_all_nodes"));
// Create a cpu -> node mapping
_cpu_to_node = new (ResourceObj::C_HEAP) GrowableArray<int>(0, true);
_cpu_to_node = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<int>(0, true);
rebuild_cpu_to_node_map();
return true;
}
@ -2676,7 +2676,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
cpu_to_node()->at_grow(cpu_num - 1);
size_t node_num = numa_get_groups_num();
unsigned long *cpu_map = NEW_C_HEAP_ARRAY(unsigned long, cpu_map_size);
unsigned long *cpu_map = NEW_C_HEAP_ARRAY(unsigned long, cpu_map_size, mtInternal);
for (size_t i = 0; i < node_num; i++) {
if (numa_node_to_cpus(i, cpu_map, cpu_map_size * sizeof(unsigned long)) != -1) {
for (size_t j = 0; j < cpu_map_valid_size; j++) {
@ -2690,7 +2690,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
}
}
}
FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
FREE_C_HEAP_ARRAY(unsigned long, cpu_map, mtInternal);
}
int os::Linux::get_node_by_cpu(int cpu_id) {
@ -2709,7 +2709,7 @@ os::Linux::numa_tonode_memory_func_t os::Linux::_numa_tonode_memory;
os::Linux::numa_interleave_memory_func_t os::Linux::_numa_interleave_memory;
unsigned long* os::Linux::_numa_all_nodes;
bool os::uncommit_memory(char* addr, size_t size) {
bool os::pd_uncommit_memory(char* addr, size_t size) {
uintptr_t res = (uintptr_t) ::mmap(addr, size, PROT_NONE,
MAP_PRIVATE|MAP_FIXED|MAP_NORESERVE|MAP_ANONYMOUS, -1, 0);
return res != (uintptr_t) MAP_FAILED;
@ -2774,7 +2774,7 @@ bool get_stack_bounds(uintptr_t *bottom, uintptr_t *top) {
// munmap() the guard pages we don't leave a hole in the stack
// mapping. This only affects the main/initial thread, but guard
// against future OS changes
bool os::create_stack_guard_pages(char* addr, size_t size) {
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
uintptr_t stack_extent, stack_base;
bool chk_bounds = NOT_DEBUG(os::Linux::is_initial_thread()) DEBUG_ONLY(true);
if (chk_bounds && get_stack_bounds(&stack_extent, &stack_base)) {
@ -2847,12 +2847,12 @@ static int anon_munmap(char * addr, size_t size) {
return ::munmap(addr, size) == 0;
}
char* os::reserve_memory(size_t bytes, char* requested_addr,
char* os::pd_reserve_memory(size_t bytes, char* requested_addr,
size_t alignment_hint) {
return anon_mmap(requested_addr, bytes, (requested_addr != NULL));
}
bool os::release_memory(char* addr, size_t size) {
bool os::pd_release_memory(char* addr, size_t size) {
return anon_munmap(addr, size);
}
@ -3149,7 +3149,7 @@ bool os::can_execute_large_page_memory() {
// Reserve memory at an arbitrary address, only if that area is
// available (and not reserved for something else).
char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
const int max_tries = 10;
char* base[max_tries];
size_t size[max_tries];
@ -4671,7 +4671,7 @@ int os::socket_available(int fd, jint *pbytes) {
}
// Map a block of memory.
char* os::map_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
int prot;
@ -4701,7 +4701,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset,
// Remap a block of memory.
char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
// same as map_memory() on this OS
@ -4711,7 +4711,7 @@ char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
// Unmap a block of memory.
bool os::unmap_memory(char* addr, size_t bytes) {
bool os::pd_unmap_memory(char* addr, size_t bytes) {
return munmap(addr, bytes) == 0;
}
@ -5447,6 +5447,18 @@ bool os::is_headless_jre() {
return true;
}
// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
const char* p = get_current_directory(buffer, bufferSize);
if (p == NULL) {
assert(p != NULL, "failed to get current directory");
return 0;
}
return strlen(buffer);
}
#ifdef JAVASE_EMBEDDED
//

View File

@ -287,7 +287,7 @@ public:
};
class PlatformEvent : public CHeapObj {
class PlatformEvent : public CHeapObj<mtInternal> {
private:
double CachePad [4] ; // increase odds that _mutex is sole occupant of cache line
volatile int _Event ;
@ -322,7 +322,7 @@ class PlatformEvent : public CHeapObj {
void SetAssociation (Thread * a) { _Assoc = a ; }
} ;
class PlatformParker : public CHeapObj {
class PlatformParker : public CHeapObj<mtInternal> {
protected:
pthread_mutex_t _mutex [1] ;
pthread_cond_t _cond [1] ;

View File

@ -99,7 +99,7 @@ inline bool os::allocate_stack_guard_pages() {
// On Linux, reservations are made on a page by page basis, nothing to do.
inline void os::split_reserved_memory(char *base, size_t size,
inline void os::pd_split_reserved_memory(char *base, size_t size,
size_t split, bool realloc) {
}

View File

@ -126,7 +126,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
FREE_C_HEAP_ARRAY(char, destfile);
FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
}
@ -153,7 +153,7 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
// construct the path name to user specific tmp directory
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
@ -246,7 +246,7 @@ static char* get_user_name(uid_t uid) {
if (bufsize == -1)
bufsize = 1024;
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize);
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
// POSIX interface to getpwuid_r is used on LINUX
struct passwd* p;
@ -278,14 +278,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1);
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return user_name;
}
@ -328,7 +328,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// to determine the user name for the process id.
//
struct dirent* dentry;
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname));
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
errno = 0;
while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
@ -338,7 +338,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strlen(tmpdirname) + strlen(dentry->d_name) + 2, mtInternal);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "/");
strcat(usrdir_name, dentry->d_name);
@ -346,7 +346,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
continue;
}
@ -357,13 +357,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
os::closedir(subdirp);
continue;
}
struct dirent* udentry;
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name));
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
errno = 0;
while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
@ -372,7 +372,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
int result;
char* filename = NEW_C_HEAP_ARRAY(char,
strlen(usrdir_name) + strlen(udentry->d_name) + 2);
strlen(usrdir_name) + strlen(udentry->d_name) + 2, mtInternal);
strcpy(filename, usrdir_name);
strcat(filename, "/");
@ -381,13 +381,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
@ -397,23 +397,23 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
oldest_ctime = statbuf.st_ctime;
}
}
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
}
}
os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
}
os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
return(oldest_user);
}
@ -434,7 +434,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
// add 2 for the file separator and a null terminator.
size_t nbytes = strlen(dirname) + UINT_CHARS + 2;
char* name = NEW_C_HEAP_ARRAY(char, nbytes);
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
snprintf(name, nbytes, "%s/%d", dirname, vmid);
return name;
@ -472,7 +472,7 @@ static void remove_file(const char* path) {
static void remove_file(const char* dirname, const char* filename) {
size_t nbytes = strlen(dirname) + strlen(filename) + 2;
char* path = NEW_C_HEAP_ARRAY(char, nbytes);
char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
strcpy(path, dirname);
strcat(path, "/");
@ -480,7 +480,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
FREE_C_HEAP_ARRAY(char, path);
FREE_C_HEAP_ARRAY(char, path, mtInternal);
}
@ -517,7 +517,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
// opendir/readdir.
//
struct dirent* entry;
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname));
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
errno = 0;
while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
@ -556,7 +556,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
}
// make the user specific temporary directory. Returns true if
@ -723,11 +723,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -869,7 +869,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}
@ -884,9 +884,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename);
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);

View File

@ -23,6 +23,7 @@
*/
#include "prims/jvm.h"
#include "runtime/frame.inline.hpp"
#include "runtime/os.hpp"
#include "utilities/vmError.hpp"
@ -33,19 +34,19 @@
// Check core dump limit and report possible place where core can be found
void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char* buffer, size_t bufferSize) {
int n;
struct rlimit rlim;
static char cwd[O_BUFLEN];
bool success;
get_current_directory(cwd, sizeof(cwd));
n = get_core_path(buffer, bufferSize);
if (getrlimit(RLIMIT_CORE, &rlim) != 0) {
jio_snprintf(buffer, bufferSize, "%s/core or core.%d (may not exist)", cwd, current_process_id());
jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (may not exist)", current_process_id());
success = true;
} else {
switch(rlim.rlim_cur) {
case RLIM_INFINITY:
jio_snprintf(buffer, bufferSize, "%s/core or core.%d", cwd, current_process_id());
jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d", current_process_id());
success = true;
break;
case 0:
@ -53,7 +54,7 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char*
success = false;
break;
default:
jio_snprintf(buffer, bufferSize, "%s/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", cwd, current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
jio_snprintf(buffer + n, bufferSize - n, "/core or core.%d (max size %lu kB). To ensure a full core dump, try \"ulimit -c unlimited\" before starting Java again", current_process_id(), (unsigned long)(rlim.rlim_cur >> 10));
success = true;
break;
}
@ -61,6 +62,23 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char*
VMError::report_coredump_status(buffer, success);
}
address os::get_caller_pc(int n) {
#ifdef _NMT_NOINLINE_
n ++;
#endif
frame fr = os::current_frame();
while (n > 0 && fr.pc() &&
!os::is_first_C_frame(&fr) && fr.sender_pc()) {
fr = os::get_sender_for_C_frame(&fr);
n --;
}
if (n == 0) {
return fr.pc();
} else {
return NULL;
}
}
int os::get_last_error() {
return errno;
}

View File

@ -23,7 +23,6 @@
*/
provider hs_private {
probe hashtable__new_entry(void*, uintptr_t, void*);
probe safepoint__begin();
probe safepoint__end();
probe cms__initmark__begin();

View File

@ -546,7 +546,7 @@ static bool find_processors_in_pset(psetid_t pset,
// Find the number of processors in the processor set.
if (pset_info(pset, NULL, id_length, NULL) == 0) {
// Make up an array to hold their ids.
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
// Fill in the array with their processor ids.
if (pset_info(pset, NULL, id_length, *id_array) == 0) {
result = true;
@ -577,7 +577,7 @@ static bool find_processors_online(processorid_t** id_array,
// Find the number of processors online.
*id_length = sysconf(_SC_NPROCESSORS_ONLN);
// Make up an array to hold their ids.
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length);
*id_array = NEW_C_HEAP_ARRAY(processorid_t, *id_length, mtInternal);
// Processors need not be numbered consecutively.
long found = 0;
processorid_t next = 0;
@ -629,7 +629,7 @@ static bool assign_distribution(processorid_t* id_array,
// The next id, to limit loops.
const processorid_t limit_id = max_id + 1;
// Make up markers for available processors.
bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id);
bool* available_id = NEW_C_HEAP_ARRAY(bool, limit_id, mtInternal);
for (uint c = 0; c < limit_id; c += 1) {
available_id[c] = false;
}
@ -666,7 +666,7 @@ static bool assign_distribution(processorid_t* id_array,
}
}
if (available_id != NULL) {
FREE_C_HEAP_ARRAY(bool, available_id);
FREE_C_HEAP_ARRAY(bool, available_id, mtInternal);
}
return true;
}
@ -698,7 +698,7 @@ bool os::distribute_processes(uint length, uint* distribution) {
}
}
if (id_array != NULL) {
FREE_C_HEAP_ARRAY(processorid_t, id_array);
FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal);
}
return result;
}
@ -771,8 +771,8 @@ void os::init_system_properties_values() {
// code needs to be changed accordingly.
// The next few definitions allow the code to be verbatim:
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n))
#define free(p) FREE_C_HEAP_ARRAY(char, p)
#define malloc(n) (char*)NEW_C_HEAP_ARRAY(char, (n), mtInternal)
#define free(p) FREE_C_HEAP_ARRAY(char, p, mtInternal)
#define getenv(n) ::getenv(n)
#define EXTENSIONS_DIR "/lib/ext"
@ -1927,11 +1927,11 @@ void os::dll_build_name(char* buffer, size_t buflen,
// release the storage
for (int i = 0 ; i < n ; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i]);
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
}
if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements);
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
}
} else {
snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@ -2662,17 +2662,17 @@ void os::Solaris::init_signal_mem() {
// pending_signals has one int per signal
// The additional signal is for SIGEXIT - exit signal to signal_thread
pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1));
pending_signals = (jint *)os::malloc(sizeof(jint) * (Sigexit+1), mtInternal);
memset(pending_signals, 0, (sizeof(jint) * (Sigexit+1)));
if (UseSignalChaining) {
chainedsigactions = (struct sigaction *)malloc(sizeof(struct sigaction)
* (Maxsignum + 1));
* (Maxsignum + 1), mtInternal);
memset(chainedsigactions, 0, (sizeof(struct sigaction) * (Maxsignum + 1)));
preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1));
preinstalled_sigs = (int *)os::malloc(sizeof(int) * (Maxsignum + 1), mtInternal);
memset(preinstalled_sigs, 0, (sizeof(int) * (Maxsignum + 1)));
}
ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ));
ourSigFlags = (int*)malloc(sizeof(int) * (Maxsignum + 1 ), mtInternal);
memset(ourSigFlags, 0, sizeof(int) * (Maxsignum + 1));
}
@ -2760,7 +2760,7 @@ int os::vm_allocation_granularity() {
return page_size;
}
bool os::commit_memory(char* addr, size_t bytes, bool exec) {
bool os::pd_commit_memory(char* addr, size_t bytes, bool exec) {
int prot = exec ? PROT_READ|PROT_WRITE|PROT_EXEC : PROT_READ|PROT_WRITE;
size_t size = bytes;
char *res = Solaris::mmap_chunk(addr, size, MAP_PRIVATE|MAP_FIXED, prot);
@ -2773,7 +2773,7 @@ bool os::commit_memory(char* addr, size_t bytes, bool exec) {
return false;
}
bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint,
bool os::pd_commit_memory(char* addr, size_t bytes, size_t alignment_hint,
bool exec) {
if (commit_memory(addr, bytes, exec)) {
if (UseMPSS && alignment_hint > (size_t)vm_page_size()) {
@ -2803,14 +2803,14 @@ bool os::commit_memory(char* addr, size_t bytes, size_t alignment_hint,
}
// Uncommit the pages in a specified region.
void os::free_memory(char* addr, size_t bytes, size_t alignment_hint) {
void os::pd_free_memory(char* addr, size_t bytes, size_t alignment_hint) {
if (madvise(addr, bytes, MADV_FREE) < 0) {
debug_only(warning("MADV_FREE failed."));
return;
}
}
bool os::create_stack_guard_pages(char* addr, size_t size) {
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
return os::commit_memory(addr, size);
}
@ -2819,7 +2819,7 @@ bool os::remove_stack_guard_pages(char* addr, size_t size) {
}
// Change the page size in a given range.
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
if (UseLargePages && UseMPSS) {
@ -3006,7 +3006,7 @@ char *os::scan_pages(char *start, char* end, page_info* page_expected, page_info
return end;
}
bool os::uncommit_memory(char* addr, size_t bytes) {
bool os::pd_uncommit_memory(char* addr, size_t bytes) {
size_t size = bytes;
// Map uncommitted pages PROT_NONE so we fail early if we touch an
// uncommitted page. Otherwise, the read/write might succeed if we
@ -3045,7 +3045,7 @@ char* os::Solaris::anon_mmap(char* requested_addr, size_t bytes, size_t alignmen
return mmap_chunk(addr, bytes, flags, PROT_NONE);
}
char* os::reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) {
char* os::pd_reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hint) {
char* addr = Solaris::anon_mmap(requested_addr, bytes, alignment_hint, (requested_addr != NULL));
guarantee(requested_addr == NULL || requested_addr == addr,
@ -3056,7 +3056,7 @@ char* os::reserve_memory(size_t bytes, char* requested_addr, size_t alignment_hi
// Reserve memory at an arbitrary address, only if that area is
// available (and not reserved for something else).
char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
const int max_tries = 10;
char* base[max_tries];
size_t size[max_tries];
@ -3178,7 +3178,7 @@ char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
return (i < max_tries) ? requested_addr : NULL;
}
bool os::release_memory(char* addr, size_t bytes) {
bool os::pd_release_memory(char* addr, size_t bytes) {
size_t size = bytes;
return munmap(addr, size) == 0;
}
@ -4792,7 +4792,7 @@ bool isT2_libthread() {
lwpSize = 16*1024;
for (;;) {
::lseek64 (lwpFile, 0, SEEK_SET);
lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize);
lwpArray = (prheader_t *)NEW_C_HEAP_ARRAY(char, lwpSize, mtInternal);
if (::read(lwpFile, lwpArray, lwpSize) < 0) {
if (ThreadPriorityVerbose) warning("Error reading /proc/self/lstatus\n");
break;
@ -4810,10 +4810,10 @@ bool isT2_libthread() {
break;
}
lwpSize = lwpArray->pr_nent * lwpArray->pr_entsize;
FREE_C_HEAP_ARRAY(char, lwpArray); // retry.
FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal); // retry.
}
FREE_C_HEAP_ARRAY(char, lwpArray);
FREE_C_HEAP_ARRAY(char, lwpArray, mtInternal);
::close (lwpFile);
if (ThreadPriorityVerbose) {
if (isT2) tty->print_cr("We are running with a T2 libthread\n");
@ -5137,9 +5137,9 @@ jint os::init_2(void) {
UseNUMA = false;
} else {
size_t lgrp_limit = os::numa_get_groups_num();
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit);
int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
FREE_C_HEAP_ARRAY(int, lgrp_ids);
FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal);
if (lgrp_num < 2) {
// There's only one locality group, disable NUMA.
UseNUMA = false;
@ -5485,7 +5485,7 @@ int os::available(int fd, jlong *bytes) {
}
// Map a block of memory.
char* os::map_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
int prot;
@ -5517,7 +5517,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset,
// Remap a block of memory.
char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
// same as map_memory() on this OS
@ -5527,7 +5527,7 @@ char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
// Unmap a block of memory.
bool os::unmap_memory(char* addr, size_t bytes) {
bool os::pd_unmap_memory(char* addr, size_t bytes) {
return munmap(addr, bytes) == 0;
}
@ -6537,3 +6537,16 @@ int os::bind(int fd, struct sockaddr* him, socklen_t len) {
INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
os::Solaris::clear_interrupted);
}
// Get the default path to the core file
// Returns the length of the string
int os::get_core_path(char* buffer, size_t bufferSize) {
const char* p = get_current_directory(buffer, bufferSize);
if (p == NULL) {
assert(p != NULL, "failed to get current directory");
return 0;
}
return strlen(buffer);
}

View File

@ -346,7 +346,7 @@ class Solaris {
};
class PlatformEvent : public CHeapObj {
class PlatformEvent : public CHeapObj<mtInternal> {
private:
double CachePad [4] ; // increase odds that _mutex is sole occupant of cache line
volatile int _Event ;
@ -383,7 +383,7 @@ class PlatformEvent : public CHeapObj {
void unpark () ;
} ;
class PlatformParker : public CHeapObj {
class PlatformParker : public CHeapObj<mtInternal> {
protected:
mutex_t _mutex [1] ;
cond_t _cond [1] ;

View File

@ -71,7 +71,7 @@ inline bool os::allocate_stack_guard_pages() {
// On Solaris, reservations are made on a page by page basis, nothing to do.
inline void os::split_reserved_memory(char *base, size_t size,
inline void os::pd_split_reserved_memory(char *base, size_t size,
size_t split, bool realloc) {
}

View File

@ -128,7 +128,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
}
FREE_C_HEAP_ARRAY(char, destfile);
FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
}
@ -155,7 +155,7 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
// construct the path name to user specific tmp directory
snprintf(dirname, nbytes, "%s/%s_%s", tmpdir, perfdir, user);
@ -248,7 +248,7 @@ static char* get_user_name(uid_t uid) {
if (bufsize == -1)
bufsize = 1024;
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize);
char* pwbuf = NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
#ifdef _GNU_SOURCE
struct passwd* p = NULL;
@ -269,14 +269,14 @@ static char* get_user_name(uid_t uid) {
"pw_name zero length");
}
}
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return NULL;
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1);
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
strcpy(user_name, p->pw_name);
FREE_C_HEAP_ARRAY(char, pwbuf);
FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
return user_name;
}
@ -319,7 +319,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// to determine the user name for the process id.
//
struct dirent* dentry;
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname));
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
errno = 0;
while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
@ -329,7 +329,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strlen(tmpdirname) + strlen(dentry->d_name) + 2, mtInternal);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "/");
strcat(usrdir_name, dentry->d_name);
@ -337,7 +337,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
continue;
}
@ -348,13 +348,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
os::closedir(subdirp);
continue;
}
struct dirent* udentry;
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name));
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
errno = 0;
while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
@ -363,7 +363,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
int result;
char* filename = NEW_C_HEAP_ARRAY(char,
strlen(usrdir_name) + strlen(udentry->d_name) + 2);
strlen(usrdir_name) + strlen(udentry->d_name) + 2, mtInternal);
strcpy(filename, usrdir_name);
strcat(filename, "/");
@ -372,13 +372,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
// don't follow symbolic links for the file
RESTARTABLE(::lstat(filename, &statbuf), result);
if (result == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
// skip over files that are not regular files.
if (!S_ISREG(statbuf.st_mode)) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
@ -388,23 +388,23 @@ static char* get_user_name_slow(int vmid, TRAPS) {
if (statbuf.st_ctime > oldest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(oldest_user, user);
oldest_ctime = statbuf.st_ctime;
}
}
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
}
}
os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
}
os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
return(oldest_user);
}
@ -471,7 +471,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
// add 2 for the file separator and a NULL terminator.
size_t nbytes = strlen(dirname) + UINT_CHARS + 2;
char* name = NEW_C_HEAP_ARRAY(char, nbytes);
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
snprintf(name, nbytes, "%s/%d", dirname, vmid);
return name;
@ -509,7 +509,7 @@ static void remove_file(const char* path) {
static void remove_file(const char* dirname, const char* filename) {
size_t nbytes = strlen(dirname) + strlen(filename) + 2;
char* path = NEW_C_HEAP_ARRAY(char, nbytes);
char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
strcpy(path, dirname);
strcat(path, "/");
@ -517,7 +517,7 @@ static void remove_file(const char* dirname, const char* filename) {
remove_file(path);
FREE_C_HEAP_ARRAY(char, path);
FREE_C_HEAP_ARRAY(char, path, mtInternal);
}
@ -554,7 +554,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
// opendir/readdir.
//
struct dirent* entry;
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname));
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
errno = 0;
while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
@ -593,7 +593,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
}
// make the user specific temporary directory. Returns true if
@ -738,11 +738,11 @@ static char* mmap_create_shared(size_t size) {
fd = create_sharedmem_resources(dirname, filename, size);
FREE_C_HEAP_ARRAY(char, user_name);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
if (fd == -1) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -758,7 +758,7 @@ static char* mmap_create_shared(size_t size) {
warning("mmap failed - %s\n", strerror(errno));
}
remove_file(filename);
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
return NULL;
}
@ -884,7 +884,7 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
// store file, we don't follow them when attaching either.
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}
@ -899,9 +899,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
strcpy(rfilename, filename);
// free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename);
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
// open the shared memory file for the give vmid
fd = open_sharedmem_file(rfilename, file_flags, CHECK);

View File

@ -96,7 +96,6 @@
#include <io.h>
#include <process.h> // For _beginthreadex(), _endthreadex()
#include <imagehlp.h> // For os::dll_address_to_function_name
/* for enumerating dll libraries */
#include <vdmdbg.h>
@ -214,13 +213,13 @@ void os::init_system_properties_values() {
}
}
home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1);
home_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + 1, mtInternal);
if (home_path == NULL)
return;
strcpy(home_path, home_dir);
Arguments::set_java_home(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);
if (dll_path == NULL)
return;
strcpy(dll_path, home_dir);
@ -251,7 +250,7 @@ void os::init_system_properties_values() {
char *path_str = ::getenv("PATH");
library_path = NEW_C_HEAP_ARRAY(char, MAX_PATH * 5 + sizeof(PACKAGE_DIR) +
sizeof(BIN_DIR) + (path_str ? strlen(path_str) : 0) + 10);
sizeof(BIN_DIR) + (path_str ? strlen(path_str) : 0) + 10, mtInternal);
library_path[0] = '\0';
@ -280,7 +279,7 @@ void os::init_system_properties_values() {
strcat(library_path, ";.");
Arguments::set_library_path(library_path);
FREE_C_HEAP_ARRAY(char, library_path);
FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
}
/* Default extensions directory */
@ -300,7 +299,7 @@ void os::init_system_properties_values() {
{
#define ENDORSED_DIR "\\lib\\endorsed"
size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
char * buf = NEW_C_HEAP_ARRAY(char, len);
char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
Arguments::set_endorsed_dirs(buf);
#undef ENDORSED_DIR
@ -324,6 +323,23 @@ extern "C" void breakpoint() {
os::breakpoint();
}
/*
* RtlCaptureStackBackTrace Windows API may not exist prior to Windows XP.
* So far, this method is only used by Native Memory Tracking, which is
* only supported on Windows XP or later.
*/
address os::get_caller_pc(int n) {
#ifdef _NMT_NOINLINE_
n ++;
#endif
address pc;
if (os::Kernel32Dll::RtlCaptureStackBackTrace(n + 1, 1, (PVOID*)&pc, NULL) == 1) {
return pc;
}
return NULL;
}
// os::current_stack_base()
//
// Returns the base of the stack, which is the stack's
@ -1014,7 +1030,7 @@ DIR *
os::opendir(const char *dirname)
{
assert(dirname != NULL, "just checking"); // hotspot change
DIR *dirp = (DIR *)malloc(sizeof(DIR));
DIR *dirp = (DIR *)malloc(sizeof(DIR), mtInternal);
DWORD fattr; // hotspot change
char alt_dirname[4] = { 0, 0, 0, 0 };
@ -1036,9 +1052,9 @@ os::opendir(const char *dirname)
dirname = alt_dirname;
}
dirp->path = (char *)malloc(strlen(dirname) + 5);
dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
if (dirp->path == 0) {
free(dirp);
free(dirp, mtInternal);
errno = ENOMEM;
return 0;
}
@ -1046,13 +1062,13 @@ os::opendir(const char *dirname)
fattr = GetFileAttributes(dirp->path);
if (fattr == 0xffffffff) {
free(dirp->path);
free(dirp);
free(dirp->path, mtInternal);
free(dirp, mtInternal);
errno = ENOENT;
return 0;
} else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
free(dirp->path);
free(dirp);
free(dirp->path, mtInternal);
free(dirp, mtInternal);
errno = ENOTDIR;
return 0;
}
@ -1070,8 +1086,8 @@ os::opendir(const char *dirname)
dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
if (dirp->handle == INVALID_HANDLE_VALUE) {
if (GetLastError() != ERROR_FILE_NOT_FOUND) {
free(dirp->path);
free(dirp);
free(dirp->path, mtInternal);
free(dirp, mtInternal);
errno = EACCES;
return 0;
}
@ -1114,8 +1130,8 @@ os::closedir(DIR *dirp)
}
dirp->handle = INVALID_HANDLE_VALUE;
}
free(dirp->path);
free(dirp);
free(dirp->path, mtInternal);
free(dirp, mtInternal);
return 0;
}
@ -1176,11 +1192,11 @@ void os::dll_build_name(char *buffer, size_t buflen,
// release the storage
for (int i = 0 ; i < n ; i++) {
if (pelements[i] != NULL) {
FREE_C_HEAP_ARRAY(char, pelements[i]);
FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
}
}
if (pelements != NULL) {
FREE_C_HEAP_ARRAY(char*, pelements);
FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
}
} else {
jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
@ -2637,7 +2653,7 @@ private:
void free_node_list() {
if (_numa_used_node_list != NULL) {
FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal);
}
}
@ -2659,7 +2675,7 @@ public:
ULONG highest_node_number;
if (!os::Kernel32Dll::GetNumaHighestNodeNumber(&highest_node_number)) return false;
free_node_list();
_numa_used_node_list = NEW_C_HEAP_ARRAY(int, highest_node_number + 1);
_numa_used_node_list = NEW_C_HEAP_ARRAY(int, highest_node_number + 1, mtInternal);
for (unsigned int i = 0; i <= highest_node_number; i++) {
ULONGLONG proc_mask_numa_node;
if (!os::Kernel32Dll::GetNumaNodeProcessorMask(i, &proc_mask_numa_node)) return false;
@ -2918,7 +2934,7 @@ void os::large_page_init() {
// On win32, one cannot release just a part of reserved memory, it's an
// all or nothing deal. When we split a reservation, we must break the
// reservation into two reservations.
void os::split_reserved_memory(char *base, size_t size, size_t split,
void os::pd_split_reserved_memory(char *base, size_t size, size_t split,
bool realloc) {
if (size > 0) {
release_memory(base, size);
@ -2931,7 +2947,7 @@ void os::split_reserved_memory(char *base, size_t size, size_t split,
}
}
char* os::reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
char* os::pd_reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
assert((size_t)addr % os::vm_allocation_granularity() == 0,
"reserve alignment");
assert(bytes % os::vm_allocation_granularity() == 0, "reserve block size");
@ -2964,7 +2980,7 @@ char* os::reserve_memory(size_t bytes, char* addr, size_t alignment_hint) {
// Reserve memory at an arbitrary address, only if that area is
// available (and not reserved for something else).
char* os::attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
char* os::pd_attempt_reserve_memory_at(size_t bytes, char* requested_addr) {
// Windows os::reserve_memory() fails of the requested address range is
// not avilable.
return reserve_memory(bytes, requested_addr);
@ -3027,7 +3043,7 @@ bool os::release_memory_special(char* base, size_t bytes) {
void os::print_statistics() {
}
bool os::commit_memory(char* addr, size_t bytes, bool exec) {
bool os::pd_commit_memory(char* addr, size_t bytes, bool exec) {
if (bytes == 0) {
// Don't bother the OS with noops.
return true;
@ -3075,26 +3091,26 @@ bool os::commit_memory(char* addr, size_t bytes, bool exec) {
return true;
}
bool os::commit_memory(char* addr, size_t size, size_t alignment_hint,
bool os::pd_commit_memory(char* addr, size_t size, size_t alignment_hint,
bool exec) {
return commit_memory(addr, size, exec);
}
bool os::uncommit_memory(char* addr, size_t bytes) {
bool os::pd_uncommit_memory(char* addr, size_t bytes) {
if (bytes == 0) {
// Don't bother the OS with noops.
return true;
}
assert((size_t) addr % os::vm_page_size() == 0, "uncommit on page boundaries");
assert(bytes % os::vm_page_size() == 0, "uncommit in page-sized chunks");
return VirtualFree(addr, bytes, MEM_DECOMMIT) != 0;
return (VirtualFree(addr, bytes, MEM_DECOMMIT) != 0);
}
bool os::release_memory(char* addr, size_t bytes) {
bool os::pd_release_memory(char* addr, size_t bytes) {
return VirtualFree(addr, 0, MEM_RELEASE) != 0;
}
bool os::create_stack_guard_pages(char* addr, size_t size) {
bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
return os::commit_memory(addr, size);
}
@ -3141,8 +3157,8 @@ bool os::unguard_memory(char* addr, size_t bytes) {
return VirtualProtect(addr, bytes, PAGE_READWRITE, &old_status) != 0;
}
void os::realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
void os::free_memory(char *addr, size_t bytes, size_t alignment_hint) { }
void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) { }
void os::pd_free_memory(char *addr, size_t bytes, size_t alignment_hint) { }
void os::numa_make_global(char *addr, size_t bytes) { }
void os::numa_make_local(char *addr, size_t bytes, int lgrp_hint) { }
bool os::numa_topology_changed() { return false; }
@ -4276,14 +4292,14 @@ static int stdinAvailable(int fd, long *pbytes) {
numEvents = MAX_INPUT_EVENTS;
}
lpBuffer = (INPUT_RECORD *)os::malloc(numEvents * sizeof(INPUT_RECORD));
lpBuffer = (INPUT_RECORD *)os::malloc(numEvents * sizeof(INPUT_RECORD), mtInternal);
if (lpBuffer == NULL) {
return FALSE;
}
error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
if (error == 0) {
os::free(lpBuffer);
os::free(lpBuffer, mtInternal);
return FALSE;
}
@ -4304,7 +4320,7 @@ static int stdinAvailable(int fd, long *pbytes) {
}
if(lpBuffer != NULL) {
os::free(lpBuffer);
os::free(lpBuffer, mtInternal);
}
*pbytes = (long) actualLength;
@ -4312,7 +4328,7 @@ static int stdinAvailable(int fd, long *pbytes) {
}
// Map a block of memory.
char* os::map_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
HANDLE hFile;
@ -4432,7 +4448,7 @@ char* os::map_memory(int fd, const char* file_name, size_t file_offset,
// Remap a block of memory.
char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
char* os::pd_remap_memory(int fd, const char* file_name, size_t file_offset,
char *addr, size_t bytes, bool read_only,
bool allow_exec) {
// This OS does not allow existing memory maps to be remapped so we
@ -4445,15 +4461,15 @@ char* os::remap_memory(int fd, const char* file_name, size_t file_offset,
// call above and the map_memory() call below where a thread in native
// code may be able to access an address that is no longer mapped.
return os::map_memory(fd, file_name, file_offset, addr, bytes, read_only,
allow_exec);
return os::map_memory(fd, file_name, file_offset, addr, bytes,
read_only, allow_exec);
}
// Unmap a block of memory.
// Returns true=success, otherwise false.
bool os::unmap_memory(char* addr, size_t bytes) {
bool os::pd_unmap_memory(char* addr, size_t bytes) {
BOOL result = UnmapViewOfFile(addr);
if (result == 0) {
if (PrintMiscellaneous && Verbose) {
@ -4931,11 +4947,15 @@ typedef SIZE_T (WINAPI* GetLargePageMinimum_Fn)(void);
typedef LPVOID (WINAPI *VirtualAllocExNuma_Fn) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
typedef BOOL (WINAPI *GetNumaHighestNodeNumber_Fn) (PULONG);
typedef BOOL (WINAPI *GetNumaNodeProcessorMask_Fn) (UCHAR, PULONGLONG);
typedef USHORT (WINAPI* RtlCaptureStackBackTrace_Fn)(ULONG, ULONG, PVOID*, PULONG);
GetLargePageMinimum_Fn os::Kernel32Dll::_GetLargePageMinimum = NULL;
VirtualAllocExNuma_Fn os::Kernel32Dll::_VirtualAllocExNuma = NULL;
GetNumaHighestNodeNumber_Fn os::Kernel32Dll::_GetNumaHighestNodeNumber = NULL;
GetNumaNodeProcessorMask_Fn os::Kernel32Dll::_GetNumaNodeProcessorMask = NULL;
RtlCaptureStackBackTrace_Fn os::Kernel32Dll::_RtlCaptureStackBackTrace = NULL;
BOOL os::Kernel32Dll::initialized = FALSE;
SIZE_T os::Kernel32Dll::GetLargePageMinimum() {
assert(initialized && _GetLargePageMinimum != NULL,
@ -4978,6 +4998,19 @@ BOOL os::Kernel32Dll::GetNumaNodeProcessorMask(UCHAR node, PULONGLONG proc_mask)
return _GetNumaNodeProcessorMask(node, proc_mask);
}
USHORT os::Kernel32Dll::RtlCaptureStackBackTrace(ULONG FrameToSkip,
ULONG FrameToCapture, PVOID* BackTrace, PULONG BackTraceHash) {
if (!initialized) {
initialize();
}
if (_RtlCaptureStackBackTrace != NULL) {
return _RtlCaptureStackBackTrace(FrameToSkip, FrameToCapture,
BackTrace, BackTraceHash);
} else {
return 0;
}
}
void os::Kernel32Dll::initializeCommon() {
if (!initialized) {
@ -4987,6 +5020,7 @@ void os::Kernel32Dll::initializeCommon() {
_VirtualAllocExNuma = (VirtualAllocExNuma_Fn)::GetProcAddress(handle, "VirtualAllocExNuma");
_GetNumaHighestNodeNumber = (GetNumaHighestNodeNumber_Fn)::GetProcAddress(handle, "GetNumaHighestNodeNumber");
_GetNumaNodeProcessorMask = (GetNumaNodeProcessorMask_Fn)::GetProcAddress(handle, "GetNumaNodeProcessorMask");
_RtlCaptureStackBackTrace = (RtlCaptureStackBackTrace_Fn)::GetProcAddress(handle, "RtlCaptureStackBackTrace");
initialized = TRUE;
}
}
@ -5101,7 +5135,6 @@ Module32First_Fn os::Kernel32Dll::_Module32First = NULL;
Module32Next_Fn os::Kernel32Dll::_Module32Next = NULL;
GetNativeSystemInfo_Fn os::Kernel32Dll::_GetNativeSystemInfo = NULL;
void os::Kernel32Dll::initialize() {
if (!initialized) {
HMODULE handle = ::GetModuleHandle("Kernel32.dll");
@ -5179,8 +5212,6 @@ void os::Kernel32Dll::GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo) {
_GetNativeSystemInfo(lpSystemInfo);
}
// PSAPI API

View File

@ -98,7 +98,7 @@ class win32 {
static LONG WINAPI serialize_fault_filter(struct _EXCEPTION_POINTERS* e);
};
class PlatformEvent : public CHeapObj {
class PlatformEvent : public CHeapObj<mtInternal> {
private:
double CachePad [4] ; // increase odds that _Event is sole occupant of cache line
volatile int _Event ;
@ -124,7 +124,7 @@ class PlatformEvent : public CHeapObj {
class PlatformParker : public CHeapObj {
class PlatformParker : public CHeapObj<mtInternal> {
protected:
HANDLE _ParkEvent ;
@ -182,6 +182,9 @@ public:
static BOOL GetNumaHighestNodeNumber(PULONG);
static BOOL GetNumaNodeProcessorMask(UCHAR, PULONGLONG);
// Stack walking
static USHORT RtlCaptureStackBackTrace(ULONG, ULONG, PVOID*, PULONG);
private:
// GetLargePageMinimum available on Windows Vista/Windows Server 2003
// and later
@ -191,6 +194,7 @@ private:
static LPVOID (WINAPI *_VirtualAllocExNuma) (HANDLE, LPVOID, SIZE_T, DWORD, DWORD, DWORD);
static BOOL (WINAPI *_GetNumaHighestNodeNumber) (PULONG);
static BOOL (WINAPI *_GetNumaNodeProcessorMask) (UCHAR, PULONGLONG);
static USHORT (WINAPI *_RtlCaptureStackBackTrace)(ULONG, ULONG, PVOID*, PULONG);
static BOOL initialized;
static void initialize();

View File

@ -120,7 +120,7 @@ static void save_memory_to_file(char* addr, size_t size) {
}
}
FREE_C_HEAP_ARRAY(char, destfile);
FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
}
// Shared Memory Implementation Details
@ -157,7 +157,7 @@ static char* get_user_tmp_dir(const char* user) {
const char* tmpdir = os::get_temp_directory();
const char* perfdir = PERFDATA_NAME;
size_t nbytes = strlen(tmpdir) + strlen(perfdir) + strlen(user) + 3;
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes);
char* dirname = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
// construct the path name to user specific tmp directory
_snprintf(dirname, nbytes, "%s\\%s_%s", tmpdir, perfdir, user);
@ -281,7 +281,7 @@ static char* get_user_name() {
}
}
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
char* user_name = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(user_name, user);
return user_name;
@ -315,7 +315,7 @@ static char* get_user_name_slow(int vmid) {
// to determine the user name for the process id.
//
struct dirent* dentry;
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname));
char* tdbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(tmpdirname), mtInternal);
errno = 0;
while ((dentry = os::readdir(tmpdirp, (struct dirent *)tdbuf)) != NULL) {
@ -325,7 +325,7 @@ static char* get_user_name_slow(int vmid) {
}
char* usrdir_name = NEW_C_HEAP_ARRAY(char,
strlen(tmpdirname) + strlen(dentry->d_name) + 2);
strlen(tmpdirname) + strlen(dentry->d_name) + 2, mtInternal);
strcpy(usrdir_name, tmpdirname);
strcat(usrdir_name, "\\");
strcat(usrdir_name, dentry->d_name);
@ -333,7 +333,7 @@ static char* get_user_name_slow(int vmid) {
DIR* subdirp = os::opendir(usrdir_name);
if (subdirp == NULL) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
continue;
}
@ -344,13 +344,13 @@ static char* get_user_name_slow(int vmid) {
// symlink can be exploited.
//
if (!is_directory_secure(usrdir_name)) {
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
os::closedir(subdirp);
continue;
}
struct dirent* udentry;
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name));
char* udbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(usrdir_name), mtInternal);
errno = 0;
while ((udentry = os::readdir(subdirp, (struct dirent *)udbuf)) != NULL) {
@ -358,20 +358,20 @@ static char* get_user_name_slow(int vmid) {
struct stat statbuf;
char* filename = NEW_C_HEAP_ARRAY(char,
strlen(usrdir_name) + strlen(udentry->d_name) + 2);
strlen(usrdir_name) + strlen(udentry->d_name) + 2, mtInternal);
strcpy(filename, usrdir_name);
strcat(filename, "\\");
strcat(filename, udentry->d_name);
if (::stat(filename, &statbuf) == OS_ERR) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
// skip over files that are not regular files.
if ((statbuf.st_mode & S_IFMT) != S_IFREG) {
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
continue;
}
@ -393,22 +393,22 @@ static char* get_user_name_slow(int vmid) {
if (statbuf.st_ctime > latest_ctime) {
char* user = strchr(dentry->d_name, '_') + 1;
if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user, mtInternal);
latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
strcpy(latest_user, user);
latest_ctime = statbuf.st_ctime;
}
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
}
}
os::closedir(subdirp);
FREE_C_HEAP_ARRAY(char, udbuf);
FREE_C_HEAP_ARRAY(char, usrdir_name);
FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
}
os::closedir(tmpdirp);
FREE_C_HEAP_ARRAY(char, tdbuf);
FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
return(latest_user);
}
@ -453,7 +453,7 @@ static char *get_sharedmem_objectname(const char* user, int vmid) {
// about a name containing a '-' characters.
//
nbytes += UINT_CHARS;
char* name = NEW_C_HEAP_ARRAY(char, nbytes);
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
_snprintf(name, nbytes, "%s_%s_%u", PERFDATA_NAME, user, vmid);
return name;
@ -469,7 +469,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
// add 2 for the file separator and a null terminator.
size_t nbytes = strlen(dirname) + UINT_CHARS + 2;
char* name = NEW_C_HEAP_ARRAY(char, nbytes);
char* name = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
_snprintf(name, nbytes, "%s\\%d", dirname, vmid);
return name;
@ -485,7 +485,7 @@ static char* get_sharedmem_filename(const char* dirname, int vmid) {
static void remove_file(const char* dirname, const char* filename) {
size_t nbytes = strlen(dirname) + strlen(filename) + 2;
char* path = NEW_C_HEAP_ARRAY(char, nbytes);
char* path = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
strcpy(path, dirname);
strcat(path, "\\");
@ -500,7 +500,7 @@ static void remove_file(const char* dirname, const char* filename) {
}
}
FREE_C_HEAP_ARRAY(char, path);
FREE_C_HEAP_ARRAY(char, path, mtInternal);
}
// returns true if the process represented by pid is alive, otherwise
@ -638,7 +638,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
// opendir/readdir.
//
struct dirent* entry;
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname));
char* dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(dirname), mtInternal);
errno = 0;
while ((entry = os::readdir(dirp, (struct dirent *)dbuf)) != NULL) {
@ -681,7 +681,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
errno = 0;
}
os::closedir(dirp);
FREE_C_HEAP_ARRAY(char, dbuf);
FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
}
// create a file mapping object with the requested name, and size
@ -747,11 +747,11 @@ static void free_security_desc(PSECURITY_DESCRIPTOR pSD) {
// be an ACL we enlisted. free the resources.
//
if (success && exists && pACL != NULL && !isdefault) {
FREE_C_HEAP_ARRAY(char, pACL);
FREE_C_HEAP_ARRAY(char, pACL, mtInternal);
}
// free the security descriptor
FREE_C_HEAP_ARRAY(char, pSD);
FREE_C_HEAP_ARRAY(char, pSD, mtInternal);
}
}
@ -766,7 +766,7 @@ static void free_security_attr(LPSECURITY_ATTRIBUTES lpSA) {
lpSA->lpSecurityDescriptor = NULL;
// free the security attributes structure
FREE_C_HEAP_ARRAY(char, lpSA);
FREE_C_HEAP_ARRAY(char, lpSA, mtInternal);
}
}
@ -805,7 +805,7 @@ static PSID get_user_sid(HANDLE hProcess) {
}
}
token_buf = (PTOKEN_USER) NEW_C_HEAP_ARRAY(char, rsize);
token_buf = (PTOKEN_USER) NEW_C_HEAP_ARRAY(char, rsize, mtInternal);
// get the user token information
if (!GetTokenInformation(hAccessToken, TokenUser, token_buf, rsize, &rsize)) {
@ -813,28 +813,28 @@ static PSID get_user_sid(HANDLE hProcess) {
warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize);
}
FREE_C_HEAP_ARRAY(char, token_buf);
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
CloseHandle(hAccessToken);
return NULL;
}
DWORD nbytes = GetLengthSid(token_buf->User.Sid);
PSID pSID = NEW_C_HEAP_ARRAY(char, nbytes);
PSID pSID = NEW_C_HEAP_ARRAY(char, nbytes, mtInternal);
if (!CopySid(nbytes, pSID, token_buf->User.Sid)) {
if (PrintMiscellaneous && Verbose) {
warning("GetTokenInformation failure: lasterror = %d,"
" rsize = %d\n", GetLastError(), rsize);
}
FREE_C_HEAP_ARRAY(char, token_buf);
FREE_C_HEAP_ARRAY(char, pSID);
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
FREE_C_HEAP_ARRAY(char, pSID, mtInternal);
CloseHandle(hAccessToken);
return NULL;
}
// close the access token.
CloseHandle(hAccessToken);
FREE_C_HEAP_ARRAY(char, token_buf);
FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
return pSID;
}
@ -912,13 +912,13 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
}
// create the new ACL
newACL = (PACL) NEW_C_HEAP_ARRAY(char, newACLsize);
newACL = (PACL) NEW_C_HEAP_ARRAY(char, newACLsize, mtInternal);
if (!InitializeAcl(newACL, newACLsize, ACL_REVISION)) {
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
@ -931,7 +931,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) {
@ -958,7 +958,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
}
@ -974,7 +974,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("AddAccessAllowedAce failure: lasterror = %d \n",
GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
}
@ -989,7 +989,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace,
@ -997,7 +997,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
if (PrintMiscellaneous && Verbose) {
warning("AddAce failure: lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
ace_index++;
@ -1010,7 +1010,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorDacl failure:"
" lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
@ -1030,7 +1030,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
warning("SetSecurityDescriptorControl failure:"
" lasterror = %d \n", GetLastError());
}
FREE_C_HEAP_ARRAY(char, newACL);
FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
return false;
}
}
@ -1054,7 +1054,7 @@ static LPSECURITY_ATTRIBUTES make_security_attr(ace_data_t aces[], int count) {
// allocate space for a security descriptor
PSECURITY_DESCRIPTOR pSD = (PSECURITY_DESCRIPTOR)
NEW_C_HEAP_ARRAY(char, SECURITY_DESCRIPTOR_MIN_LENGTH);
NEW_C_HEAP_ARRAY(char, SECURITY_DESCRIPTOR_MIN_LENGTH, mtInternal);
// initialize the security descriptor
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION)) {
@ -1076,7 +1076,7 @@ static LPSECURITY_ATTRIBUTES make_security_attr(ace_data_t aces[], int count) {
// return it to the caller.
//
LPSECURITY_ATTRIBUTES lpSA = (LPSECURITY_ATTRIBUTES)
NEW_C_HEAP_ARRAY(char, sizeof(SECURITY_ATTRIBUTES));
NEW_C_HEAP_ARRAY(char, sizeof(SECURITY_ATTRIBUTES), mtInternal);
lpSA->nLength = sizeof(SECURITY_ATTRIBUTES);
lpSA->lpSecurityDescriptor = pSD;
lpSA->bInheritHandle = FALSE;
@ -1147,7 +1147,7 @@ static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
// create a security attributes structure with access control
// entries as initialized above.
LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3);
FREE_C_HEAP_ARRAY(char, aces[0].pSid);
FREE_C_HEAP_ARRAY(char, aces[0].pSid, mtInternal);
FreeSid(everybodySid);
FreeSid(administratorsSid);
return(lpSA);
@ -1462,15 +1462,15 @@ static char* mapping_create_shared(size_t size) {
assert(((size != 0) && (size % os::vm_page_size() == 0)),
"unexpected PerfMemry region size");
FREE_C_HEAP_ARRAY(char, user);
FREE_C_HEAP_ARRAY(char, user, mtInternal);
// create the shared memory resources
sharedmem_fileMapHandle =
create_sharedmem_resources(dirname, filename, objectname, size);
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, objectname);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
if (sharedmem_fileMapHandle == NULL) {
return NULL;
@ -1621,7 +1621,7 @@ static void open_file_mapping(const char* user, int vmid,
// store file, we also don't following them when attaching
//
if (!is_directory_secure(dirname)) {
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
"Process not found");
}
@ -1640,10 +1640,10 @@ static void open_file_mapping(const char* user, int vmid,
strcpy(robjectname, objectname);
// free the c heap resources that are no longer needed
if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
FREE_C_HEAP_ARRAY(char, dirname);
FREE_C_HEAP_ARRAY(char, filename);
FREE_C_HEAP_ARRAY(char, objectname);
if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
FREE_C_HEAP_ARRAY(char, filename, mtInternal);
FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
if (*sizep == 0) {
size = sharedmem_filesize(rfilename, CHECK);

View File

@ -261,7 +261,7 @@ address CodeBuffer::decode_begin() {
GrowableArray<int>* CodeBuffer::create_patch_overflow() {
if (_overflow_arena == NULL) {
_overflow_arena = new Arena();
_overflow_arena = new (mtCode) Arena();
}
return new (_overflow_arena) GrowableArray<int>(_overflow_arena, 8, 0, 0);
}
@ -910,7 +910,7 @@ void CodeBuffer::block_comment(intptr_t offset, const char * comment) {
_comments.add_comment(offset, comment);
}
class CodeComment: public CHeapObj {
class CodeComment: public CHeapObj<mtCode> {
private:
friend class CodeComments;
intptr_t _offset;
@ -919,13 +919,13 @@ class CodeComment: public CHeapObj {
~CodeComment() {
assert(_next == NULL, "wrong interface for freeing list");
os::free((void*)_comment);
os::free((void*)_comment, mtCode);
}
public:
CodeComment(intptr_t offset, const char * comment) {
_offset = offset;
_comment = os::strdup(comment);
_comment = os::strdup(comment, mtCode);
_next = NULL;
}

View File

@ -33,7 +33,7 @@
#ifndef PRODUCT
class CFGPrinterOutput : public CHeapObj {
class CFGPrinterOutput : public CHeapObj<mtCompiler> {
private:
outputStream* _output;
@ -106,7 +106,7 @@ void CFGPrinter::print_intervals(IntervalList* intervals, const char* name) {
CFGPrinterOutput::CFGPrinterOutput()
: _output(new(ResourceObj::C_HEAP) fileStream("output.cfg"))
: _output(new(ResourceObj::C_HEAP, mtCompiler) fileStream("output.cfg"))
{
}

View File

@ -55,7 +55,7 @@ Compiler::~Compiler() {
void Compiler::initialize_all() {
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
Arena* arena = new Arena();
Arena* arena = new (mtCompiler) Arena();
Runtime1::initialize(buffer_blob);
FrameMap::initialize();
// initialize data structures

View File

@ -2467,12 +2467,12 @@ void LinearScan::compute_oop_map(IntervalWalker* iw, const LIR_OpVisitState &vis
// Allocate them with new so they are never destroyed (otherwise, a
// forced exit could destroy these objects while they are still in
// use).
ConstantOopWriteValue* LinearScan::_oop_null_scope_value = new (ResourceObj::C_HEAP) ConstantOopWriteValue(NULL);
ConstantIntValue* LinearScan::_int_m1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(-1);
ConstantIntValue* LinearScan::_int_0_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(0);
ConstantIntValue* LinearScan::_int_1_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(1);
ConstantIntValue* LinearScan::_int_2_scope_value = new (ResourceObj::C_HEAP) ConstantIntValue(2);
LocationValue* _illegal_value = new (ResourceObj::C_HEAP) LocationValue(Location());
ConstantOopWriteValue* LinearScan::_oop_null_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantOopWriteValue(NULL);
ConstantIntValue* LinearScan::_int_m1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(-1);
ConstantIntValue* LinearScan::_int_0_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(0);
ConstantIntValue* LinearScan::_int_1_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(1);
ConstantIntValue* LinearScan::_int_2_scope_value = new (ResourceObj::C_HEAP, mtCompiler) ConstantIntValue(2);
LocationValue* _illegal_value = new (ResourceObj::C_HEAP, mtCompiler) LocationValue(Location());
void LinearScan::init_compute_debug_info() {
// cache for frequently used scope values

View File

@ -111,7 +111,7 @@ void ciObjectFactory::initialize() {
// This Arena is long lived and exists in the resource mark of the
// compiler thread that initializes the initial ciObjectFactory which
// creates the shared ciObjects that all later ciObjectFactories use.
Arena* arena = new Arena();
Arena* arena = new (mtCompiler) Arena();
ciEnv initial(arena);
ciEnv* env = ciEnv::current();
env->_factory->init_shared_objects();

View File

@ -1368,7 +1368,7 @@ class Classfile_LVT_Element VALUE_OBJ_CLASS_SPEC {
};
class LVT_Hash: public CHeapObj {
class LVT_Hash: public CHeapObj<mtClass> {
public:
LocalVariableTableElement *_elem; // element
LVT_Hash* _next; // Next entry in hash table
@ -2337,12 +2337,7 @@ void ClassFileParser::parse_classfile_source_debug_extension_attribute(constantP
// Don't bother storing it if there is no way to retrieve it
if (JvmtiExport::can_get_source_debug_extension()) {
// Optimistically assume that only 1 byte UTF format is used
// (common case)
TempNewSymbol sde_symbol = SymbolTable::new_symbol((const char*)sde_buffer, length, CHECK);
k->set_source_debug_extension(sde_symbol);
// Note that set_source_debug_extension() increments the reference count
// for its copy of the Symbol*, so use a TempNewSymbol here.
k->set_source_debug_extension((char*)sde_buffer, length);
}
// Got utf8 string, set stream position forward
cfs->skip_u1(length, CHECK);

View File

@ -153,7 +153,7 @@ MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) {
_meta_package_names = NULL;
_num_meta_package_names = 0;
} else {
_meta_package_names = NEW_C_HEAP_ARRAY(char*, num_meta_package_names);
_meta_package_names = NEW_C_HEAP_ARRAY(char*, num_meta_package_names, mtClass);
_num_meta_package_names = num_meta_package_names;
memcpy(_meta_package_names, meta_package_names, num_meta_package_names * sizeof(char*));
}
@ -161,7 +161,7 @@ MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) {
MetaIndex::~MetaIndex() {
FREE_C_HEAP_ARRAY(char*, _meta_package_names);
FREE_C_HEAP_ARRAY(char*, _meta_package_names, mtClass);
}
@ -192,7 +192,7 @@ bool ClassPathEntry::is_lazy() {
}
ClassPathDirEntry::ClassPathDirEntry(char* dir) : ClassPathEntry() {
_dir = NEW_C_HEAP_ARRAY(char, strlen(dir)+1);
_dir = NEW_C_HEAP_ARRAY(char, strlen(dir)+1, mtClass);
strcpy(_dir, dir);
}
@ -229,7 +229,7 @@ ClassFileStream* ClassPathDirEntry::open_stream(const char* name) {
ClassPathZipEntry::ClassPathZipEntry(jzfile* zip, const char* zip_name) : ClassPathEntry() {
_zip = zip;
_zip_name = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1);
_zip_name = NEW_C_HEAP_ARRAY(char, strlen(zip_name)+1, mtClass);
strcpy(_zip_name, zip_name);
}
@ -237,7 +237,7 @@ ClassPathZipEntry::~ClassPathZipEntry() {
if (ZipClose != NULL) {
(*ZipClose)(_zip);
}
FREE_C_HEAP_ARRAY(char, _zip_name);
FREE_C_HEAP_ARRAY(char, _zip_name, mtClass);
}
ClassFileStream* ClassPathZipEntry::open_stream(const char* name) {
@ -454,11 +454,11 @@ void ClassLoader::setup_bootstrap_search_path() {
while (sys_class_path[end] && sys_class_path[end] != os::path_separator()[0]) {
end++;
}
char* path = NEW_C_HEAP_ARRAY(char, end-start+1);
char* path = NEW_C_HEAP_ARRAY(char, end-start+1, mtClass);
strncpy(path, &sys_class_path[start], end-start);
path[end-start] = '\0';
update_class_path_entry_list(path, false);
FREE_C_HEAP_ARRAY(char, path);
FREE_C_HEAP_ARRAY(char, path, mtClass);
while (sys_class_path[end] == os::path_separator()[0]) {
end++;
}
@ -652,13 +652,13 @@ void ClassLoader::load_zip_library() {
// in the classpath must be the same files, in the same order, even
// though the exact name is not the same.
class PackageInfo: public BasicHashtableEntry {
class PackageInfo: public BasicHashtableEntry<mtClass> {
public:
const char* _pkgname; // Package name
int _classpath_index; // Index of directory or JAR file loaded from
PackageInfo* next() {
return (PackageInfo*)BasicHashtableEntry::next();
return (PackageInfo*)BasicHashtableEntry<mtClass>::next();
}
const char* pkgname() { return _pkgname; }
@ -674,7 +674,7 @@ public:
};
class PackageHashtable : public BasicHashtable {
class PackageHashtable : public BasicHashtable<mtClass> {
private:
inline unsigned int compute_hash(const char *s, int n) {
unsigned int val = 0;
@ -685,7 +685,7 @@ private:
}
PackageInfo* bucket(int index) {
return (PackageInfo*)BasicHashtable::bucket(index);
return (PackageInfo*)BasicHashtable<mtClass>::bucket(index);
}
PackageInfo* get_entry(int index, unsigned int hash,
@ -702,10 +702,10 @@ private:
public:
PackageHashtable(int table_size)
: BasicHashtable(table_size, sizeof(PackageInfo)) {}
: BasicHashtable<mtClass>(table_size, sizeof(PackageInfo)) {}
PackageHashtable(int table_size, HashtableBucket* t, int number_of_entries)
: BasicHashtable(table_size, sizeof(PackageInfo), t, number_of_entries) {}
PackageHashtable(int table_size, HashtableBucket<mtClass>* t, int number_of_entries)
: BasicHashtable<mtClass>(table_size, sizeof(PackageInfo), t, number_of_entries) {}
PackageInfo* get_entry(const char* pkgname, int n) {
unsigned int hash = compute_hash(pkgname, n);
@ -715,14 +715,14 @@ public:
PackageInfo* new_entry(char* pkgname, int n) {
unsigned int hash = compute_hash(pkgname, n);
PackageInfo* pp;
pp = (PackageInfo*)BasicHashtable::new_entry(hash);
pp = (PackageInfo*)BasicHashtable<mtClass>::new_entry(hash);
pp->set_pkgname(pkgname);
return pp;
}
void add_entry(PackageInfo* pp) {
int index = hash_to_index(pp->hash());
BasicHashtable::add_entry(index, pp);
BasicHashtable<mtClass>::add_entry(index, pp);
}
void copy_pkgnames(const char** packages) {
@ -742,7 +742,7 @@ public:
void PackageHashtable::copy_table(char** top, char* end,
PackageHashtable* table) {
// Copy (relocate) the table to the shared space.
BasicHashtable::copy_table(top, end);
BasicHashtable<mtClass>::copy_table(top, end);
// Calculate the space needed for the package name strings.
int i;
@ -815,7 +815,7 @@ bool ClassLoader::add_package(const char *pkgname, int classpath_index, TRAPS) {
// Package prefix found
int n = cp - pkgname + 1;
char* new_pkgname = NEW_C_HEAP_ARRAY(char, n + 1);
char* new_pkgname = NEW_C_HEAP_ARRAY(char, n + 1, mtClass);
if (new_pkgname == NULL) {
return false;
}
@ -929,10 +929,10 @@ instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) {
}
void ClassLoader::create_package_info_table(HashtableBucket *t, int length,
void ClassLoader::create_package_info_table(HashtableBucket<mtClass> *t, int length,
int number_of_entries) {
assert(_package_hash_table == NULL, "One package info table allowed.");
assert(length == package_hash_table_size * sizeof(HashtableBucket),
assert(length == package_hash_table_size * sizeof(HashtableBucket<mtClass>),
"bad shared package info size.");
_package_hash_table = new PackageHashtable(package_hash_table_size, t,
number_of_entries);

View File

@ -33,7 +33,7 @@
// Meta-index (optional, to be able to skip opening boot classpath jar files)
class MetaIndex: public CHeapObj {
class MetaIndex: public CHeapObj<mtClass> {
private:
char** _meta_package_names;
int _num_meta_package_names;
@ -46,7 +46,7 @@ class MetaIndex: public CHeapObj {
// Class path entry (directory or zip file)
class ClassPathEntry: public CHeapObj {
class ClassPathEntry: public CHeapObj<mtClass> {
private:
ClassPathEntry* _next;
public:
@ -141,7 +141,7 @@ class LazyClassPathEntry: public ClassPathEntry {
class PackageHashtable;
class PackageInfo;
class HashtableBucket;
template <MEMFLAGS F> class HashtableBucket;
class ClassLoader: AllStatic {
public:
@ -299,7 +299,7 @@ class ClassLoader: AllStatic {
// Initialization
static void initialize();
static void create_package_info_table();
static void create_package_info_table(HashtableBucket *t, int length,
static void create_package_info_table(HashtableBucket<mtClass> *t, int length,
int number_of_entries);
static int compute_Object_vtable();

View File

@ -36,16 +36,16 @@ int Dictionary::_current_class_index = 0;
Dictionary::Dictionary(int table_size)
: TwoOopHashtable<klassOop>(table_size, sizeof(DictionaryEntry)) {
: TwoOopHashtable<klassOop, mtClass>(table_size, sizeof(DictionaryEntry)) {
_current_class_index = 0;
_current_class_entry = NULL;
};
Dictionary::Dictionary(int table_size, HashtableBucket* t,
Dictionary::Dictionary(int table_size, HashtableBucket<mtClass>* t,
int number_of_entries)
: TwoOopHashtable<klassOop>(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
: TwoOopHashtable<klassOop, mtClass>(table_size, sizeof(DictionaryEntry), t, number_of_entries) {
_current_class_index = 0;
_current_class_entry = NULL;
};
@ -54,7 +54,7 @@ Dictionary::Dictionary(int table_size, HashtableBucket* t,
DictionaryEntry* Dictionary::new_entry(unsigned int hash, klassOop klass,
oop loader) {
DictionaryEntry* entry;
entry = (DictionaryEntry*)Hashtable<klassOop>::new_entry(hash, klass);
entry = (DictionaryEntry*)Hashtable<klassOop, mtClass>::new_entry(hash, klass);
entry->set_loader(loader);
entry->set_pd_set(NULL);
return entry;
@ -62,7 +62,7 @@ DictionaryEntry* Dictionary::new_entry(unsigned int hash, klassOop klass,
DictionaryEntry* Dictionary::new_entry() {
DictionaryEntry* entry = (DictionaryEntry*)Hashtable<klassOop>::new_entry(0L, NULL);
DictionaryEntry* entry = (DictionaryEntry*)Hashtable<klassOop, mtClass>::new_entry(0L, NULL);
entry->set_loader(NULL);
entry->set_pd_set(NULL);
return entry;
@ -76,7 +76,7 @@ void Dictionary::free_entry(DictionaryEntry* entry) {
entry->set_pd_set(to_delete->next());
delete to_delete;
}
Hashtable<klassOop>::free_entry(entry);
Hashtable<klassOop, mtClass>::free_entry(entry);
}
@ -554,12 +554,12 @@ void Dictionary::reorder_dictionary() {
}
SymbolPropertyTable::SymbolPropertyTable(int table_size)
: Hashtable<Symbol*>(table_size, sizeof(SymbolPropertyEntry))
: Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry))
{
}
SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket* t,
SymbolPropertyTable::SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t,
int number_of_entries)
: Hashtable<Symbol*>(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries)
: Hashtable<Symbol*, mtSymbol>(table_size, sizeof(SymbolPropertyEntry), t, number_of_entries)
{
}
@ -584,7 +584,7 @@ SymbolPropertyEntry* SymbolPropertyTable::add_entry(int index, unsigned int hash
assert(find_entry(index, hash, sym, sym_mode) == NULL, "no double entry");
SymbolPropertyEntry* p = new_entry(hash, sym, sym_mode);
Hashtable<Symbol*>::add_entry(index, p);
Hashtable<Symbol*, mtSymbol>::add_entry(index, p);
return p;
}

View File

@ -36,7 +36,7 @@ class DictionaryEntry;
// The data structure for the system dictionary (and the shared system
// dictionary).
class Dictionary : public TwoOopHashtable<klassOop> {
class Dictionary : public TwoOopHashtable<klassOop, mtClass> {
friend class VMStructs;
private:
// current iteration index.
@ -48,22 +48,22 @@ private:
Symbol* name, Handle loader);
DictionaryEntry* bucket(int i) {
return (DictionaryEntry*)Hashtable<klassOop>::bucket(i);
return (DictionaryEntry*)Hashtable<klassOop, mtClass>::bucket(i);
}
// The following method is not MT-safe and must be done under lock.
DictionaryEntry** bucket_addr(int i) {
return (DictionaryEntry**)Hashtable<klassOop>::bucket_addr(i);
return (DictionaryEntry**)Hashtable<klassOop, mtClass>::bucket_addr(i);
}
void add_entry(int index, DictionaryEntry* new_entry) {
Hashtable<klassOop>::add_entry(index, (HashtableEntry<oop>*)new_entry);
Hashtable<klassOop, mtClass>::add_entry(index, (HashtableEntry<oop, mtClass>*)new_entry);
}
public:
Dictionary(int table_size);
Dictionary(int table_size, HashtableBucket* t, int number_of_entries);
Dictionary(int table_size, HashtableBucket<mtClass>* t, int number_of_entries);
DictionaryEntry* new_entry(unsigned int hash, klassOop klass, oop loader);
@ -129,7 +129,7 @@ public:
// The following classes can be in dictionary.cpp, but we need these
// to be in header file so that SA's vmStructs can access.
class ProtectionDomainEntry :public CHeapObj {
class ProtectionDomainEntry :public CHeapObj<mtClass> {
friend class VMStructs;
public:
ProtectionDomainEntry* _next;
@ -147,7 +147,7 @@ class ProtectionDomainEntry :public CHeapObj {
// An entry in the system dictionary, this describes a class as
// { klassOop, loader, protection_domain }.
class DictionaryEntry : public HashtableEntry<klassOop> {
class DictionaryEntry : public HashtableEntry<klassOop, mtClass> {
friend class VMStructs;
private:
// Contains the set of approved protection domains that can access
@ -166,11 +166,11 @@ class DictionaryEntry : public HashtableEntry<klassOop> {
klassOop* klass_addr() { return (klassOop*)literal_addr(); }
DictionaryEntry* next() const {
return (DictionaryEntry*)HashtableEntry<klassOop>::next();
return (DictionaryEntry*)HashtableEntry<klassOop, mtClass>::next();
}
DictionaryEntry** next_addr() {
return (DictionaryEntry**)HashtableEntry<klassOop>::next_addr();
return (DictionaryEntry**)HashtableEntry<klassOop, mtClass>::next_addr();
}
oop loader() const { return _loader; }
@ -228,7 +228,7 @@ class DictionaryEntry : public HashtableEntry<klassOop> {
// Entry in a SymbolPropertyTable, mapping a single Symbol*
// to a managed and an unmanaged pointer.
class SymbolPropertyEntry : public HashtableEntry<Symbol*> {
class SymbolPropertyEntry : public HashtableEntry<Symbol*, mtSymbol> {
friend class VMStructs;
private:
intptr_t _symbol_mode; // secondary key
@ -248,11 +248,11 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*> {
void set_property_data(address p) { _property_data = p; }
SymbolPropertyEntry* next() const {
return (SymbolPropertyEntry*)HashtableEntry<Symbol*>::next();
return (SymbolPropertyEntry*)HashtableEntry<Symbol*, mtSymbol>::next();
}
SymbolPropertyEntry** next_addr() {
return (SymbolPropertyEntry**)HashtableEntry<Symbol*>::next_addr();
return (SymbolPropertyEntry**)HashtableEntry<Symbol*, mtSymbol>::next_addr();
}
oop* property_oop_addr() { return &_property_oop; }
@ -278,16 +278,16 @@ class SymbolPropertyEntry : public HashtableEntry<Symbol*> {
// A system-internal mapping of symbols to pointers, both managed
// and unmanaged. Used to record the auto-generation of each method
// MethodHandle.invoke(S)T, for all signatures (S)T.
class SymbolPropertyTable : public Hashtable<Symbol*> {
class SymbolPropertyTable : public Hashtable<Symbol*, mtSymbol> {
friend class VMStructs;
private:
SymbolPropertyEntry* bucket(int i) {
return (SymbolPropertyEntry*) Hashtable<Symbol*>::bucket(i);
return (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::bucket(i);
}
// The following method is not MT-safe and must be done under lock.
SymbolPropertyEntry** bucket_addr(int i) {
return (SymbolPropertyEntry**) Hashtable<Symbol*>::bucket_addr(i);
return (SymbolPropertyEntry**) Hashtable<Symbol*, mtSymbol>::bucket_addr(i);
}
void add_entry(int index, SymbolPropertyEntry* new_entry) {
@ -298,7 +298,7 @@ private:
}
SymbolPropertyEntry* new_entry(unsigned int hash, Symbol* symbol, intptr_t symbol_mode) {
SymbolPropertyEntry* entry = (SymbolPropertyEntry*) Hashtable<Symbol*>::new_entry(hash, symbol);
SymbolPropertyEntry* entry = (SymbolPropertyEntry*) Hashtable<Symbol*, mtSymbol>::new_entry(hash, symbol);
// Hashtable with Symbol* literal must increment and decrement refcount.
symbol->increment_refcount();
entry->set_symbol_mode(symbol_mode);
@ -309,17 +309,17 @@ private:
public:
SymbolPropertyTable(int table_size);
SymbolPropertyTable(int table_size, HashtableBucket* t, int number_of_entries);
SymbolPropertyTable(int table_size, HashtableBucket<mtSymbol>* t, int number_of_entries);
void free_entry(SymbolPropertyEntry* entry) {
// decrement Symbol refcount here because hashtable doesn't.
entry->literal()->decrement_refcount();
Hashtable<Symbol*>::free_entry(entry);
Hashtable<Symbol*, mtSymbol>::free_entry(entry);
}
unsigned int compute_hash(Symbol* sym, intptr_t symbol_mode) {
// Use the regular identity_hash.
return Hashtable<Symbol*>::compute_hash(sym) ^ symbol_mode;
return Hashtable<Symbol*, mtSymbol>::compute_hash(sym) ^ symbol_mode;
}
int index_for(Symbol* name, intptr_t symbol_mode) {

View File

@ -58,7 +58,7 @@ void JavaAssertions::addOption(const char* name, bool enable) {
// it is never freed, so will be leaked (along with other option strings -
// e.g., bootclasspath) if a process creates/destroys multiple VMs.
int len = (int)strlen(name);
char *name_copy = NEW_C_HEAP_ARRAY(char, len + 1);
char *name_copy = NEW_C_HEAP_ARRAY(char, len + 1, mtClass);
strcpy(name_copy, name);
// Figure out which list the new item should go on. Names that end in "..."

View File

@ -68,7 +68,7 @@ private:
static OptionList* _packages; // Options for package trees.
};
class JavaAssertions::OptionList: public CHeapObj {
class JavaAssertions::OptionList: public CHeapObj<mtClass> {
public:
inline OptionList(const char* name, bool enable, OptionList* next);

View File

@ -31,7 +31,7 @@
#include "utilities/hashtable.inline.hpp"
LoaderConstraintTable::LoaderConstraintTable(int nof_buckets)
: Hashtable<klassOop>(nof_buckets, sizeof(LoaderConstraintEntry)) {};
: Hashtable<klassOop, mtClass>(nof_buckets, sizeof(LoaderConstraintEntry)) {};
LoaderConstraintEntry* LoaderConstraintTable::new_entry(
@ -39,7 +39,7 @@ LoaderConstraintEntry* LoaderConstraintTable::new_entry(
klassOop klass, int num_loaders,
int max_loaders) {
LoaderConstraintEntry* entry;
entry = (LoaderConstraintEntry*)Hashtable<klassOop>::new_entry(hash, klass);
entry = (LoaderConstraintEntry*)Hashtable<klassOop, mtClass>::new_entry(hash, klass);
entry->set_name(name);
entry->set_num_loaders(num_loaders);
entry->set_max_loaders(max_loaders);
@ -49,7 +49,7 @@ LoaderConstraintEntry* LoaderConstraintTable::new_entry(
void LoaderConstraintTable::free_entry(LoaderConstraintEntry *entry) {
// decrement name refcount before freeing
entry->name()->decrement_refcount();
Hashtable<klassOop>::free_entry(entry);
Hashtable<klassOop, mtClass>::free_entry(entry);
}
@ -164,7 +164,7 @@ void LoaderConstraintTable::purge_loader_constraints(BoolObjectClosure* is_alive
// Purge entry
*p = probe->next();
FREE_C_HEAP_ARRAY(oop, probe->loaders());
FREE_C_HEAP_ARRAY(oop, probe->loaders(), mtClass);
free_entry(probe);
} else {
#ifdef ASSERT
@ -224,7 +224,7 @@ bool LoaderConstraintTable::add_entry(Symbol* class_name,
int index = hash_to_index(hash);
LoaderConstraintEntry* p;
p = new_entry(hash, class_name, klass, 2, 2);
p->set_loaders(NEW_C_HEAP_ARRAY(oop, 2));
p->set_loaders(NEW_C_HEAP_ARRAY(oop, 2, mtClass));
p->set_loader(0, class_loader1());
p->set_loader(1, class_loader2());
p->set_klass(klass);
@ -340,10 +340,10 @@ void LoaderConstraintTable::ensure_loader_constraint_capacity(
int nfree) {
if (p->max_loaders() - p->num_loaders() < nfree) {
int n = nfree + p->num_loaders();
oop* new_loaders = NEW_C_HEAP_ARRAY(oop, n);
oop* new_loaders = NEW_C_HEAP_ARRAY(oop, n, mtClass);
memcpy(new_loaders, p->loaders(), sizeof(oop) * p->num_loaders());
p->set_max_loaders(n);
FREE_C_HEAP_ARRAY(oop, p->loaders());
FREE_C_HEAP_ARRAY(oop, p->loaders(), mtClass);
p->set_loaders(new_loaders);
}
}
@ -425,7 +425,7 @@ void LoaderConstraintTable::merge_loader_constraints(
}
*pp2 = p2->next();
FREE_C_HEAP_ARRAY(oop, p2->loaders());
FREE_C_HEAP_ARRAY(oop, p2->loaders(), mtClass);
free_entry(p2);
return;
}

View File

@ -31,7 +31,7 @@
class LoaderConstraintEntry;
class LoaderConstraintTable : public Hashtable<klassOop> {
class LoaderConstraintTable : public Hashtable<klassOop, mtClass> {
friend class VMStructs;
private:
@ -53,11 +53,11 @@ public:
void free_entry(LoaderConstraintEntry *entry);
LoaderConstraintEntry* bucket(int i) {
return (LoaderConstraintEntry*)Hashtable<klassOop>::bucket(i);
return (LoaderConstraintEntry*)Hashtable<klassOop, mtClass>::bucket(i);
}
LoaderConstraintEntry** bucket_addr(int i) {
return (LoaderConstraintEntry**)Hashtable<klassOop>::bucket_addr(i);
return (LoaderConstraintEntry**)Hashtable<klassOop, mtClass>::bucket_addr(i);
}
// GC support
@ -94,7 +94,7 @@ public:
#endif
};
class LoaderConstraintEntry : public HashtableEntry<klassOop> {
class LoaderConstraintEntry : public HashtableEntry<klassOop, mtClass> {
friend class VMStructs;
private:
Symbol* _name; // class name
@ -109,14 +109,14 @@ public:
void set_klass(klassOop k) { set_literal(k); }
LoaderConstraintEntry* next() {
return (LoaderConstraintEntry*)HashtableEntry<klassOop>::next();
return (LoaderConstraintEntry*)HashtableEntry<klassOop, mtClass>::next();
}
LoaderConstraintEntry** next_addr() {
return (LoaderConstraintEntry**)HashtableEntry<klassOop>::next_addr();
return (LoaderConstraintEntry**)HashtableEntry<klassOop, mtClass>::next_addr();
}
void set_next(LoaderConstraintEntry* next) {
HashtableEntry<klassOop>::set_next(next);
HashtableEntry<klassOop, mtClass>::set_next(next);
}
Symbol* name() { return _name; }

View File

@ -34,7 +34,7 @@
PlaceholderEntry* PlaceholderTable::new_entry(int hash, Symbol* name,
oop loader, bool havesupername,
Symbol* supername) {
PlaceholderEntry* entry = (PlaceholderEntry*)Hashtable<Symbol*>::new_entry(hash, name);
PlaceholderEntry* entry = (PlaceholderEntry*)Hashtable<Symbol*, mtClass>::new_entry(hash, name);
// Hashtable with Symbol* literal must increment and decrement refcount.
name->increment_refcount();
entry->set_loader(loader);
@ -52,7 +52,7 @@ void PlaceholderTable::free_entry(PlaceholderEntry* entry) {
// decrement Symbol refcount here because Hashtable doesn't.
entry->literal()->decrement_refcount();
if (entry->supername() != NULL) entry->supername()->decrement_refcount();
Hashtable<Symbol*>::free_entry(entry);
Hashtable<Symbol*, mtClass>::free_entry(entry);
}
@ -166,7 +166,7 @@ void PlaceholderTable::find_and_remove(int index, unsigned int hash,
}
PlaceholderTable::PlaceholderTable(int table_size)
: TwoOopHashtable<Symbol*>(table_size, sizeof(PlaceholderEntry)) {
: TwoOopHashtable<Symbol*, mtClass>(table_size, sizeof(PlaceholderEntry)) {
}

View File

@ -34,7 +34,7 @@ class PlaceholderEntry;
// being loaded, as well as arrays of primitives.
//
class PlaceholderTable : public TwoOopHashtable<Symbol*> {
class PlaceholderTable : public TwoOopHashtable<Symbol*, mtClass> {
friend class VMStructs;
public:
@ -44,15 +44,15 @@ public:
void free_entry(PlaceholderEntry* entry);
PlaceholderEntry* bucket(int i) {
return (PlaceholderEntry*)Hashtable<Symbol*>::bucket(i);
return (PlaceholderEntry*)Hashtable<Symbol*, mtClass>::bucket(i);
}
PlaceholderEntry** bucket_addr(int i) {
return (PlaceholderEntry**)Hashtable<Symbol*>::bucket_addr(i);
return (PlaceholderEntry**)Hashtable<Symbol*, mtClass>::bucket_addr(i);
}
void add_entry(int index, PlaceholderEntry* new_entry) {
Hashtable<Symbol*>::add_entry(index, (HashtableEntry<Symbol*>*)new_entry);
Hashtable<Symbol*, mtClass>::add_entry(index, (HashtableEntry<Symbol*, mtClass>*)new_entry);
}
void add_entry(int index, unsigned int hash, Symbol* name,
@ -116,7 +116,7 @@ public:
// For DEFINE_CLASS, the head of the queue owns the
// define token and the rest of the threads wait to return the
// result the first thread gets.
class SeenThread: public CHeapObj {
class SeenThread: public CHeapObj<mtInternal> {
private:
Thread *_thread;
SeenThread* _stnext;
@ -152,7 +152,7 @@ public:
// on store ordering here.
// The system dictionary is the only user of this class.
class PlaceholderEntry : public HashtableEntry<Symbol*> {
class PlaceholderEntry : public HashtableEntry<Symbol*, mtClass> {
friend class VMStructs;
@ -206,11 +206,11 @@ class PlaceholderEntry : public HashtableEntry<Symbol*> {
void set_defineThreadQ(SeenThread* SeenThread) { _defineThreadQ = SeenThread; }
PlaceholderEntry* next() const {
return (PlaceholderEntry*)HashtableEntry<Symbol*>::next();
return (PlaceholderEntry*)HashtableEntry<Symbol*, mtClass>::next();
}
PlaceholderEntry** next_addr() {
return (PlaceholderEntry**)HashtableEntry<Symbol*>::next_addr();
return (PlaceholderEntry**)HashtableEntry<Symbol*, mtClass>::next_addr();
}
// Test for equality

View File

@ -67,7 +67,7 @@ void ResolutionErrorEntry::set_error(Symbol* e) {
ResolutionErrorEntry* ResolutionErrorTable::new_entry(int hash, constantPoolOop pool,
int cp_index, Symbol* error)
{
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<constantPoolOop>::new_entry(hash, pool);
ResolutionErrorEntry* entry = (ResolutionErrorEntry*)Hashtable<constantPoolOop, mtClass>::new_entry(hash, pool);
entry->set_cp_index(cp_index);
NOT_PRODUCT(entry->set_error(NULL);)
entry->set_error(error);
@ -79,13 +79,13 @@ void ResolutionErrorTable::free_entry(ResolutionErrorEntry *entry) {
// decrement error refcount
assert(entry->error() != NULL, "error should be set");
entry->error()->decrement_refcount();
Hashtable<constantPoolOop>::free_entry(entry);
Hashtable<constantPoolOop, mtClass>::free_entry(entry);
}
// create resolution error table
ResolutionErrorTable::ResolutionErrorTable(int table_size)
: Hashtable<constantPoolOop>(table_size, sizeof(ResolutionErrorEntry)) {
: Hashtable<constantPoolOop, mtClass>(table_size, sizeof(ResolutionErrorEntry)) {
}
// GC support

View File

@ -33,7 +33,7 @@ class ResolutionErrorEntry;
// ResolutionError objects are used to record errors encountered during
// constant pool resolution (JVMS 5.4.3).
class ResolutionErrorTable : public Hashtable<constantPoolOop> {
class ResolutionErrorTable : public Hashtable<constantPoolOop, mtClass> {
public:
ResolutionErrorTable(int table_size);
@ -42,15 +42,16 @@ public:
void free_entry(ResolutionErrorEntry *entry);
ResolutionErrorEntry* bucket(int i) {
return (ResolutionErrorEntry*)Hashtable<constantPoolOop>::bucket(i);
return (ResolutionErrorEntry*)Hashtable<constantPoolOop, mtClass>::bucket(i);
}
ResolutionErrorEntry** bucket_addr(int i) {
return (ResolutionErrorEntry**)Hashtable<constantPoolOop>::bucket_addr(i);
return (ResolutionErrorEntry**)Hashtable<constantPoolOop, mtClass>::bucket_addr(i);
}
void add_entry(int index, ResolutionErrorEntry* new_entry) {
Hashtable<constantPoolOop>::add_entry(index, (HashtableEntry<constantPoolOop>*)new_entry);
Hashtable<constantPoolOop, mtClass>::add_entry(index,
(HashtableEntry<constantPoolOop, mtClass>*)new_entry);
}
void add_entry(int index, unsigned int hash,
@ -74,7 +75,7 @@ public:
};
class ResolutionErrorEntry : public HashtableEntry<constantPoolOop> {
class ResolutionErrorEntry : public HashtableEntry<constantPoolOop, mtClass> {
private:
int _cp_index;
Symbol* _error;
@ -90,11 +91,11 @@ class ResolutionErrorEntry : public HashtableEntry<constantPoolOop> {
void set_error(Symbol* e);
ResolutionErrorEntry* next() const {
return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop>::next();
return (ResolutionErrorEntry*)HashtableEntry<constantPoolOop, mtClass>::next();
}
ResolutionErrorEntry** next_addr() {
return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop>::next_addr();
return (ResolutionErrorEntry**)HashtableEntry<constantPoolOop, mtClass>::next_addr();
}
// GC support

View File

@ -43,7 +43,6 @@ SymbolTable* SymbolTable::_the_table = NULL;
// Static arena for symbols that are not deallocated
Arena* SymbolTable::_arena = NULL;
bool SymbolTable::_needs_rehashing = false;
jint SymbolTable::_seed = 0;
Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS) {
assert (len <= Symbol::max_length(), "should be checked by caller");
@ -64,9 +63,9 @@ Symbol* SymbolTable::allocate_symbol(const u1* name, int len, bool c_heap, TRAPS
void SymbolTable::initialize_symbols(int arena_alloc_size) {
// Initialize the arena for global symbols, size passed in depends on CDS.
if (arena_alloc_size == 0) {
_arena = new Arena();
_arena = new (mtSymbol) Arena();
} else {
_arena = new Arena(arena_alloc_size);
_arena = new (mtSymbol) Arena(arena_alloc_size);
}
}
@ -74,7 +73,7 @@ void SymbolTable::initialize_symbols(int arena_alloc_size) {
void SymbolTable::symbols_do(SymbolClosure *cl) {
const int n = the_table()->table_size();
for (int i = 0; i < n; i++) {
for (HashtableEntry<Symbol*>* p = the_table()->bucket(i);
for (HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
p != NULL;
p = p->next()) {
cl->do_symbol(p->literal_addr());
@ -92,8 +91,8 @@ void SymbolTable::unlink() {
int total = 0;
size_t memory_total = 0;
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<Symbol*>** p = the_table()->bucket_addr(i);
HashtableEntry<Symbol*>* entry = the_table()->bucket(i);
HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
while (entry != NULL) {
// Shared entries are normally at the end of the bucket and if we run into
// a shared entry, then there is nothing more to remove. However, if we
@ -117,7 +116,7 @@ void SymbolTable::unlink() {
p = entry->next_addr();
}
// get next entry
entry = (HashtableEntry<Symbol*>*)HashtableEntry<Symbol*>::make_ptr(*p);
entry = (HashtableEntry<Symbol*, mtSymbol>*)HashtableEntry<Symbol*, mtSymbol>::make_ptr(*p);
}
}
symbols_removed += removed;
@ -130,12 +129,6 @@ void SymbolTable::unlink() {
}
}
unsigned int SymbolTable::new_hash(Symbol* sym) {
ResourceMark rm;
// Use alternate hashing algorithm on this symbol.
return AltHashing::murmur3_32(seed(), (const jbyte*)sym->as_C_string(), sym->utf8_length());
}
// Create a new table and using alternate hash code, populate the new table
// with the existing strings. Set flag to use the alternate hash code afterwards.
void SymbolTable::rehash_table() {
@ -145,10 +138,6 @@ void SymbolTable::rehash_table() {
// Create a new symbol table
SymbolTable* new_table = new SymbolTable();
// Initialize the global seed for hashing.
_seed = AltHashing::compute_seed();
assert(seed() != 0, "shouldn't be zero");
the_table()->move_to(new_table);
// Delete the table and buckets (entries are reused in new table).
@ -164,7 +153,7 @@ void SymbolTable::rehash_table() {
Symbol* SymbolTable::lookup(int index, const char* name,
int len, unsigned int hash) {
int count = 0;
for (HashtableEntry<Symbol*>* e = bucket(index); e != NULL; e = e->next()) {
for (HashtableEntry<Symbol*, mtSymbol>* e = bucket(index); e != NULL; e = e->next()) {
count++; // count all entries in this bucket, not just ones with same hash
if (e->hash() == hash) {
Symbol* sym = e->literal();
@ -176,7 +165,7 @@ Symbol* SymbolTable::lookup(int index, const char* name,
}
}
// If the bucket size is too deep check if this hash code is insufficient.
if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
_needs_rehashing = check_rehash_table(count);
}
return NULL;
@ -268,7 +257,7 @@ Symbol** SymbolTable::lookup_symbol_addr(Symbol* sym){
unsigned int hash = hash_symbol((char*)sym->bytes(), sym->utf8_length());
int index = the_table()->hash_to_index(hash);
for (HashtableEntry<Symbol*>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
for (HashtableEntry<Symbol*, mtSymbol>* e = the_table()->bucket(index); e != NULL; e = e->next()) {
if (e->hash() == hash) {
Symbol* literal_sym = e->literal();
if (sym == literal_sym) {
@ -387,7 +376,7 @@ Symbol* SymbolTable::basic_add(int index_arg, u1 *name, int len,
Symbol* sym = allocate_symbol(name, len, c_heap, CHECK_NULL);
assert(sym->equals((char*)name, len), "symbol must be properly initialized");
HashtableEntry<Symbol*>* entry = new_entry(hashValue, sym);
HashtableEntry<Symbol*, mtSymbol>* entry = new_entry(hashValue, sym);
add_entry(index, entry);
return sym;
}
@ -435,7 +424,7 @@ bool SymbolTable::basic_add(Handle class_loader, constantPoolHandle cp,
bool c_heap = class_loader() != NULL;
Symbol* sym = allocate_symbol((const u1*)names[i], lengths[i], c_heap, CHECK_(false));
assert(sym->equals(names[i], lengths[i]), "symbol must be properly initialized"); // why wouldn't it be???
HashtableEntry<Symbol*>* entry = new_entry(hashValue, sym);
HashtableEntry<Symbol*, mtSymbol>* entry = new_entry(hashValue, sym);
add_entry(index, entry);
cp->symbol_at_put(cp_indices[i], sym);
}
@ -446,7 +435,7 @@ bool SymbolTable::basic_add(Handle class_loader, constantPoolHandle cp,
void SymbolTable::verify() {
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<Symbol*>* p = the_table()->bucket(i);
HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
for ( ; p != NULL; p = p->next()) {
Symbol* s = (Symbol*)(p->literal());
guarantee(s != NULL, "symbol is NULL");
@ -462,7 +451,7 @@ void SymbolTable::dump(outputStream* st) {
NumberSeq summary;
for (int i = 0; i < the_table()->table_size(); ++i) {
int count = 0;
for (HashtableEntry<Symbol*>* e = the_table()->bucket(i);
for (HashtableEntry<Symbol*, mtSymbol>* e = the_table()->bucket(i);
e != NULL; e = e->next()) {
count++;
}
@ -499,7 +488,7 @@ void SymbolTable::print_histogram() {
int memory_total = 0;
int count = 0;
for (i = 0; i < the_table()->table_size(); i++) {
HashtableEntry<Symbol*>* p = the_table()->bucket(i);
HashtableEntry<Symbol*, mtSymbol>* p = the_table()->bucket(i);
for ( ; p != NULL; p = p->next()) {
memory_total += p->literal()->object_size();
count++;
@ -560,15 +549,15 @@ void SymbolTable::print_histogram() {
void SymbolTable::print() {
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<Symbol*>** p = the_table()->bucket_addr(i);
HashtableEntry<Symbol*>* entry = the_table()->bucket(i);
HashtableEntry<Symbol*, mtSymbol>** p = the_table()->bucket_addr(i);
HashtableEntry<Symbol*, mtSymbol>* entry = the_table()->bucket(i);
if (entry != NULL) {
while (entry != NULL) {
tty->print(PTR_FORMAT " ", entry->literal());
entry->literal()->print();
tty->print(" %d", entry->literal()->refcount());
p = entry->next_addr();
entry = (HashtableEntry<Symbol*>*)HashtableEntry<Symbol*>::make_ptr(*p);
entry = (HashtableEntry<Symbol*, mtSymbol>*)HashtableEntry<Symbol*, mtSymbol>::make_ptr(*p);
}
tty->cr();
}
@ -620,7 +609,6 @@ class StableMemoryChecker : public StackObj {
StringTable* StringTable::_the_table = NULL;
bool StringTable::_needs_rehashing = false;
jint StringTable::_seed = 0;
// Pick hashing algorithm
unsigned int StringTable::hash_string(const jchar* s, int len) {
@ -631,7 +619,7 @@ unsigned int StringTable::hash_string(const jchar* s, int len) {
oop StringTable::lookup(int index, jchar* name,
int len, unsigned int hash) {
int count = 0;
for (HashtableEntry<oop>* l = bucket(index); l != NULL; l = l->next()) {
for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
count++;
if (l->hash() == hash) {
if (java_lang_String::equals(l->literal(), name, len)) {
@ -640,7 +628,7 @@ oop StringTable::lookup(int index, jchar* name,
}
}
// If the bucket size is too deep check if this hash code is insufficient.
if (count >= BasicHashtable::rehash_count && !needs_rehashing()) {
if (count >= BasicHashtable<mtSymbol>::rehash_count && !needs_rehashing()) {
_needs_rehashing = check_rehash_table(count);
}
return NULL;
@ -676,7 +664,7 @@ oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
return test;
}
HashtableEntry<oop>* entry = new_entry(hashValue, string());
HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
add_entry(index, entry);
return string();
}
@ -761,8 +749,8 @@ void StringTable::unlink(BoolObjectClosure* is_alive) {
// entries at a safepoint.
assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<oop>** p = the_table()->bucket_addr(i);
HashtableEntry<oop>* entry = the_table()->bucket(i);
HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
while (entry != NULL) {
// Shared entries are normally at the end of the bucket and if we run into
// a shared entry, then there is nothing more to remove. However, if we
@ -778,15 +766,15 @@ void StringTable::unlink(BoolObjectClosure* is_alive) {
*p = entry->next();
the_table()->free_entry(entry);
}
entry = (HashtableEntry<oop>*)HashtableEntry<oop>::make_ptr(*p);
entry = (HashtableEntry<oop, mtSymbol>*)HashtableEntry<oop, mtSymbol>::make_ptr(*p);
}
}
}
void StringTable::oops_do(OopClosure* f) {
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<oop>** p = the_table()->bucket_addr(i);
HashtableEntry<oop>* entry = the_table()->bucket(i);
HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
while (entry != NULL) {
f->do_oop((oop*)entry->literal_addr());
@ -798,14 +786,14 @@ void StringTable::oops_do(OopClosure* f) {
} else {
p = entry->next_addr();
}
entry = (HashtableEntry<oop>*)HashtableEntry<oop>::make_ptr(*p);
entry = (HashtableEntry<oop, mtSymbol>*)HashtableEntry<oop, mtSymbol>::make_ptr(*p);
}
}
}
void StringTable::verify() {
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<oop>* p = the_table()->bucket(i);
HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
for ( ; p != NULL; p = p->next()) {
oop s = p->literal();
guarantee(s != NULL, "interned string is NULL");
@ -821,7 +809,7 @@ void StringTable::verify() {
void StringTable::dump(outputStream* st) {
NumberSeq summary;
for (int i = 0; i < the_table()->table_size(); ++i) {
HashtableEntry<oop>* p = the_table()->bucket(i);
HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
int count = 0;
for ( ; p != NULL; p = p->next()) {
count++;
@ -837,14 +825,6 @@ void StringTable::dump(outputStream* st) {
}
unsigned int StringTable::new_hash(oop string) {
ResourceMark rm;
int length;
jchar* chars = java_lang_String::as_unicode_string(string, length);
// Use alternate hashing algorithm on the string
return AltHashing::murmur3_32(seed(), chars, length);
}
// Create a new table and using alternate hash code, populate the new table
// with the existing strings. Set flag to use the alternate hash code afterwards.
void StringTable::rehash_table() {
@ -853,10 +833,6 @@ void StringTable::rehash_table() {
if (DumpSharedSpaces) return;
StringTable* new_table = new StringTable();
// Initialize new global seed for hashing.
_seed = AltHashing::compute_seed();
assert(seed() != 0, "shouldn't be zero");
// Rehash the table
the_table()->move_to(new_table);

View File

@ -71,7 +71,7 @@ class TempNewSymbol : public StackObj {
operator Symbol*() { return _temp; }
};
class SymbolTable : public Hashtable<Symbol*> {
class SymbolTable : public Hashtable<Symbol*, mtSymbol> {
friend class VMStructs;
friend class ClassFileParser;
@ -81,7 +81,6 @@ private:
// Set if one bucket is out of balance due to hash algorithm deficiency
static bool _needs_rehashing;
static jint _seed;
// For statistics
static int symbols_removed;
@ -113,10 +112,10 @@ private:
Symbol* lookup(int index, const char* name, int len, unsigned int hash);
SymbolTable()
: Hashtable<Symbol*>(symbol_table_size, sizeof (HashtableEntry<Symbol*>)) {}
: Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>)) {}
SymbolTable(HashtableBucket* t, int number_of_entries)
: Hashtable<Symbol*>(symbol_table_size, sizeof (HashtableEntry<Symbol*>), t,
SymbolTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
: Hashtable<Symbol*, mtSymbol>(symbol_table_size, sizeof (HashtableEntry<Symbol*, mtSymbol>), t,
number_of_entries) {}
// Arena for permanent symbols (null class loader) that are never unloaded
@ -124,11 +123,6 @@ private:
static Arena* arena() { return _arena; } // called for statistics
static void initialize_symbols(int arena_alloc_size = 0);
static bool use_alternate_hashcode() { return _seed != 0; }
static jint seed() { return _seed; }
unsigned int new_hash(Symbol* sym);
public:
enum {
symbol_alloc_batch_size = 8,
@ -145,10 +139,10 @@ public:
initialize_symbols(symbol_alloc_arena_size);
}
static void create_table(HashtableBucket* t, int length,
static void create_table(HashtableBucket<mtSymbol>* t, int length,
int number_of_entries) {
assert(_the_table == NULL, "One symbol table allowed.");
assert(length == symbol_table_size * sizeof(HashtableBucket),
assert(length == symbol_table_size * sizeof(HashtableBucket<mtSymbol>),
"bad shared symbol size.");
_the_table = new SymbolTable(t, number_of_entries);
// if CDS give symbol table a default arena size since most symbols
@ -224,13 +218,13 @@ public:
// Sharing
static void copy_buckets(char** top, char*end) {
the_table()->Hashtable<Symbol*>::copy_buckets(top, end);
the_table()->Hashtable<Symbol*, mtSymbol>::copy_buckets(top, end);
}
static void copy_table(char** top, char*end) {
the_table()->Hashtable<Symbol*>::copy_table(top, end);
the_table()->Hashtable<Symbol*, mtSymbol>::copy_table(top, end);
}
static void reverse(void* boundary = NULL) {
the_table()->Hashtable<Symbol*>::reverse(boundary);
the_table()->Hashtable<Symbol*, mtSymbol>::reverse(boundary);
}
// Rehash the symbol table if it gets out of balance
@ -238,8 +232,7 @@ public:
static bool needs_rehashing() { return _needs_rehashing; }
};
class StringTable : public Hashtable<oop> {
class StringTable : public Hashtable<oop, mtSymbol> {
friend class VMStructs;
private:
@ -248,7 +241,6 @@ private:
// Set if one bucket is out of balance due to hash algorithm deficiency
static bool _needs_rehashing;
static jint _seed;
static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
oop basic_add(int index, Handle string_or_null, jchar* name, int len,
@ -256,17 +248,12 @@ private:
oop lookup(int index, jchar* chars, int length, unsigned int hashValue);
StringTable() : Hashtable<oop>((int)StringTableSize,
sizeof (HashtableEntry<oop>)) {}
StringTable() : Hashtable<oop, mtSymbol>((int)StringTableSize,
sizeof (HashtableEntry<oop, mtSymbol>)) {}
StringTable(HashtableBucket* t, int number_of_entries)
: Hashtable<oop>((int)StringTableSize, sizeof (HashtableEntry<oop>), t,
StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
: Hashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
number_of_entries) {}
static bool use_alternate_hashcode() { return _seed != 0; }
static jint seed() { return _seed; }
unsigned int new_hash(oop s);
public:
// The string table
static StringTable* the_table() { return _the_table; }
@ -276,10 +263,10 @@ public:
_the_table = new StringTable();
}
static void create_table(HashtableBucket* t, int length,
static void create_table(HashtableBucket<mtSymbol>* t, int length,
int number_of_entries) {
assert(_the_table == NULL, "One string table allowed.");
assert((size_t)length == StringTableSize * sizeof(HashtableBucket),
assert((size_t)length == StringTableSize * sizeof(HashtableBucket<mtSymbol>),
"bad shared string size.");
_the_table = new StringTable(t, number_of_entries);
}
@ -313,13 +300,13 @@ public:
// Sharing
static void copy_buckets(char** top, char*end) {
the_table()->Hashtable<oop>::copy_buckets(top, end);
the_table()->Hashtable<oop, mtSymbol>::copy_buckets(top, end);
}
static void copy_table(char** top, char*end) {
the_table()->Hashtable<oop>::copy_table(top, end);
the_table()->Hashtable<oop, mtSymbol>::copy_table(top, end);
}
static void reverse() {
the_table()->Hashtable<oop>::reverse();
the_table()->Hashtable<oop, mtSymbol>::reverse();
}
// Rehash the symbol table if it gets out of balance

View File

@ -1168,9 +1168,9 @@ klassOop SystemDictionary::resolve_from_stream(Symbol* class_name,
}
void SystemDictionary::set_shared_dictionary(HashtableBucket* t, int length,
void SystemDictionary::set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
int number_of_entries) {
assert(length == _nof_buckets * sizeof(HashtableBucket),
assert(length == _nof_buckets * sizeof(HashtableBucket<mtClass>),
"bad shared dictionary size.");
_shared_dictionary = new Dictionary(_nof_buckets, t, number_of_entries);
}

View File

@ -32,6 +32,7 @@
#include "runtime/java.hpp"
#include "runtime/reflectionUtils.hpp"
#include "utilities/hashtable.hpp"
#include "utilities/hashtable.inline.hpp"
// The system dictionary stores all loaded classes and maps:
//
@ -72,7 +73,7 @@
class Dictionary;
class PlaceholderTable;
class LoaderConstraintTable;
class HashtableBucket;
template <MEMFLAGS F> class HashtableBucket;
class ResolutionErrorTable;
class SymbolPropertyTable;
@ -363,7 +364,7 @@ public:
static void copy_buckets(char** top, char* end);
static void copy_table(char** top, char* end);
static void reverse();
static void set_shared_dictionary(HashtableBucket* t, int length,
static void set_shared_dictionary(HashtableBucket<mtClass>* t, int length,
int number_of_entries);
// Printing
static void print() PRODUCT_RETURN;

View File

@ -144,7 +144,7 @@ void CodeBlob::set_oop_maps(OopMapSet* p) {
// chunk of memory, its your job to free it.
if (p != NULL) {
// We need to allocate a chunk big enough to hold the OopMapSet and all of its OopMaps
_oop_maps = (OopMapSet* )NEW_C_HEAP_ARRAY(unsigned char, p->heap_size());
_oop_maps = (OopMapSet* )NEW_C_HEAP_ARRAY(unsigned char, p->heap_size(), mtCode);
p->copy_to((address)_oop_maps);
} else {
_oop_maps = NULL;
@ -180,7 +180,7 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam
void CodeBlob::flush() {
if (_oop_maps) {
FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode);
_oop_maps = NULL;
}
_comments.free();

View File

@ -856,7 +856,7 @@ void CodeCache::print_internals() {
int bucketSize = 512;
int bucketLimit = maxCodeSize / bucketSize + 1;
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit);
int *buckets = NEW_C_HEAP_ARRAY(int, bucketLimit, mtCode);
memset(buckets,0,sizeof(int) * bucketLimit);
for (cb = first(); cb != NULL; cb = next(cb)) {
@ -893,7 +893,7 @@ void CodeCache::print_internals() {
}
}
FREE_C_HEAP_ARRAY(int, buckets);
FREE_C_HEAP_ARRAY(int, buckets, mtCode);
}
void CodeCache::print() {

View File

@ -88,6 +88,9 @@ class CodeCache : AllStatic {
// Lookup that does not fail if you lookup a zombie method (if you call this, be sure to know
// what you are doing)
static CodeBlob* find_blob_unsafe(void* start) {
// NMT can walk the stack before code cache is created
if (_heap == NULL) return NULL;
CodeBlob* result = (CodeBlob*)_heap->find_start(start);
// this assert is too strong because the heap code will return the
// heapblock containing start. That block can often be larger than

View File

@ -31,7 +31,7 @@
// This class is used internally by nmethods, to cache
// exception/pc/handler information.
class ExceptionCache : public CHeapObj {
class ExceptionCache : public CHeapObj<mtCode> {
friend class VMStructs;
private:
enum { cache_size = 16 };

View File

@ -101,7 +101,7 @@ class Stub VALUE_OBJ_CLASS_SPEC {
// of the concrete stub (see also macro below). There's exactly
// one stub interface instance required per stub queue.
class StubInterface: public CHeapObj {
class StubInterface: public CHeapObj<mtCode> {
public:
// Initialization/finalization
virtual void initialize(Stub* self, int size) = 0; // called after creation (called twice if allocated via (request, commit))
@ -152,7 +152,7 @@ class StubInterface: public CHeapObj {
// A StubQueue maintains a queue of stubs.
// Note: All sizes (spaces) are given in bytes.
class StubQueue: public CHeapObj {
class StubQueue: public CHeapObj<mtCode> {
friend class VMStructs;
private:
StubInterface* _stub_interface; // the interface prototype

View File

@ -29,7 +29,7 @@
typedef void (*initializer)(void);
class AbstractCompiler : public CHeapObj {
class AbstractCompiler : public CHeapObj<mtCompiler> {
private:
bool _is_initialized; // Mark whether compiler object is initialized

View File

@ -951,7 +951,7 @@ void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler
int compiler_count = c1_compiler_count + c2_compiler_count;
_method_threads =
new (ResourceObj::C_HEAP) GrowableArray<CompilerThread*>(compiler_count, true);
new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<CompilerThread*>(compiler_count, true);
char name_buffer[256];
for (int i = 0; i < c2_compiler_count; i++) {
@ -1627,7 +1627,7 @@ void CompileBroker::init_compiler_thread_log() {
}
fp = fopen(fileBuf, "at");
if (fp != NULL) {
file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1);
file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1, mtCompiler);
strcpy(file, fileBuf);
break;
}
@ -1637,7 +1637,7 @@ void CompileBroker::init_compiler_thread_log() {
} else {
if (LogCompilation && Verbose)
tty->print_cr("Opening compilation log %s", file);
CompileLog* log = new(ResourceObj::C_HEAP) CompileLog(file, fp, thread_id);
CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file, fp, thread_id);
thread->init_log(log);
if (xtty != NULL) {

View File

@ -36,7 +36,7 @@ class nmethodLocker;
//
// An entry in the compile queue. It represents a pending or current
// compilation.
class CompileTask : public CHeapObj {
class CompileTask : public CHeapObj<mtCompiler> {
friend class VMStructs;
private:
@ -131,7 +131,7 @@ public:
//
// Per Compiler Performance Counters.
//
class CompilerCounters : public CHeapObj {
class CompilerCounters : public CHeapObj<mtCompiler> {
public:
enum {
@ -175,7 +175,7 @@ class CompilerCounters : public CHeapObj {
// CompileQueue
//
// A list of CompileTasks.
class CompileQueue : public CHeapObj {
class CompileQueue : public CHeapObj<mtCompiler> {
private:
const char* _name;
Monitor* _lock;

View File

@ -37,14 +37,14 @@ CompileLog* CompileLog::_first = NULL;
CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id)
: _context(_context_buffer, sizeof(_context_buffer))
{
initialize(new(ResourceObj::C_HEAP) fileStream(fp));
initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp));
_file = file;
_file_end = 0;
_thread_id = thread_id;
_identities_limit = 0;
_identities_capacity = 400;
_identities = NEW_C_HEAP_ARRAY(char, _identities_capacity);
_identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
// link into the global list
{ MutexLocker locker(CompileTaskAlloc_lock);
@ -56,7 +56,7 @@ CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id)
CompileLog::~CompileLog() {
delete _out;
_out = NULL;
FREE_C_HEAP_ARRAY(char, _identities);
FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
}
@ -109,7 +109,7 @@ int CompileLog::identify(ciObject* obj) {
if (id >= _identities_capacity) {
int new_cap = _identities_capacity * 2;
if (new_cap <= id) new_cap = id + 100;
_identities = REALLOC_C_HEAP_ARRAY(char, _identities, new_cap);
_identities = REALLOC_C_HEAP_ARRAY(char, _identities, new_cap, mtCompiler);
_identities_capacity = new_cap;
}
while (id >= _identities_limit) {

View File

@ -34,7 +34,7 @@
#include "runtime/handles.inline.hpp"
#include "runtime/jniHandles.hpp"
class MethodMatcher : public CHeapObj {
class MethodMatcher : public CHeapObj<mtCompiler> {
public:
enum Mode {
Exact,
@ -550,10 +550,12 @@ void CompilerOracle::parse_from_line(char* line) {
}
}
static const char* default_cc_file = ".hotspot_compiler";
static const char* cc_file() {
#ifdef ASSERT
if (CompileCommandFile == NULL)
return ".hotspot_compiler";
return default_cc_file;
#endif
return CompileCommandFile;
}
@ -636,10 +638,17 @@ void compilerOracle_init() {
CompilerOracle::parse_from_string(CompileOnly, CompilerOracle::parse_compile_only);
if (CompilerOracle::has_command_file()) {
CompilerOracle::parse_from_file();
} else {
struct stat buf;
if (os::stat(default_cc_file, &buf) == 0) {
warning("%s file is present but has been ignored. "
"Run with -XX:CompileCommandFile=%s to load the file.",
default_cc_file, default_cc_file);
}
}
if (lists[PrintCommand] != NULL) {
if (PrintAssembly) {
warning("CompileCommand and/or .hotspot_compiler file contains 'print' commands, but PrintAssembly is also enabled");
warning("CompileCommand and/or %s file contains 'print' commands, but PrintAssembly is also enabled", default_cc_file);
} else if (FLAG_IS_DEFAULT(DebugNonSafepoints)) {
warning("printing of assembly code is enabled; turning on DebugNonSafepoints to gain additional output");
DebugNonSafepoints = true;

View File

@ -599,7 +599,7 @@ void OopMapSet::print_on(outputStream* st) const {
#ifdef COMPILER2
class DerivedPointerEntry : public CHeapObj {
class DerivedPointerEntry : public CHeapObj<mtCompiler> {
private:
oop* _location; // Location of derived pointer (also pointing to the base)
intptr_t _offset; // Offset from base pointer
@ -621,7 +621,7 @@ void DerivedPointerTable::clear() {
assert (!_active, "should not be active");
assert(_list == NULL || _list->length() == 0, "table not empty");
if (_list == NULL) {
_list = new (ResourceObj::C_HEAP) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
_list = new (ResourceObj::C_HEAP, mtCompiler) GrowableArray<DerivedPointerEntry*>(10, true); // Allocated on C heap
}
_active = true;
}

View File

@ -617,7 +617,7 @@ class CompactibleFreeListSpace: public CompactibleSpace {
// A parallel-GC-thread-local allocation buffer for allocation into a
// CompactibleFreeListSpace.
class CFLS_LAB : public CHeapObj {
class CFLS_LAB : public CHeapObj<mtGC> {
// The space that this buffer allocates into.
CompactibleFreeListSpace* _cfls;

View File

@ -174,7 +174,7 @@ NOT_PRODUCT(CompactibleFreeListSpace* debug_cms_space;)
// This struct contains per-thread things necessary to support parallel
// young-gen collection.
class CMSParGCThreadState: public CHeapObj {
class CMSParGCThreadState: public CHeapObj<mtGC> {
public:
CFLS_LAB lab;
PromotionInfo promo;
@ -229,7 +229,7 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
if (CollectedHeap::use_parallel_gc_threads()) {
typedef CMSParGCThreadState* CMSParGCThreadStatePtr;
_par_gc_thread_states =
NEW_C_HEAP_ARRAY(CMSParGCThreadStatePtr, ParallelGCThreads);
NEW_C_HEAP_ARRAY(CMSParGCThreadStatePtr, ParallelGCThreads, mtGC);
if (_par_gc_thread_states == NULL) {
vm_exit_during_initialization("Could not allocate par gc structs");
}
@ -687,7 +687,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
warning("task_queues allocation failure.");
return;
}
_hash_seed = NEW_C_HEAP_ARRAY(int, num_queues);
_hash_seed = NEW_C_HEAP_ARRAY(int, num_queues, mtGC);
if (_hash_seed == NULL) {
warning("_hash_seed array allocation failure");
return;
@ -737,7 +737,7 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
assert(_young_gen != NULL, "no _young_gen");
_eden_chunk_index = 0;
_eden_chunk_capacity = (_young_gen->max_capacity()+CMSSamplingGrain)/CMSSamplingGrain;
_eden_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, _eden_chunk_capacity);
_eden_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, _eden_chunk_capacity, mtGC);
if (_eden_chunk_array == NULL) {
_eden_chunk_capacity = 0;
warning("GC/CMS: _eden_chunk_array allocation failure");
@ -750,35 +750,35 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
const size_t max_plab_samples =
((DefNewGeneration*)_young_gen)->max_survivor_size()/MinTLABSize;
_survivor_plab_array = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads);
_survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples);
_cursor = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads);
_survivor_plab_array = NEW_C_HEAP_ARRAY(ChunkArray, ParallelGCThreads, mtGC);
_survivor_chunk_array = NEW_C_HEAP_ARRAY(HeapWord*, 2*max_plab_samples, mtGC);
_cursor = NEW_C_HEAP_ARRAY(size_t, ParallelGCThreads, mtGC);
if (_survivor_plab_array == NULL || _survivor_chunk_array == NULL
|| _cursor == NULL) {
warning("Failed to allocate survivor plab/chunk array");
if (_survivor_plab_array != NULL) {
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
_survivor_plab_array = NULL;
}
if (_survivor_chunk_array != NULL) {
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
_survivor_chunk_array = NULL;
}
if (_cursor != NULL) {
FREE_C_HEAP_ARRAY(size_t, _cursor);
FREE_C_HEAP_ARRAY(size_t, _cursor, mtGC);
_cursor = NULL;
}
} else {
_survivor_chunk_capacity = 2*max_plab_samples;
for (uint i = 0; i < ParallelGCThreads; i++) {
HeapWord** vec = NEW_C_HEAP_ARRAY(HeapWord*, max_plab_samples);
HeapWord** vec = NEW_C_HEAP_ARRAY(HeapWord*, max_plab_samples, mtGC);
if (vec == NULL) {
warning("Failed to allocate survivor plab array");
for (int j = i; j > 0; j--) {
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array(), mtGC);
}
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
_survivor_plab_array = NULL;
_survivor_chunk_array = NULL;
_survivor_chunk_capacity = 0;

View File

@ -161,7 +161,7 @@ class CMSBitMap VALUE_OBJ_CLASS_SPEC {
// Represents a marking stack used by the CMS collector.
// Ideally this should be GrowableArray<> just like MSC's marking stack(s).
class CMSMarkStack: public CHeapObj {
class CMSMarkStack: public CHeapObj<mtGC> {
//
friend class CMSCollector; // to get at expasion stats further below
//
@ -265,7 +265,7 @@ class ModUnionClosurePar: public ModUnionClosure {
// Survivor Chunk Array in support of parallelization of
// Survivor Space rescan.
class ChunkArray: public CHeapObj {
class ChunkArray: public CHeapObj<mtGC> {
size_t _index;
size_t _capacity;
size_t _overflows;
@ -506,7 +506,7 @@ private:
};
class CMSCollector: public CHeapObj {
class CMSCollector: public CHeapObj<mtGC> {
friend class VMStructs;
friend class ConcurrentMarkSweepThread;
friend class ConcurrentMarkSweepGeneration;
@ -553,8 +553,8 @@ class CMSCollector: public CHeapObj {
// The following array-pair keeps track of mark words
// displaced for accomodating overflow list above.
// This code will likely be revisited under RFE#4922830.
Stack<oop> _preserved_oop_stack;
Stack<markOop> _preserved_mark_stack;
Stack<oop, mtGC> _preserved_oop_stack;
Stack<markOop, mtGC> _preserved_mark_stack;
int* _hash_seed;

View File

@ -28,7 +28,7 @@
#include "gc_implementation/g1/heapRegion.hpp"
#include "utilities/growableArray.hpp"
class CollectionSetChooser: public CHeapObj {
class CollectionSetChooser: public CHeapObj<mtGC> {
GrowableArray<HeapRegion*> _regions;

View File

@ -79,7 +79,7 @@ ConcurrentG1Refine::ConcurrentG1Refine() :
_n_threads = _n_worker_threads + 1;
reset_threshold_step();
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads);
_threads = NEW_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _n_threads, mtGC);
int worker_id_offset = (int)DirtyCardQueueSet::num_par_ids();
ConcurrentG1RefineThread *next = NULL;
for (int i = _n_threads - 1; i >= 0; i--) {
@ -157,7 +157,7 @@ void ConcurrentG1Refine::init() {
_def_use_cache = true;
_use_cache = true;
_hot_cache_size = (1 << G1ConcRSLogCacheSize);
_hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size);
_hot_cache = NEW_C_HEAP_ARRAY(jbyte*, _hot_cache_size, mtGC);
_n_hot = 0;
_hot_cache_idx = 0;
@ -191,18 +191,18 @@ ConcurrentG1Refine::~ConcurrentG1Refine() {
// Please see the comment in allocate_card_count_cache
// for why we call os::malloc() and os::free() directly.
assert(_card_counts != NULL, "Logic");
os::free(_card_counts);
os::free(_card_counts, mtGC);
assert(_card_epochs != NULL, "Logic");
os::free(_card_epochs);
os::free(_card_epochs, mtGC);
assert(_hot_cache != NULL, "Logic");
FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
FREE_C_HEAP_ARRAY(jbyte*, _hot_cache, mtGC);
}
if (_threads != NULL) {
for (int i = 0; i < _n_threads; i++) {
delete _threads[i];
}
FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads);
FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC);
}
}
@ -436,17 +436,17 @@ bool ConcurrentG1Refine::allocate_card_count_cache(size_t n,
size_t counts_size = n * sizeof(CardCountCacheEntry);
size_t epochs_size = n * sizeof(CardEpochCacheEntry);
*counts = (CardCountCacheEntry*) os::malloc(counts_size);
*counts = (CardCountCacheEntry*) os::malloc(counts_size, mtGC);
if (*counts == NULL) {
// allocation was unsuccessful
return false;
}
*epochs = (CardEpochCacheEntry*) os::malloc(epochs_size);
*epochs = (CardEpochCacheEntry*) os::malloc(epochs_size, mtGC);
if (*epochs == NULL) {
// allocation was unsuccessful - free counts array
assert(*counts != NULL, "must be");
os::free(*counts);
os::free(*counts, mtGC);
*counts = NULL;
return false;
}
@ -479,8 +479,8 @@ bool ConcurrentG1Refine::expand_card_count_cache(int cache_size_idx) {
// Allocation was successful.
// We can just free the old arrays; we're
// not interested in preserving the contents
if (_card_counts != NULL) os::free(_card_counts);
if (_card_epochs != NULL) os::free(_card_epochs);
if (_card_counts != NULL) os::free(_card_counts, mtGC);
if (_card_epochs != NULL) os::free(_card_epochs, mtGC);
// Cache the size of the arrays and the index that got us there.
_n_card_counts = cache_size;

View File

@ -34,7 +34,7 @@
class ConcurrentG1RefineThread;
class G1RemSet;
class ConcurrentG1Refine: public CHeapObj {
class ConcurrentG1Refine: public CHeapObj<mtGC> {
ConcurrentG1RefineThread** _threads;
int _n_threads;
int _n_worker_threads;

View File

@ -42,6 +42,7 @@
#include "oops/oop.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/java.hpp"
#include "services/memTracker.hpp"
// Concurrent marking bit map wrapper
@ -53,6 +54,8 @@ CMBitMapRO::CMBitMapRO(ReservedSpace rs, int shifter) :
ReservedSpace brs(ReservedSpace::allocation_align_size_up(
(_bmWordSize >> (_shifter + LogBitsPerByte)) + 1));
MemTracker::record_virtual_memory_type((address)brs.base(), mtGC);
guarantee(brs.is_reserved(), "couldn't allocate concurrent marking bit map");
// For now we'll just commit all of the bit map up fromt.
// Later on we'll try to be more parsimonious with swap.
@ -161,7 +164,7 @@ CMMarkStack::CMMarkStack(ConcurrentMark* cm) :
{}
void CMMarkStack::allocate(size_t size) {
_base = NEW_C_HEAP_ARRAY(oop, size);
_base = NEW_C_HEAP_ARRAY(oop, size, mtGC);
if (_base == NULL) {
vm_exit_during_initialization("Failed to allocate CM region mark stack");
}
@ -173,7 +176,7 @@ void CMMarkStack::allocate(size_t size) {
CMMarkStack::~CMMarkStack() {
if (_base != NULL) {
FREE_C_HEAP_ARRAY(oop, _base);
FREE_C_HEAP_ARRAY(oop, _base, mtGC);
}
}
@ -480,11 +483,11 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
_root_regions.init(_g1h, this);
_tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_task_num);
_accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_task_num);
_tasks = NEW_C_HEAP_ARRAY(CMTask*, _max_task_num, mtGC);
_accum_task_vtime = NEW_C_HEAP_ARRAY(double, _max_task_num, mtGC);
_count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_task_num);
_count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_task_num);
_count_card_bitmaps = NEW_C_HEAP_ARRAY(BitMap, _max_task_num, mtGC);
_count_marked_bytes = NEW_C_HEAP_ARRAY(size_t*, _max_task_num, mtGC);
BitMap::idx_t card_bm_size = _card_bm.size();
@ -496,7 +499,7 @@ ConcurrentMark::ConcurrentMark(ReservedSpace rs, uint max_regions) :
_task_queues->register_queue(i, task_queue);
_count_card_bitmaps[i] = BitMap(card_bm_size, false);
_count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions);
_count_marked_bytes[i] = NEW_C_HEAP_ARRAY(size_t, (size_t) max_regions, mtGC);
_tasks[i] = new CMTask(i, this,
_count_marked_bytes[i],

View File

@ -30,8 +30,8 @@
class G1CollectedHeap;
class CMTask;
typedef GenericTaskQueue<oop> CMTaskQueue;
typedef GenericTaskQueueSet<CMTaskQueue> CMTaskQueueSet;
typedef GenericTaskQueue<oop, mtGC> CMTaskQueue;
typedef GenericTaskQueueSet<CMTaskQueue, mtGC> CMTaskQueueSet;
// Closure used by CM during concurrent reference discovery
// and reference processing (during remarking) to determine
@ -343,7 +343,7 @@ public:
class ConcurrentMarkThread;
class ConcurrentMark : public CHeapObj {
class ConcurrentMark: public CHeapObj<mtGC> {
friend class ConcurrentMarkThread;
friend class CMTask;
friend class CMBitMapClosure;

View File

@ -32,7 +32,7 @@ class FreeIdSet;
// A closure class for processing card table entries. Note that we don't
// require these closure objects to be stack-allocated.
class CardTableEntryClosure: public CHeapObj {
class CardTableEntryClosure: public CHeapObj<mtGC> {
public:
// Process the card whose card table entry is "card_ptr". If returns
// "false", terminate the iteration early.

View File

@ -27,6 +27,7 @@
#include "memory/space.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/java.hpp"
#include "services/memTracker.hpp"
//////////////////////////////////////////////////////////////////////
// G1BlockOffsetSharedArray
@ -44,6 +45,9 @@ G1BlockOffsetSharedArray::G1BlockOffsetSharedArray(MemRegion reserved,
if (!_vs.initialize(rs, 0)) {
vm_exit_during_initialization("Could not reserve enough space for heap offset array");
}
MemTracker::record_virtual_memory_type((address)rs.base(), mtGC);
_offset_array = (u_char*)_vs.low_boundary();
resize(init_word_size);
if (TraceBlockOffsetTable) {

View File

@ -117,7 +117,7 @@ public:
// Here is the shared array type.
class G1BlockOffsetSharedArray: public CHeapObj {
class G1BlockOffsetSharedArray: public CHeapObj<mtGC> {
friend class G1BlockOffsetArray;
friend class G1BlockOffsetArrayContigSpace;
friend class VMStructs;

View File

@ -1916,14 +1916,14 @@ G1CollectedHeap::G1CollectedHeap(G1CollectorPolicy* policy_) :
assert(n_rem_sets > 0, "Invariant.");
HeapRegionRemSetIterator** iter_arr =
NEW_C_HEAP_ARRAY(HeapRegionRemSetIterator*, n_queues);
NEW_C_HEAP_ARRAY(HeapRegionRemSetIterator*, n_queues, mtGC);
for (int i = 0; i < n_queues; i++) {
iter_arr[i] = new HeapRegionRemSetIterator();
}
_rem_set_iterator = iter_arr;
_worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues);
_worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues);
_worker_cset_start_region = NEW_C_HEAP_ARRAY(HeapRegion*, n_queues, mtGC);
_worker_cset_start_region_time_stamp = NEW_C_HEAP_ARRAY(unsigned int, n_queues, mtGC);
for (int i = 0; i < n_queues; i++) {
RefToScanQueue* q = new RefToScanQueue();
@ -2082,7 +2082,7 @@ jint G1CollectedHeap::initialize() {
_in_cset_fast_test_length = max_regions();
_in_cset_fast_test_base =
NEW_C_HEAP_ARRAY(bool, (size_t) _in_cset_fast_test_length);
NEW_C_HEAP_ARRAY(bool, (size_t) _in_cset_fast_test_length, mtGC);
// We're biasing _in_cset_fast_test to avoid subtracting the
// beginning of the heap every time we want to index; basically
@ -3505,7 +3505,7 @@ void
G1CollectedHeap::setup_surviving_young_words() {
assert(_surviving_young_words == NULL, "pre-condition");
uint array_length = g1_policy()->young_cset_region_length();
_surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length);
_surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length, mtGC);
if (_surviving_young_words == NULL) {
vm_exit_out_of_memory(sizeof(size_t) * array_length,
"Not enough space for young surv words summary.");
@ -3530,7 +3530,7 @@ G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
void
G1CollectedHeap::cleanup_surviving_young_words() {
guarantee( _surviving_young_words != NULL, "pre-condition" );
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words, mtGC);
_surviving_young_words = NULL;
}
@ -4073,7 +4073,7 @@ void G1CollectedHeap::abandon_gc_alloc_regions() {
void G1CollectedHeap::init_for_evac_failure(OopsInHeapRegionClosure* cl) {
_drain_in_progress = false;
set_evac_failure_closure(cl);
_evac_failure_scan_stack = new (ResourceObj::C_HEAP) GrowableArray<oop>(40, true);
_evac_failure_scan_stack = new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(40, true);
}
void G1CollectedHeap::finalize_for_evac_failure() {
@ -4207,9 +4207,9 @@ void G1CollectedHeap::preserve_mark_if_necessary(oop obj, markOop m) {
if (_objs_with_preserved_marks == NULL) {
assert(_preserved_marks_of_objs == NULL, "Both or none.");
_objs_with_preserved_marks =
new (ResourceObj::C_HEAP) GrowableArray<oop>(40, true);
new (ResourceObj::C_HEAP, mtGC) GrowableArray<oop>(40, true);
_preserved_marks_of_objs =
new (ResourceObj::C_HEAP) GrowableArray<markOop>(40, true);
new (ResourceObj::C_HEAP, mtGC) GrowableArray<markOop>(40, true);
}
_objs_with_preserved_marks->push(obj);
_preserved_marks_of_objs->push(m);
@ -4269,7 +4269,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num)
uint array_length = PADDING_ELEM_NUM +
real_length +
PADDING_ELEM_NUM;
_surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length);
_surviving_young_words_base = NEW_C_HEAP_ARRAY(size_t, array_length, mtGC);
if (_surviving_young_words_base == NULL)
vm_exit_out_of_memory(array_length * sizeof(size_t),
"Not enough space for young surv histo.");

View File

@ -62,8 +62,8 @@ class ConcurrentMarkThread;
class ConcurrentG1Refine;
class GenerationCounters;
typedef OverflowTaskQueue<StarTask> RefToScanQueue;
typedef GenericTaskQueueSet<RefToScanQueue> RefToScanQueueSet;
typedef OverflowTaskQueue<StarTask, mtGC> RefToScanQueue;
typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
typedef int RegionIdx_t; // needs to hold [ 0..max_regions() )
typedef int CardIdx_t; // needs to hold [ 0..CardsPerRegion )
@ -74,7 +74,7 @@ enum GCAllocPurpose {
GCAllocPurposeCount
};
class YoungList : public CHeapObj {
class YoungList : public CHeapObj<mtGC> {
private:
G1CollectedHeap* _g1h;
@ -1772,7 +1772,7 @@ public:
G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num);
~G1ParScanThreadState() {
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
}
RefToScanQueue* refs() { return _refs; }

View File

@ -40,7 +40,7 @@ class CollectionSetChooser;
// TraceGen0Time collects data on _both_ young and mixed evacuation pauses
// (the latter may contain non-young regions - i.e. regions that are
// technically in Gen1) while TraceGen1Time collects data about full GCs.
class TraceGen0TimeData : public CHeapObj {
class TraceGen0TimeData : public CHeapObj<mtGC> {
private:
unsigned _young_pause_num;
unsigned _mixed_pause_num;
@ -86,7 +86,7 @@ public:
void print() const;
};
class TraceGen1TimeData : public CHeapObj {
class TraceGen1TimeData : public CHeapObj<mtGC> {
private:
NumberSeq _all_full_gc_times;
@ -131,7 +131,7 @@ class TraceGen1TimeData : public CHeapObj {
//
// NewSize and MaxNewSize override NewRatio. So, NewRatio is ignored if it is
// combined with either NewSize or MaxNewSize. (A warning message is printed.)
class G1YoungGenSizer : public CHeapObj {
class G1YoungGenSizer : public CHeapObj<mtGC> {
private:
enum SizerKind {
SizerDefaults,

View File

@ -34,7 +34,7 @@
/***** ALL TIMES ARE IN SECS!!!!!!! *****/
// this is the "interface"
class G1MMUTracker: public CHeapObj {
class G1MMUTracker: public CHeapObj<mtGC> {
protected:
double _time_slice;
double _max_gc_time; // this is per time slice

View File

@ -112,7 +112,7 @@ class G1CollectedHeap;
// do which is important as we want to keep the eden region allocation
// path as low-overhead as possible.
class G1MonitoringSupport : public CHeapObj {
class G1MonitoringSupport : public CHeapObj<mtGC> {
friend class VMStructs;
G1CollectedHeap* _g1h;

View File

@ -75,7 +75,7 @@ G1RemSet::G1RemSet(G1CollectedHeap* g1, CardTableModRefBS* ct_bs)
{
_seq_task = new SubTasksDone(NumSeqTasks);
guarantee(n_workers() > 0, "There should be some workers");
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers());
_cset_rs_update_cl = NEW_C_HEAP_ARRAY(OopsInHeapRegionClosure*, n_workers(), mtGC);
for (uint i = 0; i < n_workers(); i++) {
_cset_rs_update_cl[i] = NULL;
}
@ -86,7 +86,7 @@ G1RemSet::~G1RemSet() {
for (uint i = 0; i < n_workers(); i++) {
assert(_cset_rs_update_cl[i] == NULL, "it should be");
}
FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
}
void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
@ -416,7 +416,7 @@ void G1RemSet::prepare_for_oops_into_collection_set_do() {
// _seq_task->set_n_termination((int)n_workers());
}
guarantee( _cards_scanned == NULL, "invariant" );
_cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers());
_cards_scanned = NEW_C_HEAP_ARRAY(size_t, n_workers(), mtGC);
for (uint i = 0; i < n_workers(); ++i) {
_cards_scanned[i] = 0;
}
@ -487,7 +487,7 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() {
for (uint i = 0; i < n_workers(); ++i) {
_total_cards_scanned += _cards_scanned[i];
}
FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC);
_cards_scanned = NULL;
// Cleanup after copy
_g1->set_refine_cte_cl_concurrency(true);

View File

@ -36,7 +36,7 @@ class ConcurrentG1Refine;
// external heap references into it. Uses a mod ref bs to track updates,
// so that they can be used to update the individual region remsets.
class G1RemSet: public CHeapObj {
class G1RemSet: public CHeapObj<mtGC> {
protected:
G1CollectedHeap* _g1;
unsigned _conc_refine_cards;

View File

@ -36,7 +36,7 @@
// OtherRegionsTable
class PerRegionTable: public CHeapObj {
class PerRegionTable: public CHeapObj<mtGC> {
friend class OtherRegionsTable;
friend class HeapRegionRemSetIterator;
@ -272,9 +272,9 @@ void OtherRegionsTable::init_from_card_cache(size_t max_regions) {
_from_card_cache_max_regions = max_regions;
int n_par_rs = HeapRegionRemSet::num_par_rem_sets();
_from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs);
_from_card_cache = NEW_C_HEAP_ARRAY(int*, n_par_rs, mtGC);
for (int i = 0; i < n_par_rs; i++) {
_from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions);
_from_card_cache[i] = NEW_C_HEAP_ARRAY(int, max_regions, mtGC);
for (size_t j = 0; j < max_regions; j++) {
_from_card_cache[i][j] = -1; // An invalid value.
}
@ -977,9 +977,9 @@ void HeapRegionRemSet::record(HeapRegion* hr, OopOrNarrowOopStar f) {
&& _recorded_cards == NULL
&& _recorded_regions == NULL,
"Inv");
_recorded_oops = NEW_C_HEAP_ARRAY(OopOrNarrowOopStar, MaxRecorded);
_recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded);
_recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded);
_recorded_oops = NEW_C_HEAP_ARRAY(OopOrNarrowOopStar, MaxRecorded, mtGC);
_recorded_cards = NEW_C_HEAP_ARRAY(HeapWord*, MaxRecorded, mtGC);
_recorded_regions = NEW_C_HEAP_ARRAY(HeapRegion*, MaxRecorded, mtGC);
}
if (_n_recorded == MaxRecorded) {
gclog_or_tty->print_cr("Filled up 'recorded' (%d).", MaxRecorded);
@ -1000,8 +1000,8 @@ void HeapRegionRemSet::record_event(Event evnt) {
assert(_n_recorded_events == 0
&& _recorded_event_index == NULL,
"Inv");
_recorded_events = NEW_C_HEAP_ARRAY(Event, MaxRecordedEvents);
_recorded_event_index = NEW_C_HEAP_ARRAY(int, MaxRecordedEvents);
_recorded_events = NEW_C_HEAP_ARRAY(Event, MaxRecordedEvents, mtGC);
_recorded_event_index = NEW_C_HEAP_ARRAY(int, MaxRecordedEvents, mtGC);
}
if (_n_recorded_events == MaxRecordedEvents) {
gclog_or_tty->print_cr("Filled up 'recorded_events' (%d).", MaxRecordedEvents);

View File

@ -165,7 +165,7 @@ public:
static void print_from_card_cache();
};
class HeapRegionRemSet : public CHeapObj {
class HeapRegionRemSet : public CHeapObj<mtGC> {
friend class VMStructs;
friend class HeapRegionRemSetIterator;
@ -332,7 +332,7 @@ public:
#endif
};
class HeapRegionRemSetIterator : public CHeapObj {
class HeapRegionRemSetIterator : public CHeapObj<mtGC> {
// The region over which we're iterating.
const HeapRegionRemSet* _hrrs;

View File

@ -86,7 +86,7 @@ void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end,
_allocated_length = 0;
_max_length = max_length;
_regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length);
_regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length, mtGC);
memset(_regions, 0, (size_t) max_length * sizeof(HeapRegion*));
_regions_biased = _regions - ((uintx) bottom >> _region_shift);

View File

@ -53,7 +53,7 @@ class FreeRegionList;
//
// and maintain that: _length <= _allocated_length <= _max_length
class HeapRegionSeq: public CHeapObj {
class HeapRegionSeq: public CHeapObj<mtGC> {
friend class VMStructs;
// The array that holds the HeapRegions.

View File

@ -126,7 +126,7 @@ void** PtrQueueSet::allocate_buffer() {
return res;
} else {
// Allocate space for the BufferNode in front of the buffer.
char *b = NEW_C_HEAP_ARRAY(char, _sz + BufferNode::aligned_size());
char *b = NEW_C_HEAP_ARRAY(char, _sz + BufferNode::aligned_size(), mtGC);
return BufferNode::make_buffer_from_block(b);
}
}
@ -149,7 +149,7 @@ void PtrQueueSet::reduce_free_list() {
assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
void* b = BufferNode::make_block_from_node(_buf_free_list);
_buf_free_list = _buf_free_list->next();
FREE_C_HEAP_ARRAY(char, b);
FREE_C_HEAP_ARRAY(char, b, mtGC);
_buf_free_list_sz --;
n--;
}

View File

@ -208,7 +208,7 @@ void SATBMarkQueueSet::initialize(Monitor* cbl_mon, Mutex* fl_lock,
PtrQueueSet::initialize(cbl_mon, fl_lock, process_completed_threshold, -1);
_shared_satb_queue.set_lock(lock);
if (ParallelGCThreads > 0) {
_par_closures = NEW_C_HEAP_ARRAY(ObjectClosure*, ParallelGCThreads);
_par_closures = NEW_C_HEAP_ARRAY(ObjectClosure*, ParallelGCThreads, mtGC);
}
}

View File

@ -148,8 +148,8 @@ void SparsePRTEntry::copy_cards(SparsePRTEntry* e) const {
RSHashTable::RSHashTable(size_t capacity) :
_capacity(capacity), _capacity_mask(capacity-1),
_occupied_entries(0), _occupied_cards(0),
_entries((SparsePRTEntry*)NEW_C_HEAP_ARRAY(char, SparsePRTEntry::size() * capacity)),
_buckets(NEW_C_HEAP_ARRAY(int, capacity)),
_entries((SparsePRTEntry*)NEW_C_HEAP_ARRAY(char, SparsePRTEntry::size() * capacity, mtGC)),
_buckets(NEW_C_HEAP_ARRAY(int, capacity, mtGC)),
_free_list(NullEntry), _free_region(0)
{
clear();
@ -157,11 +157,11 @@ RSHashTable::RSHashTable(size_t capacity) :
RSHashTable::~RSHashTable() {
if (_entries != NULL) {
FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries, mtGC);
_entries = NULL;
}
if (_buckets != NULL) {
FREE_C_HEAP_ARRAY(int, _buckets);
FREE_C_HEAP_ARRAY(int, _buckets, mtGC);
_buckets = NULL;
}
}

View File

@ -42,7 +42,7 @@
// insertions only enqueue old versions for deletions, but do not delete
// old versions synchronously.
class SparsePRTEntry: public CHeapObj {
class SparsePRTEntry: public CHeapObj<mtGC> {
public:
enum SomePublicConstants {
NullEntry = -1,
@ -101,7 +101,7 @@ public:
};
class RSHashTable : public CHeapObj {
class RSHashTable : public CHeapObj<mtGC> {
friend class RSHashTableIter;

View File

@ -43,7 +43,7 @@ SurvRateGroup::SurvRateGroup(G1CollectorPolicy* g1p,
reset();
if (summary_surv_rates_len > 0) {
size_t length = summary_surv_rates_len;
_summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length);
_summary_surv_rates = NEW_C_HEAP_ARRAY(NumberSeq*, length, mtGC);
for (size_t i = 0; i < length; ++i) {
_summary_surv_rates[i] = new NumberSeq();
}
@ -90,9 +90,9 @@ SurvRateGroup::stop_adding_regions() {
double* old_accum_surv_rate_pred = _accum_surv_rate_pred;
TruncatedSeq** old_surv_rate_pred = _surv_rate_pred;
_surv_rate = NEW_C_HEAP_ARRAY(double, _region_num);
_accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num);
_surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num);
_surv_rate = NEW_C_HEAP_ARRAY(double, _region_num, mtGC);
_accum_surv_rate_pred = NEW_C_HEAP_ARRAY(double, _region_num, mtGC);
_surv_rate_pred = NEW_C_HEAP_ARRAY(TruncatedSeq*, _region_num, mtGC);
for (size_t i = 0; i < _stats_arrays_length; ++i) {
_surv_rate_pred[i] = old_surv_rate_pred[i];
@ -104,13 +104,13 @@ SurvRateGroup::stop_adding_regions() {
_stats_arrays_length = _region_num;
if (old_surv_rate != NULL) {
FREE_C_HEAP_ARRAY(double, old_surv_rate);
FREE_C_HEAP_ARRAY(double, old_surv_rate, mtGC);
}
if (old_accum_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred, mtGC);
}
if (old_surv_rate_pred != NULL) {
FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred, mtGC);
}
}

View File

@ -29,7 +29,7 @@
class G1CollectorPolicy;
class SurvRateGroup : public CHeapObj {
class SurvRateGroup : public CHeapObj<mtGC> {
private:
G1CollectorPolicy* _g1p;
const char* _name;

View File

@ -457,12 +457,12 @@ get_LNC_array_for_space(Space* sp,
if (_lowest_non_clean[i] != NULL) {
assert(n_chunks != _lowest_non_clean_chunk_size[i],
"logical consequence");
FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i]);
FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC);
_lowest_non_clean[i] = NULL;
}
// Now allocate a new one if necessary.
if (_lowest_non_clean[i] == NULL) {
_lowest_non_clean[i] = NEW_C_HEAP_ARRAY(CardPtr, n_chunks);
_lowest_non_clean[i] = NEW_C_HEAP_ARRAY(CardPtr, n_chunks, mtGC);
_lowest_non_clean_chunk_size[i] = n_chunks;
_lowest_non_clean_base_chunk_index[i] = addr_to_chunk_index(covered.start());
for (int j = 0; j < (int)n_chunks; j++)

View File

@ -35,7 +35,7 @@
class PLABStats;
// A per-thread allocation buffer used during GC.
class ParGCAllocBuffer: public CHeapObj {
class ParGCAllocBuffer: public CHeapObj<mtGC> {
protected:
char head[32];
size_t _word_sz; // in HeapWord units

View File

@ -59,7 +59,7 @@ ParScanThreadState::ParScanThreadState(Space* to_space_,
Generation* old_gen_,
int thread_num_,
ObjToScanQueueSet* work_queue_set_,
Stack<oop>* overflow_stacks_,
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz_,
ParallelTaskTerminator& term_) :
_to_space(to_space_), _old_gen(old_gen_), _young_gen(gen_), _thread_num(thread_num_),
@ -184,7 +184,7 @@ bool ParScanThreadState::take_from_overflow_stack() {
assert(ParGCUseLocalOverflow, "Else should not call");
assert(young_gen()->overflow_list() == NULL, "Error");
ObjToScanQueue* queue = work_queue();
Stack<oop>* const of_stack = overflow_stack();
Stack<oop, mtGC>* const of_stack = overflow_stack();
const size_t num_overflow_elems = of_stack->size();
const size_t space_available = queue->max_elems() - queue->size();
const size_t num_take_elems = MIN3(space_available / 4,
@ -297,7 +297,7 @@ public:
ParNewGeneration& gen,
Generation& old_gen,
ObjToScanQueueSet& queue_set,
Stack<oop>* overflow_stacks_,
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz,
ParallelTaskTerminator& term);
@ -331,7 +331,7 @@ private:
ParScanThreadStateSet::ParScanThreadStateSet(
int num_threads, Space& to_space, ParNewGeneration& gen,
Generation& old_gen, ObjToScanQueueSet& queue_set,
Stack<oop>* overflow_stacks,
Stack<oop, mtGC>* overflow_stacks,
size_t desired_plab_sz, ParallelTaskTerminator& term)
: ResourceArray(sizeof(ParScanThreadState), num_threads),
_gen(gen), _next_gen(old_gen), _term(term)
@ -649,9 +649,14 @@ ParNewGeneration(ReservedSpace rs, size_t initial_byte_size, int level)
_overflow_stacks = NULL;
if (ParGCUseLocalOverflow) {
_overflow_stacks = NEW_C_HEAP_ARRAY(Stack<oop>, ParallelGCThreads);
// typedef to workaround NEW_C_HEAP_ARRAY macro, which can not deal
// with ','
typedef Stack<oop, mtGC> GCOopStack;
_overflow_stacks = NEW_C_HEAP_ARRAY(GCOopStack, ParallelGCThreads, mtGC);
for (size_t i = 0; i < ParallelGCThreads; ++i) {
new (_overflow_stacks + i) Stack<oop>();
new (_overflow_stacks + i) Stack<oop, mtGC>();
}
}
@ -1401,7 +1406,7 @@ void ParNewGeneration::push_on_overflow_list(oop from_space_obj, ParScanThreadSt
assert(_num_par_pushes > 0, "Tautology");
#endif
if (from_space_obj->forwardee() == from_space_obj) {
oopDesc* listhead = NEW_C_HEAP_ARRAY(oopDesc, 1);
oopDesc* listhead = NEW_C_HEAP_ARRAY(oopDesc, 1, mtGC);
listhead->forward_to(from_space_obj);
from_space_obj = listhead;
}
@ -1553,7 +1558,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
// This can become a scaling bottleneck when there is work queue overflow coincident
// with promotion failure.
oopDesc* f = cur;
FREE_C_HEAP_ARRAY(oopDesc, f);
FREE_C_HEAP_ARRAY(oopDesc, f, mtGC);
} else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) {
assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
obj_to_push = cur;

View File

@ -41,7 +41,7 @@ class ParEvacuateFollowersClosure;
// in genOopClosures.inline.hpp.
typedef Padded<OopTaskQueue> ObjToScanQueue;
typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
private:
@ -59,7 +59,7 @@ class ParScanThreadState {
friend class ParScanThreadStateSet;
private:
ObjToScanQueue *_work_queue;
Stack<oop>* const _overflow_stack;
Stack<oop, mtGC>* const _overflow_stack;
ParGCAllocBuffer _to_space_alloc_buffer;
@ -127,7 +127,7 @@ class ParScanThreadState {
ParScanThreadState(Space* to_space_, ParNewGeneration* gen_,
Generation* old_gen_, int thread_num_,
ObjToScanQueueSet* work_queue_set_,
Stack<oop>* overflow_stacks_,
Stack<oop, mtGC>* overflow_stacks_,
size_t desired_plab_sz_,
ParallelTaskTerminator& term_);
@ -151,7 +151,7 @@ class ParScanThreadState {
void trim_queues(int max_size);
// Private overflow stack usage
Stack<oop>* overflow_stack() { return _overflow_stack; }
Stack<oop, mtGC>* overflow_stack() { return _overflow_stack; }
bool take_from_overflow_stack();
void push_on_overflow_stack(oop p);
@ -312,7 +312,7 @@ class ParNewGeneration: public DefNewGeneration {
ObjToScanQueueSet* _task_queues;
// Per-worker-thread local overflow stacks
Stack<oop>* _overflow_stacks;
Stack<oop, mtGC>* _overflow_stacks;
// Desired size of survivor space plab's
PLABStats _plab_stats;

View File

@ -32,7 +32,7 @@
class ParScanThreadState;
class ParNewGeneration;
typedef Padded<OopTaskQueue> ObjToScanQueue;
typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
typedef GenericTaskQueueSet<ObjToScanQueue, mtGC> ObjToScanQueueSet;
class ParallelTaskTerminator;
class ParScanClosure: public OopsInGenClosure {

View File

@ -40,7 +40,7 @@
// must be shrunk. Adjusting the boundary between the generations
// is called for in this class.
class AdjoiningGenerations : public CHeapObj {
class AdjoiningGenerations : public CHeapObj<mtGC> {
friend class VMStructs;
private:
// The young generation and old generation, respectively

View File

@ -116,7 +116,7 @@ GCTaskQueue* GCTaskQueue::create() {
}
GCTaskQueue* GCTaskQueue::create_on_c_heap() {
GCTaskQueue* result = new(ResourceObj::C_HEAP) GCTaskQueue(true);
GCTaskQueue* result = new(ResourceObj::C_HEAP, mtGC) GCTaskQueue(true);
if (TraceGCTaskQueue) {
tty->print_cr("GCTaskQueue::create_on_c_heap()"
" returns " INTPTR_FORMAT,
@ -403,19 +403,19 @@ void GCTaskManager::initialize() {
_queue = SynchronizedGCTaskQueue::create(unsynchronized_queue, lock());
_noop_task = NoopGCTask::create_on_c_heap();
_idle_inactive_task = WaitForBarrierGCTask::create_on_c_heap();
_resource_flag = NEW_C_HEAP_ARRAY(bool, workers());
_resource_flag = NEW_C_HEAP_ARRAY(bool, workers(), mtGC);
{
// Set up worker threads.
// Distribute the workers among the available processors,
// unless we were told not to, or if the os doesn't want to.
uint* processor_assignment = NEW_C_HEAP_ARRAY(uint, workers());
uint* processor_assignment = NEW_C_HEAP_ARRAY(uint, workers(), mtGC);
if (!BindGCTaskThreadsToCPUs ||
!os::distribute_processes(workers(), processor_assignment)) {
for (uint a = 0; a < workers(); a += 1) {
processor_assignment[a] = sentinel_worker();
}
}
_thread = NEW_C_HEAP_ARRAY(GCTaskThread*, workers());
_thread = NEW_C_HEAP_ARRAY(GCTaskThread*, workers(), mtGC);
for (uint t = 0; t < workers(); t += 1) {
set_thread(t, GCTaskThread::create(this, t, processor_assignment[t]));
}
@ -426,7 +426,7 @@ void GCTaskManager::initialize() {
}
tty->cr();
}
FREE_C_HEAP_ARRAY(uint, processor_assignment);
FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC);
}
reset_busy_workers();
set_unblocked();
@ -455,11 +455,11 @@ GCTaskManager::~GCTaskManager() {
GCTaskThread::destroy(thread(i));
set_thread(i, NULL);
}
FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC);
_thread = NULL;
}
if (_resource_flag != NULL) {
FREE_C_HEAP_ARRAY(bool, _resource_flag);
FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC);
_resource_flag = NULL;
}
if (queue() != NULL) {
@ -817,7 +817,7 @@ NoopGCTask* NoopGCTask::create() {
}
NoopGCTask* NoopGCTask::create_on_c_heap() {
NoopGCTask* result = new(ResourceObj::C_HEAP) NoopGCTask(true);
NoopGCTask* result = new(ResourceObj::C_HEAP, mtGC) NoopGCTask(true);
return result;
}
@ -848,7 +848,7 @@ IdleGCTask* IdleGCTask::create() {
}
IdleGCTask* IdleGCTask::create_on_c_heap() {
IdleGCTask* result = new(ResourceObj::C_HEAP) IdleGCTask(true);
IdleGCTask* result = new(ResourceObj::C_HEAP, mtGC) IdleGCTask(true);
assert(UseDynamicNumberOfGCThreads,
"Should only be used with dynamic GC thread");
return result;
@ -984,7 +984,7 @@ WaitForBarrierGCTask* WaitForBarrierGCTask::create() {
WaitForBarrierGCTask* WaitForBarrierGCTask::create_on_c_heap() {
WaitForBarrierGCTask* result =
new (ResourceObj::C_HEAP) WaitForBarrierGCTask(true);
new (ResourceObj::C_HEAP, mtGC) WaitForBarrierGCTask(true);
return result;
}
@ -1114,7 +1114,7 @@ Monitor* MonitorSupply::reserve() {
// Lazy initialization.
if (freelist() == NULL) {
_freelist =
new(ResourceObj::C_HEAP) GrowableArray<Monitor*>(ParallelGCThreads,
new(ResourceObj::C_HEAP, mtGC) GrowableArray<Monitor*>(ParallelGCThreads,
true);
}
if (! freelist()->is_empty()) {

View File

@ -216,7 +216,7 @@ protected:
// A GCTaskQueue that can be synchronized.
// This "has-a" GCTaskQueue and a mutex to do the exclusion.
class SynchronizedGCTaskQueue : public CHeapObj {
class SynchronizedGCTaskQueue : public CHeapObj<mtGC> {
private:
// Instance state.
GCTaskQueue* _unsynchronized_queue; // Has-a unsynchronized queue.
@ -278,7 +278,7 @@ protected:
// This is an abstract base class for getting notifications
// when a GCTaskManager is done.
class NotifyDoneClosure : public CHeapObj {
class NotifyDoneClosure : public CHeapObj<mtGC> {
public:
// The notification callback method.
virtual void notify(GCTaskManager* manager) = 0;
@ -355,7 +355,7 @@ protected:
// held in the GCTaskThread** _thread array in GCTaskManager.
class GCTaskManager : public CHeapObj {
class GCTaskManager : public CHeapObj<mtGC> {
friend class ParCompactionManager;
friend class PSParallelCompact;
friend class PSScavenge;

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