diff options
author | jiangli <none@none> | 2013-04-15 21:25:23 -0400 |
---|---|---|
committer | jiangli <none@none> | 2013-04-15 21:25:23 -0400 |
commit | e7b455fc9a6496a801216d22a5259b0187c02ab7 (patch) | |
tree | 06c95f51c880b6f9f7d841c5ecd7a13fc21710bc /src/share/vm/runtime/compilationPolicy.cpp | |
parent | 94587a094ebc1cdb2883fafaa994bde1a6f3d557 (diff) | |
parent | fb81890b3987580c4cb3fe8fd0aa0821e787d9da (diff) |
Merge
Diffstat (limited to 'src/share/vm/runtime/compilationPolicy.cpp')
-rw-r--r-- | src/share/vm/runtime/compilationPolicy.cpp | 65 |
1 files changed, 44 insertions, 21 deletions
diff --git a/src/share/vm/runtime/compilationPolicy.cpp b/src/share/vm/runtime/compilationPolicy.cpp index 71fa794cd..11607385a 100644 --- a/src/share/vm/runtime/compilationPolicy.cpp +++ b/src/share/vm/runtime/compilationPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -198,8 +198,10 @@ void NonTieredCompPolicy::reset_counter_for_invocation_event(methodHandle m) { // BUT also make sure the method doesn't look like it was never executed. // Set carry bit and reduce counter's value to min(count, CompileThreshold/2). - m->invocation_counter()->set_carry(); - m->backedge_counter()->set_carry(); + MethodCounters* mcs = m->method_counters(); + assert(mcs != NULL, "MethodCounters cannot be NULL for profiling"); + mcs->invocation_counter()->set_carry(); + mcs->backedge_counter()->set_carry(); assert(!m->was_never_executed(), "don't reset to 0 -- could be mistaken for never-executed"); } @@ -207,8 +209,10 @@ void NonTieredCompPolicy::reset_counter_for_invocation_event(methodHandle m) { void NonTieredCompPolicy::reset_counter_for_back_branch_event(methodHandle m) { // Delay next back-branch event but pump up invocation counter to triger // whole method compilation. - InvocationCounter* i = m->invocation_counter(); - InvocationCounter* b = m->backedge_counter(); + MethodCounters* mcs = m->method_counters(); + assert(mcs != NULL, "MethodCounters cannot be NULL for profiling"); + InvocationCounter* i = mcs->invocation_counter(); + InvocationCounter* b = mcs->backedge_counter(); // Don't set invocation_counter's value too low otherwise the method will // look like immature (ic < ~5300) which prevents the inlining based on @@ -227,7 +231,10 @@ void NonTieredCompPolicy::reset_counter_for_back_branch_event(methodHandle m) { class CounterDecay : public AllStatic { static jlong _last_timestamp; static void do_method(Method* m) { - m->invocation_counter()->decay(); + MethodCounters* mcs = m->method_counters(); + if (mcs != NULL) { + mcs->invocation_counter()->decay(); + } } public: static void decay(); @@ -265,30 +272,44 @@ void NonTieredCompPolicy::do_safepoint_work() { void NonTieredCompPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) { ScopeDesc* sd = trap_scope; + MethodCounters* mcs; + InvocationCounter* c; for (; !sd->is_top(); sd = sd->sender()) { - // Reset ICs of inlined methods, since they can trigger compilations also. - sd->method()->invocation_counter()->reset(); + mcs = sd->method()->method_counters(); + if (mcs != NULL) { + // Reset ICs of inlined methods, since they can trigger compilations also. + mcs->invocation_counter()->reset(); + } } - InvocationCounter* c = sd->method()->invocation_counter(); - if (is_osr) { - // It was an OSR method, so bump the count higher. - c->set(c->state(), CompileThreshold); - } else { - c->reset(); + mcs = sd->method()->method_counters(); + if (mcs != NULL) { + c = mcs->invocation_counter(); + if (is_osr) { + // It was an OSR method, so bump the count higher. + c->set(c->state(), CompileThreshold); + } else { + c->reset(); + } + mcs->backedge_counter()->reset(); } - sd->method()->backedge_counter()->reset(); } // This method can be called by any component of the runtime to notify the policy // that it's recommended to delay the complation of this method. void NonTieredCompPolicy::delay_compilation(Method* method) { - method->invocation_counter()->decay(); - method->backedge_counter()->decay(); + MethodCounters* mcs = method->method_counters(); + if (mcs != NULL) { + mcs->invocation_counter()->decay(); + mcs->backedge_counter()->decay(); + } } void NonTieredCompPolicy::disable_compilation(Method* method) { - method->invocation_counter()->set_state(InvocationCounter::wait_for_nothing); - method->backedge_counter()->set_state(InvocationCounter::wait_for_nothing); + MethodCounters* mcs = method->method_counters(); + if (mcs != NULL) { + mcs->invocation_counter()->set_state(InvocationCounter::wait_for_nothing); + mcs->backedge_counter()->set_state(InvocationCounter::wait_for_nothing); + } } CompileTask* NonTieredCompPolicy::select_task(CompileQueue* compile_queue) { @@ -371,8 +392,10 @@ nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, i #ifndef PRODUCT void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) { if (TraceInvocationCounterOverflow) { - InvocationCounter* ic = m->invocation_counter(); - InvocationCounter* bc = m->backedge_counter(); + MethodCounters* mcs = m->method_counters(); + assert(mcs != NULL, "MethodCounters cannot be NULL for profiling"); + InvocationCounter* ic = mcs->invocation_counter(); + InvocationCounter* bc = mcs->backedge_counter(); ResourceMark rm; const char* msg = bci == InvocationEntryBci |