diff options
Diffstat (limited to 'hotspot/.hg/patches/full-jdk7u60-deopt-cp.patch')
-rw-r--r-- | hotspot/.hg/patches/full-jdk7u60-deopt-cp.patch | 250 |
1 files changed, 250 insertions, 0 deletions
diff --git a/hotspot/.hg/patches/full-jdk7u60-deopt-cp.patch b/hotspot/.hg/patches/full-jdk7u60-deopt-cp.patch new file mode 100644 index 00000000..f26b1d80 --- /dev/null +++ b/hotspot/.hg/patches/full-jdk7u60-deopt-cp.patch @@ -0,0 +1,250 @@ +diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp +index 6e362d9..2947c33 100644 +--- a/src/share/vm/classfile/classFileParser.cpp ++++ b/src/share/vm/classfile/classFileParser.cpp +@@ -3942,6 +3942,11 @@ instanceKlassHandle ClassFileParser::parseClassFile(Symbol* name, + } + } + ++ if (cfs->source() != NULL && HotswapDeoptClassPath != NULL) { ++ if (strstr(cfs->source(), HotswapDeoptClassPath) != NULL) ++ this_klass->set_deoptimization_incl(true); ++ } ++ + if (TraceClassResolution) { + // print out the superclass. + const char * from = Klass::cast(this_klass())->external_name(); +diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp +index 365aeda..dedc043 100644 +--- a/src/share/vm/classfile/systemDictionary.cpp ++++ b/src/share/vm/classfile/systemDictionary.cpp +@@ -1255,6 +1255,11 @@ instanceKlassHandle SystemDictionary::load_shared_class( + } + } + ++ if (HotswapDeoptClassPath != NULL) { ++ if (strstr(HotswapDeoptClassPath, ik->external_name()) != NULL) ++ ik->set_deoptimization_incl(true); ++ } ++ + if (TraceClassLoading) { + ResourceMark rm; + tty->print("[Loaded %s", ik->external_name()); +diff --git a/src/share/vm/code/codeCache.cpp b/src/share/vm/code/codeCache.cpp +index 70574bc..b28cb02 100644 +--- a/src/share/vm/code/codeCache.cpp ++++ b/src/share/vm/code/codeCache.cpp +@@ -715,6 +715,14 @@ int CodeCache::mark_for_evol_deoptimization(instanceKlassHandle dependee) { + + + // Deoptimize all methods ++void CodeCache::mark_all_incl_nmethods_for_deoptimization() { ++ MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); ++ FOR_ALL_ALIVE_NMETHODS(nm) { ++ nm->mark_for_deoptimization_incl(); ++ } ++} ++ ++// Deoptimize all methods + void CodeCache::mark_all_nmethods_for_deoptimization() { + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag); + FOR_ALL_ALIVE_NMETHODS(nm) { +diff --git a/src/share/vm/code/codeCache.hpp b/src/share/vm/code/codeCache.hpp +index a670805..0206b48 100644 +--- a/src/share/vm/code/codeCache.hpp ++++ b/src/share/vm/code/codeCache.hpp +@@ -186,6 +186,7 @@ class CodeCache : AllStatic { + #endif // HOTSWAP + + static void mark_all_nmethods_for_deoptimization(); ++ static void mark_all_incl_nmethods_for_deoptimization(); + static int mark_for_deoptimization(methodOop dependee); + static void make_marked_nmethods_zombies(); + static void make_marked_nmethods_not_entrant(); +diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp +index dddbea2..b7c6a79 100644 +--- a/src/share/vm/code/nmethod.cpp ++++ b/src/share/vm/code/nmethod.cpp +@@ -465,6 +465,7 @@ void nmethod::init_defaults() { + _lazy_critical_native = 0; + _has_wide_vectors = 0; + _marked_for_deoptimization = 0; ++ _deoptimization_incl = false; + _lock_count = 0; + _stack_traversal_mark = 0; + _unload_reported = false; // jvmti state +@@ -673,6 +674,9 @@ nmethod::nmethod( + _exception_cache = NULL; + _pc_desc_cache.reset_to(NULL); + ++ if (method != NULL) ++ _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl(); ++ + code_buffer->copy_oops_to(this); + if (ScavengeRootsInCode && detect_scavenge_root_oops()) { + CodeCache::add_scavenge_root_nmethod(this); +@@ -756,6 +760,9 @@ nmethod::nmethod( + _exception_cache = NULL; + _pc_desc_cache.reset_to(NULL); + ++ if (method != NULL) ++ _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl(); ++ + code_buffer->copy_oops_to(this); + debug_only(verify_scavenge_root_oops()); + CodeCache::commit(this); +@@ -864,6 +871,9 @@ nmethod::nmethod( + _exception_cache = NULL; + _pc_desc_cache.reset_to(scopes_pcs_begin()); + ++ if (method != NULL) ++ _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl(); ++ + // Copy contents of ScopeDescRecorder to nmethod + code_buffer->copy_oops_to(this); + debug_info->copy_to(this); +diff --git a/src/share/vm/code/nmethod.hpp b/src/share/vm/code/nmethod.hpp +index 1a4ad9e..70d220c 100644 +--- a/src/share/vm/code/nmethod.hpp ++++ b/src/share/vm/code/nmethod.hpp +@@ -169,6 +169,8 @@ class nmethod : public CodeBlob { + bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper) + bool _marked_for_deoptimization; // Used for stack deoptimization + ++ bool _deoptimization_incl; ++ + // used by jvmti to track if an unload event has been posted for this nmethod. + bool _unload_reported; + +@@ -412,6 +414,11 @@ class nmethod : public CodeBlob { + bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; } + void mark_for_deoptimization() { _marked_for_deoptimization = true; } + ++ bool is_deoptimization_incl() const { return _deoptimization_incl; } ++ void set_deoptimization_incl(bool z) { _deoptimization_incl = z; } ++ ++ void mark_for_deoptimization_incl() { if (_deoptimization_incl) _marked_for_deoptimization = true; } ++ + void make_unloaded(BoolObjectClosure* is_alive, oop cause); + + bool has_dependencies() { return dependencies_size() != 0; } +diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp +index 767588c..59d9448 100644 +--- a/src/share/vm/oops/klass.cpp ++++ b/src/share/vm/oops/klass.cpp +@@ -57,7 +57,11 @@ bool Klass::is_subclass_of(klassOop k) const { + + void Klass::update_supers_to_newest_version() { + +- if (super() != NULL) set_super(super()->klass_part()->newest_version()); ++ if (super() != NULL) { ++ set_super(super()->klass_part()->newest_version()); ++ if (super()->klass_part()->is_deoptimization_incl()) ++ set_deoptimization_incl(true); ++ } + + for (uint i=0; i<primary_super_limit(); i++) { + klassOop cur = _primary_supers[i]; +@@ -183,6 +187,7 @@ klassOop Klass::base_create_klass_oop(KlassHandle& klass, int size, + + kl->set_redefinition_flags(Klass::NoRedefinition); + kl->set_redefining(false); ++ kl->set_deoptimization_incl(false); + kl->set_new_version(NULL); + kl->set_old_version(NULL); + kl->set_redefinition_index(-1); +@@ -256,6 +261,8 @@ void Klass::initialize_supers(klassOop k, TRAPS) { + if (FastSuperclassLimit == 0) { + // None of the other machinery matters. + set_super(k); ++ if (k != NULL && k->klass_part()->is_deoptimization_incl()) ++ set_deoptimization_incl(true); + return; + } + if (k == NULL) { +@@ -267,6 +274,8 @@ void Klass::initialize_supers(klassOop k, TRAPS) { + "initialize this only once to a non-trivial value"); + set_super(k); + Klass* sup = k->klass_part(); ++ if (sup->is_deoptimization_incl()) ++ set_deoptimization_incl(true); + int sup_depth = sup->super_depth(); + juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit()); + if (!can_be_primary_super_slow()) +diff --git a/src/share/vm/oops/klass.hpp b/src/share/vm/oops/klass.hpp +index d086b5d..0719b90 100644 +--- a/src/share/vm/oops/klass.hpp ++++ b/src/share/vm/oops/klass.hpp +@@ -303,6 +303,7 @@ class Klass : public Klass_vtbl { + char _field_redefinition_policy; + char _static_field_redefinition_policy; + bool _is_redefining; ++ bool _deoptimization_incl; // True if class methods are included in deoptimization + + #ifndef PRODUCT + int _verify_count; // to avoid redundant verifies +@@ -387,6 +388,9 @@ class Klass : public Klass_vtbl { + else { return _old_version->klass_part()->is_same_or_older_version(klass); } + } + ++ bool is_deoptimization_incl() const { return _deoptimization_incl; } ++ void set_deoptimization_incl(bool z) { _deoptimization_incl = z; } ++ + // Revision number for redefined classes, -1 for originally loaded classes + jint revision_number() const { + return _revision_number; +diff --git a/src/share/vm/prims/jvmtiRedefineClasses.cpp b/src/share/vm/prims/jvmtiRedefineClasses.cpp +index ef4f380..5d2382c 100644 +--- a/src/share/vm/prims/jvmtiRedefineClasses.cpp ++++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp +@@ -435,6 +435,8 @@ jvmtiError VM_RedefineClasses::load_new_class_versions(TRAPS) { + + new_class->set_redefinition_flags(redefinition_flags); + ++ new_class->set_deoptimization_incl(true); ++ + _max_redefinition_flags = _max_redefinition_flags | redefinition_flags; + + if ((redefinition_flags & Klass::ModifyInstances) != 0) { +@@ -2580,7 +2582,8 @@ void VM_RedefineClasses::adjust_cpool_cache(klassOop k_oop_latest, oop initiatin + }*/ + + Klass *k = k_oop->klass_part(); +- if (k->oop_is_instance()) { ++ ++ if (k->oop_is_instance() && (HotswapDeoptClassPath == NULL || k->is_deoptimization_incl())) { + HandleMark hm(THREAD); + instanceKlass *ik = (instanceKlass *) k; + +@@ -2683,7 +2686,11 @@ void VM_RedefineClasses::flush_dependent_code(instanceKlassHandle k_h, TRAPS) { + if (0 && JvmtiExport::all_dependencies_are_recorded()) { + Universe::flush_evol_dependents_on(k_h); + } else { +- CodeCache::mark_all_nmethods_for_deoptimization(); ++ ++ if (HotswapDeoptClassPath == NULL) ++ CodeCache::mark_all_nmethods_for_deoptimization(); ++ else ++ CodeCache::mark_all_incl_nmethods_for_deoptimization(); + + ResourceMark rm(THREAD); + DeoptimizationMarker dm; +diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp +index 4775f3d..1141540 100644 +--- a/src/share/vm/runtime/globals.hpp ++++ b/src/share/vm/runtime/globals.hpp +@@ -3680,7 +3680,13 @@ class CommandLineFlags { + product(bool, EnableTracing, false, \ + "Enable event-based tracing") \ + product(bool, UseLockedTracing, false, \ +- "Use locked-tracing when doing event-based tracing") ++ "Use locked-tracing when doing event-based tracing") \ ++ product(ccstr, HotswapDeoptClassPath, NULL, \ ++ "Class path or fragment of the class path to a folder with " \ ++ "classes allowed to be deoptimized on hotswap. If is not " \ ++ "defined then all classes will be deoptimized on hotswap. " \ ++ "That's default behaviour. Using this option the performance " \ ++ "of hotswap can be considerably increased. ") + + /* + * Macros for factoring of globals |