8161605: The '!UseSharedSpaces' check is not need in JvmtiManageCapabilities::recompute_always_capabilities
authoramenkov
Wed, 07 Feb 2018 10:25:10 -0800
changeset 48877 e4d80042ff19
parent 48876 45b6aae769cc
child 48878 2f265d2ac735
child 48880 ee49ac008730
8161605: The '!UseSharedSpaces' check is not need in JvmtiManageCapabilities::recompute_always_capabilities Reviewed-by: sspitsyn, mseledtsov
make/test/JtregNativeHotspot.gmk
src/hotspot/share/prims/jvmtiExport.cpp
src/hotspot/share/prims/jvmtiManageCapabilities.cpp
src/hotspot/share/prims/jvmtiManageCapabilities.hpp
--- a/make/test/JtregNativeHotspot.gmk	Wed Feb 07 16:03:12 2018 +0100
+++ b/make/test/JtregNativeHotspot.gmk	Wed Feb 07 10:25:10 2018 -0800
@@ -67,6 +67,7 @@
     $(TOPDIR)/test/hotspot/jtreg/compiler/calls \
     $(TOPDIR)/test/hotspot/jtreg/compiler/runtime/criticalnatives/lookup \
     $(TOPDIR)/test/hotspot/jtreg/compiler/runtime/criticalnatives/argumentcorruption \
+    $(TOPDIR)/test/hotspot/jtreg/serviceability/jvmti/CanGenerateAllClassHook \
     $(TOPDIR)/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorInfo \
     $(TOPDIR)/test/hotspot/jtreg/serviceability/jvmti/GetOwnedMonitorStackDepthInfo \
     $(TOPDIR)/test/hotspot/jtreg/serviceability/jvmti/GetNamedModule \
@@ -101,6 +102,7 @@
 ifeq ($(TOOLCHAIN_TYPE), solstudio)
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_liboverflow := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libSimpleClassFileLoadHook := -lc
+    BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libCanGenerateAllClassHook := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetOwnedMonitorInfoTest := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetOwnedMonitorStackDepthInfoTest := -lc
     BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libGetNamedModuleTest := -lc
--- a/src/hotspot/share/prims/jvmtiExport.cpp	Wed Feb 07 16:03:12 2018 +0100
+++ b/src/hotspot/share/prims/jvmtiExport.cpp	Wed Feb 07 10:25:10 2018 -0800
@@ -597,12 +597,10 @@
 }
 
 void JvmtiExport::enter_early_start_phase() {
-  JvmtiManageCapabilities::recompute_always_capabilities();
   set_early_vmstart_recorded(true);
 }
 
 void JvmtiExport::enter_start_phase() {
-  JvmtiManageCapabilities::recompute_always_capabilities();
   JvmtiEnvBase::set_phase(JVMTI_PHASE_START);
 }
 
--- a/src/hotspot/share/prims/jvmtiManageCapabilities.cpp	Wed Feb 07 16:03:12 2018 +0100
+++ b/src/hotspot/share/prims/jvmtiManageCapabilities.cpp	Wed Feb 07 10:25:10 2018 -0800
@@ -57,9 +57,6 @@
 
 void JvmtiManageCapabilities::initialize() {
   always_capabilities = init_always_capabilities();
-  if (JvmtiEnv::get_phase() != JVMTI_PHASE_ONLOAD) {
-    recompute_always_capabilities();
-  }
   onload_capabilities = init_onload_capabilities();
   always_solo_capabilities = init_always_solo_capabilities();
   onload_solo_capabilities = init_onload_solo_capabilities();
@@ -68,19 +65,6 @@
   memset(&acquired_capabilities, 0, sizeof(acquired_capabilities));
 }
 
-// if the capability sets are initialized in the onload phase then
-// it happens before class data sharing (CDS) is initialized. If it
-// turns out that CDS gets disabled then we must adjust the always
-// capabilities. To ensure a consistent view of the capabililties
-// anything we add here should already be in the onload set.
-void JvmtiManageCapabilities::recompute_always_capabilities() {
-  if (!UseSharedSpaces) {
-    jvmtiCapabilities jc = always_capabilities;
-    jc.can_generate_all_class_hook_events = 1;
-    always_capabilities = jc;
-  }
-}
-
 
 // corresponding init functions
 jvmtiCapabilities JvmtiManageCapabilities::init_always_capabilities() {
@@ -94,6 +78,7 @@
   jc.can_get_synthetic_attribute = 1;
   jc.can_get_monitor_info = 1;
   jc.can_get_constant_pool = 1;
+  jc.can_generate_all_class_hook_events = 1;
   jc.can_generate_monitor_events = 1;
   jc.can_generate_garbage_collection_events = 1;
   jc.can_generate_compiled_method_load_events = 1;
@@ -126,7 +111,6 @@
   jc.can_get_source_debug_extension = 1;
   jc.can_access_local_variables = 1;
   jc.can_maintain_original_method_order = 1;
-  jc.can_generate_all_class_hook_events = 1;
   jc.can_generate_single_step_events = 1;
   jc.can_generate_exception_events = 1;
   jc.can_generate_frame_pop_events = 1;
--- a/src/hotspot/share/prims/jvmtiManageCapabilities.hpp	Wed Feb 07 16:03:12 2018 +0100
+++ b/src/hotspot/share/prims/jvmtiManageCapabilities.hpp	Wed Feb 07 10:25:10 2018 -0800
@@ -64,9 +64,6 @@
 public:
   static void initialize();
 
-  // may have to adjust always capabilities when VM initialization has completed
-  static void recompute_always_capabilities();
-
   // queries and actions
   static void get_potential_capabilities(const jvmtiCapabilities *current,
                                          const jvmtiCapabilities *prohibited,