From 22bf01881226fd65dadbb695b22eaa9109282cb6 Mon Sep 17 00:00:00 2001 From: Gerard Ziemski Date: Thu, 9 May 2019 12:04:20 -0500 Subject: [PATCH] 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 --- src/hotspot/share/classfile/javaClasses.cpp | 3 --- src/hotspot/share/include/jvm.h | 13 +---------- src/hotspot/share/runtime/arguments.cpp | 8 ------- src/hotspot/share/runtime/java.cpp | 9 +------- src/hotspot/share/runtime/java.hpp | 23 ++++--------------- src/hotspot/share/runtime/thread.cpp | 15 +++++------- src/hotspot/share/services/threadService.cpp | 5 +--- src/java.base/share/native/libjava/jdk_util.c | 7 +----- 8 files changed, 15 insertions(+), 68 deletions(-) diff --git a/src/hotspot/share/classfile/javaClasses.cpp b/src/hotspot/share/classfile/javaClasses.cpp index 9cadfc42744..651836b0835 100644 --- a/src/hotspot/share/classfile/javaClasses.cpp +++ b/src/hotspot/share/classfile/javaClasses.cpp @@ -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); } diff --git a/src/hotspot/share/include/jvm.h b/src/hotspot/share/include/jvm.h index d8606b2cc1f..6913a9f6562 100644 --- a/src/hotspot/share/include/jvm.h +++ b/src/hotspot/share/include/jvm.h @@ -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; diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index 34028443609..a615a7240e6 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -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; diff --git a/src/hotspot/share/runtime/java.cpp b/src/hotspot/share/runtime/java.cpp index 0a68304cfc3..5cb9712fdc0 100644 --- a/src/hotspot/share/runtime/java.cpp +++ b/src/hotspot/share/runtime/java.cpp @@ -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() { diff --git a/src/hotspot/share/runtime/java.hpp b/src/hotspot/share/runtime/java.hpp index 7ac5ac53236..096484e0dc6 100644 --- a/src/hotspot/share/runtime/java.hpp +++ b/src/hotspot/share/runtime/java.hpp @@ -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; diff --git a/src/hotspot/share/runtime/thread.cpp b/src/hotspot/share/runtime/thread.cpp index 33de7725892..f0d1e1001fe 100644 --- a/src/hotspot/share/runtime/thread.cpp +++ b/src/hotspot/share/runtime/thread.cpp @@ -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; } { diff --git a/src/hotspot/share/services/threadService.cpp b/src/hotspot/share/services/threadService.cpp index 67200176b48..667e2b58c4e 100644 --- a/src/hotspot/share/services/threadService.cpp +++ b/src/hotspot/share/services/threadService.cpp @@ -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); diff --git a/src/java.base/share/native/libjava/jdk_util.c b/src/java.base/share/native/libjava/jdk_util.c index 208350328cb..bfff103da78 100644 --- a/src/java.base/share/native/libjava/jdk_util.c +++ b/src/java.base/share/native/libjava/jdk_util.c @@ -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; }