# HG changeset patch # User stuefe # Date 1558460853 -7200 # Tue May 21 19:47:33 2019 +0200 # Node ID ea445307d54ca02225ec732c568d4ac3c6c1e940 # Parent 00425a850a2f1ab1740ec5b74f3d160f46b76534 8224487-make-streams-not-copyable diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/c1/c1_Runtime1.cpp --- a/src/hotspot/share/c1/c1_Runtime1.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/c1/c1_Runtime1.cpp Tue May 21 19:47:33 2019 +0200 @@ -575,7 +575,7 @@ tempst.print("compiled method <%s>\n" " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, nm->method()->print_value_string(), p2i(pc), p2i(thread)); - Exceptions::log_exception(exception, tempst); + Exceptions::log_exception(exception, tempst.as_string()); } // for AbortVMOnException flag Exceptions::debug_check_abort(exception); diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/code/codeHeapState.cpp --- a/src/hotspot/share/code/codeHeapState.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/code/codeHeapState.cpp Tue May 21 19:47:33 2019 +0200 @@ -124,7 +124,7 @@ size_t _nlockedflush = 0; \ size_t _nflush_bytes = 0; \ size_t _capacity = _capa; \ - bufferedStream _sstobj = bufferedStream(_capa); \ + bufferedStream _sstobj(_capa); \ bufferedStream* _sstbuf = &_sstobj; \ outputStream* _outbuf = _outst; \ bufferedStream* _anyst = &_sstobj; /* any stream. Use this to just print - no buffer flush. */ diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/compiler/compileBroker.cpp --- a/src/hotspot/share/compiler/compileBroker.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/compiler/compileBroker.cpp Tue May 21 19:47:33 2019 +0200 @@ -192,7 +192,7 @@ void log_compile(JavaThread* thread, CompileTask* task) { StringLogMessage lm; - stringStream sstr = lm.stream(); + stringStream sstr(lm.buffer(), lm.size()); // msg.time_stamp().update_to(tty->time_stamp().ticks()); task->print(&sstr, NULL, true, false); log(thread, "%s", (const char*)lm); diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/interpreter/bytecodeInterpreter.cpp --- a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/interpreter/bytecodeInterpreter.cpp Tue May 21 19:47:33 2019 +0200 @@ -2871,7 +2871,7 @@ METHOD->print_value_string(), (int)(istate->bcp() - METHOD->code_base()), (int)continuation_bci, p2i(THREAD)); - Exceptions::log_exception(except_oop, tempst); + Exceptions::log_exception(except_oop, tempst.as_string()); } // for AbortVMOnException flag Exceptions::debug_check_abort(except_oop); @@ -2888,7 +2888,7 @@ METHOD->print_value_string(), (int)(istate->bcp() - METHOD->code_base()), p2i(THREAD)); - Exceptions::log_exception(except_oop, tempst); + Exceptions::log_exception(except_oop, tempst.as_string()); } // for AbortVMOnException flag Exceptions::debug_check_abort(except_oop); diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/interpreter/interpreterRuntime.cpp --- a/src/hotspot/share/interpreter/interpreterRuntime.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp Tue May 21 19:47:33 2019 +0200 @@ -543,7 +543,7 @@ tempst.print("interpreter method <%s>\n" " at bci %d for thread " INTPTR_FORMAT " (%s)", h_method->print_value_string(), current_bci, p2i(thread), thread->name()); - Exceptions::log_exception(h_exception, tempst); + Exceptions::log_exception(h_exception, tempst.as_string()); } // Don't go paging in something which won't be used. // else if (extable->length() == 0) { diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/jvmci/jvmciRuntime.cpp --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp Tue May 21 19:47:33 2019 +0200 @@ -311,7 +311,7 @@ tempst.print("compiled method <%s>\n" " at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT, cm->method()->print_value_string(), p2i(pc), p2i(thread)); - Exceptions::log_exception(exception, tempst); + Exceptions::log_exception(exception, tempst.as_string()); } // for AbortVMOnException flag NOT_PRODUCT(Exceptions::debug_check_abort(exception)); diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/utilities/events.cpp --- a/src/hotspot/share/utilities/events.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/utilities/events.cpp Tue May 21 19:47:33 2019 +0200 @@ -108,7 +108,8 @@ int index = compute_log_index(); _records[index].thread = thread; _records[index].timestamp = timestamp; - stringStream st = _records[index].data.stream(); + stringStream st(_records[index].data.buffer(), + _records[index].data.size()); st.print("Unloading class " INTPTR_FORMAT " ", p2i(ik)); ik->name()->print_value_on(&st); } @@ -121,7 +122,8 @@ int index = compute_log_index(); _records[index].thread = thread; _records[index].timestamp = timestamp; - stringStream st = _records[index].data.stream(); + stringStream st(_records[index].data.buffer(), + _records[index].data.size()); st.print("Exception <"); h_exception->print_value_on(&st); st.print("%s%s> (" INTPTR_FORMAT ") \n" diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/utilities/events.hpp --- a/src/hotspot/share/utilities/events.hpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/utilities/events.hpp Tue May 21 19:47:33 2019 +0200 @@ -137,11 +137,6 @@ // A simple wrapper class for fixed size text messages. template class FormatStringLogMessage : public FormatBuffer { - public: - // Wrap this buffer in a stringStream. - stringStream stream() { - return stringStream(this->_buf, this->size()); - } }; typedef FormatStringLogMessage<256> StringLogMessage; typedef FormatStringLogMessage<512> ExtendedStringLogMessage; diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/utilities/exceptions.cpp --- a/src/hotspot/share/utilities/exceptions.cpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/utilities/exceptions.cpp Tue May 21 19:47:33 2019 +0200 @@ -526,17 +526,17 @@ } // for logging exceptions -void Exceptions::log_exception(Handle exception, stringStream tempst) { +void Exceptions::log_exception(Handle exception, const char* message) { ResourceMark rm; - Symbol* message = java_lang_Throwable::detail_message(exception()); - if (message != NULL) { + Symbol* detail_message = java_lang_Throwable::detail_message(exception()); + if (detail_message != NULL) { log_info(exceptions)("Exception <%s: %s>\n thrown in %s", exception->print_value_string(), - message->as_C_string(), - tempst.as_string()); + detail_message->as_C_string(), + message); } else { log_info(exceptions)("Exception <%s>\n thrown in %s", exception->print_value_string(), - tempst.as_string()); + message); } } diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/utilities/exceptions.hpp --- a/src/hotspot/share/utilities/exceptions.hpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/utilities/exceptions.hpp Tue May 21 19:47:33 2019 +0200 @@ -186,7 +186,7 @@ static void debug_check_abort(const char *value_string, const char* message = NULL); // for logging exceptions - static void log_exception(Handle exception, stringStream tempst); + static void log_exception(Handle exception, const char* message); }; diff -r 00425a850a2f -r ea445307d54c src/hotspot/share/utilities/ostream.hpp --- a/src/hotspot/share/utilities/ostream.hpp Tue May 21 11:45:37 2019 +0200 +++ b/src/hotspot/share/utilities/ostream.hpp Tue May 21 19:47:33 2019 +0200 @@ -42,6 +42,10 @@ // This allows for redirection via -XX:+DisplayVMOutputToStdout and // -XX:+DisplayVMOutputToStderr class outputStream : public ResourceObj { + private: + outputStream(const outputStream&); + outputStream& operator=(const outputStream&); + protected: int _indentation; // current indentation int _width; // width of the page