mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8156034: [JVMCI] Notify the jvmci compiler on completion of a bootstrap
Reviewed-by: twisti
This commit is contained in:
parent
3548f9ecba
commit
536db8741f
10 changed files with 48 additions and 7 deletions
|
@ -381,6 +381,18 @@ public final class HotSpotJVMCIRuntime implements HotSpotJVMCIRuntimeProvider, H
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on completion of a bootstrap.
|
||||
*
|
||||
* Called from the VM.
|
||||
*/
|
||||
@SuppressWarnings({"unused"})
|
||||
private void bootstrapFinished() throws Exception {
|
||||
for (HotSpotVMEventListener vmEventListener : vmEventListeners) {
|
||||
vmEventListener.notifyBootstrapFinished();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on successful install into the CodeCache.
|
||||
*
|
||||
|
|
|
@ -74,6 +74,12 @@ public abstract class HotSpotVMEventListener {
|
|||
public void notifyInstall(HotSpotCodeCacheProvider hotSpotCodeCacheProvider, InstalledCode installedCode, CompiledCode compiledCode) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify on completion of a bootstrap.
|
||||
*/
|
||||
public void notifyBootstrapFinished() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a custom {@link JVMCIMetaAccessContext} to be used for managing the lifetime of loaded
|
||||
* metadata. It a custom one isn't created then the default implementation will be a single
|
||||
|
|
|
@ -358,6 +358,7 @@
|
|||
template(nthreads_name, "nthreads") \
|
||||
template(ngroups_name, "ngroups") \
|
||||
template(shutdown_method_name, "shutdown") \
|
||||
template(bootstrapFinished_method_name, "bootstrapFinished") \
|
||||
template(finalize_method_name, "finalize") \
|
||||
template(reference_lock_name, "lock") \
|
||||
template(reference_discovered_name, "discovered") \
|
||||
|
|
|
@ -39,6 +39,7 @@ elapsedTimer JVMCICompiler::_codeInstallTimer;
|
|||
|
||||
JVMCICompiler::JVMCICompiler() : AbstractCompiler(jvmci) {
|
||||
_bootstrapping = false;
|
||||
_bootstrap_compilation_request_handled = false;
|
||||
_methods_compiled = 0;
|
||||
assert(_instance == NULL, "only one instance allowed");
|
||||
_instance = this;
|
||||
|
@ -57,7 +58,7 @@ void JVMCICompiler::initialize() {
|
|||
CompilationPolicy::completed_vm_startup();
|
||||
}
|
||||
|
||||
void JVMCICompiler::bootstrap() {
|
||||
void JVMCICompiler::bootstrap(TRAPS) {
|
||||
if (Arguments::mode() == Arguments::_int) {
|
||||
// Nothing to do in -Xint mode
|
||||
return;
|
||||
|
@ -68,7 +69,6 @@ void JVMCICompiler::bootstrap() {
|
|||
FlagSetting ctwOff(CompileTheWorld, false);
|
||||
#endif
|
||||
|
||||
JavaThread* THREAD = JavaThread::current();
|
||||
_bootstrapping = true;
|
||||
ResourceMark rm;
|
||||
HandleMark hm;
|
||||
|
@ -97,7 +97,7 @@ void JVMCICompiler::bootstrap() {
|
|||
do {
|
||||
os::sleep(THREAD, 100, true);
|
||||
qsize = CompileBroker::queue_size(CompLevel_full_optimization);
|
||||
} while (first_round && qsize == 0);
|
||||
} while (!_bootstrap_compilation_request_handled && first_round && qsize == 0);
|
||||
first_round = false;
|
||||
if (PrintBootstrap) {
|
||||
while (z < (_methods_compiled / 100)) {
|
||||
|
@ -111,6 +111,7 @@ void JVMCICompiler::bootstrap() {
|
|||
tty->print_cr(" in " JLONG_FORMAT " ms (compiled %d methods)", os::javaTimeMillis() - start, _methods_compiled);
|
||||
}
|
||||
_bootstrapping = false;
|
||||
JVMCIRuntime::bootstrap_finished(CHECK);
|
||||
}
|
||||
|
||||
#define CHECK_ABORT THREAD); \
|
||||
|
@ -187,6 +188,9 @@ void JVMCICompiler::compile_method(const methodHandle& method, int entry_bci, JV
|
|||
assert(false, "JVMCICompiler.compileMethod should always return non-null");
|
||||
}
|
||||
}
|
||||
if (_bootstrapping) {
|
||||
_bootstrap_compilation_request_handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
CompLevel JVMCIRuntime::adjust_comp_level(methodHandle method, bool is_osr, CompLevel level, JavaThread* thread) {
|
||||
|
|
|
@ -32,6 +32,11 @@ class JVMCICompiler : public AbstractCompiler {
|
|||
private:
|
||||
bool _bootstrapping;
|
||||
|
||||
/**
|
||||
* True if we have seen a bootstrap compilation request.
|
||||
*/
|
||||
volatile bool _bootstrap_compilation_request_handled;
|
||||
|
||||
/**
|
||||
* Number of methods successfully compiled by a call to
|
||||
* JVMCICompiler::compile_method().
|
||||
|
@ -72,7 +77,7 @@ public:
|
|||
* Initialize the compile queue with the methods in java.lang.Object and
|
||||
* then wait until the queue is empty.
|
||||
*/
|
||||
void bootstrap();
|
||||
void bootstrap(TRAPS);
|
||||
|
||||
bool is_bootstrapping() const { return _bootstrapping; }
|
||||
|
||||
|
|
|
@ -867,6 +867,15 @@ if (HAS_PENDING_EXCEPTION) { \
|
|||
#undef CHECK_RETURN
|
||||
}
|
||||
|
||||
void JVMCIRuntime::bootstrap_finished(TRAPS) {
|
||||
HandleMark hm(THREAD);
|
||||
Handle receiver = get_HotSpotJVMCIRuntime(CHECK);
|
||||
JavaValue result(T_VOID);
|
||||
JavaCallArguments args;
|
||||
args.push_oop(receiver);
|
||||
JavaCalls::call_special(&result, receiver->klass(), vmSymbols::bootstrapFinished_method_name(), vmSymbols::void_method_signature(), &args, CHECK);
|
||||
}
|
||||
|
||||
bool JVMCIRuntime::treat_as_trivial(Method* method) {
|
||||
if (_HotSpotJVMCIRuntime_initialized) {
|
||||
for (int i = 0; i < _trivial_prefixes_count; i++) {
|
||||
|
|
|
@ -127,6 +127,8 @@ class JVMCIRuntime: public AllStatic {
|
|||
|
||||
static void shutdown(TRAPS);
|
||||
|
||||
static void bootstrap_finished(TRAPS);
|
||||
|
||||
static bool shutdown_called() {
|
||||
return _shutdown_called;
|
||||
}
|
||||
|
|
|
@ -3988,7 +3988,11 @@ static jint JNI_CreateJavaVM_inner(JavaVM **vm, void **penv, void *args) {
|
|||
if (BootstrapJVMCI) {
|
||||
JavaThread* THREAD = thread;
|
||||
JVMCICompiler* compiler = JVMCICompiler::instance(CATCH);
|
||||
compiler->bootstrap();
|
||||
compiler->bootstrap(THREAD);
|
||||
if (HAS_PENDING_EXCEPTION) {
|
||||
HandleMark hm;
|
||||
vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
|
|
@ -1 +0,0 @@
|
|||
compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
|
Loading…
Add table
Add a link
Reference in a new issue