comparison src/share/vm/runtime/advancedThresholdPolicy.hpp @ 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 91eba9f82325
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.
97 * where $i$ is the number of method invocations, $b$ number of backedges and $s$ is the scaling 97 * where $i$ is the number of method invocations, $b$ number of backedges and $s$ is the scaling
98 * coefficient that will be discussed further. 98 * coefficient that will be discussed further.
99 * The intuition is to equalize the time that is spend profiling each method. 99 * The intuition is to equalize the time that is spend profiling each method.
100 * The same predicate is used to control the transition from level 3 to level 4 (C2). It should be 100 * The same predicate is used to control the transition from level 3 to level 4 (C2). It should be
101 * noted though that the thresholds are relative. Moreover i and b for the 0->3 transition come 101 * noted though that the thresholds are relative. Moreover i and b for the 0->3 transition come
102 * from methodOop and for 3->4 transition they come from MDO (since profiled invocations are 102 * from Method* and for 3->4 transition they come from MDO (since profiled invocations are
103 * counted separately). 103 * counted separately).
104 * 104 *
105 * OSR transitions are controlled simply with b > TierXBackEdgeThreshold * s predicates. 105 * OSR transitions are controlled simply with b > TierXBackEdgeThreshold * s predicates.
106 * 106 *
107 * - Tier?LoadFeedback options are used to automatically scale the predicates described above depending 107 * - Tier?LoadFeedback options are used to automatically scale the predicates described above depending
166 // Predicates also take compiler load into account. 166 // Predicates also take compiler load into account.
167 typedef bool (AdvancedThresholdPolicy::*Predicate)(int i, int b, CompLevel cur_level); 167 typedef bool (AdvancedThresholdPolicy::*Predicate)(int i, int b, CompLevel cur_level);
168 bool call_predicate(int i, int b, CompLevel cur_level); 168 bool call_predicate(int i, int b, CompLevel cur_level);
169 bool loop_predicate(int i, int b, CompLevel cur_level); 169 bool loop_predicate(int i, int b, CompLevel cur_level);
170 // Common transition function. Given a predicate determines if a method should transition to another level. 170 // Common transition function. Given a predicate determines if a method should transition to another level.
171 CompLevel common(Predicate p, methodOop method, CompLevel cur_level, bool disable_feedback = false); 171 CompLevel common(Predicate p, Method* method, CompLevel cur_level, bool disable_feedback = false);
172 // Transition functions. 172 // Transition functions.
173 // call_event determines if a method should be compiled at a different 173 // call_event determines if a method should be compiled at a different
174 // level with a regular invocation entry. 174 // level with a regular invocation entry.
175 CompLevel call_event(methodOop method, CompLevel cur_level); 175 CompLevel call_event(Method* method, CompLevel cur_level);
176 // loop_event checks if a method should be OSR compiled at a different 176 // loop_event checks if a method should be OSR compiled at a different
177 // level. 177 // level.
178 CompLevel loop_event(methodOop method, CompLevel cur_level); 178 CompLevel loop_event(Method* method, CompLevel cur_level);
179 // Has a method been long around? 179 // Has a method been long around?
180 // We don't remove old methods from the compile queue even if they have 180 // We don't remove old methods from the compile queue even if they have
181 // very low activity (see select_task()). 181 // very low activity (see select_task()).
182 inline bool is_old(methodOop method); 182 inline bool is_old(Method* method);
183 // Was a given method inactive for a given number of milliseconds. 183 // Was a given method inactive for a given number of milliseconds.
184 // If it is, we would remove it from the queue (see select_task()). 184 // If it is, we would remove it from the queue (see select_task()).
185 inline bool is_stale(jlong t, jlong timeout, methodOop m); 185 inline bool is_stale(jlong t, jlong timeout, Method* m);
186 // Compute the weight of the method for the compilation scheduling 186 // Compute the weight of the method for the compilation scheduling
187 inline double weight(methodOop method); 187 inline double weight(Method* method);
188 // Apply heuristics and return true if x should be compiled before y 188 // Apply heuristics and return true if x should be compiled before y
189 inline bool compare_methods(methodOop x, methodOop y); 189 inline bool compare_methods(Method* x, Method* y);
190 // Compute event rate for a given method. The rate is the number of event (invocations + backedges) 190 // Compute event rate for a given method. The rate is the number of event (invocations + backedges)
191 // per millisecond. 191 // per millisecond.
192 inline void update_rate(jlong t, methodOop m); 192 inline void update_rate(jlong t, Method* m);
193 // Compute threshold scaling coefficient 193 // Compute threshold scaling coefficient
194 inline double threshold_scale(CompLevel level, int feedback_k); 194 inline double threshold_scale(CompLevel level, int feedback_k);
195 // If a method is old enough and is still in the interpreter we would want to 195 // If a method is old enough and is still in the interpreter we would want to
196 // start profiling without waiting for the compiled method to arrive. This function 196 // start profiling without waiting for the compiled method to arrive. This function
197 // determines whether we should do that. 197 // determines whether we should do that.
198 inline bool should_create_mdo(methodOop method, CompLevel cur_level); 198 inline bool should_create_mdo(Method* method, CompLevel cur_level);
199 // Create MDO if necessary. 199 // Create MDO if necessary.
200 void create_mdo(methodHandle mh, JavaThread* thread); 200 void create_mdo(methodHandle mh, JavaThread* thread);
201 // Is method profiled enough? 201 // Is method profiled enough?
202 bool is_method_profiled(methodOop method); 202 bool is_method_profiled(Method* method);
203 203
204 protected: 204 protected:
205 void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level); 205 void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
206 206
207 void set_start_time(jlong t) { _start_time = t; } 207 void set_start_time(jlong t) { _start_time = t; }