Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/simpleThresholdPolicy.cpp @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | 20334ed5ed3c |
children | 9191895df19d |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
32 | 32 |
33 | 33 |
34 void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) { | 34 void SimpleThresholdPolicy::print_counters(const char* prefix, methodHandle mh) { |
35 int invocation_count = mh->invocation_count(); | 35 int invocation_count = mh->invocation_count(); |
36 int backedge_count = mh->backedge_count(); | 36 int backedge_count = mh->backedge_count(); |
37 methodDataHandle mdh = mh->method_data(); | 37 MethodData* mdh = mh->method_data(); |
38 int mdo_invocations = 0, mdo_backedges = 0; | 38 int mdo_invocations = 0, mdo_backedges = 0; |
39 int mdo_invocations_start = 0, mdo_backedges_start = 0; | 39 int mdo_invocations_start = 0, mdo_backedges_start = 0; |
40 if (mdh() != NULL) { | 40 if (mdh != NULL) { |
41 mdo_invocations = mdh->invocation_count(); | 41 mdo_invocations = mdh->invocation_count(); |
42 mdo_backedges = mdh->backedge_count(); | 42 mdo_backedges = mdh->backedge_count(); |
43 mdo_invocations_start = mdh->invocation_count_start(); | 43 mdo_invocations_start = mdh->invocation_count_start(); |
44 mdo_backedges_start = mdh->backedge_count_start(); | 44 mdo_backedges_start = mdh->backedge_count_start(); |
45 } | 45 } |
145 counter->set_carry_flag(); | 145 counter->set_carry_flag(); |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 // Set carry flags on the counters if necessary | 149 // Set carry flags on the counters if necessary |
150 void SimpleThresholdPolicy::handle_counter_overflow(methodOop method) { | 150 void SimpleThresholdPolicy::handle_counter_overflow(Method* method) { |
151 set_carry_if_necessary(method->invocation_counter()); | 151 set_carry_if_necessary(method->invocation_counter()); |
152 set_carry_if_necessary(method->backedge_counter()); | 152 set_carry_if_necessary(method->backedge_counter()); |
153 methodDataOop mdo = method->method_data(); | 153 MethodData* mdo = method->method_data(); |
154 if (mdo != NULL) { | 154 if (mdo != NULL) { |
155 set_carry_if_necessary(mdo->invocation_counter()); | 155 set_carry_if_necessary(mdo->invocation_counter()); |
156 set_carry_if_necessary(mdo->backedge_counter()); | 156 set_carry_if_necessary(mdo->backedge_counter()); |
157 } | 157 } |
158 } | 158 } |
166 for (ScopeDesc* sd = trap_scope;; sd = sd->sender()) { | 166 for (ScopeDesc* sd = trap_scope;; sd = sd->sender()) { |
167 if (PrintTieredEvents) { | 167 if (PrintTieredEvents) { |
168 methodHandle mh(sd->method()); | 168 methodHandle mh(sd->method()); |
169 print_event(REPROFILE, mh, mh, InvocationEntryBci, CompLevel_none); | 169 print_event(REPROFILE, mh, mh, InvocationEntryBci, CompLevel_none); |
170 } | 170 } |
171 methodDataOop mdo = sd->method()->method_data(); | 171 MethodData* mdo = sd->method()->method_data(); |
172 if (mdo != NULL) { | 172 if (mdo != NULL) { |
173 mdo->reset_start_counters(); | 173 mdo->reset_start_counters(); |
174 } | 174 } |
175 if (sd->is_top()) break; | 175 if (sd->is_top()) break; |
176 } | 176 } |
270 return true; | 270 return true; |
271 } | 271 } |
272 } | 272 } |
273 | 273 |
274 // Determine is a method is mature. | 274 // Determine is a method is mature. |
275 bool SimpleThresholdPolicy::is_mature(methodOop method) { | 275 bool SimpleThresholdPolicy::is_mature(Method* method) { |
276 if (is_trivial(method)) return true; | 276 if (is_trivial(method)) return true; |
277 methodDataOop mdo = method->method_data(); | 277 MethodData* mdo = method->method_data(); |
278 if (mdo != NULL) { | 278 if (mdo != NULL) { |
279 int i = mdo->invocation_count(); | 279 int i = mdo->invocation_count(); |
280 int b = mdo->backedge_count(); | 280 int b = mdo->backedge_count(); |
281 double k = ProfileMaturityPercentage / 100.0; | 281 double k = ProfileMaturityPercentage / 100.0; |
282 return call_predicate_helper<CompLevel_full_profile>(i, b, k) || | 282 return call_predicate_helper<CompLevel_full_profile>(i, b, k) || |
284 } | 284 } |
285 return false; | 285 return false; |
286 } | 286 } |
287 | 287 |
288 // Common transition function. Given a predicate determines if a method should transition to another level. | 288 // Common transition function. Given a predicate determines if a method should transition to another level. |
289 CompLevel SimpleThresholdPolicy::common(Predicate p, methodOop method, CompLevel cur_level) { | 289 CompLevel SimpleThresholdPolicy::common(Predicate p, Method* method, CompLevel cur_level) { |
290 CompLevel next_level = cur_level; | 290 CompLevel next_level = cur_level; |
291 int i = method->invocation_count(); | 291 int i = method->invocation_count(); |
292 int b = method->backedge_count(); | 292 int b = method->backedge_count(); |
293 | 293 |
294 if (is_trivial(method)) { | 294 if (is_trivial(method)) { |
304 } | 304 } |
305 break; | 305 break; |
306 case CompLevel_limited_profile: | 306 case CompLevel_limited_profile: |
307 case CompLevel_full_profile: | 307 case CompLevel_full_profile: |
308 { | 308 { |
309 methodDataOop mdo = method->method_data(); | 309 MethodData* mdo = method->method_data(); |
310 if (mdo != NULL) { | 310 if (mdo != NULL) { |
311 if (mdo->would_profile()) { | 311 if (mdo->would_profile()) { |
312 int mdo_i = mdo->invocation_count_delta(); | 312 int mdo_i = mdo->invocation_count_delta(); |
313 int mdo_b = mdo->backedge_count_delta(); | 313 int mdo_b = mdo->backedge_count_delta(); |
314 if ((this->*p)(mdo_i, mdo_b, cur_level)) { | 314 if ((this->*p)(mdo_i, mdo_b, cur_level)) { |
324 } | 324 } |
325 return MIN2(next_level, (CompLevel)TieredStopAtLevel); | 325 return MIN2(next_level, (CompLevel)TieredStopAtLevel); |
326 } | 326 } |
327 | 327 |
328 // Determine if a method should be compiled with a normal entry point at a different level. | 328 // Determine if a method should be compiled with a normal entry point at a different level. |
329 CompLevel SimpleThresholdPolicy::call_event(methodOop method, CompLevel cur_level) { | 329 CompLevel SimpleThresholdPolicy::call_event(Method* method, CompLevel cur_level) { |
330 CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(), | 330 CompLevel osr_level = MIN2((CompLevel) method->highest_osr_comp_level(), |
331 common(&SimpleThresholdPolicy::loop_predicate, method, cur_level)); | 331 common(&SimpleThresholdPolicy::loop_predicate, method, cur_level)); |
332 CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level); | 332 CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level); |
333 | 333 |
334 // If OSR method level is greater than the regular method level, the levels should be | 334 // If OSR method level is greater than the regular method level, the levels should be |
335 // equalized by raising the regular method level in order to avoid OSRs during each | 335 // equalized by raising the regular method level in order to avoid OSRs during each |
336 // invocation of the method. | 336 // invocation of the method. |
337 if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) { | 337 if (osr_level == CompLevel_full_optimization && cur_level == CompLevel_full_profile) { |
338 methodDataOop mdo = method->method_data(); | 338 MethodData* mdo = method->method_data(); |
339 guarantee(mdo != NULL, "MDO should not be NULL"); | 339 guarantee(mdo != NULL, "MDO should not be NULL"); |
340 if (mdo->invocation_count() >= 1) { | 340 if (mdo->invocation_count() >= 1) { |
341 next_level = CompLevel_full_optimization; | 341 next_level = CompLevel_full_optimization; |
342 } | 342 } |
343 } else { | 343 } else { |
346 | 346 |
347 return next_level; | 347 return next_level; |
348 } | 348 } |
349 | 349 |
350 // Determine if we should do an OSR compilation of a given method. | 350 // Determine if we should do an OSR compilation of a given method. |
351 CompLevel SimpleThresholdPolicy::loop_event(methodOop method, CompLevel cur_level) { | 351 CompLevel SimpleThresholdPolicy::loop_event(Method* method, CompLevel cur_level) { |
352 CompLevel next_level = common(&SimpleThresholdPolicy::loop_predicate, method, cur_level); | 352 CompLevel next_level = common(&SimpleThresholdPolicy::loop_predicate, method, cur_level); |
353 if (cur_level == CompLevel_none) { | 353 if (cur_level == CompLevel_none) { |
354 // If there is a live OSR method that means that we deopted to the interpreter | 354 // If there is a live OSR method that means that we deopted to the interpreter |
355 // for the transition. | 355 // for the transition. |
356 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level); | 356 CompLevel osr_level = MIN2((CompLevel)method->highest_osr_comp_level(), next_level); |