You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

light-jdk7u51-deopt-cp.patch 8.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
  2. index 8590ad1..7e35b1a 100644
  3. --- a/src/share/vm/classfile/classFileParser.cpp
  4. +++ b/src/share/vm/classfile/classFileParser.cpp
  5. @@ -3798,6 +3798,11 @@
  6. }
  7. }
  8. + if (cfs->source() != NULL && HotswapDeoptClassPath != NULL) {
  9. + if (strstr(cfs->source(), HotswapDeoptClassPath) != NULL)
  10. + this_klass->set_deoptimization_incl(true);
  11. + }
  12. +
  13. if (TraceClassResolution) {
  14. // print out the superclass.
  15. const char * from = Klass::cast(this_klass())->external_name();
  16. diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
  17. index 3f64268..124c39c 100644
  18. --- a/src/share/vm/classfile/systemDictionary.cpp
  19. +++ b/src/share/vm/classfile/systemDictionary.cpp
  20. @@ -1256,6 +1256,11 @@
  21. }
  22. }
  23. + if (HotswapDeoptClassPath != NULL) {
  24. + if (strstr(HotswapDeoptClassPath, ik->external_name()) != NULL)
  25. + ik->set_deoptimization_incl(true);
  26. + }
  27. +
  28. if (TraceClassLoading) {
  29. ResourceMark rm;
  30. tty->print("[Loaded %s", ik->external_name());
  31. diff --git a/src/share/vm/code/codeCache.cpp b/src/share/vm/code/codeCache.cpp
  32. index 70574bc..722ecfd 100644
  33. --- a/src/share/vm/code/codeCache.cpp
  34. +++ b/src/share/vm/code/codeCache.cpp
  35. @@ -713,6 +713,13 @@
  36. }
  37. #endif // HOTSWAP
  38. +// Deoptimize all methods having deopt-include flag
  39. +void CodeCache::mark_all_incl_nmethods_for_deoptimization() {
  40. + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  41. + FOR_ALL_ALIVE_NMETHODS(nm) {
  42. + nm->mark_for_deoptimization_incl();
  43. + }
  44. +}
  45. // Deoptimize all methods
  46. void CodeCache::mark_all_nmethods_for_deoptimization() {
  47. diff --git a/src/share/vm/code/codeCache.hpp b/src/share/vm/code/codeCache.hpp
  48. index a670805..0206b48 100644
  49. --- a/src/share/vm/code/codeCache.hpp
  50. +++ b/src/share/vm/code/codeCache.hpp
  51. @@ -186,6 +186,7 @@
  52. #endif // HOTSWAP
  53. static void mark_all_nmethods_for_deoptimization();
  54. + static void mark_all_incl_nmethods_for_deoptimization();
  55. static int mark_for_deoptimization(methodOop dependee);
  56. static void make_marked_nmethods_zombies();
  57. static void make_marked_nmethods_not_entrant();
  58. diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp
  59. index 59f5f7e..b7d0742 100644
  60. --- a/src/share/vm/code/nmethod.cpp
  61. +++ b/src/share/vm/code/nmethod.cpp
  62. @@ -465,6 +465,7 @@
  63. _lazy_critical_native = 0;
  64. _has_wide_vectors = 0;
  65. _marked_for_deoptimization = 0;
  66. + _deoptimization_incl = false;
  67. _lock_count = 0;
  68. _stack_traversal_mark = 0;
  69. _unload_reported = false; // jvmti state
  70. @@ -673,6 +674,9 @@
  71. _exception_cache = NULL;
  72. _pc_desc_cache.reset_to(NULL);
  73. + if (method != NULL)
  74. + _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl();
  75. +
  76. code_buffer->copy_oops_to(this);
  77. if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
  78. CodeCache::add_scavenge_root_nmethod(this);
  79. @@ -754,6 +758,9 @@
  80. _osr_entry_point = NULL;
  81. _exception_cache = NULL;
  82. _pc_desc_cache.reset_to(NULL);
  83. +
  84. + if (method != NULL)
  85. + _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl();
  86. code_buffer->copy_oops_to(this);
  87. debug_only(verify_scavenge_root_oops());
  88. @@ -863,6 +870,9 @@
  89. _exception_cache = NULL;
  90. _pc_desc_cache.reset_to(scopes_pcs_begin());
  91. + if (method != NULL)
  92. + _deoptimization_incl = Klass::cast(method->method_holder())->is_deoptimization_incl();
  93. +
  94. // Copy contents of ScopeDescRecorder to nmethod
  95. code_buffer->copy_oops_to(this);
  96. debug_info->copy_to(this);
  97. diff --git a/src/share/vm/code/nmethod.hpp b/src/share/vm/code/nmethod.hpp
  98. index 8d76afb..d2d1acc 100644
  99. --- a/src/share/vm/code/nmethod.hpp
  100. +++ b/src/share/vm/code/nmethod.hpp
  101. @@ -169,6 +169,8 @@
  102. bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper)
  103. bool _marked_for_deoptimization; // Used for stack deoptimization
  104. + bool _deoptimization_incl;
  105. +
  106. // used by jvmti to track if an unload event has been posted for this nmethod.
  107. bool _unload_reported;
  108. @@ -412,6 +414,11 @@
  109. bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; }
  110. void mark_for_deoptimization() { _marked_for_deoptimization = true; }
  111. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  112. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  113. +
  114. + void mark_for_deoptimization_incl() { if (_deoptimization_incl) _marked_for_deoptimization = true; }
  115. +
  116. void make_unloaded(BoolObjectClosure* is_alive, oop cause);
  117. bool has_dependencies() { return dependencies_size() != 0; }
  118. diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp
  119. index a928777..d3714b7 100644
  120. --- a/src/share/vm/oops/klass.cpp
  121. +++ b/src/share/vm/oops/klass.cpp
  122. @@ -163,6 +163,7 @@
  123. kl->set_redefinition_flags(Klass::NoRedefinition);
  124. kl->set_redefining(false);
  125. + kl->set_deoptimization_incl(false);
  126. kl->set_new_version(NULL);
  127. kl->set_old_version(NULL);
  128. kl->set_redefinition_index(-1);
  129. @@ -233,6 +234,8 @@
  130. if (FastSuperclassLimit == 0) {
  131. // None of the other machinery matters.
  132. set_super(k);
  133. + if (k != NULL && k->klass_part()->is_deoptimization_incl())
  134. + set_deoptimization_incl(true);
  135. return;
  136. }
  137. if (k == NULL) {
  138. @@ -244,6 +247,8 @@
  139. "initialize this only once to a non-trivial value");
  140. set_super(k);
  141. Klass* sup = k->klass_part();
  142. + if (sup->is_deoptimization_incl())
  143. + set_deoptimization_incl(true);
  144. int sup_depth = sup->super_depth();
  145. juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit());
  146. if (!can_be_primary_super_slow())
  147. diff --git a/src/share/vm/oops/klass.hpp b/src/share/vm/oops/klass.hpp
  148. index bf242d9..884deae 100644
  149. --- a/src/share/vm/oops/klass.hpp
  150. +++ b/src/share/vm/oops/klass.hpp
  151. @@ -292,6 +292,7 @@
  152. bool _original_field_offsets_changed; // Did the original field offsets of this class change during class redefinition?
  153. int * _update_information; // Update information
  154. bool _is_redefining;
  155. + bool _deoptimization_incl; // True if class methods are included in deoptimization
  156. #ifndef PRODUCT
  157. int _verify_count; // to avoid redundant verifies
  158. @@ -376,6 +377,9 @@
  159. else { return _old_version->klass_part()->is_same_or_older_version(klass); }
  160. }
  161. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  162. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  163. +
  164. // Revision number for redefined classes, -1 for originally loaded classes
  165. jint revision_number() const {
  166. return _revision_number;
  167. diff --git a/src/share/vm/prims/jvmtiRedefineClasses.cpp b/src/share/vm/prims/jvmtiRedefineClasses.cpp
  168. index cb90823..6836fae 100644
  169. --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp
  170. +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp
  171. @@ -482,6 +482,8 @@
  172. new_class->set_redefinition_flags(redefinition_flags);
  173. + new_class->set_deoptimization_incl(true);
  174. +
  175. _max_redefinition_flags = _max_redefinition_flags | redefinition_flags;
  176. if ((redefinition_flags & Klass::ModifyInstances) != 0) {
  177. @@ -1857,7 +1859,10 @@
  178. if (0 && JvmtiExport::all_dependencies_are_recorded()) {
  179. Universe::flush_evol_dependents_on(k_h);
  180. } else {
  181. - CodeCache::mark_all_nmethods_for_deoptimization();
  182. + if (HotswapDeoptClassPath == NULL)
  183. + CodeCache::mark_all_nmethods_for_deoptimization();
  184. + else
  185. + CodeCache::mark_all_incl_nmethods_for_deoptimization();
  186. ResourceMark rm(THREAD);
  187. DeoptimizationMarker dm;
  188. diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
  189. index 341b399..1e8b1b0 100644
  190. --- a/src/share/vm/runtime/globals.hpp
  191. +++ b/src/share/vm/runtime/globals.hpp
  192. @@ -3650,7 +3650,13 @@
  193. product(bool, EnableTracing, false, \
  194. "Enable event-based tracing") \
  195. product(bool, UseLockedTracing, false, \
  196. - "Use locked-tracing when doing event-based tracing")
  197. + "Use locked-tracing when doing event-based tracing") \
  198. + product(ccstr, HotswapDeoptClassPath, NULL, \
  199. + "Class path or fragment of the class path to a folder with " \
  200. + "classes allowed to be deoptimized on hotswap. If is not " \
  201. + "defined then all classes will be deoptimized on hotswap. " \
  202. + "That's default behaviour. Using this option the performance " \
  203. + "of hotswap can be considerably increased. ")
  204. /*
  205. * Macros for factoring of globals