提交 fc2bb1ec 编写于 作者: P poonam

8081219: hs_err improvement: Add event logging for class redefinition to the hs_err file

Summary: Use the Events::log function to save redefined classes for output to the hs_err file
Reviewed-by: dholmes
上级 666c66bf
/* /*
* Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2017, 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
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "runtime/deoptimization.hpp" #include "runtime/deoptimization.hpp"
#include "runtime/relocator.hpp" #include "runtime/relocator.hpp"
#include "utilities/bitMap.inline.hpp" #include "utilities/bitMap.inline.hpp"
#include "utilities/events.hpp"
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
...@@ -172,6 +173,9 @@ void VM_RedefineClasses::doit_epilogue() { ...@@ -172,6 +173,9 @@ void VM_RedefineClasses::doit_epilogue() {
// Free os::malloc allocated memory. // Free os::malloc allocated memory.
os::free(_scratch_classes); os::free(_scratch_classes);
// Reset the_class_oop to null for error printing.
_the_class_oop = NULL;
if (RC_TRACE_ENABLED(0x00000004)) { if (RC_TRACE_ENABLED(0x00000004)) {
// Used to have separate timers for "doit" and "all", but the timer // Used to have separate timers for "doit" and "all", but the timer
// overhead skewed the measurements. // overhead skewed the measurements.
...@@ -4096,6 +4100,13 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass, ...@@ -4096,6 +4100,13 @@ void VM_RedefineClasses::redefine_single_class(jclass the_jclass,
java_lang_Class::classRedefinedCount(the_class_mirror), java_lang_Class::classRedefinedCount(the_class_mirror),
os::available_memory() >> 10)); os::available_memory() >> 10));
{
ResourceMark rm(THREAD);
Events::log_redefinition(THREAD, "redefined class name=%s, count=%d",
the_class->external_name(),
java_lang_Class::classRedefinedCount(the_class_mirror));
}
RC_TIMER_STOP(_timer_rsc_phase2); RC_TIMER_STOP(_timer_rsc_phase2);
} // end redefine_single_class() } // end redefine_single_class()
...@@ -4240,3 +4251,11 @@ void VM_RedefineClasses::dump_methods() { ...@@ -4240,3 +4251,11 @@ void VM_RedefineClasses::dump_methods() {
tty->cr(); tty->cr();
} }
} }
void VM_RedefineClasses::print_on_error(outputStream* st) const {
VM_Operation::print_on_error(st);
if (_the_class_oop != NULL) {
ResourceMark rm;
st->print_cr(", redefining class %s", _the_class_oop->external_name());
}
}
/* /*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2017, 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
...@@ -538,5 +538,8 @@ class VM_RedefineClasses: public VM_Operation { ...@@ -538,5 +538,8 @@ class VM_RedefineClasses: public VM_Operation {
static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) { static unsigned char * get_cached_class_file_bytes(JvmtiCachedClassFileData *cache) {
return cache == NULL ? NULL : cache->data; return cache == NULL ? NULL : cache->data;
} }
// Error printing
void print_on_error(outputStream* st) const;
}; };
#endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP #endif // SHARE_VM_PRIMS_JVMTIREDEFINECLASSES_HPP
/* /*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, 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
...@@ -183,7 +183,7 @@ class VM_Operation: public CHeapObj<mtInternal> { ...@@ -183,7 +183,7 @@ class VM_Operation: public CHeapObj<mtInternal> {
static const char* mode_to_string(Mode mode); static const char* mode_to_string(Mode mode);
// Debugging // Debugging
void print_on_error(outputStream* st) const; virtual void print_on_error(outputStream* st) const;
const char* name() const { return _names[type()]; } const char* name() const { return _names[type()]; }
static const char* name(int type) { static const char* name(int type) {
assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type"); assert(type >= 0 && type < VMOp_Terminating, "invalid VM operation type");
......
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, 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
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
EventLog* Events::_logs = NULL; EventLog* Events::_logs = NULL;
StringEventLog* Events::_messages = NULL; StringEventLog* Events::_messages = NULL;
StringEventLog* Events::_exceptions = NULL; StringEventLog* Events::_exceptions = NULL;
StringEventLog* Events::_redefinitions = NULL;
StringEventLog* Events::_deopt_messages = NULL; StringEventLog* Events::_deopt_messages = NULL;
EventLog::EventLog() { EventLog::EventLog() {
...@@ -65,6 +66,7 @@ void Events::init() { ...@@ -65,6 +66,7 @@ void Events::init() {
if (LogEvents) { if (LogEvents) {
_messages = new StringEventLog("Events"); _messages = new StringEventLog("Events");
_exceptions = new StringEventLog("Internal exceptions"); _exceptions = new StringEventLog("Internal exceptions");
_redefinitions = new StringEventLog("Classes redefined");
_deopt_messages = new StringEventLog("Deoptimization events"); _deopt_messages = new StringEventLog("Deoptimization events");
} }
} }
......
/* /*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2017, 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
...@@ -186,6 +186,9 @@ class Events : AllStatic { ...@@ -186,6 +186,9 @@ class Events : AllStatic {
// Deoptization related messages // Deoptization related messages
static StringEventLog* _deopt_messages; static StringEventLog* _deopt_messages;
// Redefinition related messages
static StringEventLog* _redefinitions;
public: public:
static void print_all(outputStream* out); static void print_all(outputStream* out);
...@@ -198,6 +201,8 @@ class Events : AllStatic { ...@@ -198,6 +201,8 @@ class Events : AllStatic {
// Log exception related message // Log exception related message
static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); static void log_exception(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
static void log_redefinition(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3); static void log_deopt_message(Thread* thread, const char* format, ...) ATTRIBUTE_PRINTF(2, 3);
// Register default loggers // Register default loggers
...@@ -222,6 +227,15 @@ inline void Events::log_exception(Thread* thread, const char* format, ...) { ...@@ -222,6 +227,15 @@ inline void Events::log_exception(Thread* thread, const char* format, ...) {
} }
} }
inline void Events::log_redefinition(Thread* thread, const char* format, ...) {
if (LogEvents) {
va_list ap;
va_start(ap, format);
_redefinitions->logv(thread, format, ap);
va_end(ap);
}
}
inline void Events::log_deopt_message(Thread* thread, const char* format, ...) { inline void Events::log_deopt_message(Thread* thread, const char* format, ...) {
if (LogEvents) { if (LogEvents) {
va_list ap; va_list ap;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册