提交 06939246 编写于 作者: Z zgu

Merge

...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* JavaCallWrapper */ \ /* JavaCallWrapper */ \
...@@ -37,22 +37,12 @@ ...@@ -37,22 +37,12 @@
/******************************/ \ /******************************/ \
/* JavaFrameAnchor */ \ /* JavaFrameAnchor */ \
/******************************/ \ /******************************/ \
volatile_nonstatic_field(JavaFrameAnchor, _flags, int) \ volatile_nonstatic_field(JavaFrameAnchor, _flags, int)
\
/* NOTE that we do not use the last_entry() macro here; it is used */ #define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
/* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */
/* be present there) */
#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must */
/* be present there) */
#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/******************************/ \ /******************************/ \
/* Register numbers (C2 only) */ \ /* Register numbers (C2 only) */ \
/******************************/ \ /******************************/ \
...@@ -90,15 +80,6 @@ ...@@ -90,15 +80,6 @@
declare_c2_constant(R_G6_num) \ declare_c2_constant(R_G6_num) \
declare_c2_constant(R_G7_num) declare_c2_constant(R_G7_num)
#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#endif // CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP #endif // CPU_SPARC_VM_VMSTRUCTS_SPARC_HPP
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* JavaCallWrapper */ \ /* JavaCallWrapper */ \
...@@ -37,31 +37,14 @@ ...@@ -37,31 +37,14 @@
/******************************/ \ /******************************/ \
/* JavaFrameAnchor */ \ /* JavaFrameAnchor */ \
/******************************/ \ /******************************/ \
volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*) \ volatile_nonstatic_field(JavaFrameAnchor, _last_Java_fp, intptr_t*)
\
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */
/* be present there) */
#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must */
/* be present there) */
#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/* NOTE that we do not use the last_entry() macro here; it is used */ #define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
/* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* NOTE that we do not use the last_entry() macro here; it is used */ #define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#endif // CPU_X86_VM_VMSTRUCTS_X86_HPP #endif // CPU_X86_VM_VMSTRUCTS_X86_HPP
...@@ -30,28 +30,12 @@ ...@@ -30,28 +30,12 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
/* NOTE that we do not use the last_entry() macro here; it is used */ #define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
/* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */
/* be present there) */
#define VM_TYPES_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* NOTE that we do not use the last_entry() macro here; it is used */ #define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must */
/* be present there) */
#define VM_INT_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#define VM_LONG_CONSTANTS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and must */
/* be present there) */
#endif // CPU_ZERO_VM_VMSTRUCTS_ZERO_HPP #endif // CPU_ZERO_VM_VMSTRUCTS_ZERO_HPP
...@@ -49,7 +49,7 @@ void WindowsDecoder::initialize() { ...@@ -49,7 +49,7 @@ void WindowsDecoder::initialize() {
pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions"); pfn_SymSetOptions _pfnSymSetOptions = (pfn_SymSetOptions)::GetProcAddress(handle, "SymSetOptions");
pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize"); pfn_SymInitialize _pfnSymInitialize = (pfn_SymInitialize)::GetProcAddress(handle, "SymInitialize");
_pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64"); _pfnSymGetSymFromAddr64 = (pfn_SymGetSymFromAddr64)::GetProcAddress(handle, "SymGetSymFromAddr64");
_pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)GetProcAddress(handle, "UnDecorateSymbolName"); _pfnUndecorateSymbolName = (pfn_UndecorateSymbolName)::GetProcAddress(handle, "UnDecorateSymbolName");
if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) { if (_pfnSymSetOptions == NULL || _pfnSymInitialize == NULL || _pfnSymGetSymFromAddr64 == NULL) {
_pfnSymGetSymFromAddr64 = NULL; _pfnSymGetSymFromAddr64 = NULL;
...@@ -60,8 +60,9 @@ void WindowsDecoder::initialize() { ...@@ -60,8 +60,9 @@ void WindowsDecoder::initialize() {
return; return;
} }
_pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS); HANDLE hProcess = ::GetCurrentProcess();
if (!_pfnSymInitialize(GetCurrentProcess(), NULL, TRUE)) { _pfnSymSetOptions(SYMOPT_UNDNAME | SYMOPT_DEFERRED_LOADS | SYMOPT_EXACT_SYMBOLS);
if (!_pfnSymInitialize(hProcess, NULL, TRUE)) {
_pfnSymGetSymFromAddr64 = NULL; _pfnSymGetSymFromAddr64 = NULL;
_pfnUndecorateSymbolName = NULL; _pfnUndecorateSymbolName = NULL;
::FreeLibrary(handle); ::FreeLibrary(handle);
...@@ -70,6 +71,77 @@ void WindowsDecoder::initialize() { ...@@ -70,6 +71,77 @@ void WindowsDecoder::initialize() {
return; return;
} }
// set pdb search paths
pfn_SymSetSearchPath _pfn_SymSetSearchPath =
(pfn_SymSetSearchPath)::GetProcAddress(handle, "SymSetSearchPath");
pfn_SymGetSearchPath _pfn_SymGetSearchPath =
(pfn_SymGetSearchPath)::GetProcAddress(handle, "SymGetSearchPath");
if (_pfn_SymSetSearchPath != NULL && _pfn_SymGetSearchPath != NULL) {
char paths[MAX_PATH];
int len = sizeof(paths);
if (!_pfn_SymGetSearchPath(hProcess, paths, len)) {
paths[0] = '\0';
} else {
// available spaces in path buffer
len -= (int)strlen(paths);
}
char tmp_path[MAX_PATH];
DWORD dwSize;
HMODULE hJVM = ::GetModuleHandle("jvm.dll");
tmp_path[0] = '\0';
// append the path where jvm.dll is located
if (hJVM != NULL && (dwSize = ::GetModuleFileName(hJVM, tmp_path, sizeof(tmp_path))) > 0) {
while (dwSize > 0 && tmp_path[dwSize] != '\\') {
dwSize --;
}
tmp_path[dwSize] = '\0';
if (dwSize > 0 && len > (int)dwSize + 1) {
strncat(paths, os::path_separator(), 1);
strncat(paths, tmp_path, dwSize);
len -= dwSize + 1;
}
}
// append $JRE/bin. Arguments::get_java_home actually returns $JRE
// path
char *p = Arguments::get_java_home();
assert(p != NULL, "empty java home");
size_t java_home_len = strlen(p);
if (len > (int)java_home_len + 5) {
strncat(paths, os::path_separator(), 1);
strncat(paths, p, java_home_len);
strncat(paths, "\\bin", 4);
len -= (int)(java_home_len + 5);
}
// append $JDK/bin path if it exists
assert(java_home_len < MAX_PATH, "Invalid path length");
// assume $JRE is under $JDK, construct $JDK/bin path and
// see if it exists or not
if (strncmp(&p[java_home_len - 3], "jre", 3) == 0) {
strncpy(tmp_path, p, java_home_len - 3);
tmp_path[java_home_len - 3] = '\0';
strncat(tmp_path, "bin", 3);
// if the directory exists
DWORD dwAttrib = GetFileAttributes(tmp_path);
if (dwAttrib != INVALID_FILE_ATTRIBUTES &&
(dwAttrib & FILE_ATTRIBUTE_DIRECTORY)) {
// tmp_path should have the same length as java_home_len, since we only
// replaced 'jre' with 'bin'
if (len > (int)java_home_len + 1) {
strncat(paths, os::path_separator(), 1);
strncat(paths, tmp_path, java_home_len);
}
}
}
_pfn_SymSetSearchPath(hProcess, paths);
}
// find out if jvm.dll contains private symbols, by decoding // find out if jvm.dll contains private symbols, by decoding
// current function and comparing the result // current function and comparing the result
address addr = (address)Decoder::demangle; address addr = (address)Decoder::demangle;
......
...@@ -35,6 +35,8 @@ typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD); ...@@ -35,6 +35,8 @@ typedef DWORD (WINAPI *pfn_SymSetOptions)(DWORD);
typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL); typedef BOOL (WINAPI *pfn_SymInitialize)(HANDLE, PCTSTR, BOOL);
typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64); typedef BOOL (WINAPI *pfn_SymGetSymFromAddr64)(HANDLE, DWORD64, PDWORD64, PIMAGEHLP_SYMBOL64);
typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD); typedef DWORD (WINAPI *pfn_UndecorateSymbolName)(const char*, char*, DWORD, DWORD);
typedef BOOL (WINAPI *pfn_SymSetSearchPath)(HANDLE, PCTSTR);
typedef BOOL (WINAPI *pfn_SymGetSearchPath)(HANDLE, PTSTR, int);
class WindowsDecoder : public AbstractDecoder { class WindowsDecoder : public AbstractDecoder {
......
...@@ -29,37 +29,26 @@ ...@@ -29,37 +29,26 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
/******************************/ \ /******************************/ \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \
nonstatic_field(OSThread, _pthread_id, pthread_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\ \
/**********************/ \ /**********************/ \
/* Posix Thread IDs */ \ /* Posix Thread IDs */ \
/**********************/ \ /**********************/ \
\ \
declare_unsigned_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(OSThread::thread_id_t) \
declare_unsigned_integer_type(pthread_t) \ declare_unsigned_integer_type(pthread_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP #endif // OS_CPU_BSD_X86_VM_VMSTRUCTS_BSD_X86_HPP
...@@ -30,21 +30,13 @@ ...@@ -30,21 +30,13 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP #endif // OS_CPU_BSD_ZERO_VM_VMSTRUCTS_BSD_ZERO_HPP
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
...@@ -37,38 +37,27 @@ ...@@ -37,38 +37,27 @@
\ \
nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \ nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \
nonstatic_field(OSThread, _pthread_id, pthread_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\ \
/**********************/ \ /**********************/ \
/* POSIX Thread IDs */ \ /* POSIX Thread IDs */ \
/**********************/ \ /**********************/ \
\ \
declare_integer_type(OSThread::thread_id_t) \ declare_integer_type(OSThread::thread_id_t) \
declare_unsigned_integer_type(pthread_t) \ declare_unsigned_integer_type(pthread_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
\ \
/************************/ \ /************************/ \
/* JavaThread constants */ \ /* JavaThread constants */ \
/************************/ \ /************************/ \
\ \
declare_constant(JavaFrameAnchor::flushed) \ declare_constant(JavaFrameAnchor::flushed)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_LINUX_SPARC_VM_VMSTRUCTS_LINUX_SPARC_HPP #endif // OS_CPU_LINUX_SPARC_VM_VMSTRUCTS_LINUX_SPARC_HPP
...@@ -29,37 +29,26 @@ ...@@ -29,37 +29,26 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
/******************************/ \ /******************************/ \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \
nonstatic_field(OSThread, _pthread_id, pthread_t) \ nonstatic_field(OSThread, _pthread_id, pthread_t)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\ \
/**********************/ \ /**********************/ \
/* Posix Thread IDs */ \ /* Posix Thread IDs */ \
/**********************/ \ /**********************/ \
\ \
declare_integer_type(OSThread::thread_id_t) \ declare_integer_type(OSThread::thread_id_t) \
declare_unsigned_integer_type(pthread_t) \ declare_unsigned_integer_type(pthread_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_LINUX_X86_VM_VMSTRUCTS_LINUX_X86_HPP #endif // OS_CPU_LINUX_X86_VM_VMSTRUCTS_LINUX_X86_HPP
...@@ -30,21 +30,12 @@ ...@@ -30,21 +30,12 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type)
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_LINUX_ZERO_VM_VMSTRUCTS_LINUX_ZERO_HPP #endif // OS_CPU_LINUX_ZERO_VM_VMSTRUCTS_LINUX_ZERO_HPP
...@@ -29,44 +29,32 @@ ...@@ -29,44 +29,32 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
/******************************/ \ /******************************/ \
\ \
nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \ nonstatic_field(JavaThread, _base_of_stack_pointer, intptr_t*) \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \
\ \
/**********************/ \ /**********************/ \
/* Solaris Thread IDs */ \ /* Solaris Thread IDs */ \
/**********************/ \ /**********************/ \
\ \
declare_unsigned_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(OSThread::thread_id_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
\ \
/************************/ \ /************************/ \
/* JavaThread constants */ \ /* JavaThread constants */ \
/************************/ \ /************************/ \
\ \
declare_constant(JavaFrameAnchor::flushed) \ declare_constant(JavaFrameAnchor::flushed)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_SOLARIS_SPARC_VM_VMSTRUCTS_SOLARIS_SPARC_HPP #endif // OS_CPU_SOLARIS_SPARC_VM_VMSTRUCTS_SOLARIS_SPARC_HPP
...@@ -29,36 +29,24 @@ ...@@ -29,36 +29,24 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
/******************************/ \ /******************************/ \
\ \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\ \
/**********************/ \ /**********************/ \
/* Solaris Thread IDs */ \ /* Solaris Thread IDs */ \
/**********************/ \ /**********************/ \
\ \
declare_unsigned_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(OSThread::thread_id_t)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_SOLARIS_X86_VM_VMSTRUCTS_SOLARIS_X86_HPP #endif // OS_CPU_SOLARIS_X86_VM_VMSTRUCTS_SOLARIS_X86_HPP
...@@ -29,32 +29,21 @@ ...@@ -29,32 +29,21 @@
// constants required by the Serviceability Agent. This file is // constants required by the Serviceability Agent. This file is
// referenced by vmStructs.cpp. // referenced by vmStructs.cpp.
#define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field, last_entry) \ #define VM_STRUCTS_OS_CPU(nonstatic_field, static_field, unchecked_nonstatic_field, volatile_nonstatic_field, nonproduct_nonstatic_field, c2_nonstatic_field, unchecked_c1_static_field, unchecked_c2_static_field) \
\ \
/******************************/ \ /******************************/ \
/* Threads (NOTE: incomplete) */ \ /* Threads (NOTE: incomplete) */ \
/******************************/ \ /******************************/ \
\ \
nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \ nonstatic_field(OSThread, _thread_id, OSThread::thread_id_t) \
unchecked_nonstatic_field(OSThread, _thread_handle, sizeof(HANDLE)) /* NOTE: no type */ \ unchecked_nonstatic_field(OSThread, _thread_handle, sizeof(HANDLE)) /* NOTE: no type */
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type, last_entry) \ #define VM_TYPES_OS_CPU(declare_type, declare_toplevel_type, declare_oop_type, declare_integer_type, declare_unsigned_integer_type, declare_c1_toplevel_type, declare_c2_type, declare_c2_toplevel_type) \
\ \
declare_unsigned_integer_type(OSThread::thread_id_t) \ declare_unsigned_integer_type(OSThread::thread_id_t)
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_INT_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS_OS_CPU(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant)
\
/* This must be the last entry, and must be present */ \
last_entry()
#endif // OS_CPU_WINDOWS_X86_VM_VMSTRUCTS_WINDOWS_X86_HPP #endif // OS_CPU_WINDOWS_X86_VM_VMSTRUCTS_WINDOWS_X86_HPP
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -3912,7 +3912,10 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, ...@@ -3912,7 +3912,10 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
// check that if this class is an interface then it doesn't have static methods // check that if this class is an interface then it doesn't have static methods
if (this_klass->is_interface()) { if (this_klass->is_interface()) {
check_illegal_static_method(this_klass, CHECK_(nullHandle)); /* An interface in a JAVA 8 classfile can be static */
if (_major_version < JAVA_8_VERSION) {
check_illegal_static_method(this_klass, CHECK_(nullHandle));
}
} }
...@@ -4466,6 +4469,7 @@ void ClassFileParser::verify_legal_method_modifiers( ...@@ -4466,6 +4469,7 @@ void ClassFileParser::verify_legal_method_modifiers(
const bool is_bridge = (flags & JVM_ACC_BRIDGE) != 0; const bool is_bridge = (flags & JVM_ACC_BRIDGE) != 0;
const bool is_strict = (flags & JVM_ACC_STRICT) != 0; const bool is_strict = (flags & JVM_ACC_STRICT) != 0;
const bool is_synchronized = (flags & JVM_ACC_SYNCHRONIZED) != 0; const bool is_synchronized = (flags & JVM_ACC_SYNCHRONIZED) != 0;
const bool is_protected = (flags & JVM_ACC_PROTECTED) != 0;
const bool major_gte_15 = _major_version >= JAVA_1_5_VERSION; const bool major_gte_15 = _major_version >= JAVA_1_5_VERSION;
const bool major_gte_8 = _major_version >= JAVA_8_VERSION; const bool major_gte_8 = _major_version >= JAVA_8_VERSION;
const bool is_initializer = (name == vmSymbols::object_initializer_name()); const bool is_initializer = (name == vmSymbols::object_initializer_name());
...@@ -4473,11 +4477,33 @@ void ClassFileParser::verify_legal_method_modifiers( ...@@ -4473,11 +4477,33 @@ void ClassFileParser::verify_legal_method_modifiers(
bool is_illegal = false; bool is_illegal = false;
if (is_interface) { if (is_interface) {
if (!is_public || is_static || is_final || is_native || if (major_gte_8) {
((is_synchronized || is_strict) && major_gte_15 && // Class file version is JAVA_8_VERSION or later Methods of
(!major_gte_8 || is_abstract)) || // interfaces may set any of the flags except ACC_PROTECTED,
(!major_gte_8 && !is_abstract)) { // ACC_FINAL, ACC_NATIVE, and ACC_SYNCHRONIZED; they must
is_illegal = true; // have exactly one of the ACC_PUBLIC or ACC_PRIVATE flags set.
if ((is_public == is_private) || /* Only one of private and public should be true - XNOR */
(is_native || is_protected || is_final || is_synchronized) ||
// If a specific method of a class or interface has its
// ACC_ABSTRACT flag set, it must not have any of its
// ACC_FINAL, ACC_NATIVE, ACC_PRIVATE, ACC_STATIC,
// ACC_STRICT, or ACC_SYNCHRONIZED flags set. No need to
// check for ACC_FINAL, ACC_NATIVE or ACC_SYNCHRONIZED as
// those flags are illegal irrespective of ACC_ABSTRACT being set or not.
(is_abstract && (is_private || is_static || is_strict))) {
is_illegal = true;
}
} else if (major_gte_15) {
// Class file version in the interval [JAVA_1_5_VERSION, JAVA_8_VERSION)
if (!is_public || is_static || is_final || is_synchronized ||
is_native || !is_abstract || is_strict) {
is_illegal = true;
}
} else {
// Class file version is pre-JAVA_1_5_VERSION
if (!is_public || is_static || is_final || is_native || !is_abstract) {
is_illegal = true;
}
} }
} else { // not interface } else { // not interface
if (is_initializer) { if (is_initializer) {
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -142,7 +142,7 @@ PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash, ...@@ -142,7 +142,7 @@ PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash,
} }
// placeholder used to track class loading internal states // placeholder is used to track class loading internal states
// placeholder existence now for loading superclass/superinterface // placeholder existence now for loading superclass/superinterface
// superthreadQ tracks class circularity, while loading superclass/superinterface // superthreadQ tracks class circularity, while loading superclass/superinterface
// loadInstanceThreadQ tracks load_instance_class calls // loadInstanceThreadQ tracks load_instance_class calls
...@@ -153,15 +153,17 @@ PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash, ...@@ -153,15 +153,17 @@ PlaceholderEntry* PlaceholderTable::find_and_add(int index, unsigned int hash,
// All claimants remove SeenThread after completing action // All claimants remove SeenThread after completing action
// On removal: if definer and all queues empty, remove entry // On removal: if definer and all queues empty, remove entry
// Note: you can be in both placeholders and systemDictionary // Note: you can be in both placeholders and systemDictionary
// see parse_stream for redefine classes
// Therefore - must always check SD first // Therefore - must always check SD first
// Ignores the case where entry is not found // Ignores the case where entry is not found
void PlaceholderTable::find_and_remove(int index, unsigned int hash, void PlaceholderTable::find_and_remove(int index, unsigned int hash,
Symbol* name, ClassLoaderData* loader_data, Thread* thread) { Symbol* name, ClassLoaderData* loader_data,
classloadAction action,
Thread* thread) {
assert_locked_or_safepoint(SystemDictionary_lock); assert_locked_or_safepoint(SystemDictionary_lock);
PlaceholderEntry *probe = get_entry(index, hash, name, loader_data); PlaceholderEntry *probe = get_entry(index, hash, name, loader_data);
if (probe != NULL) { if (probe != NULL) {
// No other threads using this entry probe->remove_seen_thread(thread, action);
// If no other threads using this entry, and this thread is not using this entry for other states
if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL) if ((probe->superThreadQ() == NULL) && (probe->loadInstanceThreadQ() == NULL)
&& (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) { && (probe->defineThreadQ() == NULL) && (probe->definer() == NULL)) {
remove_entry(index, hash, name, loader_data); remove_entry(index, hash, name, loader_data);
......
/* /*
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -82,7 +82,7 @@ public: ...@@ -82,7 +82,7 @@ public:
}; };
// find_and_add returns probe pointer - old or new // find_and_add returns probe pointer - old or new
// If no entry exists, add a placeholder entry and push SeenThread // If no entry exists, add a placeholder entry and push SeenThread for classloadAction
// If entry exists, reuse entry and push SeenThread for classloadAction // If entry exists, reuse entry and push SeenThread for classloadAction
PlaceholderEntry* find_and_add(int index, unsigned int hash, PlaceholderEntry* find_and_add(int index, unsigned int hash,
Symbol* name, ClassLoaderData* loader_data, Symbol* name, ClassLoaderData* loader_data,
...@@ -92,9 +92,11 @@ public: ...@@ -92,9 +92,11 @@ public:
void remove_entry(int index, unsigned int hash, void remove_entry(int index, unsigned int hash,
Symbol* name, ClassLoaderData* loader_data); Symbol* name, ClassLoaderData* loader_data);
// Remove placeholder information // find_and_remove first removes SeenThread for classloadAction
// If all queues are empty and definer is null, remove the PlacheholderEntry completely
void find_and_remove(int index, unsigned int hash, void find_and_remove(int index, unsigned int hash,
Symbol* name, ClassLoaderData* loader_data, Thread* thread); Symbol* name, ClassLoaderData* loader_data,
classloadAction action, Thread* thread);
// GC support. // GC support.
void classes_do(KlassClosure* f); void classes_do(KlassClosure* f);
......
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -172,7 +172,7 @@ Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle ...@@ -172,7 +172,7 @@ Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle
assert(klass_h() == NULL, "Should not have result with exception pending"); assert(klass_h() == NULL, "Should not have result with exception pending");
Handle e(THREAD, PENDING_EXCEPTION); Handle e(THREAD, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION; CLEAR_PENDING_EXCEPTION;
THROW_MSG_CAUSE_0(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string(), e); THROW_MSG_CAUSE_NULL(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string(), e);
} else { } else {
return NULL; return NULL;
} }
...@@ -181,9 +181,9 @@ Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle ...@@ -181,9 +181,9 @@ Klass* SystemDictionary::handle_resolution_exception(Symbol* class_name, Handle
if (klass_h() == NULL) { if (klass_h() == NULL) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
if (throw_error) { if (throw_error) {
THROW_MSG_0(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string()); THROW_MSG_NULL(vmSymbols::java_lang_NoClassDefFoundError(), class_name->as_C_string());
} else { } else {
THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string()); THROW_MSG_NULL(vmSymbols::java_lang_ClassNotFoundException(), class_name->as_C_string());
} }
} }
return (Klass*)klass_h(); return (Klass*)klass_h();
...@@ -343,29 +343,29 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name, ...@@ -343,29 +343,29 @@ Klass* SystemDictionary::resolve_super_or_fail(Symbol* child_name,
} }
if (throw_circularity_error) { if (throw_circularity_error) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
THROW_MSG_0(vmSymbols::java_lang_ClassCircularityError(), child_name->as_C_string()); THROW_MSG_NULL(vmSymbols::java_lang_ClassCircularityError(), child_name->as_C_string());
} }
// java.lang.Object should have been found above // java.lang.Object should have been found above
assert(class_name != NULL, "null super class for resolving"); assert(class_name != NULL, "null super class for resolving");
// Resolve the super class or interface, check results on return // Resolve the super class or interface, check results on return
Klass* superk = NULL; Klass* superk = SystemDictionary::resolve_or_null(class_name,
superk = SystemDictionary::resolve_or_null(class_name,
class_loader, class_loader,
protection_domain, protection_domain,
THREAD); THREAD);
KlassHandle superk_h(THREAD, superk); KlassHandle superk_h(THREAD, superk);
// Note: clean up of placeholders currently in callers of // Clean up of placeholders moved so that each classloadAction registrar self-cleans up
// resolve_super_or_fail - either at update_dictionary time // It is no longer necessary to keep the placeholder table alive until update_dictionary
// or on error // or error. GC used to walk the placeholder table as strong roots.
// The instanceKlass is kept alive because the class loader is on the stack,
// which keeps the loader_data alive, as well as all instanceKlasses in
// the loader_data. parseClassFile adds the instanceKlass to loader_data.
{ {
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, child_name, loader_data); placeholders()->find_and_remove(p_index, p_hash, child_name, loader_data, PlaceholderTable::LOAD_SUPER, THREAD);
if (probe != NULL) { SystemDictionary_lock->notify_all();
probe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_SUPER);
}
} }
if (HAS_PENDING_EXCEPTION || superk_h() == NULL) { if (HAS_PENDING_EXCEPTION || superk_h() == NULL) {
// can null superk // can null superk
...@@ -430,8 +430,8 @@ void SystemDictionary::validate_protection_domain(instanceKlassHandle klass, ...@@ -430,8 +430,8 @@ void SystemDictionary::validate_protection_domain(instanceKlassHandle klass,
// We're using a No_Safepoint_Verifier to catch any place where we // We're using a No_Safepoint_Verifier to catch any place where we
// might potentially do a GC at all. // might potentially do a GC at all.
// SystemDictionary::do_unloading() asserts that classes are only // Dictionary::do_unloading() asserts that classes in SD are only
// unloaded at a safepoint. // unloaded at a safepoint. Anonymous classes are not in SD.
No_Safepoint_Verifier nosafepoint; No_Safepoint_Verifier nosafepoint;
dictionary()->add_protection_domain(d_index, d_hash, klass, loader_data, dictionary()->add_protection_domain(d_index, d_hash, klass, loader_data,
protection_domain, THREAD); protection_domain, THREAD);
...@@ -486,7 +486,6 @@ void SystemDictionary::double_lock_wait(Handle lockObject, TRAPS) { ...@@ -486,7 +486,6 @@ void SystemDictionary::double_lock_wait(Handle lockObject, TRAPS) {
// super class loading here. // super class loading here.
// This also is critical in cases where the original thread gets stalled // This also is critical in cases where the original thread gets stalled
// even in non-circularity situations. // even in non-circularity situations.
// Note: only one thread can define the class, but multiple can resolve
// Note: must call resolve_super_or_fail even if null super - // Note: must call resolve_super_or_fail even if null super -
// to force placeholder entry creation for this class for circularity detection // to force placeholder entry creation for this class for circularity detection
// Caller must check for pending exception // Caller must check for pending exception
...@@ -518,14 +517,6 @@ instanceKlassHandle SystemDictionary::handle_parallel_super_load( ...@@ -518,14 +517,6 @@ instanceKlassHandle SystemDictionary::handle_parallel_super_load(
protection_domain, protection_domain,
true, true,
CHECK_(nh)); CHECK_(nh));
// We don't redefine the class, so we just need to clean up if there
// was not an error (don't want to modify any system dictionary
// data structures).
{
MutexLocker mu(SystemDictionary_lock, THREAD);
placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
SystemDictionary_lock->notify_all();
}
// parallelCapable class loaders do NOT wait for parallel superclass loads to complete // parallelCapable class loaders do NOT wait for parallel superclass loads to complete
// Serial class loaders and bootstrap classloader do wait for superclass loads // Serial class loaders and bootstrap classloader do wait for superclass loads
...@@ -595,6 +586,10 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -595,6 +586,10 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
// Do lookup to see if class already exist and the protection domain // Do lookup to see if class already exist and the protection domain
// has the right access // has the right access
// This call uses find which checks protection domain already matches
// All subsequent calls use find_class, and set has_loaded_class so that
// before we return a result we call out to java to check for valid protection domain
// to allow returning the Klass* and add it to the pd_set if it is valid
unsigned int d_hash = dictionary()->compute_hash(name, loader_data); unsigned int d_hash = dictionary()->compute_hash(name, loader_data);
int d_index = dictionary()->hash_to_index(d_hash); int d_index = dictionary()->hash_to_index(d_hash);
Klass* probe = dictionary()->find(d_index, d_hash, name, loader_data, Klass* probe = dictionary()->find(d_index, d_hash, name, loader_data,
...@@ -652,7 +647,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -652,7 +647,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
} }
} }
// If the class in is in the placeholder table, class loading is in progress // If the class is in the placeholder table, class loading is in progress
if (super_load_in_progress && havesupername==true) { if (super_load_in_progress && havesupername==true) {
k = SystemDictionary::handle_parallel_super_load(name, superclassname, k = SystemDictionary::handle_parallel_super_load(name, superclassname,
class_loader, protection_domain, lockObject, THREAD); class_loader, protection_domain, lockObject, THREAD);
...@@ -664,7 +659,9 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -664,7 +659,9 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
} }
} }
bool throw_circularity_error = false;
if (!class_has_been_loaded) { if (!class_has_been_loaded) {
bool load_instance_added = false;
// add placeholder entry to record loading instance class // add placeholder entry to record loading instance class
// Five cases: // Five cases:
...@@ -690,7 +687,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -690,7 +687,7 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
// No performance benefit and no deadlock issues. // No performance benefit and no deadlock issues.
// case 5. parallelCapable user level classloaders - without objectLocker // case 5. parallelCapable user level classloaders - without objectLocker
// Allow parallel classloading of a class/classloader pair // Allow parallel classloading of a class/classloader pair
bool throw_circularity_error = false;
{ {
MutexLocker mu(SystemDictionary_lock, THREAD); MutexLocker mu(SystemDictionary_lock, THREAD);
if (class_loader.is_null() || !is_parallelCapable(class_loader)) { if (class_loader.is_null() || !is_parallelCapable(class_loader)) {
...@@ -726,12 +723,13 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -726,12 +723,13 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
} }
} }
} }
// All cases: add LOAD_INSTANCE // All cases: add LOAD_INSTANCE holding SystemDictionary_lock
// case 3: UnsyncloadClass || case 5: parallelCapable: allow competing threads to try // case 3: UnsyncloadClass || case 5: parallelCapable: allow competing threads to try
// LOAD_INSTANCE in parallel // LOAD_INSTANCE in parallel
// add placeholder entry even if error - callers will remove on error
if (!throw_circularity_error && !class_has_been_loaded) { if (!throw_circularity_error && !class_has_been_loaded) {
PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, loader_data, PlaceholderTable::LOAD_INSTANCE, NULL, THREAD); PlaceholderEntry* newprobe = placeholders()->find_and_add(p_index, p_hash, name, loader_data, PlaceholderTable::LOAD_INSTANCE, NULL, THREAD);
load_instance_added = true;
// For class loaders that do not acquire the classloader object lock, // For class loaders that do not acquire the classloader object lock,
// if they did not catch another thread holding LOAD_INSTANCE, // if they did not catch another thread holding LOAD_INSTANCE,
// need a check analogous to the acquire ObjectLocker/find_class // need a check analogous to the acquire ObjectLocker/find_class
...@@ -740,19 +738,18 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -740,19 +738,18 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
// class loaders holding the ObjectLock shouldn't find the class here // class loaders holding the ObjectLock shouldn't find the class here
Klass* check = find_class(d_index, d_hash, name, loader_data); Klass* check = find_class(d_index, d_hash, name, loader_data);
if (check != NULL) { if (check != NULL) {
// Klass is already loaded, so just return it // Klass is already loaded, so return it after checking/adding protection domain
k = instanceKlassHandle(THREAD, check); k = instanceKlassHandle(THREAD, check);
class_has_been_loaded = true; class_has_been_loaded = true;
newprobe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE);
placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
SystemDictionary_lock->notify_all();
} }
} }
} }
// must throw error outside of owning lock // must throw error outside of owning lock
if (throw_circularity_error) { if (throw_circularity_error) {
assert(!HAS_PENDING_EXCEPTION && load_instance_added == false,"circularity error cleanup");
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
THROW_MSG_0(vmSymbols::java_lang_ClassCircularityError(), name->as_C_string()); THROW_MSG_NULL(vmSymbols::java_lang_ClassCircularityError(), name->as_C_string());
} }
if (!class_has_been_loaded) { if (!class_has_been_loaded) {
...@@ -782,20 +779,6 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -782,20 +779,6 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
} }
} }
// clean up placeholder entries for success or error
// This cleans up LOAD_INSTANCE entries
// It also cleans up LOAD_SUPER entries on errors from
// calling load_instance_class
{
MutexLocker mu(SystemDictionary_lock, THREAD);
PlaceholderEntry* probe = placeholders()->get_entry(p_index, p_hash, name, loader_data);
if (probe != NULL) {
probe->remove_seen_thread(THREAD, PlaceholderTable::LOAD_INSTANCE);
placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
SystemDictionary_lock->notify_all();
}
}
// If everything was OK (no exceptions, no null return value), and // If everything was OK (no exceptions, no null return value), and
// class_loader is NOT the defining loader, do a little more bookkeeping. // class_loader is NOT the defining loader, do a little more bookkeeping.
if (!HAS_PENDING_EXCEPTION && !k.is_null() && if (!HAS_PENDING_EXCEPTION && !k.is_null() &&
...@@ -819,18 +802,22 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -819,18 +802,22 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
} }
} }
} }
if (HAS_PENDING_EXCEPTION || k.is_null()) { } // load_instance_class loop
// On error, clean up placeholders
{ if (load_instance_added == true) {
MutexLocker mu(SystemDictionary_lock, THREAD); // clean up placeholder entries for LOAD_INSTANCE success or error
placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD); // This brackets the SystemDictionary updates for both defining
SystemDictionary_lock->notify_all(); // and initiating loaders
} MutexLocker mu(SystemDictionary_lock, THREAD);
return NULL; placeholders()->find_and_remove(p_index, p_hash, name, loader_data, PlaceholderTable::LOAD_INSTANCE, THREAD);
} SystemDictionary_lock->notify_all();
} }
} }
if (HAS_PENDING_EXCEPTION || k.is_null()) {
return NULL;
}
#ifdef ASSERT #ifdef ASSERT
{ {
ClassLoaderData* loader_data = k->class_loader_data(); ClassLoaderData* loader_data = k->class_loader_data();
...@@ -850,8 +837,8 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla ...@@ -850,8 +837,8 @@ Klass* SystemDictionary::resolve_instance_class_or_null(Symbol* name, Handle cla
// so we cannot allow GC to occur while we're holding this entry. // so we cannot allow GC to occur while we're holding this entry.
// We're using a No_Safepoint_Verifier to catch any place where we // We're using a No_Safepoint_Verifier to catch any place where we
// might potentially do a GC at all. // might potentially do a GC at all.
// SystemDictionary::do_unloading() asserts that classes are only // Dictionary::do_unloading() asserts that classes in SD are only
// unloaded at a safepoint. // unloaded at a safepoint. Anonymous classes are not in SD.
No_Safepoint_Verifier nosafepoint; No_Safepoint_Verifier nosafepoint;
if (dictionary()->is_valid_protection_domain(d_index, d_hash, name, if (dictionary()->is_valid_protection_domain(d_index, d_hash, name,
loader_data, loader_data,
...@@ -898,8 +885,8 @@ Klass* SystemDictionary::find(Symbol* class_name, ...@@ -898,8 +885,8 @@ Klass* SystemDictionary::find(Symbol* class_name,
// so we cannot allow GC to occur while we're holding this entry. // so we cannot allow GC to occur while we're holding this entry.
// We're using a No_Safepoint_Verifier to catch any place where we // We're using a No_Safepoint_Verifier to catch any place where we
// might potentially do a GC at all. // might potentially do a GC at all.
// SystemDictionary::do_unloading() asserts that classes are only // Dictionary::do_unloading() asserts that classes in SD are only
// unloaded at a safepoint. // unloaded at a safepoint. Anonymous classes are not in SD.
No_Safepoint_Verifier nosafepoint; No_Safepoint_Verifier nosafepoint;
return dictionary()->find(d_index, d_hash, class_name, loader_data, return dictionary()->find(d_index, d_hash, class_name, loader_data,
protection_domain, THREAD); protection_domain, THREAD);
...@@ -965,10 +952,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name, ...@@ -965,10 +952,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
// throw potential ClassFormatErrors. // throw potential ClassFormatErrors.
// //
// Note: "name" is updated. // Note: "name" is updated.
// Further note: a placeholder will be added for this class when
// super classes are loaded (resolve_super_or_fail). We expect this
// to be called for all classes but java.lang.Object; and we preload
// java.lang.Object through resolve_or_fail, not this path.
instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
loader_data, loader_data,
...@@ -979,21 +962,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name, ...@@ -979,21 +962,6 @@ Klass* SystemDictionary::parse_stream(Symbol* class_name,
true, true,
THREAD); THREAD);
// We don't redefine the class, so we just need to clean up whether there
// was an error or not (don't want to modify any system dictionary
// data structures).
// Parsed name could be null if we threw an error before we got far
// enough along to parse it -- in that case, there is nothing to clean up.
if (parsed_name != NULL) {
unsigned int p_hash = placeholders()->compute_hash(parsed_name,
loader_data);
int p_index = placeholders()->hash_to_index(p_hash);
{
MutexLocker mu(SystemDictionary_lock, THREAD);
placeholders()->find_and_remove(p_index, p_hash, parsed_name, loader_data, THREAD);
SystemDictionary_lock->notify_all();
}
}
if (host_klass.not_null() && k.not_null()) { if (host_klass.not_null() && k.not_null()) {
assert(EnableInvokeDynamic, ""); assert(EnableInvokeDynamic, "");
...@@ -1062,10 +1030,6 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name, ...@@ -1062,10 +1030,6 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
// throw potential ClassFormatErrors. // throw potential ClassFormatErrors.
// //
// Note: "name" is updated. // Note: "name" is updated.
// Further note: a placeholder will be added for this class when
// super classes are loaded (resolve_super_or_fail). We expect this
// to be called for all classes but java.lang.Object; and we preload
// java.lang.Object through resolve_or_fail, not this path.
instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name, instanceKlassHandle k = ClassFileParser(st).parseClassFile(class_name,
loader_data, loader_data,
...@@ -1114,25 +1078,7 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name, ...@@ -1114,25 +1078,7 @@ Klass* SystemDictionary::resolve_from_stream(Symbol* class_name,
} }
} }
// If parsing the class file or define_instance_class failed, we // Make sure we have an entry in the SystemDictionary on success
// need to remove the placeholder added on our behalf. But we
// must make sure parsed_name is valid first (it won't be if we had
// a format error before the class was parsed far enough to
// find the name).
if (HAS_PENDING_EXCEPTION && parsed_name != NULL) {
unsigned int p_hash = placeholders()->compute_hash(parsed_name,
loader_data);
int p_index = placeholders()->hash_to_index(p_hash);
{
MutexLocker mu(SystemDictionary_lock, THREAD);
placeholders()->find_and_remove(p_index, p_hash, parsed_name, loader_data, THREAD);
SystemDictionary_lock->notify_all();
}
return NULL;
}
// Make sure that we didn't leave a place holder in the
// SystemDictionary; this is only done on success
debug_only( { debug_only( {
if (!HAS_PENDING_EXCEPTION) { if (!HAS_PENDING_EXCEPTION) {
assert(parsed_name != NULL, "parsed_name is still null?"); assert(parsed_name != NULL, "parsed_name is still null?");
...@@ -1547,8 +1493,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas ...@@ -1547,8 +1493,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
// Other cases fall through, and may run into duplicate defines // Other cases fall through, and may run into duplicate defines
// caught by finding an entry in the SystemDictionary // caught by finding an entry in the SystemDictionary
if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->instance_klass() != NULL)) { if ((UnsyncloadClass || is_parallelDefine(class_loader)) && (probe->instance_klass() != NULL)) {
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS); placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
SystemDictionary_lock->notify_all(); SystemDictionary_lock->notify_all();
#ifdef ASSERT #ifdef ASSERT
Klass* check = find_class(d_index, d_hash, name_h, loader_data); Klass* check = find_class(d_index, d_hash, name_h, loader_data);
...@@ -1578,8 +1523,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas ...@@ -1578,8 +1523,7 @@ instanceKlassHandle SystemDictionary::find_or_define_instance_class(Symbol* clas
probe->set_instance_klass(k()); probe->set_instance_klass(k());
} }
probe->set_definer(NULL); probe->set_definer(NULL);
probe->remove_seen_thread(THREAD, PlaceholderTable::DEFINE_CLASS); placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, PlaceholderTable::DEFINE_CLASS, THREAD);
placeholders()->find_and_remove(p_index, p_hash, name_h, loader_data, THREAD);
SystemDictionary_lock->notify_all(); SystemDictionary_lock->notify_all();
} }
} }
...@@ -1736,6 +1680,8 @@ int SystemDictionary::calculate_systemdictionary_size(int classcount) { ...@@ -1736,6 +1680,8 @@ int SystemDictionary::calculate_systemdictionary_size(int classcount) {
} }
return newsize; return newsize;
} }
// Assumes classes in the SystemDictionary are only unloaded at a safepoint
// Note: anonymous classes are not in the SD.
bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) { bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive) {
// First, mark for unload all ClassLoaderData referencing a dead class loader. // First, mark for unload all ClassLoaderData referencing a dead class loader.
bool has_dead_loaders = ClassLoaderDataGraph::do_unloading(is_alive); bool has_dead_loaders = ClassLoaderDataGraph::do_unloading(is_alive);
...@@ -2105,9 +2051,7 @@ void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash, ...@@ -2105,9 +2051,7 @@ void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash,
// All loaded classes get a unique ID. // All loaded classes get a unique ID.
TRACE_INIT_ID(k); TRACE_INIT_ID(k);
// Check for a placeholder. If there, remove it and make a // Make a new system dictionary entry.
// new system dictionary entry.
placeholders()->find_and_remove(p_index, p_hash, name, loader_data, THREAD);
Klass* sd_check = find_class(d_index, d_hash, name, loader_data); Klass* sd_check = find_class(d_index, d_hash, name, loader_data);
if (sd_check == NULL) { if (sd_check == NULL) {
dictionary()->add_klass(name, loader_data, k); dictionary()->add_klass(name, loader_data, k);
...@@ -2116,12 +2060,8 @@ void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash, ...@@ -2116,12 +2060,8 @@ void SystemDictionary::update_dictionary(int d_index, unsigned int d_hash,
#ifdef ASSERT #ifdef ASSERT
sd_check = find_class(d_index, d_hash, name, loader_data); sd_check = find_class(d_index, d_hash, name, loader_data);
assert (sd_check != NULL, "should have entry in system dictionary"); assert (sd_check != NULL, "should have entry in system dictionary");
// Changed to allow PH to remain to complete class circularity checking // Note: there may be a placeholder entry: for circularity testing
// while only one thread can define a class at one time, multiple // or for parallel defines
// classes can resolve the superclass for a class at one time,
// and the placeholder is used to track that
// Symbol* ph_check = find_placeholder(name, class_loader);
// assert (ph_check == NULL, "should not have a placeholder entry");
#endif #endif
SystemDictionary_lock->notify_all(); SystemDictionary_lock->notify_all();
} }
......
...@@ -257,8 +257,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -257,8 +257,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
c1_nonstatic_field, \ c1_nonstatic_field, \
c2_nonstatic_field, \ c2_nonstatic_field, \
unchecked_c1_static_field, \ unchecked_c1_static_field, \
unchecked_c2_static_field, \ unchecked_c2_static_field) \
last_entry) \
\ \
/******************************************************************/ \ /******************************************************************/ \
/* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \ /* OopDesc and Klass hierarchies (NOTE: MethodData* incomplete) */ \
...@@ -1238,9 +1237,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -1238,9 +1237,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(FreeList<Metablock>, _count, ssize_t) \ nonstatic_field(FreeList<Metablock>, _count, ssize_t) \
nonstatic_field(MetablockTreeDictionary, _total_size, size_t) nonstatic_field(MetablockTreeDictionary, _total_size, size_t)
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_STRUCTS_OS_CPU macro (and must */
/* be present there) */
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// VM_TYPES // VM_TYPES
...@@ -1280,8 +1276,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -1280,8 +1276,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_unsigned_integer_type, \ declare_unsigned_integer_type, \
declare_c1_toplevel_type, \ declare_c1_toplevel_type, \
declare_c2_type, \ declare_c2_type, \
declare_c2_toplevel_type, \ declare_c2_toplevel_type) \
last_entry) \
\ \
/*************************************************************/ \ /*************************************************************/ \
/* Java primitive types -- required by the SA implementation */ \ /* Java primitive types -- required by the SA implementation */ \
...@@ -2098,10 +2093,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2098,10 +2093,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>) declare_type(MetablockTreeDictionary, FreeBlockDictionary<Metablock>)
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_TYPES_OS_CPU macro (and must be */
/* present there) */
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// VM_INT_CONSTANTS // VM_INT_CONSTANTS
// //
...@@ -2114,8 +2105,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2114,8 +2105,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_preprocessor_constant, \ declare_preprocessor_constant, \
declare_c1_constant, \ declare_c1_constant, \
declare_c2_constant, \ declare_c2_constant, \
declare_c2_preprocessor_constant, \ declare_c2_preprocessor_constant) \
last_entry) \
\ \
/******************/ \ /******************/ \
/* Useful globals */ \ /* Useful globals */ \
...@@ -2483,9 +2473,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2483,9 +2473,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_c2_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT) \ declare_c2_preprocessor_constant("SAVED_ON_ENTRY_REG_COUNT", SAVED_ON_ENTRY_REG_COUNT) \
declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT) declare_c2_preprocessor_constant("C_SAVED_ON_ENTRY_REG_COUNT", C_SAVED_ON_ENTRY_REG_COUNT)
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_INT_CONSTANTS_OS_CPU macro (and */
/* must be present there) */
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// VM_LONG_CONSTANTS // VM_LONG_CONSTANTS
...@@ -2495,7 +2482,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2495,7 +2482,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
// enums, etc., while "declare_preprocessor_constant" must be used for // enums, etc., while "declare_preprocessor_constant" must be used for
// all #defined constants. // all #defined constants.
#define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant, last_entry) \ #define VM_LONG_CONSTANTS(declare_constant, declare_preprocessor_constant, declare_c1_constant, declare_c2_constant, declare_c2_preprocessor_constant) \
\ \
/*********************/ \ /*********************/ \
/* MarkOop constants */ \ /* MarkOop constants */ \
...@@ -2541,11 +2528,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2541,11 +2528,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
/* Constants in markOop used by CMS. */ \ /* Constants in markOop used by CMS. */ \
declare_constant(markOopDesc::cms_shift) \ declare_constant(markOopDesc::cms_shift) \
declare_constant(markOopDesc::cms_mask) \ declare_constant(markOopDesc::cms_mask) \
declare_constant(markOopDesc::size_shift) \ declare_constant(markOopDesc::size_shift)
/* NOTE that we do not use the last_entry() macro here; it is used */
/* in vmStructs_<os>_<cpu>.hpp's VM_LONG_CONSTANTS_OS_CPU macro (and */
/* must be present there) */
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
...@@ -2608,9 +2591,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2608,9 +2591,6 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
// This is a no-op macro for unchecked fields // This is a no-op macro for unchecked fields
#define CHECK_NO_OP(a, b, c) #define CHECK_NO_OP(a, b, c)
// This is a no-op macro for the sentinel value
#define CHECK_SENTINEL()
// //
// Build-specific macros: // Build-specific macros:
// //
...@@ -2789,48 +2769,47 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary; ...@@ -2789,48 +2769,47 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
// as long as class VMStructs is a friend // as long as class VMStructs is a friend
VMStructEntry VMStructs::localHotSpotVMStructs[] = { VMStructEntry VMStructs::localHotSpotVMStructs[] = {
VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ VM_STRUCTS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY, \ GENERATE_STATIC_VM_STRUCT_ENTRY,
GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_C1_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \ GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
GENERATE_VM_STRUCT_LAST_ENTRY)
#ifndef SERIALGC #ifndef SERIALGC
VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ VM_STRUCTS_PARALLELGC(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY) GENERATE_STATIC_VM_STRUCT_ENTRY)
VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ VM_STRUCTS_CMS(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY) GENERATE_STATIC_VM_STRUCT_ENTRY)
VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ VM_STRUCTS_G1(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY) GENERATE_STATIC_VM_STRUCT_ENTRY)
#endif // SERIALGC #endif // SERIALGC
VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ VM_STRUCTS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY, \ GENERATE_STATIC_VM_STRUCT_ENTRY,
GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \ GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
GENERATE_VM_STRUCT_LAST_ENTRY)
VM_STRUCTS_OS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
VM_STRUCTS_OS_CPU(GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_STATIC_VM_STRUCT_ENTRY,
GENERATE_STATIC_VM_STRUCT_ENTRY, \ GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_UNCHECKED_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY,
GENERATE_C2_NONSTATIC_VM_STRUCT_ENTRY, \ GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY,
GENERATE_C1_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \ GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY)
GENERATE_C2_UNCHECKED_STATIC_VM_STRUCT_ENTRY, \
GENERATE_VM_STRUCT_LAST_ENTRY) GENERATE_VM_STRUCT_LAST_ENTRY()
}; };
VMTypeEntry VMStructs::localHotSpotVMTypes[] = { VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
...@@ -2842,8 +2821,7 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = { ...@@ -2842,8 +2821,7 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY, GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
GENERATE_C2_VM_TYPE_ENTRY, GENERATE_C2_VM_TYPE_ENTRY,
GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
GENERATE_VM_TYPE_LAST_ENTRY)
#ifndef SERIALGC #ifndef SERIALGC
VM_TYPES_PARALLELGC(GENERATE_VM_TYPE_ENTRY, VM_TYPES_PARALLELGC(GENERATE_VM_TYPE_ENTRY,
...@@ -2865,8 +2843,7 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = { ...@@ -2865,8 +2843,7 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY, GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
GENERATE_C2_VM_TYPE_ENTRY, GENERATE_C2_VM_TYPE_ENTRY,
GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
GENERATE_VM_TYPE_LAST_ENTRY)
VM_TYPES_OS_CPU(GENERATE_VM_TYPE_ENTRY, VM_TYPES_OS_CPU(GENERATE_VM_TYPE_ENTRY,
GENERATE_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_TOPLEVEL_VM_TYPE_ENTRY,
...@@ -2875,8 +2852,9 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = { ...@@ -2875,8 +2852,9 @@ VMTypeEntry VMStructs::localHotSpotVMTypes[] = {
GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY, GENERATE_UNSIGNED_INTEGER_VM_TYPE_ENTRY,
GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C1_TOPLEVEL_VM_TYPE_ENTRY,
GENERATE_C2_VM_TYPE_ENTRY, GENERATE_C2_VM_TYPE_ENTRY,
GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY, GENERATE_C2_TOPLEVEL_VM_TYPE_ENTRY)
GENERATE_VM_TYPE_LAST_ENTRY)
GENERATE_VM_TYPE_LAST_ENTRY()
}; };
VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = { VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
...@@ -2885,8 +2863,7 @@ VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = { ...@@ -2885,8 +2863,7 @@ VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
GENERATE_C1_VM_INT_CONSTANT_ENTRY, GENERATE_C1_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_VM_INT_CONSTANT_ENTRY, GENERATE_C2_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
#ifndef SERIALGC #ifndef SERIALGC
VM_INT_CONSTANTS_CMS(GENERATE_VM_INT_CONSTANT_ENTRY) VM_INT_CONSTANTS_CMS(GENERATE_VM_INT_CONSTANT_ENTRY)
...@@ -2898,15 +2875,15 @@ VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = { ...@@ -2898,15 +2875,15 @@ VMIntConstantEntry VMStructs::localHotSpotVMIntConstants[] = {
GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
GENERATE_C1_VM_INT_CONSTANT_ENTRY, GENERATE_C1_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_VM_INT_CONSTANT_ENTRY, GENERATE_C2_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
VM_INT_CONSTANTS_OS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY, VM_INT_CONSTANTS_OS_CPU(GENERATE_VM_INT_CONSTANT_ENTRY,
GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_INT_CONSTANT_ENTRY,
GENERATE_C1_VM_INT_CONSTANT_ENTRY, GENERATE_C1_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_VM_INT_CONSTANT_ENTRY, GENERATE_C2_VM_INT_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_INT_CONSTANT_ENTRY)
GENERATE_VM_INT_CONSTANT_LAST_ENTRY)
GENERATE_VM_INT_CONSTANT_LAST_ENTRY()
}; };
VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = { VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = {
...@@ -2915,22 +2892,21 @@ VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = { ...@@ -2915,22 +2892,21 @@ VMLongConstantEntry VMStructs::localHotSpotVMLongConstants[] = {
GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
GENERATE_C1_VM_LONG_CONSTANT_ENTRY, GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY, VM_LONG_CONSTANTS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
GENERATE_C1_VM_LONG_CONSTANT_ENTRY, GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
VM_LONG_CONSTANTS_OS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY, VM_LONG_CONSTANTS_OS_CPU(GENERATE_VM_LONG_CONSTANT_ENTRY,
GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY,
GENERATE_C1_VM_LONG_CONSTANT_ENTRY, GENERATE_C1_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_VM_LONG_CONSTANT_ENTRY,
GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY, GENERATE_C2_PREPROCESSOR_VM_LONG_CONSTANT_ENTRY)
GENERATE_VM_LONG_CONSTANT_LAST_ENTRY)
GENERATE_VM_LONG_CONSTANT_LAST_ENTRY()
}; };
// This is used both to check the types of referenced fields and, in // This is used both to check the types of referenced fields and, in
...@@ -2945,8 +2921,7 @@ VMStructs::init() { ...@@ -2945,8 +2921,7 @@ VMStructs::init() {
CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY, CHECK_C1_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY, CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_NO_OP, CHECK_NO_OP,
CHECK_NO_OP, CHECK_NO_OP);
CHECK_SENTINEL);
#ifndef SERIALGC #ifndef SERIALGC
VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY, VM_STRUCTS_PARALLELGC(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
...@@ -2967,8 +2942,7 @@ VMStructs::init() { ...@@ -2967,8 +2942,7 @@ VMStructs::init() {
CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY, CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_NO_OP, CHECK_NO_OP,
CHECK_NO_OP, CHECK_NO_OP);
CHECK_SENTINEL);
VM_STRUCTS_OS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY, VM_STRUCTS_OS_CPU(CHECK_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_STATIC_VM_STRUCT_ENTRY, CHECK_STATIC_VM_STRUCT_ENTRY,
...@@ -2977,8 +2951,7 @@ VMStructs::init() { ...@@ -2977,8 +2951,7 @@ VMStructs::init() {
CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY, CHECK_NONPRODUCT_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY, CHECK_C2_NONSTATIC_VM_STRUCT_ENTRY,
CHECK_NO_OP, CHECK_NO_OP,
CHECK_NO_OP, CHECK_NO_OP);
CHECK_SENTINEL);
VM_TYPES(CHECK_VM_TYPE_ENTRY, VM_TYPES(CHECK_VM_TYPE_ENTRY,
CHECK_SINGLE_ARG_VM_TYPE_NO_OP, CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
...@@ -2987,8 +2960,7 @@ VMStructs::init() { ...@@ -2987,8 +2960,7 @@ VMStructs::init() {
CHECK_SINGLE_ARG_VM_TYPE_NO_OP, CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
CHECK_C2_VM_TYPE_ENTRY, CHECK_C2_VM_TYPE_ENTRY,
CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
CHECK_SENTINEL);
#ifndef SERIALGC #ifndef SERIALGC
VM_TYPES_PARALLELGC(CHECK_VM_TYPE_ENTRY, VM_TYPES_PARALLELGC(CHECK_VM_TYPE_ENTRY,
...@@ -3010,8 +2982,7 @@ VMStructs::init() { ...@@ -3010,8 +2982,7 @@ VMStructs::init() {
CHECK_SINGLE_ARG_VM_TYPE_NO_OP, CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
CHECK_C2_VM_TYPE_ENTRY, CHECK_C2_VM_TYPE_ENTRY,
CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
CHECK_SENTINEL);
VM_TYPES_OS_CPU(CHECK_VM_TYPE_ENTRY, VM_TYPES_OS_CPU(CHECK_VM_TYPE_ENTRY,
CHECK_SINGLE_ARG_VM_TYPE_NO_OP, CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
...@@ -3020,8 +2991,7 @@ VMStructs::init() { ...@@ -3020,8 +2991,7 @@ VMStructs::init() {
CHECK_SINGLE_ARG_VM_TYPE_NO_OP, CHECK_SINGLE_ARG_VM_TYPE_NO_OP,
CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C1_TOPLEVEL_VM_TYPE_ENTRY,
CHECK_C2_VM_TYPE_ENTRY, CHECK_C2_VM_TYPE_ENTRY,
CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY, CHECK_C2_TOPLEVEL_VM_TYPE_ENTRY);
CHECK_SENTINEL);
// //
// Split VM_STRUCTS() invocation into two parts to allow MS VC++ 6.0 // Split VM_STRUCTS() invocation into two parts to allow MS VC++ 6.0
...@@ -3040,53 +3010,49 @@ VMStructs::init() { ...@@ -3040,53 +3010,49 @@ VMStructs::init() {
// Solstice NFS setup. If everyone switches to local workspaces on // Solstice NFS setup. If everyone switches to local workspaces on
// Win32, we can put this back in. // Win32, we can put this back in.
#ifndef _WINDOWS #ifndef _WINDOWS
debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT, \ debug_only(VM_STRUCTS(ENSURE_FIELD_TYPE_PRESENT,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP));
CHECK_SENTINEL)); debug_only(VM_STRUCTS(CHECK_NO_OP,
debug_only(VM_STRUCTS(CHECK_NO_OP, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ CHECK_NO_OP,
CHECK_NO_OP, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \ ENSURE_C1_FIELD_TYPE_PRESENT,
ENSURE_C1_FIELD_TYPE_PRESENT, \ ENSURE_C2_FIELD_TYPE_PRESENT,
ENSURE_C2_FIELD_TYPE_PRESENT, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP));
CHECK_NO_OP, \
CHECK_SENTINEL));
#ifndef SERIALGC #ifndef SERIALGC
debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT, \ debug_only(VM_STRUCTS_PARALLELGC(ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT)); ENSURE_FIELD_TYPE_PRESENT));
debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT, \ debug_only(VM_STRUCTS_CMS(ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT)); ENSURE_FIELD_TYPE_PRESENT));
debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT, \ debug_only(VM_STRUCTS_G1(ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT)); ENSURE_FIELD_TYPE_PRESENT));
#endif // SERIALGC #endif // SERIALGC
debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT, \ debug_only(VM_STRUCTS_CPU(ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_FIELD_TYPE_PRESENT,
CHECK_NO_OP, \ CHECK_NO_OP,
ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \ ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
ENSURE_C2_FIELD_TYPE_PRESENT, \ ENSURE_C2_FIELD_TYPE_PRESENT,
CHECK_NO_OP, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP));
CHECK_SENTINEL)); debug_only(VM_STRUCTS_OS_CPU(ENSURE_FIELD_TYPE_PRESENT,
debug_only(VM_STRUCTS_OS_CPU(ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ CHECK_NO_OP,
CHECK_NO_OP, \ ENSURE_FIELD_TYPE_PRESENT,
ENSURE_FIELD_TYPE_PRESENT, \ ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT,
ENSURE_NONPRODUCT_FIELD_TYPE_PRESENT, \ ENSURE_C2_FIELD_TYPE_PRESENT,
ENSURE_C2_FIELD_TYPE_PRESENT, \ CHECK_NO_OP,
CHECK_NO_OP, \ CHECK_NO_OP));
CHECK_NO_OP, \
CHECK_SENTINEL));
#endif #endif
} }
...@@ -3146,10 +3112,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool ...@@ -3146,10 +3112,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0'; s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) { if (recursiveFindType(origtypes, s, true) == 1) {
delete s; delete [] s;
return 1; return 1;
} }
delete s; delete [] s;
} }
const char* start = NULL; const char* start = NULL;
if (strstr(typeName, "GrowableArray<") == typeName) { if (strstr(typeName, "GrowableArray<") == typeName) {
...@@ -3165,10 +3131,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool ...@@ -3165,10 +3131,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len-1] = '\0'; s[len-1] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) { if (recursiveFindType(origtypes, s, true) == 1) {
delete s; delete [] s;
return 1; return 1;
} }
delete s; delete [] s;
} }
if (strstr(typeName, "const ") == typeName) { if (strstr(typeName, "const ") == typeName) {
const char * s = typeName + strlen("const "); const char * s = typeName + strlen("const ");
...@@ -3182,8 +3148,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool ...@@ -3182,8 +3148,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
s[len - 6] = '\0'; s[len - 6] = '\0';
// tty->print_cr("checking \"%s\" for \"%s\"", s, typeName); // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
if (recursiveFindType(origtypes, s, true) == 1) { if (recursiveFindType(origtypes, s, true) == 1) {
free(s);
return 1; return 1;
} }
free(s);
} }
if (!isRecurse) { if (!isRecurse) {
tty->print_cr("type \"%s\" not found", typeName); tty->print_cr("type \"%s\" not found", typeName);
...@@ -3206,6 +3174,30 @@ void vmStructs_init() { ...@@ -3206,6 +3174,30 @@ void vmStructs_init() {
#ifndef PRODUCT #ifndef PRODUCT
void VMStructs::test() { void VMStructs::test() {
// Make sure last entry in the each array is indeed the correct end marker.
// The reason why these are static is to make sure they are zero initialized.
// Putting them on the stack will leave some garbage in the padding of some fields.
static VMStructEntry struct_last_entry = GENERATE_VM_STRUCT_LAST_ENTRY();
assert(memcmp(&localHotSpotVMStructs[(sizeof(localHotSpotVMStructs) / sizeof(VMStructEntry)) - 1],
&struct_last_entry,
sizeof(VMStructEntry)) == 0, "Incorrect last entry in localHotSpotVMStructs");
static VMTypeEntry type_last_entry = GENERATE_VM_TYPE_LAST_ENTRY();
assert(memcmp(&localHotSpotVMTypes[sizeof(localHotSpotVMTypes) / sizeof(VMTypeEntry) - 1],
&type_last_entry,
sizeof(VMTypeEntry)) == 0, "Incorrect last entry in localHotSpotVMTypes");
static VMIntConstantEntry int_last_entry = GENERATE_VM_INT_CONSTANT_LAST_ENTRY();
assert(memcmp(&localHotSpotVMIntConstants[sizeof(localHotSpotVMIntConstants) / sizeof(VMIntConstantEntry) - 1],
&int_last_entry,
sizeof(VMIntConstantEntry)) == 0, "Incorrect last entry in localHotSpotVMIntConstants");
static VMLongConstantEntry long_last_entry = GENERATE_VM_LONG_CONSTANT_LAST_ENTRY();
assert(memcmp(&localHotSpotVMLongConstants[sizeof(localHotSpotVMLongConstants) / sizeof(VMLongConstantEntry) - 1],
&long_last_entry,
sizeof(VMLongConstantEntry)) == 0, "Incorrect last entry in localHotSpotVMLongConstants");
// Check for duplicate entries in type array // Check for duplicate entries in type array
for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) { for (int i = 0; localHotSpotVMTypes[i].typeName != NULL; i++) {
for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) { for (int j = i + 1; localHotSpotVMTypes[j].typeName != NULL; j++) {
......
/* /*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -267,6 +267,7 @@ class Exceptions { ...@@ -267,6 +267,7 @@ class Exceptions {
#define THROW_WRAPPED_0(name, oop_to_wrap) THROW_WRAPPED_(name, oop_to_wrap, 0) #define THROW_WRAPPED_0(name, oop_to_wrap) THROW_WRAPPED_(name, oop_to_wrap, 0)
#define THROW_ARG_0(name, signature, arg) THROW_ARG_(name, signature, arg, 0) #define THROW_ARG_0(name, signature, arg) THROW_ARG_(name, signature, arg, 0)
#define THROW_MSG_CAUSE_0(name, message, cause) THROW_MSG_CAUSE_(name, message, cause, 0) #define THROW_MSG_CAUSE_0(name, message, cause) THROW_MSG_CAUSE_(name, message, cause, 0)
#define THROW_MSG_CAUSE_NULL(name, message, cause) THROW_MSG_CAUSE_(name, message, cause, NULL)
#define THROW_NULL(name) THROW_(name, NULL) #define THROW_NULL(name) THROW_(name, NULL)
#define THROW_MSG_NULL(name, message) THROW_MSG_(name, message, NULL) #define THROW_MSG_NULL(name, message) THROW_MSG_(name, message, NULL)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册