8200196: [Graal] implement Object.notify/notifyAll intrinsics

Reviewed-by: iveresov
This commit is contained in:
Dean Long 2018-04-19 16:28:55 -07:00
parent 716ac034c4
commit 054d2a2984
5 changed files with 36 additions and 0 deletions

View file

@ -445,6 +445,8 @@ void AOTCodeHeap::link_shared_runtime_symbols() {
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_handle_wrong_method_stub", address, SharedRuntime::get_handle_wrong_method_stub());
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_exception_handler_for_return_address", address, SharedRuntime::exception_handler_for_return_address);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_register_finalizer", address, SharedRuntime::register_finalizer);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_object_notify", address, JVMCIRuntime::object_notify);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_object_notifyAll", address, JVMCIRuntime::object_notifyAll);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_OSR_migration_end", address, SharedRuntime::OSR_migration_end);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_resolve_dynamic_invoke", address, CompilerRuntime::resolve_dynamic_invoke);
SET_AOT_GLOBAL_SYMBOL_VALUE("_aot_resolve_string_by_symbol", address, CompilerRuntime::resolve_string_by_symbol);

View file

@ -415,6 +415,34 @@ JRT_LEAF(void, JVMCIRuntime::monitorexit(JavaThread* thread, oopDesc* obj, Basic
}
JRT_END
// Object.notify() fast path, caller does slow path
JRT_LEAF(jboolean, JVMCIRuntime::object_notify(JavaThread *thread, oopDesc* obj))
// Very few notify/notifyAll operations find any threads on the waitset, so
// the dominant fast-path is to simply return.
// Relatedly, it's critical that notify/notifyAll be fast in order to
// reduce lock hold times.
if (!SafepointSynchronize::is_synchronizing()) {
if (ObjectSynchronizer::quick_notify(obj, thread, false)) {
return true;
}
}
return false; // caller must perform slow path
JRT_END
// Object.notifyAll() fast path, caller does slow path
JRT_LEAF(jboolean, JVMCIRuntime::object_notifyAll(JavaThread *thread, oopDesc* obj))
if (!SafepointSynchronize::is_synchronizing() ) {
if (ObjectSynchronizer::quick_notify(obj, thread, true)) {
return true;
}
}
return false; // caller must perform slow path
JRT_END
JRT_ENTRY(void, JVMCIRuntime::throw_and_post_jvmti_exception(JavaThread* thread, const char* exception, const char* message))
TempNewSymbol symbol = SymbolTable::new_symbol(exception, CHECK);
SharedRuntime::throw_and_post_jvmti_exception(thread, symbol, message);

View file

@ -139,6 +139,8 @@ class JVMCIRuntime: public AllStatic {
static address exception_handler_for_pc(JavaThread* thread);
static void monitorenter(JavaThread* thread, oopDesc* obj, BasicLock* lock);
static void monitorexit (JavaThread* thread, oopDesc* obj, BasicLock* lock);
static jboolean object_notify(JavaThread* thread, oopDesc* obj);
static jboolean object_notifyAll(JavaThread* thread, oopDesc* obj);
static void vm_error(JavaThread* thread, jlong where, jlong format, jlong value);
static oopDesc* load_and_clear_exception(JavaThread* thread);
static void log_printf(JavaThread* thread, oopDesc* format, jlong v1, jlong v2, jlong v3);

View file

@ -625,6 +625,8 @@
declare_function(JVMCIRuntime::exception_handler_for_pc) \
declare_function(JVMCIRuntime::monitorenter) \
declare_function(JVMCIRuntime::monitorexit) \
declare_function(JVMCIRuntime::object_notify) \
declare_function(JVMCIRuntime::object_notifyAll) \
declare_function(JVMCIRuntime::throw_and_post_jvmti_exception) \
declare_function(JVMCIRuntime::throw_klass_external_name_exception) \
declare_function(JVMCIRuntime::throw_class_cast_exception) \

View file

@ -230,6 +230,8 @@ public final class BinaryContainer implements SymbolTable {
{"JVMCIRuntime::monitorenter", "_aot_jvmci_runtime_monitorenter"},
{"JVMCIRuntime::monitorexit", "_aot_jvmci_runtime_monitorexit"},
{"JVMCIRuntime::object_notify", "_aot_object_notify"},
{"JVMCIRuntime::object_notifyAll", "_aot_object_notifyAll"},
{"JVMCIRuntime::log_object", "_aot_jvmci_runtime_log_object"},
{"JVMCIRuntime::log_printf", "_aot_jvmci_runtime_log_printf"},
{"JVMCIRuntime::vm_message", "_aot_jvmci_runtime_vm_message"},