8294245: Make Compile::print_inlining_stream stack allocated

Reviewed-by: kvn, rehn
This commit is contained in:
Johan Sjölen 2022-09-26 10:50:43 +00:00 committed by Robbin Ehn
parent 91a23d775f
commit 050eebf2e8
2 changed files with 6 additions and 17 deletions

View File

@ -635,7 +635,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
_vector_reboxing_late_inlines(comp_arena(), 2, 0, NULL), _vector_reboxing_late_inlines(comp_arena(), 2, 0, NULL),
_late_inlines_pos(0), _late_inlines_pos(0),
_number_of_mh_late_inlines(0), _number_of_mh_late_inlines(0),
_print_inlining_stream(NULL), _print_inlining_stream(new stringStream()),
_print_inlining_list(NULL), _print_inlining_list(NULL),
_print_inlining_idx(0), _print_inlining_idx(0),
_print_inlining_output(NULL), _print_inlining_output(NULL),
@ -908,7 +908,7 @@ Compile::Compile( ciEnv* ci_env,
_initial_gvn(NULL), _initial_gvn(NULL),
_for_igvn(NULL), _for_igvn(NULL),
_number_of_mh_late_inlines(0), _number_of_mh_late_inlines(0),
_print_inlining_stream(NULL), _print_inlining_stream(new stringStream()),
_print_inlining_list(NULL), _print_inlining_list(NULL),
_print_inlining_idx(0), _print_inlining_idx(0),
_print_inlining_output(NULL), _print_inlining_output(NULL),
@ -4396,13 +4396,6 @@ Node* Compile::constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt*
return phase->transform(new ConvI2LNode(value, ltype)); 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 // The message about the current inlining is accumulated in
// _print_inlining_stream and transferred into the _print_inlining_list // _print_inlining_stream and transferred into the _print_inlining_list
// once we know whether inlining succeeds or not. For regular // once we know whether inlining succeeds or not. For regular
@ -4414,17 +4407,14 @@ void Compile::print_inlining_stream_free() {
void Compile::print_inlining_init() { void Compile::print_inlining_init() {
if (print_inlining() || print_intrinsics()) { if (print_inlining() || print_intrinsics()) {
// print_inlining_init is actually called several times. // print_inlining_init is actually called several times.
print_inlining_stream_free(); print_inlining_reset();
_print_inlining_stream = new stringStream();
_print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer*>(comp_arena(), 1, 1, new PrintInliningBuffer()); _print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer*>(comp_arena(), 1, 1, new PrintInliningBuffer());
} }
} }
void Compile::print_inlining_reinit() { void Compile::print_inlining_reinit() {
if (print_inlining() || print_intrinsics()) { if (print_inlining() || print_intrinsics()) {
print_inlining_stream_free(); print_inlining_reset();
// Re allocate buffer when we change ResourceMark
_print_inlining_stream = new stringStream();
} }
} }
@ -4514,7 +4504,7 @@ void Compile::process_print_inlining() {
// It is on the arena, so it will be freed when the arena is reset. // It is on the arena, so it will be freed when the arena is reset.
_print_inlining_list = NULL; _print_inlining_list = NULL;
// _print_inlining_stream won't be used anymore, either. // _print_inlining_stream won't be used anymore, either.
print_inlining_stream_free(); print_inlining_reset();
size_t end = ss.size(); size_t end = ss.size();
_print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1); _print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1);
strncpy(_print_inlining_output, ss.freeze(), end+1); strncpy(_print_inlining_output, ss.freeze(), end+1);

View File

@ -463,7 +463,6 @@ class Compile : public Phase {
void* _replay_inline_data; // Pointer to data loaded from file void* _replay_inline_data; // Pointer to data loaded from file
void print_inlining_stream_free();
void print_inlining_init(); void print_inlining_init();
void print_inlining_reinit(); void print_inlining_reinit();
void print_inlining_commit(); void print_inlining_commit();
@ -477,7 +476,7 @@ class Compile : public Phase {
void* barrier_set_state() const { return _barrier_set_state; } 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?"); assert(print_inlining() || print_intrinsics(), "PrintInlining off?");
return _print_inlining_stream; return _print_inlining_stream;
} }