aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/hotspot/share/prims/jvmtiExport.hpp10
-rw-r--r--src/hotspot/share/prims/jvmtiRedefineClasses.cpp21
-rw-r--r--src/hotspot/share/runtime/globals.hpp9
-rw-r--r--src/hotspot/share/runtime/init.cpp6
4 files changed, 34 insertions, 12 deletions
diff --git a/src/hotspot/share/prims/jvmtiExport.hpp b/src/hotspot/share/prims/jvmtiExport.hpp
index 25899fbe6b3..a6db7d99d4c 100644
--- a/src/hotspot/share/prims/jvmtiExport.hpp
+++ b/src/hotspot/share/prims/jvmtiExport.hpp
@@ -149,7 +149,15 @@ class JvmtiExport : public AllStatic {
JVMTI_ONLY(_can_access_local_variables = (on != 0);)
}
inline static void set_can_hotswap_or_post_breakpoint(bool on) {
- JVMTI_ONLY(_can_hotswap_or_post_breakpoint = (on != 0);)
+#if INCLUDE_JVMTI
+ // Check that _can_hotswap_or_post_breakpoint is not reset once it
+ // was set to true. When _can_hotswap_or_post_breakpoint is set to true
+ // _all_dependencies_are_recorded is also set to true and never
+ // reset so we have to ensure that evol dependencies are always
+ // recorded from that point on.
+ assert(!_can_hotswap_or_post_breakpoint || on, "sanity check");
+ _can_hotswap_or_post_breakpoint = (on != 0);
+#endif
}
inline static void set_can_walk_any_space(bool on) {
JVMTI_ONLY(_can_walk_any_space = (on != 0);)
diff --git a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
index 8e1623a6599..6ea79b78525 100644
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp
@@ -4099,21 +4099,22 @@ void VM_RedefineClasses::transfer_old_native_function_registrations(InstanceKlas
// Deoptimize all compiled code that depends on the classes redefined.
//
// If the can_redefine_classes capability is obtained in the onload
-// phase then the compiler has recorded all dependencies from startup.
-// In that case we need only deoptimize and throw away all compiled code
-// that depends on the class.
+// phase or 'AlwaysRecordEvolDependencies' is true, then the compiler has
+// recorded all dependencies from startup. In that case we need only
+// deoptimize and throw away all compiled code that depends on the class.
//
-// If can_redefine_classes is obtained sometime after the onload
-// phase then the dependency information may be incomplete. In that case
-// the first call to RedefineClasses causes all compiled code to be
-// thrown away. As can_redefine_classes has been obtained then
-// all future compilations will record dependencies so second and
-// subsequent calls to RedefineClasses need only throw away code
-// that depends on the class.
+// If can_redefine_classes is obtained sometime after the onload phase
+// (and 'AlwaysRecordEvolDependencies' is false) then the dependency
+// information may be incomplete. In that case the first call to
+// RedefineClasses causes all compiled code to be thrown away. As
+// can_redefine_classes has been obtained then all future compilations will
+// record dependencies so second and subsequent calls to RedefineClasses
+// need only throw away code that depends on the class.
//
void VM_RedefineClasses::flush_dependent_code() {
assert(SafepointSynchronize::is_at_safepoint(), "sanity check");
+ assert(JvmtiExport::all_dependencies_are_recorded() || !AlwaysRecordEvolDependencies, "sanity check");
DeoptimizationScope deopt_scope;
diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp
index 604f56f3238..4c749c6cc8b 100644
--- a/src/hotspot/share/runtime/globals.hpp
+++ b/src/hotspot/share/runtime/globals.hpp
@@ -1980,6 +1980,14 @@ const int ObjectAlignmentInBytes = 8;
"(default) disables native heap trimming.") \
range(0, UINT_MAX) \
\
+ product(bool, ProfileExceptionHandlers, true, \
+ "Profile exception handlers") \
+ \
+ product(bool, AlwaysRecordEvolDependencies, true, EXPERIMENTAL, \
+ "Unconditionally record nmethod dependencies on class " \
+ "rewriting/transformation independently of the JVMTI " \
+ "can_{retransform/redefine}_classes capabilities.") \
+ \
product(bool, AllowEnhancedClassRedefinition, false, \
"Allow enhanced class redefinition beyond swapping method " \
"bodies") \
@@ -1993,7 +2001,6 @@ const int ObjectAlignmentInBytes = 8;
"modules.") \
constraint(HotswapAgentConstraintFunc, AfterErgo)
-
// end of RUNTIME_FLAGS
DECLARE_FLAGS(LP64_RUNTIME_FLAGS)
diff --git a/src/hotspot/share/runtime/init.cpp b/src/hotspot/share/runtime/init.cpp
index c3f75cdcf84..c1ceffaec4c 100644
--- a/src/hotspot/share/runtime/init.cpp
+++ b/src/hotspot/share/runtime/init.cpp
@@ -115,6 +115,12 @@ void vm_init_globals() {
jint init_globals() {
management_init();
JvmtiExport::initialize_oop_storage();
+#if INCLUDE_JVMTI
+ if (AlwaysRecordEvolDependencies) {
+ JvmtiExport::set_can_hotswap_or_post_breakpoint(true);
+ JvmtiExport::set_all_dependencies_are_recorded(true);
+ }
+#endif
bytecodes_init();
classLoader_init1();
compilationPolicy_init();