aboutsummaryrefslogtreecommitdiff
path: root/src/share/vm/runtime
diff options
context:
space:
mode:
authorjiangli <none@none>2013-04-15 21:25:23 -0400
committerjiangli <none@none>2013-04-15 21:25:23 -0400
commite7b455fc9a6496a801216d22a5259b0187c02ab7 (patch)
tree06c95f51c880b6f9f7d841c5ecd7a13fc21710bc /src/share/vm/runtime
parent94587a094ebc1cdb2883fafaa994bde1a6f3d557 (diff)
parentfb81890b3987580c4cb3fe8fd0aa0821e787d9da (diff)
Merge
Diffstat (limited to 'src/share/vm/runtime')
-rw-r--r--src/share/vm/runtime/advancedThresholdPolicy.cpp13
-rw-r--r--src/share/vm/runtime/compilationPolicy.cpp65
-rw-r--r--src/share/vm/runtime/fprofiler.cpp5
-rw-r--r--src/share/vm/runtime/simpleThresholdPolicy.cpp8
-rw-r--r--src/share/vm/runtime/vmStructs.cpp17
5 files changed, 69 insertions, 39 deletions
diff --git a/src/share/vm/runtime/advancedThresholdPolicy.cpp b/src/share/vm/runtime/advancedThresholdPolicy.cpp
index ce5804a60..81c2b7473 100644
--- a/src/share/vm/runtime/advancedThresholdPolicy.cpp
+++ b/src/share/vm/runtime/advancedThresholdPolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -74,10 +74,11 @@ void AdvancedThresholdPolicy::initialize() {
// update_rate() is called from select_task() while holding a compile queue lock.
void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
+ JavaThread* THREAD = JavaThread::current();
if (is_old(m)) {
// We don't remove old methods from the queue,
// so we can just zero the rate.
- m->set_rate(0);
+ m->set_rate(0, THREAD);
return;
}
@@ -93,13 +94,13 @@ void AdvancedThresholdPolicy::update_rate(jlong t, Method* m) {
if (delta_s >= TieredRateUpdateMinTime) {
// And we must've taken the previous point at least 1ms before.
if (delta_t >= TieredRateUpdateMinTime && delta_e > 0) {
- m->set_prev_time(t);
- m->set_prev_event_count(event_count);
- m->set_rate((float)delta_e / (float)delta_t); // Rate is events per millisecond
+ m->set_prev_time(t, THREAD);
+ m->set_prev_event_count(event_count, THREAD);
+ m->set_rate((float)delta_e / (float)delta_t, THREAD); // Rate is events per millisecond
} else
if (delta_t > TieredRateUpdateMaxTime && delta_e == 0) {
// If nothing happened for 25ms, zero the rate. Don't modify prev values.
- m->set_rate(0);
+ m->set_rate(0, THREAD);
}
}
}
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
diff --git a/src/share/vm/runtime/fprofiler.cpp b/src/share/vm/runtime/fprofiler.cpp
index ce910b45f..111c4db5a 100644
--- a/src/share/vm/runtime/fprofiler.cpp
+++ b/src/share/vm/runtime/fprofiler.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -421,7 +421,8 @@ class interpretedNode : public ProfilerNode {
void print_method_on(outputStream* st) {
ProfilerNode::print_method_on(st);
- if (Verbose) method()->invocation_counter()->print_short();
+ MethodCounters* mcs = method()->method_counters();
+ if (Verbose && mcs != NULL) mcs->invocation_counter()->print_short();
}
};
diff --git a/src/share/vm/runtime/simpleThresholdPolicy.cpp b/src/share/vm/runtime/simpleThresholdPolicy.cpp
index fbb0f89c3..0752fac9d 100644
--- a/src/share/vm/runtime/simpleThresholdPolicy.cpp
+++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 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
@@ -153,8 +153,10 @@ void SimpleThresholdPolicy::set_carry_if_necessary(InvocationCounter *counter) {
// Set carry flags on the counters if necessary
void SimpleThresholdPolicy::handle_counter_overflow(Method* method) {
- set_carry_if_necessary(method->invocation_counter());
- set_carry_if_necessary(method->backedge_counter());
+ MethodCounters *mcs = method->method_counters();
+ assert(mcs != NULL, "");
+ set_carry_if_necessary(mcs->invocation_counter());
+ set_carry_if_necessary(mcs->backedge_counter());
MethodData* mdo = method->method_data();
if (mdo != NULL) {
set_carry_if_necessary(mdo->invocation_counter());
diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
index b00f6825d..5b5cdfbd1 100644
--- a/src/share/vm/runtime/vmStructs.cpp
+++ b/src/share/vm/runtime/vmStructs.cpp
@@ -77,6 +77,7 @@
#include "oops/klass.hpp"
#include "oops/markOop.hpp"
#include "oops/methodData.hpp"
+#include "oops/methodCounters.hpp"
#include "oops/method.hpp"
#include "oops/objArrayKlass.hpp"
#include "oops/objArrayOop.hpp"
@@ -348,16 +349,17 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
nonstatic_field(MethodData, _arg_local, intx) \
nonstatic_field(MethodData, _arg_stack, intx) \
nonstatic_field(MethodData, _arg_returned, intx) \
- nonstatic_field(Method, _constMethod, ConstMethod*) \
- nonstatic_field(Method, _method_data, MethodData*) \
- nonstatic_field(Method, _interpreter_invocation_count, int) \
+ nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
+ nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
+ nonstatic_field(MethodCounters, _number_of_breakpoints, u2) \
+ nonstatic_field(MethodCounters, _invocation_counter, InvocationCounter) \
+ nonstatic_field(MethodCounters, _backedge_counter, InvocationCounter) \
+ nonstatic_field(Method, _constMethod, ConstMethod*) \
+ nonstatic_field(Method, _method_data, MethodData*) \
+ nonstatic_field(Method, _method_counters, MethodCounters*) \
nonstatic_field(Method, _access_flags, AccessFlags) \
nonstatic_field(Method, _vtable_index, int) \
nonstatic_field(Method, _method_size, u2) \
- nonstatic_field(Method, _interpreter_throwout_count, u2) \
- nonstatic_field(Method, _number_of_breakpoints, u2) \
- nonstatic_field(Method, _invocation_counter, InvocationCounter) \
- nonstatic_field(Method, _backedge_counter, InvocationCounter) \
nonproduct_nonstatic_field(Method, _compiled_invocation_count, int) \
volatile_nonstatic_field(Method, _code, nmethod*) \
nonstatic_field(Method, _i2i_entry, address) \
@@ -1382,6 +1384,7 @@ typedef BinaryTreeDictionary<Metablock, FreeList> MetablockTreeDictionary;
declare_type(ConstantPoolCache, MetaspaceObj) \
declare_type(MethodData, Metadata) \
declare_type(Method, Metadata) \
+ declare_type(MethodCounters, MetaspaceObj) \
declare_type(ConstMethod, MetaspaceObj) \
\
declare_toplevel_type(Symbol) \