Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8294245: Make Compile::print_inlining_stream stack allocated
Reviewed-by: kvn, rehn
  • Loading branch information
jdksjolen authored and robehn committed Sep 26, 2022
1 parent 91a23d7 commit 050eebf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
20 changes: 5 additions & 15 deletions src/hotspot/share/opto/compile.cpp
Expand Up @@ -635,7 +635,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
_vector_reboxing_late_inlines(comp_arena(), 2, 0, NULL),
_late_inlines_pos(0),
_number_of_mh_late_inlines(0),
_print_inlining_stream(NULL),
_print_inlining_stream(new stringStream()),
_print_inlining_list(NULL),
_print_inlining_idx(0),
_print_inlining_output(NULL),
Expand Down Expand Up @@ -908,7 +908,7 @@ Compile::Compile( ciEnv* ci_env,
_initial_gvn(NULL),
_for_igvn(NULL),
_number_of_mh_late_inlines(0),
_print_inlining_stream(NULL),
_print_inlining_stream(new stringStream()),
_print_inlining_list(NULL),
_print_inlining_idx(0),
_print_inlining_output(NULL),
Expand Down Expand Up @@ -4396,13 +4396,6 @@ Node* Compile::constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt*
return phase->transform(new ConvI2LNode(value, ltype));
}

void Compile::print_inlining_stream_free() {
if (_print_inlining_stream != NULL) {
_print_inlining_stream->~stringStream();
_print_inlining_stream = NULL;
}
}

// The message about the current inlining is accumulated in
// _print_inlining_stream and transferred into the _print_inlining_list
// once we know whether inlining succeeds or not. For regular
Expand All @@ -4414,17 +4407,14 @@ void Compile::print_inlining_stream_free() {
void Compile::print_inlining_init() {
if (print_inlining() || print_intrinsics()) {
// print_inlining_init is actually called several times.
print_inlining_stream_free();
_print_inlining_stream = new stringStream();
print_inlining_reset();
_print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer*>(comp_arena(), 1, 1, new PrintInliningBuffer());
}
}

void Compile::print_inlining_reinit() {
if (print_inlining() || print_intrinsics()) {
print_inlining_stream_free();
// Re allocate buffer when we change ResourceMark
_print_inlining_stream = new stringStream();
print_inlining_reset();
}
}

Expand Down Expand Up @@ -4514,7 +4504,7 @@ void Compile::process_print_inlining() {
// It is on the arena, so it will be freed when the arena is reset.
_print_inlining_list = NULL;
// _print_inlining_stream won't be used anymore, either.
print_inlining_stream_free();
print_inlining_reset();
size_t end = ss.size();
_print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1);
strncpy(_print_inlining_output, ss.freeze(), end+1);
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/opto/compile.hpp
Expand Up @@ -463,7 +463,6 @@ class Compile : public Phase {

void* _replay_inline_data; // Pointer to data loaded from file

void print_inlining_stream_free();
void print_inlining_init();
void print_inlining_reinit();
void print_inlining_commit();
Expand All @@ -477,7 +476,7 @@ class Compile : public Phase {

void* barrier_set_state() const { return _barrier_set_state; }

outputStream* print_inlining_stream() const {
stringStream* print_inlining_stream() {
assert(print_inlining() || print_intrinsics(), "PrintInlining off?");
return _print_inlining_stream;
}
Expand Down

0 comments on commit 050eebf

Please sign in to comment.