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 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. # HG changeset patch
  2. # Parent ae559120fec5645d5f89c6aee6704c64707ccec5
  3. diff -r ae559120fec5 src/share/vm/classfile/classFileParser.cpp
  4. --- a/src/share/vm/classfile/classFileParser.cpp Thu Apr 27 18:12:53 2017 -0700
  5. +++ b/src/share/vm/classfile/classFileParser.cpp Sat Jul 08 13:28:02 2017 -0500
  6. @@ -4264,6 +4264,30 @@
  7. }
  8. }
  9. + if (this_klass->external_name() != NULL && HotswapDeoptClassPath != NULL) {
  10. + const char* deopt_path = HotswapDeoptClassPath;
  11. + const char* const end = deopt_path + strlen(deopt_path);
  12. + bool deopt_found = false;
  13. + while (!deopt_found && deopt_path < end) {
  14. + const char* tmp_end = strchr(deopt_path, ',');
  15. + if (tmp_end == NULL) {
  16. + tmp_end = end;
  17. + }
  18. + char* deopt_segm_path = NEW_C_HEAP_ARRAY(char, tmp_end - deopt_path + 1, mtInternal);
  19. + memcpy(deopt_segm_path, deopt_path, tmp_end - deopt_path);
  20. + deopt_segm_path[tmp_end - deopt_path] = '\0';
  21. + if (strstr(this_klass->external_name(), deopt_segm_path) != NULL) {
  22. + if (TraceRedefineClasses > 0) {
  23. + tty->print_cr("Including in deoptimization : %s", this_klass->external_name());
  24. + }
  25. + this_klass->set_deoptimization_incl(true);
  26. + deopt_found = true;
  27. + }
  28. + FREE_C_HEAP_ARRAY(char, deopt_segm_path, mtInternal);
  29. + deopt_path = tmp_end + 1;
  30. + }
  31. + }
  32. +
  33. if (TraceClassResolution) {
  34. ResourceMark rm;
  35. // print out the superclass.
  36. diff -r ae559120fec5 src/share/vm/classfile/systemDictionary.cpp
  37. --- a/src/share/vm/classfile/systemDictionary.cpp Thu Apr 27 18:12:53 2017 -0700
  38. +++ b/src/share/vm/classfile/systemDictionary.cpp Sat Jul 08 13:28:02 2017 -0500
  39. @@ -1255,6 +1255,31 @@
  40. ik->restore_unshareable_info(loader_data, protection_domain, CHECK_(nh));
  41. }
  42. + if (HotswapDeoptClassPath != NULL) {
  43. + const char* deopt_path = HotswapDeoptClassPath;
  44. + const char* const end = deopt_path + strlen(deopt_path);
  45. + bool deopt_found = false;
  46. + while (!deopt_found && deopt_path < end) {
  47. + const char* tmp_end = strchr(deopt_path, ',');
  48. + if (tmp_end == NULL) {
  49. + tmp_end = end;
  50. + }
  51. + char* deopt_segm_path = NEW_C_HEAP_ARRAY(char, tmp_end - deopt_path + 1, mtInternal);
  52. + memcpy(deopt_segm_path, deopt_path, tmp_end - deopt_path);
  53. + deopt_segm_path[tmp_end - deopt_path] = '\0';
  54. + if (strstr(ik->external_name(), deopt_segm_path) != NULL) {
  55. + if (TraceRedefineClasses > 0) {
  56. + tty->print_cr("Including in deoptimization : %s", ik->external_name());
  57. + }
  58. + ik->set_deoptimization_incl(true);
  59. + deopt_found = true;
  60. + }
  61. + FREE_C_HEAP_ARRAY(char, deopt_segm_path, mtInternal);
  62. + deopt_path = tmp_end + 1;
  63. + }
  64. + }
  65. +
  66. +
  67. if (TraceClassLoading) {
  68. ResourceMark rm;
  69. tty->print("[Loaded %s", ik->external_name());
  70. diff -r ae559120fec5 src/share/vm/code/codeCache.cpp
  71. --- a/src/share/vm/code/codeCache.cpp Thu Apr 27 18:12:53 2017 -0700
  72. +++ b/src/share/vm/code/codeCache.cpp Sat Jul 08 13:28:02 2017 -0500
  73. @@ -709,6 +709,13 @@
  74. }
  75. #endif // HOTSWAP
  76. +// Deoptimize all methods having deopt-include flag
  77. +void CodeCache::mark_all_incl_nmethods_for_deoptimization() {
  78. + MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  79. + FOR_ALL_ALIVE_NMETHODS(nm) {
  80. + nm->mark_for_deoptimization_incl();
  81. + }
  82. +}
  83. // Deoptimize all methods
  84. void CodeCache::mark_all_nmethods_for_deoptimization() {
  85. diff -r ae559120fec5 src/share/vm/code/codeCache.hpp
  86. --- a/src/share/vm/code/codeCache.hpp Thu Apr 27 18:12:53 2017 -0700
  87. +++ b/src/share/vm/code/codeCache.hpp Sat Jul 08 13:28:02 2017 -0500
  88. @@ -184,6 +184,7 @@
  89. // tells how many nmethods have dependencies
  90. static int number_of_nmethods_with_dependencies();
  91. + static void mark_all_incl_nmethods_for_deoptimization();
  92. static int get_codemem_full_count() { return _codemem_full_count; }
  93. };
  94. diff -r ae559120fec5 src/share/vm/code/nmethod.cpp
  95. --- a/src/share/vm/code/nmethod.cpp Thu Apr 27 18:12:53 2017 -0700
  96. +++ b/src/share/vm/code/nmethod.cpp Sat Jul 08 13:28:02 2017 -0500
  97. @@ -476,6 +476,7 @@
  98. _lazy_critical_native = 0;
  99. _has_wide_vectors = 0;
  100. _marked_for_deoptimization = 0;
  101. + _deoptimization_incl = false;
  102. _lock_count = 0;
  103. _stack_traversal_mark = 0;
  104. _unload_reported = false; // jvmti state
  105. @@ -688,6 +689,7 @@
  106. _dependencies_offset = _scopes_pcs_offset;
  107. _handler_table_offset = _dependencies_offset;
  108. _nul_chk_table_offset = _handler_table_offset;
  109. +
  110. _nmethod_end_offset = _nul_chk_table_offset;
  111. _compile_id = compile_id;
  112. _comp_level = CompLevel_none;
  113. @@ -697,6 +699,8 @@
  114. _exception_cache = NULL;
  115. _pc_desc_cache.reset_to(NULL);
  116. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  117. + if (method != NULL)
  118. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  119. code_buffer->copy_values_to(this);
  120. if (ScavengeRootsInCode) {
  121. @@ -772,6 +776,7 @@
  122. _metadata_offset = _oops_offset + round_to(code_buffer->total_oop_size(), oopSize);
  123. _scopes_data_offset = _metadata_offset + round_to(code_buffer->total_metadata_size(), wordSize);
  124. _scopes_pcs_offset = _scopes_data_offset;
  125. +
  126. _dependencies_offset = _scopes_pcs_offset;
  127. _handler_table_offset = _dependencies_offset;
  128. _nul_chk_table_offset = _handler_table_offset;
  129. @@ -784,6 +789,8 @@
  130. _exception_cache = NULL;
  131. _pc_desc_cache.reset_to(NULL);
  132. _hotness_counter = NMethodSweeper::hotness_counter_reset_val();
  133. + if (method != NULL)
  134. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  135. code_buffer->copy_values_to(this);
  136. if (ScavengeRootsInCode) {
  137. @@ -900,6 +907,9 @@
  138. _exception_cache = NULL;
  139. _pc_desc_cache.reset_to(scopes_pcs_begin());
  140. + if (method != NULL)
  141. + _deoptimization_incl = method->method_holder()->is_deoptimization_incl();
  142. +
  143. // Copy contents of ScopeDescRecorder to nmethod
  144. code_buffer->copy_values_to(this);
  145. debug_info->copy_to(this);
  146. diff -r ae559120fec5 src/share/vm/code/nmethod.hpp
  147. --- a/src/share/vm/code/nmethod.hpp Thu Apr 27 18:12:53 2017 -0700
  148. +++ b/src/share/vm/code/nmethod.hpp Sat Jul 08 13:28:02 2017 -0500
  149. @@ -184,6 +184,8 @@
  150. bool _marked_for_reclamation; // Used by NMethodSweeper (set only by sweeper)
  151. bool _marked_for_deoptimization; // Used for stack deoptimization
  152. + bool _deoptimization_incl;
  153. +
  154. // used by jvmti to track if an unload event has been posted for this nmethod.
  155. bool _unload_reported;
  156. @@ -470,6 +472,11 @@
  157. bool is_marked_for_deoptimization() const { return _marked_for_deoptimization; }
  158. void mark_for_deoptimization() { _marked_for_deoptimization = true; }
  159. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  160. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  161. +
  162. + void mark_for_deoptimization_incl() { if (_deoptimization_incl) _marked_for_deoptimization = true; }
  163. +
  164. void make_unloaded(BoolObjectClosure* is_alive, oop cause);
  165. bool has_dependencies() { return dependencies_size() != 0; }
  166. diff -r ae559120fec5 src/share/vm/gc_implementation/shared/markSweep.cpp
  167. --- a/src/share/vm/gc_implementation/shared/markSweep.cpp Thu Apr 27 18:12:53 2017 -0700
  168. +++ b/src/share/vm/gc_implementation/shared/markSweep.cpp Sat Jul 08 13:28:02 2017 -0500
  169. @@ -222,7 +222,7 @@
  170. ((HeapWord *)new_location >= (HeapWord *)q && (HeapWord *)new_location < (HeapWord *)q + size)) {
  171. tmp = NEW_RESOURCE_ARRAY(HeapWord, size);
  172. q = (oop) tmp;
  173. - Copy::aligned_disjoint_words((HeapWord*)q, (HeapWord*)tmp_obj, size);
  174. + Copy::aligned_disjoint_words((HeapWord*)tmp_obj, (HeapWord*)q, size);
  175. }
  176. }
  177. diff -r ae559120fec5 src/share/vm/memory/genMarkSweep.cpp
  178. --- a/src/share/vm/memory/genMarkSweep.cpp Thu Apr 27 18:12:53 2017 -0700
  179. +++ b/src/share/vm/memory/genMarkSweep.cpp Sat Jul 08 13:28:02 2017 -0500
  180. @@ -333,8 +333,6 @@
  181. GCTraceTime tm("phase 4", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
  182. trace("4");
  183. - MarkSweep::copy_rescued_objects_back();
  184. -
  185. GenCompactClosure blk;
  186. gch->generation_iterate(&blk, true);
  187. diff -r ae559120fec5 src/share/vm/oops/klass.cpp
  188. --- a/src/share/vm/oops/klass.cpp Thu Apr 27 18:12:53 2017 -0700
  189. +++ b/src/share/vm/oops/klass.cpp Sat Jul 08 13:28:02 2017 -0500
  190. @@ -188,6 +188,7 @@
  191. set_redefinition_flags(Klass::NoRedefinition);
  192. set_redefining(false);
  193. + set_deoptimization_incl(false);
  194. set_new_version(NULL);
  195. set_old_version(NULL);
  196. set_redefinition_index(-1);
  197. @@ -236,6 +237,8 @@
  198. if (FastSuperclassLimit == 0) {
  199. // None of the other machinery matters.
  200. set_super(k);
  201. + if (k != NULL && k->is_deoptimization_incl())
  202. + set_deoptimization_incl(true);
  203. return;
  204. }
  205. if (k == NULL) {
  206. @@ -247,6 +250,8 @@
  207. "initialize this only once to a non-trivial value");
  208. set_super(k);
  209. Klass* sup = k;
  210. + if (sup->is_deoptimization_incl())
  211. + set_deoptimization_incl(true);
  212. int sup_depth = sup->super_depth();
  213. juint my_depth = MIN2(sup_depth + 1, (int)primary_super_limit());
  214. if (!can_be_primary_super_slow())
  215. diff -r ae559120fec5 src/share/vm/oops/klass.hpp
  216. --- a/src/share/vm/oops/klass.hpp Thu Apr 27 18:12:53 2017 -0700
  217. +++ b/src/share/vm/oops/klass.hpp Sat Jul 08 13:28:02 2017 -0500
  218. @@ -177,6 +177,7 @@
  219. bool _original_field_offsets_changed; // Did the original field offsets of this class change during class redefinition?
  220. int * _update_information; // Update information
  221. bool _is_redefining;
  222. + bool _deoptimization_incl; // True if class methods are included in deoptimization
  223. // Biased locking implementation and statistics
  224. // (the 64-bit chunk goes first, to avoid some fragmentation)
  225. @@ -263,6 +264,9 @@
  226. int *update_information() const { return _update_information; }
  227. void set_update_information(int *info) { _update_information = info; }
  228. + bool is_deoptimization_incl() const { return _deoptimization_incl; }
  229. + void set_deoptimization_incl(bool z) { _deoptimization_incl = z; }
  230. +
  231. // Revision number for redefined classes, -1 for originally loaded classes
  232. bool was_redefined() const { return _revision_number != -1; }
  233. jint revision_number() const { return _revision_number; }
  234. diff -r ae559120fec5 src/share/vm/prims/jvmtiRedefineClasses2.cpp
  235. --- a/src/share/vm/prims/jvmtiRedefineClasses2.cpp Thu Apr 27 18:12:53 2017 -0700
  236. +++ b/src/share/vm/prims/jvmtiRedefineClasses2.cpp Sat Jul 08 13:28:02 2017 -0500
  237. @@ -443,6 +443,8 @@
  238. new_class->set_redefinition_flags(redefinition_flags);
  239. + new_class->set_deoptimization_incl(true);
  240. +
  241. _max_redefinition_flags = _max_redefinition_flags | redefinition_flags;
  242. if ((redefinition_flags & Klass::ModifyInstances) != 0) {
  243. @@ -1579,7 +1581,10 @@
  244. if (0 && JvmtiExport::all_dependencies_are_recorded()) {
  245. Universe::flush_evol_dependents_on(k_h);
  246. } else {
  247. - CodeCache::mark_all_nmethods_for_deoptimization();
  248. + if (HotswapDeoptClassPath == NULL)
  249. + CodeCache::mark_all_nmethods_for_deoptimization();
  250. + else
  251. + CodeCache::mark_all_incl_nmethods_for_deoptimization();
  252. ResourceMark rm(THREAD);
  253. DeoptimizationMarker dm;
  254. diff -r ae559120fec5 src/share/vm/runtime/globals.hpp
  255. --- a/src/share/vm/runtime/globals.hpp Thu Apr 27 18:12:53 2017 -0700
  256. +++ b/src/share/vm/runtime/globals.hpp Sat Jul 08 13:28:02 2017 -0500
  257. @@ -3962,7 +3962,16 @@
  258. \
  259. product_pd(bool, PreserveFramePointer, \
  260. "Use the FP register for holding the frame pointer " \
  261. - "and not as a general purpose register.")
  262. + "and not as a general purpose register.") \
  263. + \
  264. + product(ccstr, HotswapDeoptClassPath, NULL, \
  265. + "Comma separated list of packages containing classes that are " \
  266. + "expected to be redefined. If com.sun.proxy is used by " \
  267. + "application and proxied class is redefined, then this option " \
  268. + "should contain 'com.sun.proxy'. If the option is not defined, " \
  269. + "then all classes will be deoptimized on hotswap. Using this " \
  270. + "option improves hotswap performance. ")
  271. +
  272. /*
  273. * Macros for factoring of globals