8189208: Cleanup ancient argument processing code

Remove bits thread_park_blocker, post_vm_init_hook_enabled and pending_list_uses_discovered_fields

Reviewed-by: hseigel, dholmes
This commit is contained in:
Gerard Ziemski 2019-05-09 12:04:20 -05:00
parent 241444ed3f
commit 22bf018812
8 changed files with 15 additions and 68 deletions

View File

@ -1738,9 +1738,6 @@ jlong java_lang_Thread::thread_id(oop java_thread) {
}
oop java_lang_Thread::park_blocker(oop java_thread) {
assert(JDK_Version::current().supports_thread_park_blocker(),
"Must support parkBlocker field");
return java_thread->obj_field(_park_blocker_offset);
}

View File

@ -1280,18 +1280,7 @@ typedef struct {
unsigned int reserved3 : 8;
unsigned int reserved1 : 16;
unsigned int reserved2;
/* The following bits represents new JDK supports that VM has dependency on.
* VM implementation can use these bits to determine which JDK version
* and support it has to maintain runtime compatibility.
*
* When a new bit is added in a minor or update release, make sure
* the new bit is also added in the main/baseline.
*/
unsigned int thread_park_blocker : 1;
unsigned int post_vm_init_hook_enabled : 1;
unsigned int pending_list_uses_discovered_field : 1;
unsigned int : 29;
unsigned int : 32;
unsigned int : 32;
unsigned int : 32;
} jdk_version_info;

View File

@ -2959,14 +2959,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, path));
}
// Change the default value for flags which have different default values
// when working with older JDKs.
#ifdef LINUX
if (JDK_Version::current().compare_major(6) <= 0 &&
FLAG_IS_DEFAULT(UseLinuxPosixThreadCPUClocks)) {
FLAG_SET_DEFAULT(UseLinuxPosixThreadCPUClocks, false);
}
#endif // LINUX
fix_appclasspath();
return JNI_OK;

View File

@ -710,14 +710,7 @@ void JDK_Version::initialize() {
int security = JDK_VERSION_SECURITY(info.jdk_version);
int build = JDK_VERSION_BUILD(info.jdk_version);
// Incompatible with pre-4243978 JDK.
if (info.pending_list_uses_discovered_field == 0) {
vm_exit_during_initialization(
"Incompatible JDK is not using Reference.discovered field for pending list");
}
_current = JDK_Version(major, minor, security, info.patch_version, build,
info.thread_park_blocker == 1,
info.post_vm_init_hook_enabled == 1);
_current = JDK_Version(major, minor, security, info.patch_version, build);
}
void JDK_Version_init() {

View File

@ -74,9 +74,6 @@ class JDK_Version {
uint8_t _patch;
uint8_t _build;
bool _thread_park_blocker;
bool _post_vm_init_hook_enabled;
bool is_valid() const {
return (_major != 0);
}
@ -86,16 +83,13 @@ class JDK_Version {
public:
JDK_Version() : _major(0), _minor(0), _security(0), _patch(0), _build(0),
_thread_park_blocker(false), _post_vm_init_hook_enabled(false)
{}
JDK_Version() :
_major(0), _minor(0), _security(0), _patch(0), _build(0)
{}
JDK_Version(uint8_t major, uint8_t minor = 0, uint8_t security = 0,
uint8_t patch = 0, uint8_t build = 0,
bool thread_park_blocker = false, bool post_vm_init_hook_enabled = false) :
_major(major), _minor(minor), _security(security), _patch(patch), _build(build),
_thread_park_blocker(thread_park_blocker),
_post_vm_init_hook_enabled(post_vm_init_hook_enabled)
uint8_t patch = 0, uint8_t build = 0) :
_major(major), _minor(minor), _security(security), _patch(patch), _build(build)
{}
// Returns the current running JDK version
@ -120,13 +114,6 @@ class JDK_Version {
uint8_t patch_version() const { return _patch; }
uint8_t build_number() const { return _build; }
bool supports_thread_park_blocker() const {
return _thread_park_blocker;
}
bool post_vm_init_hook_enabled() const {
return _post_vm_init_hook_enabled;
}
// Performs a full ordering comparison using all fields (patch, build, etc.)
int compare(const JDK_Version& other) const;

View File

@ -3190,8 +3190,7 @@ void JavaThread::prepare(jobject jni_thread, ThreadPriority prio) {
oop JavaThread::current_park_blocker() {
// Support for JSR-166 locks
oop thread_oop = threadObj();
if (thread_oop != NULL &&
JDK_Version::current().supports_thread_park_blocker()) {
if (thread_oop != NULL) {
return java_lang_Thread::park_blocker(thread_oop);
}
return NULL;
@ -4007,13 +4006,11 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
RTMLockingCounters::init();
#endif
if (JDK_Version::current().post_vm_init_hook_enabled()) {
call_postVMInitHook(THREAD);
// The Java side of PostVMInitHook.run must deal with all
// exceptions and provide means of diagnosis.
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
}
call_postVMInitHook(THREAD);
// The Java side of PostVMInitHook.run must deal with all
// exceptions and provide means of diagnosis.
if (HAS_PENDING_EXCEPTION) {
CLEAR_PENDING_EXCEPTION;
}
{

View File

@ -893,10 +893,7 @@ void ThreadSnapshot::initialize(ThreadsList * t_list, JavaThread* thread) {
}
// Support for JSR-166 locks
if (JDK_Version::current().supports_thread_park_blocker() &&
(_thread_status == java_lang_Thread::PARKED ||
_thread_status == java_lang_Thread::PARKED_TIMED)) {
if (_thread_status == java_lang_Thread::PARKED || _thread_status == java_lang_Thread::PARKED_TIMED) {
_blocker_object = thread->current_park_blocker();
if (_blocker_object != NULL && _blocker_object->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass())) {
_blocker_object_owner = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(_blocker_object);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -46,9 +46,4 @@ JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
((version_security & 0xFF) << 8) |
(version_build & 0xFF);
info->patch_version = version_patch;
info->thread_park_blocker = 1;
// Advertise presence of PostVMInitHook:
// future optimization: detect if this is enabled.
info->post_vm_init_hook_enabled = 1;
info->pending_list_uses_discovered_field = 1;
}