8221477: Inject os/cpu-specific constants into Unsafe from JVM

Initialize Unsafe os/cpu-specific constants using injection instead of native callouts

Reviewed-by: stuefe, coleenp, dholmes, plevart
This commit is contained in:
Andrew Dinn 2019-04-05 10:01:09 +01:00
parent 7a093bcf50
commit 71164a973b
9 changed files with 190 additions and 52 deletions

View file

@ -3628,6 +3628,7 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
initialize_class(vmSymbols::java_lang_Thread(), CHECK);
oop thread_object = create_initial_thread(thread_group, main_thread, CHECK);
main_thread->set_threadObj(thread_object);
// Set thread status to running since main thread has
// been started and running.
java_lang_Thread::set_thread_status(thread_object,
@ -3636,6 +3637,15 @@ void Threads::initialize_java_lang_classes(JavaThread* main_thread, TRAPS) {
// The VM creates objects of this class.
initialize_class(vmSymbols::java_lang_Module(), CHECK);
#ifdef ASSERT
InstanceKlass *k = SystemDictionary::UnsafeConstants_klass();
assert(k->is_not_initialized(), "UnsafeConstants should not already be initialized");
#endif
// initialize the hardware-specific constants needed by Unsafe
initialize_class(vmSymbols::jdk_internal_misc_UnsafeConstants(), CHECK);
jdk_internal_misc_UnsafeConstants::set_unsafe_constants();
// The VM preresolves methods to these classes. Make sure that they get initialized
initialize_class(vmSymbols::java_lang_reflect_Method(), CHECK);
initialize_class(vmSymbols::java_lang_ref_Finalizer(), CHECK);