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-jdk8u20-deopt-cp.patch 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
  2. index 70dac6d..4634cf8 100644
  3. --- a/src/share/vm/classfile/classFileParser.cpp
  4. +++ b/src/share/vm/classfile/classFileParser.cpp
  5. @@ -4168,6 +4168,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. ResourceMark rm;
  15. // print out the superclass.
  16. diff --git a/src/share/vm/classfile/systemDictionary.cpp b/src/share/vm/classfile/systemDictionary.cpp
  17. index 56c1085..d602ced 100644
  18. --- a/src/share/vm/classfile/systemDictionary.cpp
  19. +++ b/src/share/vm/classfile/systemDictionary.cpp
  20. @@ -1228,6 +1228,11 @@
  21. ik->restore_unshareable_info(CHECK_(nh));
  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 9ba6ef0..984b660 100644
  33. --- a/src/share/vm/code/codeCache.cpp
  34. +++ b/src/share/vm/code/codeCache.cpp
  35. @@ -682,6 +682,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 e190b11..60fa139 100644
  49. --- a/src/share/vm/code/codeCache.hpp
  50. +++ b/src/share/vm/code/codeCache.hpp
  51. @@ -186,6 +186,7 @@
  52. // tells how many nmethods have dependencies
  53. static int number_of_nmethods_with_dependencies();
  54. + static void mark_all_incl_nmethods_for_deoptimization();
  55. static int get_codemem_full_count() { return _codemem_full_count; }
  56. };
  57. diff --git a/src/share/vm/code/nmethod.cpp b/src/share/vm/code/nmethod.cpp
  58. index 003bb30..9078132 100644
  59. --- a/src/share/vm/code/nmethod.cpp
  60. +++ b/src/share/vm/code/nmethod.cpp
  61. @@ -469,6 +469,7 @@
  62. _lazy_critical_native = 0;
  63. _has_wide_vectors = 0;
  64. _marked_for_deoptimization = 0;
  65. + _deoptimization_incl = false;
  66. _lock_count = 0;
  67. _stack_traversal_mark = 0;
  68. _unload_reported = false; // jvmti state
  69. @@ -677,6 +678,7 @@
  70. _dependencies_offset = _scopes_pcs_offset;
  71. _handler_table_offset = _dependencies_offset;
  72. _nul_chk_table_offset = _handler_table_offset;
  73. +
  74. _nmethod_end_offset = _nul_chk_table_offset;
  75. _compile_id = compile_id;
  76. _comp_level = CompLevel_none;
  77. @@ -686,6 +688,8 @@
  78. _exception_cache = NULL;
  79. _pc_desc_cache.reset_to(NULL);
  80. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  81. + if (method != NULL)
  82. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  83. code_buffer->copy_values_to(this);
  84. if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
  85. @@ -759,6 +763,7 @@
  86. _metadata_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize);
  87. _scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize);
  88. _scopes_pcs_offset = _scopes_data_offset;
  89. +
  90. _dependencies_offset = _scopes_pcs_offset;
  91. _handler_table_offset = _dependencies_offset;
  92. _nul_chk_table_offset = _handler_table_offset;
  93. @@ -771,6 +776,8 @@
  94. _exception_cache = NULL;
  95. _pc_desc_cache.reset_to(NULL);
  96. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  97. + if (method != NULL)
  98. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  99. code_buffer->copy_values_to(this);
  100. if (ScavengeRootsInCode && detect_scavenge_root_oops()) {
  101. @@ -885,6 +892,9 @@
  102. _exception_cache = NULL;
  103. _pc_desc_cache.reset_to(scopes_pcs_begin());
  104. + if (method != NULL)
  105. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  106. +
  107. // Copy contents of ScopeDescRecorder to nmethod
  108. code_buffer->copy_values_to(this);
  109. debug_info->copy_to(this);
  110. diff --git a/src/share/vm/code/nmethod.hpp b/src/share/vm/code/nmethod.hpp
  111. index e1793ce..059509a 100644
  112. --- a/src/share/vm/code/nmethod.hpp
  113. +++ b/src/share/vm/code/nmethod.hpp
  114. @@ -168,6 +168,8 @@
  115. bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper)
  116. bool _marked_for_deoptimization; // Used for stack deoptimization
  117. + bool _deoptimization_incl;
  118. +
  119. // used by jvmti to track if an unload event has been posted for this nmethod.
  120. bool _unload_reported;
  121. @@ -440,6 +442,11 @@
  122. bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; }
  123. void mark_for_deoptimization() { _marked_for_deoptimization = true; }
  124. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  125. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  126. +
  127. + void mark_for_deoptimization_incl() { if (_deoptimization_incl) _marked_for_deoptimization = true; }
  128. +
  129. void make_unloaded(BoolObjectClosure* is_alive, oop cause);
  130. bool has_dependencies() { return dependencies_size() != 0; }
  131. diff --git a/src/share/vm/oops/klass.cpp b/src/share/vm/oops/klass.cpp
  132. index 90e017e..4fd9e64 100644
  133. --- a/src/share/vm/oops/klass.cpp
  134. +++ b/src/share/vm/oops/klass.cpp
  135. @@ -172,6 +172,7 @@
  136. set_redefinition_flags(Klass::NoRedefinition);
  137. set_redefining(false);
  138. + set_deoptimization_incl(false);
  139. set_new_version(NULL);
  140. set_old_version(NULL);
  141. set_redefinition_index(-1);
  142. @@ -219,6 +220,8 @@
  143. if (FastSuperclassLimit == 0) {
  144. // None of the other machinery matters.
  145. set_super(k);
  146. + if (k != NULL && k->is_deoptimization_incl())
  147. + set_deoptimization_incl(true);
  148. return;
  149. }
  150. if (k == NULL) {
  151. @@ -230,6 +233,8 @@
  152. "initialize this only once to a non-trivial value");
  153. set_super(k);
  154. Klass* sup = k;
  155. + if (sup->is_deoptimization_incl())
  156. + set_deoptimization_incl(true);
  157. int sup_depth = sup->super_depth();
  158. juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit());
  159. if (!can_be_primary_super_slow())
  160. diff --git a/src/share/vm/oops/klass.hpp b/src/share/vm/oops/klass.hpp
  161. index e0da996..a976694 100644
  162. --- a/src/share/vm/oops/klass.hpp
  163. +++ b/src/share/vm/oops/klass.hpp
  164. @@ -177,6 +177,7 @@
  165. bool _original_field_offsets_changed; // Did the original field offsets of this class change during class redefinition?
  166. int * _update_information; // Update information
  167. bool _is_redefining;
  168. + bool _deoptimization_incl; // True if class methods are included in deoptimization
  169. // Biased locking implementation and statistics
  170. // (the 64-bit chunk goes first, to avoid some fragmentation)
  171. @@ -253,6 +254,9 @@
  172. int *update_information() const { return _update_information; }
  173. void set_update_information(int *info) { _update_information = info; }
  174. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  175. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  176. +
  177. // Revision number for redefined classes, -1 for originally loaded classes
  178. bool was_redefined() const { return _revision_number != -1; }
  179. jint revision_number() const { return _revision_number; }
  180. diff --git a/src/share/vm/prims/jvmtiRedefineClasses2.cpp b/src/share/vm/prims/jvmtiRedefineClasses2.cpp
  181. index 1a0406e..f6b3cc6 100644
  182. --- a/src/share/vm/prims/jvmtiRedefineClasses2.cpp
  183. +++ b/src/share/vm/prims/jvmtiRedefineClasses2.cpp
  184. @@ -465,6 +465,8 @@
  185. new_class->set_redefinition_flags(redefinition_flags);
  186. + new_class->set_deoptimization_incl(true);
  187. +
  188. _max_redefinition_flags = _max_redefinition_flags | redefinition_flags;
  189. if ((redefinition_flags & Klass::ModifyInstances) != 0) {
  190. @@ -1587,7 +1589,10 @@
  191. if (0 && JvmtiExport::all_dependencies_are_recorded()) {
  192. Universe::flush_evol_dependents_on(k_h);
  193. } else {
  194. - CodeCache::mark_all_nmethods_for_deoptimization();
  195. + if (HotswapDeoptClassPath == NULL)
  196. + CodeCache::mark_all_nmethods_for_deoptimization();
  197. + else
  198. + CodeCache::mark_all_incl_nmethods_for_deoptimization();
  199. ResourceMark rm(THREAD);
  200. DeoptimizationMarker dm;
  201. diff --git a/src/share/vm/runtime/globals.hpp b/src/share/vm/runtime/globals.hpp
  202. index b6d297e..22207e8 100644
  203. --- a/src/share/vm/runtime/globals.hpp
  204. +++ b/src/share/vm/runtime/globals.hpp
  205. @@ -3883,7 +3883,13 @@
  206. "Enable event-based tracing") \
  207. \
  208. product(bool, UseLockedTracing, false, \
  209. - "Use locked-tracing when doing event-based tracing")
  210. + "Use locked-tracing when doing event-based tracing") \
  211. + product(ccstr, HotswapDeoptClassPath, NULL, \
  212. + "Class path or fragment of the class path to a folder with " \
  213. + "classes allowed to be deoptimized on hotswap. If is not " \
  214. + "defined then all classes will be deoptimized on hotswap. " \
  215. + "That's default behaviour. Using this option the performance " \
  216. + "of hotswap can be considerably increased. ")
  217. /*
  218. * Macros for factoring of globals