Merge
This commit is contained in:
commit
66388c03c9
@ -59,6 +59,10 @@ void os::check_or_create_dump(void* exceptionRecord, void* contextRecord, char*
|
|||||||
VMError::report_coredump_status(buffer, success);
|
VMError::report_coredump_status(buffer, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int os::get_last_error() {
|
||||||
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
bool os::is_debugger_attached() {
|
bool os::is_debugger_attached() {
|
||||||
// not implemented
|
// not implemented
|
||||||
return false;
|
return false;
|
||||||
|
@ -132,7 +132,6 @@ PVOID topLevelVectoredExceptionHandler = NULL;
|
|||||||
// save DLL module handle, used by GetModuleFileName
|
// save DLL module handle, used by GetModuleFileName
|
||||||
|
|
||||||
HINSTANCE vm_lib_handle;
|
HINSTANCE vm_lib_handle;
|
||||||
static int getLastErrorString(char *buf, size_t len);
|
|
||||||
|
|
||||||
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, LPVOID reserved) {
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
@ -1452,7 +1451,7 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
long errcode = GetLastError();
|
DWORD errcode = GetLastError();
|
||||||
if (errcode == ERROR_MOD_NOT_FOUND) {
|
if (errcode == ERROR_MOD_NOT_FOUND) {
|
||||||
strncpy(ebuf, "Can't find dependent libraries", ebuflen-1);
|
strncpy(ebuf, "Can't find dependent libraries", ebuflen-1);
|
||||||
ebuf[ebuflen-1]='\0';
|
ebuf[ebuflen-1]='\0';
|
||||||
@ -1463,11 +1462,11 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen)
|
|||||||
// If we can read dll-info and find that dll was built
|
// If we can read dll-info and find that dll was built
|
||||||
// for an architecture other than Hotspot is running in
|
// for an architecture other than Hotspot is running in
|
||||||
// - then print to buffer "DLL was built for a different architecture"
|
// - then print to buffer "DLL was built for a different architecture"
|
||||||
// else call getLastErrorString to obtain system error message
|
// else call os::lasterror to obtain system error message
|
||||||
|
|
||||||
// Read system error message into ebuf
|
// Read system error message into ebuf
|
||||||
// It may or may not be overwritten below (in the for loop and just above)
|
// It may or may not be overwritten below (in the for loop and just above)
|
||||||
getLastErrorString(ebuf, (size_t) ebuflen);
|
lasterror(ebuf, (size_t) ebuflen);
|
||||||
ebuf[ebuflen-1]='\0';
|
ebuf[ebuflen-1]='\0';
|
||||||
int file_descriptor=::open(name, O_RDONLY | O_BINARY, 0);
|
int file_descriptor=::open(name, O_RDONLY | O_BINARY, 0);
|
||||||
if (file_descriptor<0)
|
if (file_descriptor<0)
|
||||||
@ -1500,7 +1499,7 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen)
|
|||||||
::close(file_descriptor);
|
::close(file_descriptor);
|
||||||
if (failed_to_get_lib_arch)
|
if (failed_to_get_lib_arch)
|
||||||
{
|
{
|
||||||
// file i/o error - report getLastErrorString(...) msg
|
// file i/o error - report os::lasterror(...) msg
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1543,7 +1542,7 @@ void * os::dll_load(const char *name, char *ebuf, int ebuflen)
|
|||||||
"Didn't find runing architecture code in arch_array");
|
"Didn't find runing architecture code in arch_array");
|
||||||
|
|
||||||
// If the architure is right
|
// If the architure is right
|
||||||
// but some other error took place - report getLastErrorString(...) msg
|
// but some other error took place - report os::lasterror(...) msg
|
||||||
if (lib_arch == running_arch)
|
if (lib_arch == running_arch)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1775,12 +1774,12 @@ void os::print_jni_name_suffix_on(outputStream* st, int args_size) {
|
|||||||
// This method is a copy of JDK's sysGetLastErrorString
|
// This method is a copy of JDK's sysGetLastErrorString
|
||||||
// from src/windows/hpi/src/system_md.c
|
// from src/windows/hpi/src/system_md.c
|
||||||
|
|
||||||
size_t os::lasterror(char *buf, size_t len) {
|
size_t os::lasterror(char* buf, size_t len) {
|
||||||
long errval;
|
DWORD errval;
|
||||||
|
|
||||||
if ((errval = GetLastError()) != 0) {
|
if ((errval = GetLastError()) != 0) {
|
||||||
/* DOS error */
|
// DOS error
|
||||||
int n = (int)FormatMessage(
|
size_t n = (size_t)FormatMessage(
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||||
NULL,
|
NULL,
|
||||||
errval,
|
errval,
|
||||||
@ -1789,7 +1788,7 @@ size_t os::lasterror(char *buf, size_t len) {
|
|||||||
(DWORD)len,
|
(DWORD)len,
|
||||||
NULL);
|
NULL);
|
||||||
if (n > 3) {
|
if (n > 3) {
|
||||||
/* Drop final '.', CR, LF */
|
// Drop final '.', CR, LF
|
||||||
if (buf[n - 1] == '\n') n--;
|
if (buf[n - 1] == '\n') n--;
|
||||||
if (buf[n - 1] == '\r') n--;
|
if (buf[n - 1] == '\r') n--;
|
||||||
if (buf[n - 1] == '.') n--;
|
if (buf[n - 1] == '.') n--;
|
||||||
@ -1799,17 +1798,25 @@ size_t os::lasterror(char *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (errno != 0) {
|
if (errno != 0) {
|
||||||
/* C runtime error that has no corresponding DOS error code */
|
// C runtime error that has no corresponding DOS error code
|
||||||
const char *s = strerror(errno);
|
const char* s = strerror(errno);
|
||||||
size_t n = strlen(s);
|
size_t n = strlen(s);
|
||||||
if (n >= len) n = len - 1;
|
if (n >= len) n = len - 1;
|
||||||
strncpy(buf, s, n);
|
strncpy(buf, s, n);
|
||||||
buf[n] = '\0';
|
buf[n] = '\0';
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int os::get_last_error() {
|
||||||
|
DWORD error = GetLastError();
|
||||||
|
if (error == 0)
|
||||||
|
error = errno;
|
||||||
|
return (int)error;
|
||||||
|
}
|
||||||
|
|
||||||
// sun.misc.Signal
|
// sun.misc.Signal
|
||||||
// NOTE that this is a workaround for an apparent kernel bug where if
|
// NOTE that this is a workaround for an apparent kernel bug where if
|
||||||
// a signal handler for SIGBREAK is installed then that signal handler
|
// a signal handler for SIGBREAK is installed then that signal handler
|
||||||
@ -4746,7 +4753,7 @@ bool os::check_heap(bool force) {
|
|||||||
fatal("corrupted C heap");
|
fatal("corrupted C heap");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int err = GetLastError();
|
DWORD err = GetLastError();
|
||||||
if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) {
|
if (err != ERROR_NO_MORE_ITEMS && err != ERROR_CALL_NOT_IMPLEMENTED) {
|
||||||
fatal(err_msg("heap walk aborted with error %d", err));
|
fatal(err_msg("heap walk aborted with error %d", err));
|
||||||
}
|
}
|
||||||
@ -4778,45 +4785,6 @@ LONG WINAPI os::win32::serialize_fault_filter(struct _EXCEPTION_POINTERS* e) {
|
|||||||
return EXCEPTION_CONTINUE_SEARCH;
|
return EXCEPTION_CONTINUE_SEARCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int getLastErrorString(char *buf, size_t len)
|
|
||||||
{
|
|
||||||
long errval;
|
|
||||||
|
|
||||||
if ((errval = GetLastError()) != 0)
|
|
||||||
{
|
|
||||||
/* DOS error */
|
|
||||||
size_t n = (size_t)FormatMessage(
|
|
||||||
FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
|
|
||||||
NULL,
|
|
||||||
errval,
|
|
||||||
0,
|
|
||||||
buf,
|
|
||||||
(DWORD)len,
|
|
||||||
NULL);
|
|
||||||
if (n > 3) {
|
|
||||||
/* Drop final '.', CR, LF */
|
|
||||||
if (buf[n - 1] == '\n') n--;
|
|
||||||
if (buf[n - 1] == '\r') n--;
|
|
||||||
if (buf[n - 1] == '.') n--;
|
|
||||||
buf[n] = '\0';
|
|
||||||
}
|
|
||||||
return (int)n;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errno != 0)
|
|
||||||
{
|
|
||||||
/* C runtime error that has no corresponding DOS error code */
|
|
||||||
const char *s = strerror(errno);
|
|
||||||
size_t n = strlen(s);
|
|
||||||
if (n >= len) n = len - 1;
|
|
||||||
strncpy(buf, s, n);
|
|
||||||
buf[n] = '\0';
|
|
||||||
return (int)n;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// We don't build a headless jre for Windows
|
// We don't build a headless jre for Windows
|
||||||
bool os::is_headless_jre() { return false; }
|
bool os::is_headless_jre() { return false; }
|
||||||
|
|
||||||
|
@ -2664,18 +2664,23 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name,
|
|||||||
_max_bootstrap_specifier_index = -1;
|
_max_bootstrap_specifier_index = -1;
|
||||||
|
|
||||||
if (JvmtiExport::should_post_class_file_load_hook()) {
|
if (JvmtiExport::should_post_class_file_load_hook()) {
|
||||||
// Get the cached class file bytes (if any) from the
|
// Get the cached class file bytes (if any) from the class that
|
||||||
// class that is being redefined.
|
// is being redefined or retransformed. We use jvmti_thread_state()
|
||||||
JvmtiThreadState *state = JvmtiThreadState::state_for(jt);
|
// instead of JvmtiThreadState::state_for(jt) so we don't allocate
|
||||||
KlassHandle *h_class_being_redefined =
|
// a JvmtiThreadState any earlier than necessary. This will help
|
||||||
state->get_class_being_redefined();
|
// avoid the bug described by 7126851.
|
||||||
if (h_class_being_redefined != NULL) {
|
JvmtiThreadState *state = jt->jvmti_thread_state();
|
||||||
instanceKlassHandle ikh_class_being_redefined =
|
if (state != NULL) {
|
||||||
instanceKlassHandle(THREAD, (*h_class_being_redefined)());
|
KlassHandle *h_class_being_redefined =
|
||||||
cached_class_file_bytes =
|
state->get_class_being_redefined();
|
||||||
ikh_class_being_redefined->get_cached_class_file_bytes();
|
if (h_class_being_redefined != NULL) {
|
||||||
cached_class_file_length =
|
instanceKlassHandle ikh_class_being_redefined =
|
||||||
ikh_class_being_redefined->get_cached_class_file_len();
|
instanceKlassHandle(THREAD, (*h_class_being_redefined)());
|
||||||
|
cached_class_file_bytes =
|
||||||
|
ikh_class_being_redefined->get_cached_class_file_bytes();
|
||||||
|
cached_class_file_length =
|
||||||
|
ikh_class_being_redefined->get_cached_class_file_len();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* ptr = cfs->buffer();
|
unsigned char* ptr = cfs->buffer();
|
||||||
|
@ -502,6 +502,7 @@ class os: AllStatic {
|
|||||||
|
|
||||||
static void print_location(outputStream* st, intptr_t x, bool verbose = false);
|
static void print_location(outputStream* st, intptr_t x, bool verbose = false);
|
||||||
static size_t lasterror(char *buf, size_t len);
|
static size_t lasterror(char *buf, size_t len);
|
||||||
|
static int get_last_error();
|
||||||
|
|
||||||
// Determines whether the calling process is being debugged by a user-mode debugger.
|
// Determines whether the calling process is being debugged by a user-mode debugger.
|
||||||
static bool is_debugger_attached();
|
static bool is_debugger_attached();
|
||||||
|
@ -377,7 +377,7 @@ DeadlockCycle* ThreadService::find_deadlocks_at_safepoint(bool concurrent_locks)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
delete cycle;
|
||||||
return deadlocks;
|
return deadlocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user