Skip to content

Commit 6b2ef42

Browse files
author
duke
committedJul 3, 2020
Automatic merge of jdk:master into master
2 parents a46a119 + 4506975 commit 6b2ef42

15 files changed

+41
-20
lines changed
 

‎src/hotspot/share/c1/c1_Compilation.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ void Compilation::compile_method() {
463463
// Note: make sure we mark the method as not compilable!
464464
CHECK_BAILOUT();
465465

466-
if (InstallMethods) {
466+
if (should_install_code()) {
467467
// install code
468468
PhaseTraceTime timeit(_t_codeinstall);
469469
install_code(frame_size);
@@ -539,7 +539,7 @@ void Compilation::generate_exception_handler_table() {
539539
}
540540

541541
Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
542-
int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive)
542+
int osr_bci, BufferBlob* buffer_blob, bool install_code, DirectiveSet* directive)
543543
: _next_id(0)
544544
, _next_block_id(0)
545545
, _compiler(compiler)
@@ -558,6 +558,7 @@ Compilation::Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* metho
558558
, _would_profile(false)
559559
, _has_method_handle_invokes(false)
560560
, _has_reserved_stack_access(method->has_reserved_stack_access())
561+
, _install_code(install_code)
561562
, _bailout_msg(NULL)
562563
, _exception_info_list(NULL)
563564
, _allocator(NULL)

‎src/hotspot/share/c1/c1_Compilation.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class Compilation: public StackObj {
8181
bool _would_profile;
8282
bool _has_method_handle_invokes; // True if this method has MethodHandle invokes.
8383
bool _has_reserved_stack_access;
84+
bool _install_code;
8485
const char* _bailout_msg;
8586
ExceptionInfoList* _exception_info_list;
8687
ExceptionHandlerTable _exception_handler_table;
@@ -120,7 +121,7 @@ class Compilation: public StackObj {
120121
public:
121122
// creation
122123
Compilation(AbstractCompiler* compiler, ciEnv* env, ciMethod* method,
123-
int osr_bci, BufferBlob* buffer_blob, DirectiveSet* directive);
124+
int osr_bci, BufferBlob* buffer_blob, bool install_code, DirectiveSet* directive);
124125
~Compilation();
125126

126127

@@ -148,6 +149,7 @@ class Compilation: public StackObj {
148149
CodeOffsets* offsets() { return &_offsets; }
149150
Arena* arena() { return _arena; }
150151
bool has_access_indexed() { return _has_access_indexed; }
152+
bool should_install_code() { return _install_code && InstallMethods; }
151153

152154
// Instruction ids
153155
int get_next_id() { return _next_id++; }

‎src/hotspot/share/c1/c1_Compiler.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
235235
return true;
236236
}
237237

238-
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, DirectiveSet* directive) {
238+
void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, bool install_code, DirectiveSet* directive) {
239239
BufferBlob* buffer_blob = CompilerThread::current()->get_buffer_blob();
240240
assert(buffer_blob != NULL, "Must exist");
241241
// invoke compilation
@@ -244,7 +244,7 @@ void Compiler::compile_method(ciEnv* env, ciMethod* method, int entry_bci, Direc
244244
// of Compilation to occur before we release the any
245245
// competing compiler thread
246246
ResourceMark rm;
247-
Compilation c(this, env, method, entry_bci, buffer_blob, directive);
247+
Compilation c(this, env, method, entry_bci, buffer_blob, install_code, directive);
248248
}
249249
}
250250

‎src/hotspot/share/c1/c1_Compiler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Compiler: public AbstractCompiler {
5151
virtual void initialize();
5252

5353
// Compilation entry point for methods
54-
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive);
54+
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive);
5555

5656
// Print compilation timers and statistics
5757
virtual void print_timers();

‎src/hotspot/share/compiler/abstractCompiler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ class AbstractCompiler : public CHeapObj<mtCompiler> {
166166
void set_state (int state);
167167
void set_shut_down () { set_state(shut_down); }
168168
// Compilation entry point for methods
169-
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
169+
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
170170
ShouldNotReachHere();
171171
}
172172

‎src/hotspot/share/compiler/compileBroker.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -2223,7 +2223,15 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
22232223
locker.wait();
22242224
}
22252225
}
2226-
comp->compile_method(&ci_env, target, osr_bci, directive);
2226+
comp->compile_method(&ci_env, target, osr_bci, true, directive);
2227+
2228+
/* Repeat compilation without installing code for profiling purposes */
2229+
int repeat_compilation_count = directive->RepeatCompilationOption;
2230+
while (repeat_compilation_count > 0) {
2231+
task->print_ul("NO CODE INSTALLED");
2232+
comp->compile_method(&ci_env, target, osr_bci, false , directive);
2233+
repeat_compilation_count--;
2234+
}
22272235
}
22282236

22292237
if (!ci_env.failing() && task->code() == NULL) {

‎src/hotspot/share/compiler/compilerDirectives.hpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@
4848
cflags(DumpInline, bool, false, DumpInline) \
4949
cflags(CompilerDirectivesIgnoreCompileCommands, bool, CompilerDirectivesIgnoreCompileCommands, X) \
5050
cflags(DisableIntrinsic, ccstrlist, DisableIntrinsic, DisableIntrinsic) \
51-
cflags(ControlIntrinsic, ccstrlist, ControlIntrinsic, ControlIntrinsic)
51+
cflags(ControlIntrinsic, ccstrlist, ControlIntrinsic, ControlIntrinsic) \
52+
cflags(RepeatCompilation, intx, RepeatCompilation, RepeatCompilation)
5253

5354
#ifdef COMPILER1
5455
#define compilerdirectives_c1_flags(cflags)
@@ -64,11 +65,11 @@
6465
NOT_PRODUCT(cflags(TraceOptoPipelining, bool, TraceOptoPipelining, TraceOptoPipelining)) \
6566
NOT_PRODUCT(cflags(TraceOptoOutput, bool, TraceOptoOutput, TraceOptoOutput)) \
6667
NOT_PRODUCT(cflags(PrintIdeal, bool, PrintIdeal, PrintIdeal)) \
67-
NOT_PRODUCT(cflags(IGVPrintLevel, intx, PrintIdealGraphLevel, IGVPrintLevel)) \
6868
cflags(TraceSpilling, bool, TraceSpilling, TraceSpilling) \
6969
cflags(Vectorize, bool, false, Vectorize) \
70-
cflags(VectorizeDebug, uintx, 0, VectorizeDebug) \
7170
cflags(CloneMapDebug, bool, false, CloneMapDebug) \
71+
NOT_PRODUCT(cflags(IGVPrintLevel, intx, PrintIdealGraphLevel, IGVPrintLevel)) \
72+
cflags(VectorizeDebug, uintx, 0, VectorizeDebug) \
7273
cflags(MaxNodeLimit, intx, MaxNodeLimit, MaxNodeLimit)
7374
#else
7475
#define compilerdirectives_c2_flags(cflags)

‎src/hotspot/share/jvmci/jvmciCompiler.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ bool JVMCICompiler::force_comp_at_level_simple(const methodHandle& method) {
135135
}
136136

137137
// Compilation entry point for methods
138-
void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
138+
void JVMCICompiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
139139
ShouldNotReachHere();
140140
}
141141

‎src/hotspot/share/jvmci/jvmciCompiler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class JVMCICompiler : public AbstractCompiler {
9494
}
9595

9696
// Compilation entry point for methods
97-
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive);
97+
virtual void compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive);
9898

9999
// Print compilation timers and statistics
100100
virtual void print_timers();

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

+2-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void C2Compiler::initialize() {
9999
}
100100
}
101101

102-
void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, DirectiveSet* directive) {
102+
void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, bool install_code, DirectiveSet* directive) {
103103
assert(is_initialized(), "Compiler thread must be initialized");
104104

105105
bool subsume_loads = SubsumeLoads;
@@ -109,7 +109,7 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, Dir
109109

110110
while (!env->failing()) {
111111
// Attempt to compile while subsuming loads into machine instructions.
112-
Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, directive);
112+
Compile C(env, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing, install_code, directive);
113113

114114
// Check result and retry if appropriate.
115115
if (C.failure_reason() != NULL) {
@@ -151,7 +151,6 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci, Dir
151151
continue; // retry
152152
}
153153
}
154-
155154
// print inlining for last compilation only
156155
C.dump_print_inlining();
157156

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

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class C2Compiler : public AbstractCompiler {
4343
void compile_method(ciEnv* env,
4444
ciMethod* target,
4545
int entry_bci,
46+
bool install_code,
4647
DirectiveSet* directive);
4748

4849
// sentinel value used to trigger backtracking in compile_method().

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -499,12 +499,13 @@ debug_only( int Compile::_debug_idx = 100000; )
499499

500500

501501
Compile::Compile( ciEnv* ci_env, ciMethod* target, int osr_bci,
502-
bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing, DirectiveSet* directive)
502+
bool subsume_loads, bool do_escape_analysis, bool eliminate_boxing, bool install_code, DirectiveSet* directive)
503503
: Phase(Compiler),
504504
_compile_id(ci_env->compile_id()),
505505
_save_argument_registers(false),
506506
_subsume_loads(subsume_loads),
507507
_do_escape_analysis(do_escape_analysis),
508+
_install_code(install_code),
508509
_eliminate_boxing(eliminate_boxing),
509510
_method(target),
510511
_entry_bci(osr_bci),
@@ -791,6 +792,7 @@ Compile::Compile( ciEnv* ci_env,
791792
_save_argument_registers(save_arg_registers),
792793
_subsume_loads(true),
793794
_do_escape_analysis(false),
795+
_install_code(true),
794796
_eliminate_boxing(false),
795797
_method(NULL),
796798
_entry_bci(InvocationEntryBci),

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ class Compile : public Phase {
246246
const bool _save_argument_registers; // save/restore arg regs for trampolines
247247
const bool _subsume_loads; // Load can be matched as part of a larger op.
248248
const bool _do_escape_analysis; // Do escape analysis.
249+
const bool _install_code; // Install the code that was compiled
249250
const bool _eliminate_boxing; // Do boxing elimination.
250251
ciMethod* _method; // The method being compiled.
251252
int _entry_bci; // entry bci for osr methods.
@@ -507,7 +508,7 @@ class Compile : public Phase {
507508
/** Do aggressive boxing elimination. */
508509
bool aggressive_unboxing() const { return _eliminate_boxing && AggressiveUnboxing; }
509510
bool save_argument_registers() const { return _save_argument_registers; }
510-
511+
bool should_install_code() const { return _install_code; }
511512

512513
// Other fixed compilation parameters.
513514
ciMethod* method() const { return _method; }
@@ -1008,7 +1009,7 @@ class Compile : public Phase {
10081009
// continuation.
10091010
Compile(ciEnv* ci_env, ciMethod* target,
10101011
int entry_bci, bool subsume_loads, bool do_escape_analysis,
1011-
bool eliminate_boxing, DirectiveSet* directive);
1012+
bool eliminate_boxing, bool install_code, DirectiveSet* directive);
10121013

10131014
// Second major entry point. From the TypeFunc signature, generate code
10141015
// to pass arguments from the Java calling convention to the C calling

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -3260,7 +3260,9 @@ uint PhaseOutput::scratch_emit_size(const Node* n) {
32603260
}
32613261

32623262
void PhaseOutput::install() {
3263-
if (C->stub_function() != NULL) {
3263+
if (!C->should_install_code()) {
3264+
return;
3265+
} else if (C->stub_function() != NULL) {
32643266
install_stub(C->stub_name(),
32653267
C->save_argument_registers());
32663268
} else {

‎src/hotspot/share/runtime/globals.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,10 @@ const size_t minimumSymbolTableSize = 1024;
538538
product(bool, PrintCompilation, false, \
539539
"Print compilations") \
540540
\
541+
diagnostic(intx, RepeatCompilation, 0, \
542+
"Repeat compilation without installing code (number of times)") \
543+
range(0, max_jint) \
544+
\
541545
product(bool, PrintExtendedThreadInfo, false, \
542546
"Print more information in thread dump") \
543547
\

0 commit comments

Comments
 (0)
Please sign in to comment.