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-jdk8u66-b17-deopt-cp.patch 9.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. # HG changeset patch
  2. # Parent 5c1a815b73abcb755c43eb820f6557d37aeb4f9f
  3. diff -r 5c1a815b73ab src/share/vm/classfile/classFileParser.cpp
  4. --- a/src/share/vm/classfile/classFileParser.cpp Mon Dec 07 17:08:29 2015 -0800
  5. +++ b/src/share/vm/classfile/classFileParser.cpp Mon Dec 07 17:11:00 2015 -0800
  6. @@ -4257,6 +4257,11 @@
  7. }
  8. }
  9. + if (cfs->source() != NULL && HotswapDeoptClassPath != NULL) {
  10. + if (strstr(cfs->source(), HotswapDeoptClassPath) != NULL)
  11. + this_klass->set_deoptimization_incl(true);
  12. + }
  13. +
  14. if (TraceClassResolution) {
  15. ResourceMark rm;
  16. // print out the superclass.
  17. diff -r 5c1a815b73ab src/share/vm/classfile/systemDictionary.cpp
  18. --- a/src/share/vm/classfile/systemDictionary.cpp Mon Dec 07 17:08:29 2015 -0800
  19. +++ b/src/share/vm/classfile/systemDictionary.cpp Mon Dec 07 17:11:00 2015 -0800
  20. @@ -1245,6 +1245,11 @@
  21. ik->restore_unshareable_info(loader_data, protection_domain, 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 -r 5c1a815b73ab src/share/vm/code/codeCache.cpp
  32. --- a/src/share/vm/code/codeCache.cpp Mon Dec 07 17:08:29 2015 -0800
  33. +++ b/src/share/vm/code/codeCache.cpp Mon Dec 07 17:11:00 2015 -0800
  34. @@ -707,6 +707,13 @@
  35. }
  36. #endif // HOTSWAP
  37. +// Deoptimize all methods having deopt-include flag
  38. +void CodeCache::mark_all_incl_nmethods_for_deoptimization() {
  39. + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  40. + FOR_ALL_ALIVE_NMETHODS(nm) {
  41. + nm->mark_for_deoptimization_incl();
  42. + }
  43. +}
  44. // Deoptimize all methods
  45. void CodeCache::mark_all_nmethods_for_deoptimization() {
  46. diff -r 5c1a815b73ab src/share/vm/code/codeCache.hpp
  47. --- a/src/share/vm/code/codeCache.hpp Mon Dec 07 17:08:29 2015 -0800
  48. +++ b/src/share/vm/code/codeCache.hpp Mon Dec 07 17:11:00 2015 -0800
  49. @@ -185,6 +185,7 @@
  50. // tells how many nmethods have dependencies
  51. static int number_of_nmethods_with_dependencies();
  52. + static void mark_all_incl_nmethods_for_deoptimization();
  53. static int get_codemem_full_count() { return _codemem_full_count; }
  54. };
  55. diff -r 5c1a815b73ab src/share/vm/code/nmethod.cpp
  56. --- a/src/share/vm/code/nmethod.cpp Mon Dec 07 17:08:29 2015 -0800
  57. +++ b/src/share/vm/code/nmethod.cpp Mon Dec 07 17:11:00 2015 -0800
  58. @@ -476,6 +476,7 @@
  59. _lazy_critical_native = 0;
  60. _has_wide_vectors = 0;
  61. _marked_for_deoptimization = 0;
  62. + _deoptimization_incl = false;
  63. _lock_count = 0;
  64. _stack_traversal_mark = 0;
  65. _unload_reported = false; // jvmti state
  66. @@ -688,6 +689,7 @@
  67. _dependencies_offset = _scopes_pcs_offset;
  68. _handler_table_offset = _dependencies_offset;
  69. _nul_chk_table_offset = _handler_table_offset;
  70. +
  71. _nmethod_end_offset = _nul_chk_table_offset;
  72. _compile_id = compile_id;
  73. _comp_level = CompLevel_none;
  74. @@ -697,6 +699,8 @@
  75. _exception_cache = NULL;
  76. _pc_desc_cache.reset_to(NULL);
  77. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  78. + if (method != NULL)
  79. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  80. code_buffer->copy_values_to(this);
  81. if (ScavengeRootsInCode) {
  82. @@ -772,6 +776,7 @@
  83. _metadata_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize);
  84. _scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize);
  85. _scopes_pcs_offset = _scopes_data_offset;
  86. +
  87. _dependencies_offset = _scopes_pcs_offset;
  88. _handler_table_offset = _dependencies_offset;
  89. _nul_chk_table_offset = _handler_table_offset;
  90. @@ -784,6 +789,8 @@
  91. _exception_cache = NULL;
  92. _pc_desc_cache.reset_to(NULL);
  93. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  94. + if (method != NULL)
  95. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  96. code_buffer->copy_values_to(this);
  97. if (ScavengeRootsInCode) {
  98. @@ -900,6 +907,9 @@
  99. _exception_cache = NULL;
  100. _pc_desc_cache.reset_to(scopes_pcs_begin());
  101. + if (method != NULL)
  102. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  103. +
  104. // Copy contents of ScopeDescRecorder to nmethod
  105. code_buffer->copy_values_to(this);
  106. debug_info->copy_to(this);
  107. diff -r 5c1a815b73ab src/share/vm/code/nmethod.hpp
  108. --- a/src/share/vm/code/nmethod.hpp Mon Dec 07 17:08:29 2015 -0800
  109. +++ b/src/share/vm/code/nmethod.hpp Mon Dec 07 17:11:00 2015 -0800
  110. @@ -184,6 +184,8 @@
  111. bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper)
  112. bool _marked_for_deoptimization; // Used for stack deoptimization
  113. + bool _deoptimization_incl;
  114. +
  115. // used by jvmti to track if an unload event has been posted for this nmethod.
  116. bool _unload_reported;
  117. @@ -470,6 +472,11 @@
  118. bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; }
  119. void mark_for_deoptimization() { _marked_for_deoptimization = true; }
  120. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  121. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  122. +
  123. + void mark_for_deoptimization_incl() { if (_deoptimization_incl) _marked_for_deoptimization = true; }
  124. +
  125. void make_unloaded(BoolObjectClosure* is_alive, oop cause);
  126. bool has_dependencies() { return dependencies_size() != 0; }
  127. diff -r 5c1a815b73ab src/share/vm/oops/klass.cpp
  128. --- a/src/share/vm/oops/klass.cpp Mon Dec 07 17:08:29 2015 -0800
  129. +++ b/src/share/vm/oops/klass.cpp Mon Dec 07 17:11:00 2015 -0800
  130. @@ -188,6 +188,7 @@
  131. set_redefinition_flags(Klass::NoRedefinition);
  132. set_redefining(false);
  133. + set_deoptimization_incl(false);
  134. set_new_version(NULL);
  135. set_old_version(NULL);
  136. set_redefinition_index(-1);
  137. @@ -236,6 +237,8 @@
  138. if (FastSuperclassLimit == 0) {
  139. // None of the other machinery matters.
  140. set_super(k);
  141. + if (k != NULL && k->is_deoptimization_incl())
  142. + set_deoptimization_incl(true);
  143. return;
  144. }
  145. if (k == NULL) {
  146. @@ -247,6 +250,8 @@
  147. "initialize this only once to a non-trivial value");
  148. set_super(k);
  149. Klass* sup = k;
  150. + if (sup->is_deoptimization_incl())
  151. + set_deoptimization_incl(true);
  152. int sup_depth = sup->super_depth();
  153. juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit());
  154. if (!can_be_primary_super_slow())
  155. diff -r 5c1a815b73ab src/share/vm/oops/klass.hpp
  156. --- a/src/share/vm/oops/klass.hpp Mon Dec 07 17:08:29 2015 -0800
  157. +++ b/src/share/vm/oops/klass.hpp Mon Dec 07 17:11:00 2015 -0800
  158. @@ -177,6 +177,7 @@
  159. bool _original_field_offsets_changed; // Did the original field offsets of this class change during class redefinition?
  160. int * _update_information; // Update information
  161. bool _is_redefining;
  162. + bool _deoptimization_incl; // True if class methods are included in deoptimization
  163. // Biased locking implementation and statistics
  164. // (the 64-bit chunk goes first, to avoid some fragmentation)
  165. @@ -263,6 +264,9 @@
  166. int *update_information() const { return _update_information; }
  167. void set_update_information(int *info) { _update_information = info; }
  168. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  169. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  170. +
  171. // Revision number for redefined classes, -1 for originally loaded classes
  172. bool was_redefined() const { return _revision_number != -1; }
  173. jint revision_number() const { return _revision_number; }
  174. diff -r 5c1a815b73ab src/share/vm/prims/jvmtiRedefineClasses2.cpp
  175. --- a/src/share/vm/prims/jvmtiRedefineClasses2.cpp Mon Dec 07 17:08:29 2015 -0800
  176. +++ b/src/share/vm/prims/jvmtiRedefineClasses2.cpp Mon Dec 07 17:11:00 2015 -0800
  177. @@ -443,6 +443,8 @@
  178. new_class->set_redefinition_flags(redefinition_flags);
  179. + new_class->set_deoptimization_incl(true);
  180. +
  181. _max_redefinition_flags = _max_redefinition_flags | redefinition_flags;
  182. if ((redefinition_flags & Klass::ModifyInstances) != 0) {
  183. @@ -1568,7 +1570,10 @@
  184. if (0 && JvmtiExport::all_dependencies_are_recorded()) {
  185. Universe::flush_evol_dependents_on(k_h);
  186. } else {
  187. - CodeCache::mark_all_nmethods_for_deoptimization();
  188. + if (HotswapDeoptClassPath == NULL)
  189. + CodeCache::mark_all_nmethods_for_deoptimization();
  190. + else
  191. + CodeCache::mark_all_incl_nmethods_for_deoptimization();
  192. ResourceMark rm(THREAD);
  193. DeoptimizationMarker dm;
  194. diff -r 5c1a815b73ab src/share/vm/runtime/globals.hpp
  195. --- a/src/share/vm/runtime/globals.hpp Mon Dec 07 17:08:29 2015 -0800
  196. +++ b/src/share/vm/runtime/globals.hpp Mon Dec 07 17:11:00 2015 -0800
  197. @@ -3947,7 +3947,15 @@
  198. \
  199. product_pd(bool, PreserveFramePointer, \
  200. "Use the FP register for holding the frame pointer " \
  201. - "and not as a general purpose register.")
  202. + "and not as a general purpose register.") \
  203. + \
  204. + product(ccstr, HotswapDeoptClassPath, NULL, \
  205. + "Class path or fragment of the class path to a folder with " \
  206. + "classes allowed to be deoptimized on hotswap. If is not " \
  207. + "defined then all classes will be deoptimized on hotswap. " \
  208. + "That's default behaviour. Using this option the performance " \
  209. + "of hotswap can be considerably increased. ")
  210. +
  211. /*
  212. * Macros for factoring of globals