114 // See select_task().
115 bool AdvancedThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
116 jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
117 jlong delta_t = t - m->prev_time();
118 if (delta_t > timeout && delta_s > timeout) {
119 int event_count = m->invocation_count() + m->backedge_count();
120 int delta_e = event_count - m->prev_event_count();
121 // Return true if there were no events.
122 return delta_e == 0;
123 }
124 return false;
125 }
126
127 // We don't remove old methods from the compile queue even if they have
128 // very low activity. See select_task().
129 bool AdvancedThresholdPolicy::is_old(Method* method) {
130 return method->invocation_count() > 50000 || method->backedge_count() > 500000;
131 }
132
133 double AdvancedThresholdPolicy::weight(Method* method) {
134 return (method->rate() + 1) * ((method->invocation_count() + 1) * (method->backedge_count() + 1));
135 }
136
137 // Apply heuristics and return true if x should be compiled before y
138 bool AdvancedThresholdPolicy::compare_methods(Method* x, Method* y) {
139 if (x->highest_comp_level() > y->highest_comp_level()) {
140 // recompilation after deopt
141 return true;
142 } else
143 if (x->highest_comp_level() == y->highest_comp_level()) {
144 if (weight(x) > weight(y)) {
145 return true;
146 }
147 }
148 return false;
149 }
150
151 // Is method profiled enough?
152 bool AdvancedThresholdPolicy::is_method_profiled(Method* method) {
153 MethodData* mdo = method->method_data();
154 if (mdo != NULL) {
|
114 // See select_task().
115 bool AdvancedThresholdPolicy::is_stale(jlong t, jlong timeout, Method* m) {
116 jlong delta_s = t - SafepointSynchronize::end_of_last_safepoint();
117 jlong delta_t = t - m->prev_time();
118 if (delta_t > timeout && delta_s > timeout) {
119 int event_count = m->invocation_count() + m->backedge_count();
120 int delta_e = event_count - m->prev_event_count();
121 // Return true if there were no events.
122 return delta_e == 0;
123 }
124 return false;
125 }
126
127 // We don't remove old methods from the compile queue even if they have
128 // very low activity. See select_task().
129 bool AdvancedThresholdPolicy::is_old(Method* method) {
130 return method->invocation_count() > 50000 || method->backedge_count() > 500000;
131 }
132
133 double AdvancedThresholdPolicy::weight(Method* method) {
134 return (double)(method->rate() + 1) *
135 (method->invocation_count() + 1) * (method->backedge_count() + 1);
136 }
137
138 // Apply heuristics and return true if x should be compiled before y
139 bool AdvancedThresholdPolicy::compare_methods(Method* x, Method* y) {
140 if (x->highest_comp_level() > y->highest_comp_level()) {
141 // recompilation after deopt
142 return true;
143 } else
144 if (x->highest_comp_level() == y->highest_comp_level()) {
145 if (weight(x) > weight(y)) {
146 return true;
147 }
148 }
149 return false;
150 }
151
152 // Is method profiled enough?
153 bool AdvancedThresholdPolicy::is_method_profiled(Method* method) {
154 MethodData* mdo = method->method_data();
155 if (mdo != NULL) {
|