8148639: Some MethodCounter fields can be excluded when not including C2
Removed _interpreter_invocation_count and _interpreter_throwout_count fields for C1 Reviewed-by: kvn, coleenp
This commit is contained in:
parent
755b6af36e
commit
fbe049838a
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -47,8 +47,10 @@ public class MethodCounters extends Metadata {
|
||||
private static synchronized void initialize(TypeDataBase db) throws WrongTypeException {
|
||||
Type type = db.lookupType("MethodCounters");
|
||||
|
||||
interpreterInvocationCountField = new CIntField(type.getCIntegerField("_interpreter_invocation_count"), 0);
|
||||
interpreterThrowoutCountField = new CIntField(type.getCIntegerField("_interpreter_throwout_count"), 0);
|
||||
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);
|
||||
@ -61,11 +63,19 @@ public class MethodCounters extends Metadata {
|
||||
private static CIntField backedgeCounter;
|
||||
|
||||
public int interpreterInvocationCount() {
|
||||
return (int) interpreterInvocationCountField.getValue(this);
|
||||
if (interpreterInvocationCountField != null) {
|
||||
return (int) interpreterInvocationCountField.getValue(this);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public int interpreterThrowoutCount() {
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
if (interpreterThrowoutCountField != null) {
|
||||
return (int) interpreterThrowoutCountField.getValue(this);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public long getInvocationCounter() {
|
||||
if (Assert.ASSERTS_ENABLED) {
|
||||
|
@ -632,9 +632,11 @@ BytecodeInterpreter::run(interpreterState istate) {
|
||||
if (_compiling) {
|
||||
MethodCounters* mcs;
|
||||
GET_METHOD_COUNTERS(mcs);
|
||||
#if COMPILER2_OR_JVMCI
|
||||
if (ProfileInterpreter) {
|
||||
METHOD->increment_interpreter_invocation_count(THREAD);
|
||||
}
|
||||
#endif
|
||||
mcs->invocation_counter()->increment();
|
||||
if (mcs->invocation_counter()->reached_InvocationLimit(mcs->backedge_counter())) {
|
||||
CALL_VM((void)InterpreterRuntime::frequency_counter_overflow(THREAD, NULL), handle_exception);
|
||||
|
@ -523,8 +523,10 @@ IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThrea
|
||||
#ifndef CC_INTERP
|
||||
continuation = Interpreter::remove_activation_entry();
|
||||
#endif
|
||||
#if COMPILER2_OR_JVMCI
|
||||
// Count this for compilation purposes
|
||||
h_method->interpreter_throwout_increment(THREAD);
|
||||
#endif
|
||||
} else {
|
||||
// handler in this method => change bci/bcp to handler bci/bcp and continue there
|
||||
handler_pc = h_method->code_base() + handler_bci;
|
||||
|
@ -264,6 +264,7 @@ class Method : public Metadata {
|
||||
int highest_osr_comp_level() const;
|
||||
void set_highest_osr_comp_level(int level);
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
// Count of times method was exited via exception while interpreting
|
||||
void interpreter_throwout_increment(TRAPS) {
|
||||
MethodCounters* mcs = get_method_counters(CHECK);
|
||||
@ -271,6 +272,7 @@ class Method : public Metadata {
|
||||
mcs->interpreter_throwout_increment();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int interpreter_throwout_count() const {
|
||||
MethodCounters* mcs = method_counters();
|
||||
@ -407,11 +409,13 @@ class Method : public Metadata {
|
||||
return (mcs == NULL) ? 0 : mcs->interpreter_invocation_count();
|
||||
}
|
||||
}
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
int increment_interpreter_invocation_count(TRAPS) {
|
||||
if (TieredCompilation) ShouldNotReachHere();
|
||||
MethodCounters* mcs = get_method_counters(CHECK_0);
|
||||
return (mcs == NULL) ? 0 : mcs->increment_interpreter_invocation_count();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PRODUCT
|
||||
int compiled_invocation_count() const { return _compiled_invocation_count; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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
|
||||
@ -34,8 +34,10 @@ class MethodCounters: public MetaspaceObj {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
private:
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
int _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
|
||||
u2 _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
|
||||
#endif
|
||||
u2 _number_of_breakpoints; // fullspeed debugging support
|
||||
InvocationCounter _invocation_counter; // Incremented before each activation of the method - used to trigger frequency-based optimizations
|
||||
InvocationCounter _backedge_counter; // Incremented before each backedge taken - used to trigger frequencey-based optimizations
|
||||
@ -60,9 +62,7 @@ class MethodCounters: public MetaspaceObj {
|
||||
u1 _highest_osr_comp_level; // Same for OSR level
|
||||
#endif
|
||||
|
||||
MethodCounters(methodHandle mh) : _interpreter_invocation_count(0),
|
||||
_interpreter_throwout_count(0),
|
||||
_number_of_breakpoints(0),
|
||||
MethodCounters(methodHandle mh) : _number_of_breakpoints(0),
|
||||
_nmethod_age(INT_MAX)
|
||||
#ifdef TIERED
|
||||
, _rate(0),
|
||||
@ -71,6 +71,8 @@ class MethodCounters: public MetaspaceObj {
|
||||
_highest_osr_comp_level(0)
|
||||
#endif
|
||||
{
|
||||
set_interpreter_invocation_count(0);
|
||||
set_interpreter_throwout_count(0);
|
||||
invocation_counter()->init();
|
||||
backedge_counter()->init();
|
||||
|
||||
@ -109,6 +111,8 @@ class MethodCounters: public MetaspaceObj {
|
||||
|
||||
void clear_counters();
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
int interpreter_invocation_count() {
|
||||
return _interpreter_invocation_count;
|
||||
}
|
||||
@ -131,6 +135,24 @@ class MethodCounters: public MetaspaceObj {
|
||||
_interpreter_throwout_count = count;
|
||||
}
|
||||
|
||||
#else // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
int interpreter_invocation_count() {
|
||||
return 0;
|
||||
}
|
||||
void set_interpreter_invocation_count(int count) {
|
||||
assert(count == 0, "count must be 0");
|
||||
}
|
||||
|
||||
int interpreter_throwout_count() const {
|
||||
return 0;
|
||||
}
|
||||
void set_interpreter_throwout_count(int count) {
|
||||
assert(count == 0, "count must be 0");
|
||||
}
|
||||
|
||||
#endif // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
u2 number_of_breakpoints() const { return _number_of_breakpoints; }
|
||||
void incr_number_of_breakpoints() { ++_number_of_breakpoints; }
|
||||
void decr_number_of_breakpoints() { --_number_of_breakpoints; }
|
||||
@ -170,10 +192,25 @@ class MethodCounters: public MetaspaceObj {
|
||||
return byte_offset_of(MethodCounters, _nmethod_age);
|
||||
}
|
||||
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize interpreter_invocation_counter_offset() {
|
||||
return byte_offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
static int interpreter_invocation_counter_offset_in_bytes() {
|
||||
return offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
#else // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize interpreter_invocation_counter_offset() {
|
||||
ShouldNotReachHere();
|
||||
return in_ByteSize(0);
|
||||
}
|
||||
|
||||
#endif // defined(COMPILER2) || INCLUDE_JVMCI
|
||||
|
||||
static ByteSize invocation_counter_offset() {
|
||||
return byte_offset_of(MethodCounters, _invocation_counter);
|
||||
}
|
||||
@ -182,10 +219,6 @@ class MethodCounters: public MetaspaceObj {
|
||||
return byte_offset_of(MethodCounters, _backedge_counter);
|
||||
}
|
||||
|
||||
static int interpreter_invocation_counter_offset_in_bytes() {
|
||||
return offset_of(MethodCounters, _interpreter_invocation_count);
|
||||
}
|
||||
|
||||
static ByteSize interpreter_invocation_limit_offset() {
|
||||
return byte_offset_of(MethodCounters, _interpreter_invocation_limit);
|
||||
}
|
||||
|
@ -3595,6 +3595,11 @@ jint Arguments::finalize_vm_init_args(ArgumentBootClassPath* bcp_p, bool bcp_ass
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(COMPILER2) && !INCLUDE_JVMCI
|
||||
UNSUPPORTED_OPTION(ProfileInterpreter, "ProfileInterpreter");
|
||||
NOT_PRODUCT(UNSUPPORTED_OPTION(TraceProfileInterpreter, "TraceProfileInterpreter"));
|
||||
#endif
|
||||
|
||||
#ifndef TIERED
|
||||
// Tiered compilation is undefined.
|
||||
UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation");
|
||||
|
@ -384,8 +384,8 @@ typedef CompactHashtable<Symbol*, char> SymbolCompactHashTable;
|
||||
nonstatic_field(MethodCounters, _interpreter_profile_limit, int) \
|
||||
nonstatic_field(MethodCounters, _invoke_mask, int) \
|
||||
nonstatic_field(MethodCounters, _backedge_mask, int) \
|
||||
nonstatic_field(MethodCounters, _interpreter_invocation_count, int) \
|
||||
nonstatic_field(MethodCounters, _interpreter_throwout_count, u2) \
|
||||
COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(MethodCounters, _interpreter_invocation_count, int)) \
|
||||
COMPILER2_OR_JVMCI_PRESENT(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) \
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 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
|
||||
@ -206,6 +206,17 @@
|
||||
#define NOT_COMPILER2(code) code
|
||||
#endif // COMPILER2
|
||||
|
||||
// COMPILER2 or JVMCI
|
||||
#if defined(COMPILER2) || INCLUDE_JVMCI
|
||||
#define COMPILER2_OR_JVMCI 1
|
||||
#define COMPILER2_OR_JVMCI_PRESENT(code) code
|
||||
#define NOT_COMPILER2_OR_JVMCI(code)
|
||||
#else
|
||||
#define COMPILER2_OR_JVMCI 0
|
||||
#define COMPILER2_OR_JVMCI_PRESENT(code)
|
||||
#define NOT_COMPILER2_OR_JVMCI(code) code
|
||||
#endif
|
||||
|
||||
#ifdef TIERED
|
||||
#define TIERED_ONLY(code) code
|
||||
#define NOT_TIERED(code)
|
||||
|
Loading…
x
Reference in New Issue
Block a user