142
143 void print_on(outputStream* st);
144 void print() { print_on(tty); }
145 };
146
147
148 class BiasedLocking : AllStatic {
149 private:
150 static BiasedLockingCounters _counters;
151
152 public:
153 static int* total_entry_count_addr();
154 static int* biased_lock_entry_count_addr();
155 static int* anonymously_biased_lock_entry_count_addr();
156 static int* rebiased_lock_entry_count_addr();
157 static int* revoked_lock_entry_count_addr();
158 static int* fast_path_entry_count_addr();
159 static int* slow_path_entry_count_addr();
160
161 enum Condition {
162 NOT_BIASED = 1,
163 BIAS_REVOKED = 2,
164 BIAS_REVOKED_AND_REBIASED = 3
165 };
166
167 // This initialization routine should only be called once and
168 // schedules a PeriodicTask to turn on biased locking a few seconds
169 // into the VM run to avoid startup time regressions
170 static void init();
171
172 // This provides a global switch for leaving biased locking disabled
173 // for the first part of a run and enabling it later
174 static bool enabled();
175
176 // This should be called by JavaThreads to revoke the bias of an object
177 static Condition revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS);
178
179 // These do not allow rebiasing; they are used by deoptimization to
180 // ensure that monitors on the stack can be migrated
181 static void revoke(GrowableArray<Handle>* objs);
182 static void revoke_at_safepoint(Handle obj);
183 static void revoke_at_safepoint(GrowableArray<Handle>* objs);
184
185 static void print_counters() { _counters.print(); }
186 static BiasedLockingCounters* counters() { return &_counters; }
187
188 // These routines are GC-related and should not be called by end
189 // users. GCs which do not do preservation of mark words do not need
190 // to call these routines.
191 static void preserve_marks();
192 static void restore_marks();
193 };
194
195 #endif // SHARE_RUNTIME_BIASEDLOCKING_HPP
|
142
143 void print_on(outputStream* st);
144 void print() { print_on(tty); }
145 };
146
147
148 class BiasedLocking : AllStatic {
149 private:
150 static BiasedLockingCounters _counters;
151
152 public:
153 static int* total_entry_count_addr();
154 static int* biased_lock_entry_count_addr();
155 static int* anonymously_biased_lock_entry_count_addr();
156 static int* rebiased_lock_entry_count_addr();
157 static int* revoked_lock_entry_count_addr();
158 static int* fast_path_entry_count_addr();
159 static int* slow_path_entry_count_addr();
160
161 enum Condition {
162 NOT_REVOKED = 0,
163 NOT_BIASED = 1,
164 BIAS_REVOKED = 2,
165 BIAS_REVOKED_AND_REBIASED = 3
166 };
167
168 // This initialization routine should only be called once and
169 // schedules a PeriodicTask to turn on biased locking a few seconds
170 // into the VM run to avoid startup time regressions
171 static void init();
172
173 // This provides a global switch for leaving biased locking disabled
174 // for the first part of a run and enabling it later
175 static bool enabled();
176
177 // This should be called by JavaThreads to revoke the bias of an object
178 static Condition revoke_and_rebias(Handle obj, bool attempt_rebias, TRAPS);
179 static Condition revoke_and_rebias_in_handshake(Handle obj, TRAPS);
180
181 // These do not allow rebiasing; they are used by deoptimization to
182 // ensure that monitors on the stack can be migrated
183 static void revoke(GrowableArray<Handle>* objs);
184 static void revoke_at_safepoint(Handle obj);
185 static void revoke_at_safepoint(GrowableArray<Handle>* objs);
186
187 static void print_counters() { _counters.print(); }
188 static BiasedLockingCounters* counters() { return &_counters; }
189
190 // These routines are GC-related and should not be called by end
191 // users. GCs which do not do preservation of mark words do not need
192 // to call these routines.
193 static void preserve_marks();
194 static void restore_marks();
195 };
196
197 #endif // SHARE_RUNTIME_BIASEDLOCKING_HPP
|