aboutsummaryrefslogtreecommitdiffstats
path: root/hotspot/.hg/patches/light-jdk7u51-deopt-cp.patch
blob: 7df3297b80f30a0bc5eccc09a2e3162f66c4c0c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
index 8590ad1..7e35b1a 100644
--- a/src/share/vm/classfile/classFileParser.cpp
+++ b/src/share/vm/classfile/classFileParser.cpp
@@ -3798,6 +3798,11 @@
       }
     }
 
+    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 3f64268..124c39c 100644
--- a/src/share/vm/classfile/systemDictionary.cpp
+++ b/src/share/vm/classfile/systemDictionary.cpp
@@ -1256,6 +1256,11 @@
       }
     }
 
+    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..722ecfd 100644
--- a/src/share/vm/code/codeCache.cpp
+++ b/src/share/vm/code/codeCache.cpp
@@ -713,6 +713,13 @@
 }
 #endif // HOTSWAP
 
+// Deoptimize all methods having deopt-include flag
+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() {
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 @@
 #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 59f5f7e..b7d0742 100644
--- a/src/share/vm/code/nmethod.cpp
+++ b/src/share/vm/code/nmethod.cpp
@@ -465,6 +465,7 @@
   _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 @@
     _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);
@@ -754,6 +758,9 @@
     _osr_entry_point         = NULL;
     _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());
@@ -863,6 +870,9 @@
     _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 8d76afb..d2d1acc 100644
--- a/src/share/vm/code/nmethod.hpp
+++ b/src/share/vm/code/nmethod.hpp
@@ -169,6 +169,8 @@
   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 @@
   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 a928777..d3714b7 100644
--- a/src/share/vm/oops/klass.cpp
+++ b/src/share/vm/oops/klass.cpp
@@ -163,6 +163,7 @@
 
   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);
@@ -233,6 +234,8 @@
   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) {
@@ -244,6 +247,8 @@
            "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 bf242d9..884deae 100644
--- a/src/share/vm/oops/klass.hpp
+++ b/src/share/vm/oops/klass.hpp
@@ -292,6 +292,7 @@
   bool                  _original_field_offsets_changed; // Did the original field offsets of this class change during class redefinition?
   int *                 _update_information;     // Update information
   bool                  _is_redefining;
+  bool                  _deoptimization_incl; // True if class methods are included in deoptimization
 
 #ifndef PRODUCT
   int           _verify_count;  // to avoid redundant verifies
@@ -376,6 +377,9 @@
     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 cb90823..6836fae 100644
--- a/src/share/vm/prims/jvmtiRedefineClasses.cpp
+++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp
@@ -482,6 +482,8 @@
 
     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) {
@@ -1857,7 +1859,10 @@
   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 341b399..1e8b1b0 100644
--- a/src/share/vm/runtime/globals.hpp
+++ b/src/share/vm/runtime/globals.hpp
@@ -3650,7 +3650,13 @@
   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