< prev index next >
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/MethodCounters.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2016 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -45,12 +45,14 @@
}
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
Type type = db.lookupType("MethodCounters");
+ if (VM.getVM().isServerCompiler()) {
interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0);
interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0);
+ }
if (!VM.getVM().isCore()) {
invocationCounter = new CIntField(type.getCIntegerField("_invocation_counter"), 0);
backedgeCounter = new CIntField(type.getCIntegerField("_backedge_counter"), 0);
}
}
@@ -59,15 +61,23 @@
private static CIntField interpreterThrowoutCountField;
private static CIntField invocationCounter;
private static CIntField backedgeCounter;
public int interpreterInvocationCount() {
+ if (interpreterInvocationCountField != null) {
return (int) interpreterInvocationCountField.getValue(this);
+ } else {
+ return 0;
+ }
}
public int interpreterThrowoutCount() {
+ if (interpreterThrowoutCountField != null) {
return (int) interpreterThrowoutCountField.getValue(this);
+ } else {
+ return 0;
+ }
}
public long getInvocationCounter() {
if (Assert.ASSERTS_ENABLED) {
Assert.that(!VM.getVM().isCore(), "must not be used in core build");
}
< prev index next >