8293251: Use stringStream::base() instead of as_string() when applicable
Reviewed-by: rehn
This commit is contained in:
parent
a8f0f575ab
commit
4b8399b5f0
@ -377,7 +377,7 @@ address UpcallLinker::make_upcall_stub(jobject receiver, Method* entry,
|
||||
#ifndef PRODUCT
|
||||
stringStream ss;
|
||||
ss.print("upcall_stub_%s", entry->signature()->as_C_string());
|
||||
const char* name = _masm->code_string(ss.as_string());
|
||||
const char* name = _masm->code_string(ss.freeze());
|
||||
#else // PRODUCT
|
||||
const char* name = "upcall_stub";
|
||||
#endif // PRODUCT
|
||||
|
@ -140,7 +140,7 @@ BlockListBuilder::BlockListBuilder(Compilation* compilation, IRScope* scope, int
|
||||
stringStream title;
|
||||
title.print("BlockListBuilder ");
|
||||
scope->method()->print_name(&title);
|
||||
CFGPrinter::print_cfg(_bci2block, title.as_string(), false, false);
|
||||
CFGPrinter::print_cfg(_bci2block, title.freeze(), false, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -975,7 +975,7 @@ Assert::Assert(Value x, Condition cond, bool unordered_is_true, Value y) : Instr
|
||||
ip2.print_instr(y);
|
||||
|
||||
stringStream ss;
|
||||
ss.print("Assertion %s %s %s in method %s", strStream1.as_string(), ip2.cond_name(cond), strStream2.as_string(), strStream.as_string());
|
||||
ss.print("Assertion %s %s %s in method %s", strStream1.freeze(), ip2.cond_name(cond), strStream2.freeze(), strStream.freeze());
|
||||
|
||||
_message = ss.as_string();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ void LIR_Assembler::emit_stubs(CodeStubList* stub_list) {
|
||||
stringStream st;
|
||||
s->print_name(&st);
|
||||
st.print(" slow case");
|
||||
_masm->block_comment(st.as_string());
|
||||
_masm->block_comment(st.freeze());
|
||||
}
|
||||
#endif
|
||||
s->emit_code(this);
|
||||
@ -262,7 +262,7 @@ void LIR_Assembler::emit_block(BlockBegin* block) {
|
||||
if (CommentedAssembly) {
|
||||
stringStream st;
|
||||
st.print_cr(" block B%d [%d, %d]", block->block_id(), block->bci(), block->end()->printable_bci());
|
||||
_masm->block_comment(st.as_string());
|
||||
_masm->block_comment(st.freeze());
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -292,7 +292,7 @@ void LIR_Assembler::emit_lir_list(LIR_List* list) {
|
||||
(op->code() == lir_leal && op->as_Op1()->patch_code() != lir_patch_none)) {
|
||||
stringStream st;
|
||||
op->print_on(&st);
|
||||
_masm->block_comment(st.as_string());
|
||||
_masm->block_comment(st.freeze());
|
||||
}
|
||||
}
|
||||
if (PrintLIRWithAssembly) {
|
||||
|
@ -553,13 +553,13 @@ JRT_ENTRY_NO_ASYNC(static address, exception_handler_for_pc_helper(JavaThread* c
|
||||
// debugging support
|
||||
// tracing
|
||||
if (log_is_enabled(Info, exceptions)) {
|
||||
ResourceMark rm;
|
||||
ResourceMark rm; // print_value_string
|
||||
stringStream tempst;
|
||||
assert(nm->method() != NULL, "Unexpected NULL method()");
|
||||
tempst.print("C1 compiled method <%s>\n"
|
||||
" at PC" INTPTR_FORMAT " for thread " INTPTR_FORMAT,
|
||||
nm->method()->print_value_string(), p2i(pc), p2i(current));
|
||||
Exceptions::log_exception(exception, tempst.as_string());
|
||||
Exceptions::log_exception(exception, tempst.freeze());
|
||||
}
|
||||
// for AbortVMOnException flag
|
||||
Exceptions::debug_check_abort(exception);
|
||||
@ -1496,7 +1496,7 @@ JRT_ENTRY(void, Runtime1::predicate_failed_trap(JavaThread* current))
|
||||
Method* inlinee = vfst.method();
|
||||
inlinee->print_short_name(&ss1);
|
||||
m->print_short_name(&ss2);
|
||||
tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.as_string(), vfst.bci(), ss2.as_string(), p2i(caller_frame.pc()));
|
||||
tty->print_cr("Predicate failed trap in method %s at bci %d inlined in %s at pc " INTPTR_FORMAT, ss1.freeze(), vfst.bci(), ss2.freeze(), p2i(caller_frame.pc()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,10 +439,10 @@ void ClassLoaderDataGraph::print_dictionary(outputStream* st) {
|
||||
|
||||
void ClassLoaderDataGraph::print_table_statistics(outputStream* st) {
|
||||
FOR_ALL_DICTIONARY(cld) {
|
||||
ResourceMark rm;
|
||||
ResourceMark rm; // loader_name_and_id
|
||||
stringStream tempst;
|
||||
tempst.print("System Dictionary for %s class loader", cld->loader_name_and_id());
|
||||
cld->dictionary()->print_table_statistics(st, tempst.as_string());
|
||||
cld->dictionary()->print_table_statistics(st, tempst.freeze());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1498,7 +1498,6 @@ void CodeCache::report_codemem_full(CodeBlobType code_blob_type, bool print) {
|
||||
warning("%s", msg1);
|
||||
warning("%s", msg2);
|
||||
}
|
||||
ResourceMark rm;
|
||||
stringStream s;
|
||||
// Dump code cache into a buffer before locking the tty.
|
||||
{
|
||||
@ -1507,7 +1506,7 @@ void CodeCache::report_codemem_full(CodeBlobType code_blob_type, bool print) {
|
||||
}
|
||||
{
|
||||
ttyLocker ttyl;
|
||||
tty->print("%s", s.as_string());
|
||||
tty->print("%s", s.freeze());
|
||||
}
|
||||
|
||||
if (full_count == 1) {
|
||||
|
@ -547,13 +547,12 @@ void CompileQueue::print(outputStream* st) {
|
||||
}
|
||||
|
||||
void CompileQueue::print_tty() {
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
// Dump the compile queue into a buffer before locking the tty
|
||||
print(&ss);
|
||||
{
|
||||
ttyLocker ttyl;
|
||||
tty->print("%s", ss.as_string());
|
||||
tty->print("%s", ss.freeze());
|
||||
}
|
||||
}
|
||||
|
||||
@ -2023,7 +2022,6 @@ void CompileBroker::maybe_block() {
|
||||
// wrapper for CodeCache::print_summary()
|
||||
static void codecache_print(bool detailed)
|
||||
{
|
||||
ResourceMark rm;
|
||||
stringStream s;
|
||||
// Dump code cache into a buffer before locking the tty,
|
||||
{
|
||||
@ -2031,12 +2029,11 @@ static void codecache_print(bool detailed)
|
||||
CodeCache::print_summary(&s, detailed);
|
||||
}
|
||||
ttyLocker ttyl;
|
||||
tty->print("%s", s.as_string());
|
||||
tty->print("%s", s.freeze());
|
||||
}
|
||||
|
||||
// wrapper for CodeCache::print_summary() using outputStream
|
||||
static void codecache_print(outputStream* out, bool detailed) {
|
||||
ResourceMark rm;
|
||||
stringStream s;
|
||||
|
||||
// Dump code cache into a buffer
|
||||
@ -2351,7 +2348,6 @@ void CompileBroker::handle_full_code_cache(CodeBlobType code_blob_type) {
|
||||
UseInterpreter = true;
|
||||
if (UseCompiler || AlwaysCompileLoopMethods ) {
|
||||
if (xtty != NULL) {
|
||||
ResourceMark rm;
|
||||
stringStream s;
|
||||
// Dump code cache state into a buffer before locking the tty,
|
||||
// because log_state() will use locks causing lock conflicts.
|
||||
@ -2359,7 +2355,7 @@ void CompileBroker::handle_full_code_cache(CodeBlobType code_blob_type) {
|
||||
// Lock to prevent tearing
|
||||
ttyLocker ttyl;
|
||||
xtty->begin_elem("code_cache_full");
|
||||
xtty->print("%s", s.as_string());
|
||||
xtty->print("%s", s.freeze());
|
||||
xtty->stamp();
|
||||
xtty->end_elem();
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ void print_raw_memory(ShenandoahMessageBuffer &msg, void* loc) {
|
||||
stringStream ss;
|
||||
os::print_hex_dump(&ss, start, end, 4);
|
||||
msg.append("\n");
|
||||
msg.append("Raw heap memory:\n%s", ss.as_string());
|
||||
msg.append("Raw heap memory:\n%s", ss.freeze());
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ void ShenandoahAsserts::print_obj(ShenandoahMessageBuffer& msg, oop obj) {
|
||||
msg.append(" %3s marked strong\n", ctx->is_marked_strong(obj) ? "" : "not");
|
||||
msg.append(" %3s marked weak\n", ctx->is_marked_weak(obj) ? "" : "not");
|
||||
msg.append(" %3s in collection set\n", heap->in_collection_set(obj) ? "" : "not");
|
||||
msg.append(" mark:%s\n", mw_ss.as_string());
|
||||
msg.append(" region: %s", ss.as_string());
|
||||
msg.append(" mark:%s\n", mw_ss.freeze());
|
||||
msg.append(" region: %s", ss.freeze());
|
||||
}
|
||||
|
||||
void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) {
|
||||
@ -84,12 +84,12 @@ void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) {
|
||||
r->print_on(&ss);
|
||||
|
||||
msg.append(" %3s in collection set\n", heap->in_collection_set_loc(loc) ? "" : "not");
|
||||
msg.append(" region: %s", ss.as_string());
|
||||
msg.append(" region: %s", ss.freeze());
|
||||
} else {
|
||||
msg.append(" outside of Java heap\n");
|
||||
stringStream ss;
|
||||
os::print_location(&ss, (intptr_t) loc, false);
|
||||
msg.append(" %s", ss.as_string());
|
||||
msg.append(" %s", ss.freeze());
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ void ShenandoahAsserts::print_obj_safe(ShenandoahMessageBuffer& msg, void* loc)
|
||||
if (r != NULL) {
|
||||
stringStream ss;
|
||||
r->print_on(&ss);
|
||||
msg.append(" region: %s", ss.as_string());
|
||||
msg.append(" region: %s", ss.freeze());
|
||||
print_raw_memory(msg, loc);
|
||||
}
|
||||
}
|
||||
|
@ -77,11 +77,10 @@ ShenandoahHeapRegion::ShenandoahHeapRegion(HeapWord* start, size_t index, bool c
|
||||
}
|
||||
|
||||
void ShenandoahHeapRegion::report_illegal_transition(const char *method) {
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
ss.print("Illegal region state transition from \"%s\", at %s\n ", region_state_to_string(_state), method);
|
||||
print_on(&ss);
|
||||
fatal("%s", ss.as_string());
|
||||
fatal("%s", ss.freeze());
|
||||
}
|
||||
|
||||
void ShenandoahHeapRegion::make_regular_allocation() {
|
||||
|
@ -250,7 +250,7 @@ void ShenandoahNMethod::assert_same_oops(bool allow_dead) {
|
||||
debug_stream.print_cr("-> " PTR_FORMAT, p2i(check.at(i)));
|
||||
}
|
||||
fatal("Must match #detected: %d, #recorded: %d, #total: %d, begin: " PTR_FORMAT ", end: " PTR_FORMAT "\n%s",
|
||||
oops->length(), _oops_count, count, p2i(nm()->oops_begin()), p2i(nm()->oops_end()), debug_stream.as_string());
|
||||
oops->length(), _oops_count, count, p2i(nm()->oops_begin()), p2i(nm()->oops_end()), debug_stream.freeze());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -765,11 +765,10 @@ void ShenandoahVerifier::verify_at_safepoint(const char *label,
|
||||
|
||||
size_t reg_live = r->get_live_data_words();
|
||||
if (reg_live != verf_live) {
|
||||
ResourceMark rm;
|
||||
stringStream ss;
|
||||
r->print_on(&ss);
|
||||
fatal("%s: Live data should match: region-live = " SIZE_FORMAT ", verifier-live = " UINT32_FORMAT "\n%s",
|
||||
label, reg_live, verf_live, ss.as_string());
|
||||
label, reg_live, verf_live, ss.freeze());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -963,7 +963,7 @@ C2V_VMENTRY_0(jint, installCode0, (JNIEnv *env, jobject,
|
||||
CodeCache::print_summary(&s, false);
|
||||
}
|
||||
ttyLocker ttyl;
|
||||
tty->print_raw_cr(s.as_string());
|
||||
tty->print_raw_cr(s.freeze());
|
||||
}
|
||||
|
||||
if (result != JVMCI::ok) {
|
||||
|
@ -248,7 +248,7 @@ const Type* CastIINode::Value(PhaseGVN* phase) const {
|
||||
} else {
|
||||
stringStream ss;
|
||||
test.dump_on(&ss);
|
||||
fatal("unexpected comparison %s", ss.as_string());
|
||||
fatal("unexpected comparison %s", ss.freeze());
|
||||
}
|
||||
int lo_int = (int)lo_long;
|
||||
int hi_int = (int)hi_long;
|
||||
|
@ -4500,7 +4500,7 @@ void Compile::process_print_inlining() {
|
||||
assert(_print_inlining_list != NULL, "process_print_inlining should be called only once.");
|
||||
for (int i = 0; i < _print_inlining_list->length(); i++) {
|
||||
PrintInliningBuffer* pib = _print_inlining_list->at(i);
|
||||
ss.print("%s", pib->ss()->as_string());
|
||||
ss.print("%s", pib->ss()->freeze());
|
||||
delete pib;
|
||||
DEBUG_ONLY(_print_inlining_list->at_put(i, NULL));
|
||||
}
|
||||
@ -4511,7 +4511,7 @@ void Compile::process_print_inlining() {
|
||||
print_inlining_stream_free();
|
||||
size_t end = ss.size();
|
||||
_print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1);
|
||||
strncpy(_print_inlining_output, ss.base(), end+1);
|
||||
strncpy(_print_inlining_output, ss.freeze(), end+1);
|
||||
_print_inlining_output[end] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ class Compile : public Phase {
|
||||
void print_inlining(ciMethod* method, int inline_level, int bci, const char* msg = NULL) {
|
||||
stringStream ss;
|
||||
CompileTask::print_inlining_inner(&ss, method, inline_level, bci, msg);
|
||||
print_inlining_stream()->print("%s", ss.as_string());
|
||||
print_inlining_stream()->print("%s", ss.freeze());
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
|
@ -62,7 +62,7 @@ void trace_type_profile(Compile* C, ciMethod *method, int depth, int bci, ciMeth
|
||||
out->print(" \\-> TypeProfile (%d/%d counts) = ", receiver_count, site_count);
|
||||
stringStream ss;
|
||||
prof_klass->name()->print_symbol_on(&ss);
|
||||
out->print("%s", ss.as_string());
|
||||
out->print("%s", ss.freeze());
|
||||
out->cr();
|
||||
}
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ void IdealGraphPrinter::end_head() {
|
||||
void IdealGraphPrinter::print_attr(const char *name, intptr_t val) {
|
||||
stringStream stream;
|
||||
stream.print(INTX_FORMAT, val);
|
||||
print_attr(name, stream.as_string());
|
||||
print_attr(name, stream.freeze());
|
||||
}
|
||||
|
||||
void IdealGraphPrinter::print_attr(const char *name, const char *val) {
|
||||
@ -225,7 +225,7 @@ void IdealGraphPrinter::text(const char *s) {
|
||||
void IdealGraphPrinter::print_prop(const char *name, int val) {
|
||||
stringStream stream;
|
||||
stream.print("%d", val);
|
||||
print_prop(name, stream.as_string());
|
||||
print_prop(name, stream.freeze());
|
||||
}
|
||||
|
||||
void IdealGraphPrinter::print_prop(const char *name, const char *val) {
|
||||
@ -245,8 +245,8 @@ void IdealGraphPrinter::print_method(ciMethod *method, int bci, InlineTree *tree
|
||||
stringStream shortStr;
|
||||
method->print_short_name(&shortStr);
|
||||
|
||||
print_attr(METHOD_NAME_PROPERTY, str.as_string());
|
||||
print_attr(METHOD_SHORT_NAME_PROPERTY, shortStr.as_string());
|
||||
print_attr(METHOD_NAME_PROPERTY, str.freeze());
|
||||
print_attr(METHOD_SHORT_NAME_PROPERTY, shortStr.freeze());
|
||||
print_attr(METHOD_BCI_PROPERTY, bci);
|
||||
|
||||
end_head();
|
||||
@ -305,7 +305,7 @@ void IdealGraphPrinter::begin_method() {
|
||||
// Add method name
|
||||
stringStream strStream;
|
||||
method->print_name(&strStream);
|
||||
print_prop(METHOD_NAME_PROPERTY, strStream.as_string());
|
||||
print_prop(METHOD_NAME_PROPERTY, strStream.freeze());
|
||||
|
||||
if (method->flags().is_public()) {
|
||||
print_prop(METHOD_IS_PUBLIC_PROPERTY, TRUE_VALUE);
|
||||
@ -318,7 +318,7 @@ void IdealGraphPrinter::begin_method() {
|
||||
if (C->is_osr_compilation()) {
|
||||
stringStream ss;
|
||||
ss.print("bci: %d, line: %d", C->entry_bci(), method->line_number_from_bci(C->entry_bci()));
|
||||
print_prop(COMPILATION_OSR_PROPERTY, ss.as_string());
|
||||
print_prop(COMPILATION_OSR_PROPERTY, ss.freeze());
|
||||
}
|
||||
|
||||
print_prop(COMPILATION_ID_PROPERTY, C->compile_id());
|
||||
@ -601,7 +601,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
bciStream.print("%d ", caller->bci());
|
||||
caller = caller->caller();
|
||||
}
|
||||
print_prop("bci", bciStream.as_string());
|
||||
print_prop("bci", bciStream.freeze());
|
||||
if (last != NULL && last->has_linenumber_table() && last_bci >= 0) {
|
||||
print_prop("line", last->line_number_from_bci(last_bci));
|
||||
}
|
||||
@ -611,7 +611,7 @@ void IdealGraphPrinter::visit_node(Node *n, bool edges, VectorSet* temp_set) {
|
||||
if (node->debug_orig() != NULL) {
|
||||
stringStream dorigStream;
|
||||
node->dump_orig(&dorigStream, false);
|
||||
print_prop("debug_orig", dorigStream.as_string());
|
||||
print_prop("debug_orig", dorigStream.freeze());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -154,7 +154,7 @@ JVMState* LibraryIntrinsic::generate(JVMState* jvms) {
|
||||
msg_stream.print("Did not generate intrinsic %s%s at bci:%d in",
|
||||
vmIntrinsics::name_at(intrinsic_id()),
|
||||
is_virtual() ? " (virtual)" : "", bci);
|
||||
const char *msg = msg_stream.as_string();
|
||||
const char *msg = msg_stream.freeze();
|
||||
log_debug(jit, inlining)("%s", msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
tty->print("%s", msg);
|
||||
@ -215,7 +215,7 @@ Node* LibraryIntrinsic::generate_predicate(JVMState* jvms, int predicate) {
|
||||
msg_stream.print("Did not generate intrinsic %s%s at bci:%d in",
|
||||
vmIntrinsics::name_at(intrinsic_id()),
|
||||
is_virtual() ? " (virtual)" : "", bci);
|
||||
const char *msg = msg_stream.as_string();
|
||||
const char *msg = msg_stream.freeze();
|
||||
log_debug(jit, inlining)("%s", msg);
|
||||
if (C->print_intrinsics() || C->print_inlining()) {
|
||||
C->print_inlining_stream()->print("%s", msg);
|
||||
|
@ -1472,7 +1472,7 @@ void PhaseOutput::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
|
||||
if (!block->is_connector()) {
|
||||
stringStream st;
|
||||
block->dump_head(C->cfg(), &st);
|
||||
MacroAssembler(cb).block_comment(st.as_string());
|
||||
MacroAssembler(cb).block_comment(st.freeze());
|
||||
}
|
||||
jmp_target[i] = 0;
|
||||
jmp_offset[i] = 0;
|
||||
@ -1925,13 +1925,13 @@ void PhaseOutput::fill_buffer(CodeBuffer* cb, uint* blk_starts) {
|
||||
}
|
||||
if (C->method() != NULL) {
|
||||
tty->print_cr("----------------------- MetaData before Compile_id = %d ------------------------", C->compile_id());
|
||||
tty->print_raw(method_metadata_str.as_string());
|
||||
tty->print_raw(method_metadata_str.freeze());
|
||||
} else if (C->stub_name() != NULL) {
|
||||
tty->print_cr("----------------------------- RuntimeStub %s -------------------------------", C->stub_name());
|
||||
}
|
||||
tty->cr();
|
||||
tty->print_cr("------------------------ OptoAssembly for Compile_id = %d -----------------------", C->compile_id());
|
||||
tty->print_raw(dump_asm_str.as_string());
|
||||
tty->print_raw(dump_asm_str.freeze());
|
||||
tty->print_cr("--------------------------------------------------------------------------------");
|
||||
if (xtty != NULL) {
|
||||
xtty->tail("opto_assembly");
|
||||
|
@ -1720,9 +1720,9 @@ NamedCounter* OptoRuntime::new_named_counter(JVMState* youngest_jvms, NamedCount
|
||||
}
|
||||
NamedCounter* c;
|
||||
if (tag == NamedCounter::RTMLockingCounter) {
|
||||
c = new RTMLockingNamedCounter(st.as_string());
|
||||
c = new RTMLockingNamedCounter(st.freeze());
|
||||
} else {
|
||||
c = new NamedCounter(st.as_string(), tag);
|
||||
c = new NamedCounter(st.freeze(), tag);
|
||||
}
|
||||
|
||||
// atomically add the new counter to the head of the list. We only
|
||||
@ -1756,5 +1756,5 @@ static void trace_exception(outputStream* st, oop exception_oop, address excepti
|
||||
tempst.print(" at " INTPTR_FORMAT, p2i(exception_pc));
|
||||
tempst.print("]");
|
||||
|
||||
st->print_raw_cr(tempst.as_string());
|
||||
st->print_raw_cr(tempst.freeze());
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ Handle VectorSupport::allocate_vector_payload(InstanceKlass* ik, frame* fr, Regi
|
||||
} else if (!payload->is_object() && !payload->is_constant_oop()) {
|
||||
stringStream ss;
|
||||
payload->print_on(&ss);
|
||||
assert(false, "expected 'object' value for scalar-replaced boxed vector but got: %s", ss.as_string());
|
||||
assert(false, "expected 'object' value for scalar-replaced boxed vector but got: %s", ss.freeze());
|
||||
#endif
|
||||
}
|
||||
return Handle(THREAD, nullptr);
|
||||
|
@ -2463,7 +2463,7 @@ WB_ENTRY(void, WB_VerifyFrames(JNIEnv* env, jobject wb, jboolean log, jboolean u
|
||||
}
|
||||
if (log) {
|
||||
tty->print_cr("[WhiteBox::VerifyFrames] Walking Frames");
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
tty->print_cr("[WhiteBox::VerifyFrames] Done");
|
||||
}
|
||||
WB_END
|
||||
|
@ -161,7 +161,7 @@ void Deoptimization::UnrollBlock::print() {
|
||||
st.print(INTX_FORMAT " ", frame_sizes()[index]);
|
||||
}
|
||||
st.cr();
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
|
||||
|
||||
@ -214,7 +214,7 @@ static void print_objects(JavaThread* deoptee_thread,
|
||||
k->oop_print_on(obj(), &st);
|
||||
}
|
||||
}
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
|
||||
static bool rematerialize_objects(JavaThread* thread, int exec_mode, CompiledMethod* compiled_method,
|
||||
@ -321,7 +321,7 @@ static void restore_eliminated_locks(JavaThread* thread, GrowableArray<compiledV
|
||||
}
|
||||
}
|
||||
}
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
#endif // !PRODUCT
|
||||
}
|
||||
@ -1582,7 +1582,7 @@ vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, Re
|
||||
st.print(" - %s", code_name);
|
||||
st.print_cr(" @ bci=%d ", bci);
|
||||
}
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
tty->cr();
|
||||
}
|
||||
|
||||
@ -2063,7 +2063,7 @@ JRT_ENTRY(void, Deoptimization::uncommon_trap_inner(JavaThread* current, jint tr
|
||||
class_name->print_symbol_on(&st);
|
||||
}
|
||||
st.cr();
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
if (xtty != NULL) {
|
||||
// Log the precise location of the trap.
|
||||
|
@ -592,7 +592,7 @@ void vframeArray::unpack_to_stack(frame &unpack_frame, int exec_mode, int caller
|
||||
st.print_cr("DEOPT UNPACKING thread=" INTPTR_FORMAT " vframeArray=" INTPTR_FORMAT " mode=%d",
|
||||
p2i(current), p2i(this), exec_mode);
|
||||
st.print_cr(" Virtual frames (outermost/oldest first):");
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
|
||||
// Do the unpacking of interpreter frames; the frame at index 0 represents the top activation, so it has no callee
|
||||
@ -630,7 +630,7 @@ void vframeArray::unpack_to_stack(frame &unpack_frame, int exec_mode, int caller
|
||||
st.print(" - %s", code_name);
|
||||
st.print(" @ bci=%d ", bci);
|
||||
st.print_cr("sp=" PTR_FORMAT, p2i(elem->iframe()->sp()));
|
||||
tty->print_raw(st.as_string());
|
||||
tty->print_raw(st.freeze());
|
||||
}
|
||||
elem->unpack_on_stack(caller_actual_parameters,
|
||||
callee_parameters,
|
||||
|
@ -358,6 +358,7 @@ void stringStream::grow(size_t new_capacity) {
|
||||
}
|
||||
|
||||
void stringStream::write(const char* s, size_t len) {
|
||||
assert(_is_frozen == false, "Modification forbidden");
|
||||
assert(_capacity >= _written + 1, "Sanity");
|
||||
if (len == 0) {
|
||||
return;
|
||||
@ -397,6 +398,7 @@ void stringStream::zero_terminate() {
|
||||
}
|
||||
|
||||
void stringStream::reset() {
|
||||
assert(_is_frozen == false, "Modification forbidden");
|
||||
_written = 0; _precount = 0; _position = 0;
|
||||
_newlines = 0;
|
||||
zero_terminate();
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "memory/allocation.hpp"
|
||||
#include "runtime/timer.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
DEBUG_ONLY(class ResourceMark;)
|
||||
|
||||
@ -191,6 +192,7 @@ class ttyUnlocker: StackObj {
|
||||
// for writing to strings; buffer will expand automatically.
|
||||
// Buffer will always be zero-terminated.
|
||||
class stringStream : public outputStream {
|
||||
DEBUG_ONLY(bool _is_frozen = false);
|
||||
char* _buffer;
|
||||
size_t _written; // Number of characters written, excluding termin. zero
|
||||
size_t _capacity;
|
||||
@ -215,9 +217,18 @@ class stringStream : public outputStream {
|
||||
// Return number of characters written into buffer, excluding terminating zero and
|
||||
// subject to truncation in static buffer mode.
|
||||
size_t size() const { return _written; }
|
||||
// Returns internal buffer containing the accumulated string.
|
||||
// Returned buffer is only guaranteed to be valid as long as stream is not modified
|
||||
const char* base() const { return _buffer; }
|
||||
// Freezes stringStream (no further modifications possible) and returns pointer to it.
|
||||
// No-op if stream is frozen already.
|
||||
// Returns the internal buffer containing the accumulated string.
|
||||
const char* freeze() NOT_DEBUG(const) {
|
||||
DEBUG_ONLY(_is_frozen = true);
|
||||
return _buffer;
|
||||
};
|
||||
void reset();
|
||||
// copy to a resource, or C-heap, array as requested
|
||||
// Copy to a resource, or C-heap, array as requested
|
||||
char* as_string(bool c_heap = false) const;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user