Skip to content

Commit 050eebf

Browse files
jdksjolenrobehn
authored andcommittedSep 26, 2022
8294245: Make Compile::print_inlining_stream stack allocated
Reviewed-by: kvn, rehn
1 parent 91a23d7 commit 050eebf

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed
 

‎src/hotspot/share/opto/compile.cpp

+5-15
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
635635
_vector_reboxing_late_inlines(comp_arena(), 2, 0, NULL),
636636
_late_inlines_pos(0),
637637
_number_of_mh_late_inlines(0),
638-
_print_inlining_stream(NULL),
638+
_print_inlining_stream(new stringStream()),
639639
_print_inlining_list(NULL),
640640
_print_inlining_idx(0),
641641
_print_inlining_output(NULL),
@@ -908,7 +908,7 @@ Compile::Compile( ciEnv* ci_env,
908908
_initial_gvn(NULL),
909909
_for_igvn(NULL),
910910
_number_of_mh_late_inlines(0),
911-
_print_inlining_stream(NULL),
911+
_print_inlining_stream(new stringStream()),
912912
_print_inlining_list(NULL),
913913
_print_inlining_idx(0),
914914
_print_inlining_output(NULL),
@@ -4396,13 +4396,6 @@ Node* Compile::constrained_convI2L(PhaseGVN* phase, Node* value, const TypeInt*
43964396
return phase->transform(new ConvI2LNode(value, ltype));
43974397
}
43984398

4399-
void Compile::print_inlining_stream_free() {
4400-
if (_print_inlining_stream != NULL) {
4401-
_print_inlining_stream->~stringStream();
4402-
_print_inlining_stream = NULL;
4403-
}
4404-
}
4405-
44064399
// The message about the current inlining is accumulated in
44074400
// _print_inlining_stream and transferred into the _print_inlining_list
44084401
// once we know whether inlining succeeds or not. For regular
@@ -4414,17 +4407,14 @@ void Compile::print_inlining_stream_free() {
44144407
void Compile::print_inlining_init() {
44154408
if (print_inlining() || print_intrinsics()) {
44164409
// print_inlining_init is actually called several times.
4417-
print_inlining_stream_free();
4418-
_print_inlining_stream = new stringStream();
4410+
print_inlining_reset();
44194411
_print_inlining_list = new (comp_arena())GrowableArray<PrintInliningBuffer*>(comp_arena(), 1, 1, new PrintInliningBuffer());
44204412
}
44214413
}
44224414

44234415
void Compile::print_inlining_reinit() {
44244416
if (print_inlining() || print_intrinsics()) {
4425-
print_inlining_stream_free();
4426-
// Re allocate buffer when we change ResourceMark
4427-
_print_inlining_stream = new stringStream();
4417+
print_inlining_reset();
44284418
}
44294419
}
44304420

@@ -4514,7 +4504,7 @@ void Compile::process_print_inlining() {
45144504
// It is on the arena, so it will be freed when the arena is reset.
45154505
_print_inlining_list = NULL;
45164506
// _print_inlining_stream won't be used anymore, either.
4517-
print_inlining_stream_free();
4507+
print_inlining_reset();
45184508
size_t end = ss.size();
45194509
_print_inlining_output = NEW_ARENA_ARRAY(comp_arena(), char, end+1);
45204510
strncpy(_print_inlining_output, ss.freeze(), end+1);

‎src/hotspot/share/opto/compile.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ class Compile : public Phase {
463463

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

466-
void print_inlining_stream_free();
467466
void print_inlining_init();
468467
void print_inlining_reinit();
469468
void print_inlining_commit();
@@ -477,7 +476,7 @@ class Compile : public Phase {
477476

478477
void* barrier_set_state() const { return _barrier_set_state; }
479478

480-
outputStream* print_inlining_stream() const {
479+
stringStream* print_inlining_stream() {
481480
assert(print_inlining() || print_intrinsics(), "PrintInlining off?");
482481
return _print_inlining_stream;
483482
}

0 commit comments

Comments
 (0)