提交 a5874716 编写于 作者: P phh

8145788: JVM crashes with -XX:+EnableTracing

Summary: Events can trigger before ResourceMark is usable: move use from writeEvent() to print_val().
Reviewed-by: dholmes, ysuenaga, mlarsson
上级 d78de3e8
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2012, 2018, 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,7 +36,6 @@ ...@@ -36,7 +36,6 @@
// Some parts of traceEvent.hpp are used outside of // Some parts of traceEvent.hpp are used outside of
// INCLUDE_TRACE // INCLUDE_TRACE
#include "memory/resourceArea.hpp"
#include "tracefiles/traceTypes.hpp" #include "tracefiles/traceTypes.hpp"
#include "trace/traceEvent.hpp" #include "trace/traceEvent.hpp"
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
...@@ -135,7 +134,6 @@ public: ...@@ -135,7 +134,6 @@ public:
</xsl:text> </xsl:text>
<xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : TraceEvent&lt;Event', @id, '&gt;(timing) {}', $newline)"/> <xsl:value-of select="concat(' Event', @id, '(EventStartTime timing=TIMED) : TraceEvent&lt;Event', @id, '&gt;(timing) {}', $newline)"/>
void writeEvent(void) { void writeEvent(void) {
ResourceMark rm;
if (UseLockedTracing) { if (UseLockedTracing) {
ttyLocker lock; ttyLocker lock;
writeEventContent(); writeEventContent();
......
/* /*
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018, 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
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "utilities/macros.hpp" #include "utilities/macros.hpp"
#if INCLUDE_TRACE #if INCLUDE_TRACE
#include "memory/resourceArea.hpp"
#include "oops/klass.hpp" #include "oops/klass.hpp"
#include "oops/method.hpp" #include "oops/method.hpp"
#include "oops/symbol.hpp" #include "oops/symbol.hpp"
...@@ -79,11 +80,8 @@ class TraceStream : public StackObj { ...@@ -79,11 +80,8 @@ class TraceStream : public StackObj {
_st.print("%s = %f", label, val); _st.print("%s = %f", label, val);
} }
// Caller is machine generated code located in traceEventClasses.hpp
// Event<TraceId>::writeEvent() (pseudocode) contains the
// necessary ResourceMark for the resource allocations below.
// See traceEventClasses.xsl for details.
void print_val(const char* label, const Klass* const val) { void print_val(const char* label, const Klass* const val) {
ResourceMark rm;
const char* description = "NULL"; const char* description = "NULL";
if (val != NULL) { if (val != NULL) {
Symbol* name = val->name(); Symbol* name = val->name();
...@@ -94,11 +92,8 @@ class TraceStream : public StackObj { ...@@ -94,11 +92,8 @@ class TraceStream : public StackObj {
_st.print("%s = %s", label, description); _st.print("%s = %s", label, description);
} }
// Caller is machine generated code located in traceEventClasses.hpp
// Event<TraceId>::writeEvent() (pseudocode) contains the
// necessary ResourceMark for the resource allocations below.
// See traceEventClasses.xsl for details.
void print_val(const char* label, const Method* const val) { void print_val(const char* label, const Method* const val) {
ResourceMark rm;
const char* description = "NULL"; const char* description = "NULL";
if (val != NULL) { if (val != NULL) {
description = val->name_and_sig_as_C_string(); description = val->name_and_sig_as_C_string();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册