8231471: Obsolete -XX:CompilationPolicyChoice
Reviewed-by: kvn, dholmes, thartmann
--- a/src/hotspot/share/compiler/compilerDefinitions.cpp Thu Sep 26 17:49:44 2019 +0200
+++ b/src/hotspot/share/compiler/compilerDefinitions.cpp Fri Sep 27 12:46:14 2019 +0200
@@ -188,14 +188,6 @@
#endif // TIERED
void CompilerConfig::set_tiered_flags() {
- // With tiered, set default policy to SimpleThresholdPolicy, which is 2.
- if (FLAG_IS_DEFAULT(CompilationPolicyChoice)) {
- FLAG_SET_DEFAULT(CompilationPolicyChoice, 2);
- }
- if (CompilationPolicyChoice < 2) {
- vm_exit_during_initialization(
- "Incompatible compilation policy selected", NULL);
- }
// Increase the code cache size - tiered compiles a lot more.
if (FLAG_IS_DEFAULT(ReservedCodeCacheSize)) {
FLAG_SET_ERGO(ReservedCodeCacheSize,
@@ -420,17 +412,6 @@
if (TieredCompilation) {
set_tiered_flags();
} else {
- int max_compilation_policy_choice = 1;
-#ifdef COMPILER2
- if (is_server_compilation_mode_vm()) {
- max_compilation_policy_choice = 2;
- }
-#endif
- // Check if the policy is valid.
- if (CompilationPolicyChoice >= max_compilation_policy_choice) {
- vm_exit_during_initialization(
- "Incompatible compilation policy selected", NULL);
- }
// Scale CompileThreshold
// CompileThresholdScaling == 0.0 is equivalent to -Xint and leaves CompileThreshold unchanged.
if (!FLAG_IS_DEFAULT(CompileThresholdScaling) && CompileThresholdScaling > 0.0) {
--- a/src/hotspot/share/runtime/arguments.cpp Thu Sep 26 17:49:44 2019 +0200
+++ b/src/hotspot/share/runtime/arguments.cpp Fri Sep 27 12:46:14 2019 +0200
@@ -526,7 +526,6 @@
{ "MinRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "InitialRAMFraction", JDK_Version::jdk(10), JDK_Version::undefined(), JDK_Version::undefined() },
{ "UseMembar", JDK_Version::jdk(10), JDK_Version::jdk(12), JDK_Version::undefined() },
- { "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::undefined() },
{ "AllowJNIEnvProxy", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
{ "ThreadLocalHandshakes", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
{ "AllowRedefinitionToAddDeleteMethods", JDK_Version::jdk(13), JDK_Version::undefined(), JDK_Version::undefined() },
@@ -547,6 +546,7 @@
{ "SharedReadOnlySize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscDataSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
{ "SharedMiscCodeSize", JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
+ { "CompilationPolicyChoice", JDK_Version::jdk(13), JDK_Version::jdk(14), JDK_Version::jdk(15) },
{ "FailOverToOldVerifier", JDK_Version::undefined(), JDK_Version::jdk(14), JDK_Version::jdk(15) },
{ "BindGCTaskThreadsToCPUs", JDK_Version::undefined(), JDK_Version::jdk(14), JDK_Version::jdk(16) },
{ "UseGCTaskAffinity", JDK_Version::undefined(), JDK_Version::jdk(14), JDK_Version::jdk(16) },
--- a/src/hotspot/share/runtime/compilationPolicy.cpp Thu Sep 26 17:49:44 2019 +0200
+++ b/src/hotspot/share/runtime/compilationPolicy.cpp Fri Sep 27 12:46:14 2019 +0200
@@ -36,7 +36,6 @@
#include "runtime/compilationPolicy.hpp"
#include "runtime/frame.hpp"
#include "runtime/handles.inline.hpp"
-#include "runtime/rframe.hpp"
#include "runtime/stubRoutines.hpp"
#include "runtime/thread.hpp"
#include "runtime/tieredThresholdPolicy.hpp"
@@ -56,28 +55,16 @@
// Determine compilation policy based on command line argument
void compilationPolicy_init() {
- switch(CompilationPolicyChoice) {
- case 0:
+ #ifdef TIERED
+ if (TieredCompilation) {
+ CompilationPolicy::set_policy(new TieredThresholdPolicy());
+ } else {
CompilationPolicy::set_policy(new SimpleCompPolicy());
- break;
+ }
+ #else
+ CompilationPolicy::set_policy(new SimpleCompPolicy());
+ #endif
- case 1:
-#ifdef COMPILER2
- CompilationPolicy::set_policy(new StackWalkCompPolicy());
-#else
- Unimplemented();
-#endif
- break;
- case 2:
-#ifdef TIERED
- CompilationPolicy::set_policy(new TieredThresholdPolicy());
-#else
- Unimplemented();
-#endif
- break;
- default:
- fatal("CompilationPolicyChoice must be in the range: [0-2]");
- }
CompilationPolicy::policy()->initialize();
}
@@ -519,208 +506,3 @@
NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));)
}
}
-// StackWalkCompPolicy - walk up stack to find a suitable method to compile
-
-#ifdef COMPILER2
-const char* StackWalkCompPolicy::_msg = NULL;
-
-
-// Consider m for compilation
-void StackWalkCompPolicy::method_invocation_event(const methodHandle& m, JavaThread* thread) {
- const int comp_level = CompLevel_highest_tier;
- const int hot_count = m->invocation_count();
- reset_counter_for_invocation_event(m);
-
- if (is_compilation_enabled() && m->code() == NULL && can_be_compiled(m, comp_level)) {
- ResourceMark rm(thread);
- frame fr = thread->last_frame();
- assert(fr.is_interpreted_frame(), "must be interpreted");
- assert(fr.interpreter_frame_method() == m(), "bad method");
-
- RegisterMap reg_map(thread, false);
- javaVFrame* triggerVF = thread->last_java_vframe(®_map);
- // triggerVF is the frame that triggered its counter
- RFrame* first = new InterpretedRFrame(triggerVF->fr(), thread, m());
-
- if (first->top_method()->code() != NULL) {
- // called obsolete method/nmethod -- no need to recompile
- } else {
- GrowableArray<RFrame*>* stack = new GrowableArray<RFrame*>(50);
- stack->push(first);
- RFrame* top = findTopInlinableFrame(stack);
- assert(top != NULL, "findTopInlinableFrame returned null");
- CompileBroker::compile_method(top->top_method(), InvocationEntryBci, comp_level,
- m, hot_count, CompileTask::Reason_InvocationCount, thread);
- }
- }
-}
-
-void StackWalkCompPolicy::method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) {
- const int comp_level = CompLevel_highest_tier;
- const int hot_count = m->backedge_count();
-
- if (is_compilation_enabled() && can_be_osr_compiled(m, comp_level)) {
- CompileBroker::compile_method(m, bci, comp_level, m, hot_count, CompileTask::Reason_BackedgeCount, thread);
- NOT_PRODUCT(trace_osr_completion(m->lookup_osr_nmethod_for(bci, comp_level, true));)
- }
-}
-
-RFrame* StackWalkCompPolicy::findTopInlinableFrame(GrowableArray<RFrame*>* stack) {
- // go up the stack until finding a frame that (probably) won't be inlined
- // into its caller
- RFrame* current = stack->at(0); // current choice for stopping
- assert( current && !current->is_compiled(), "" );
- const char* msg = NULL;
-
- while (1) {
-
- // before going up the stack further, check if doing so would get us into
- // compiled code
- RFrame* next = senderOf(current, stack);
- if( !next ) // No next frame up the stack?
- break; // Then compile with current frame
-
- Method* m = current->top_method();
- Method* next_m = next->top_method();
-
- if( !Inline ) { // Inlining turned off
- msg = "Inlining turned off";
- break;
- }
- if (next_m->is_not_compilable()) { // Did fail to compile this before/
- msg = "caller not compilable";
- break;
- }
- if (next->num() > MaxRecompilationSearchLength) {
- // don't go up too high when searching for recompilees
- msg = "don't go up any further: > MaxRecompilationSearchLength";
- break;
- }
- if (next->distance() > MaxInterpretedSearchLength) {
- // don't go up too high when searching for recompilees
- msg = "don't go up any further: next > MaxInterpretedSearchLength";
- break;
- }
- // Compiled frame above already decided not to inline;
- // do not recompile him.
- if (next->is_compiled()) {
- msg = "not going up into optimized code";
- break;
- }
-
- // Interpreted frame above us was already compiled. Do not force
- // a recompile, although if the frame above us runs long enough an
- // OSR might still happen.
- if( current->is_interpreted() && next_m->has_compiled_code() ) {
- msg = "not going up -- already compiled caller";
- break;
- }
-
- // Compute how frequent this call site is. We have current method 'm'.
- // We know next method 'next_m' is interpreted. Find the call site and
- // check the various invocation counts.
- int invcnt = 0; // Caller counts
- if (ProfileInterpreter) {
- invcnt = next_m->interpreter_invocation_count();
- }
- int cnt = 0; // Call site counts
- if (ProfileInterpreter && next_m->method_data() != NULL) {
- ResourceMark rm;
- int bci = next->top_vframe()->bci();
- ProfileData* data = next_m->method_data()->bci_to_data(bci);
- if (data != NULL && data->is_CounterData())
- cnt = data->as_CounterData()->count();
- }
-
- // Caller counts / call-site counts; i.e. is this call site
- // a hot call site for method next_m?
- int freq = (invcnt) ? cnt/invcnt : cnt;
-
- // Check size and frequency limits
- if ((msg = shouldInline(m, freq, cnt)) != NULL) {
- break;
- }
- // Check inlining negative tests
- if ((msg = shouldNotInline(m)) != NULL) {
- break;
- }
-
-
- // If the caller method is too big or something then we do not want to
- // compile it just to inline a method
- if (!can_be_compiled(next_m, CompLevel_any)) {
- msg = "caller cannot be compiled";
- break;
- }
-
- if( next_m->name() == vmSymbols::class_initializer_name() ) {
- msg = "do not compile class initializer (OSR ok)";
- break;
- }
-
- current = next;
- }
-
- assert( !current || !current->is_compiled(), "" );
-
- return current;
-}
-
-RFrame* StackWalkCompPolicy::senderOf(RFrame* rf, GrowableArray<RFrame*>* stack) {
- RFrame* sender = rf->caller();
- if (sender && sender->num() == stack->length()) stack->push(sender);
- return sender;
-}
-
-
-const char* StackWalkCompPolicy::shouldInline(const methodHandle& m, float freq, int cnt) {
- // Allows targeted inlining
- // positive filter: should send be inlined? returns NULL (--> yes)
- // or rejection msg
- int max_size = MaxInlineSize;
- int cost = m->code_size();
-
- // Check for too many throws (and not too huge)
- if (m->interpreter_throwout_count() > InlineThrowCount && cost < InlineThrowMaxSize ) {
- return NULL;
- }
-
- // bump the max size if the call is frequent
- if ((freq >= InlineFrequencyRatio) || (cnt >= InlineFrequencyCount)) {
- if (TraceFrequencyInlining) {
- tty->print("(Inlined frequent method)\n");
- m->print();
- }
- max_size = FreqInlineSize;
- }
- if (cost > max_size) {
- return (_msg = "too big");
- }
- return NULL;
-}
-
-
-const char* StackWalkCompPolicy::shouldNotInline(const methodHandle& m) {
- // negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg
- if (m->is_abstract()) return (_msg = "abstract method");
- // note: we allow ik->is_abstract()
- if (!m->method_holder()->is_initialized()) return (_msg = "method holder not initialized");
- if (m->is_native()) return (_msg = "native method");
- CompiledMethod* m_code = m->code();
- if (m_code != NULL && m_code->code_size() > InlineSmallCode)
- return (_msg = "already compiled into a big method");
-
- // use frequency-based objections only for non-trivial methods
- if (m->code_size() <= MaxTrivialSize) return NULL;
- if (UseInterpreter) { // don't use counts with -Xcomp
- if ((m->code() == NULL) && m->was_never_executed()) return (_msg = "never executed");
- if (!m->was_executed_more_than(MIN2(MinInliningThreshold, CompileThreshold >> 1))) return (_msg = "executed < MinInliningThreshold times");
- }
- if (Method::has_unloaded_classes_in_signature(m, JavaThread::current())) return (_msg = "unloaded signature classes");
-
- return NULL;
-}
-
-
-
-#endif // COMPILER2
--- a/src/hotspot/share/runtime/compilationPolicy.hpp Thu Sep 26 17:49:44 2019 +0200
+++ b/src/hotspot/share/runtime/compilationPolicy.hpp Fri Sep 27 12:46:14 2019 +0200
@@ -36,7 +36,6 @@
// interpreted).
class CompileTask;
class CompileQueue;
-class RFrame;
class CompilationPolicy : public CHeapObj<mtCompiler> {
static CompilationPolicy* _policy;
@@ -116,28 +115,4 @@
virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
};
-// StackWalkCompPolicy - existing C2 policy
-
-#ifdef COMPILER2
-class StackWalkCompPolicy : public NonTieredCompPolicy {
- public:
- virtual void method_invocation_event(const methodHandle& m, JavaThread* thread);
- virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
-
- private:
- RFrame* findTopInlinableFrame(GrowableArray<RFrame*>* stack);
- RFrame* senderOf(RFrame* rf, GrowableArray<RFrame*>* stack);
-
- // the following variables hold values computed by the last inlining decision
- // they are used for performance debugging only (print better messages)
- static const char* _msg; // reason for not inlining
-
- static const char* shouldInline (const methodHandle& callee, float frequency, int cnt);
- // positive filter: should send be inlined? returns NULL (--> yes) or rejection msg
- static const char* shouldNotInline(const methodHandle& callee);
- // negative filter: should send NOT be inlined? returns NULL (--> inline) or rejection msg
-
-};
-#endif
-
#endif // SHARE_RUNTIME_COMPILATIONPOLICY_HPP
--- a/src/hotspot/share/runtime/globals.hpp Thu Sep 26 17:49:44 2019 +0200
+++ b/src/hotspot/share/runtime/globals.hpp Fri Sep 27 12:46:14 2019 +0200
@@ -1017,10 +1017,6 @@
"Inject thread creation failures for " \
"UseDynamicNumberOfCompilerThreads") \
\
- product(intx, CompilationPolicyChoice, 0, \
- "which compilation policy (0-2)") \
- range(0, 2) \
- \
develop(bool, UseStackBanging, true, \
"use stack banging for stack overflow checks (required for " \
"proper StackOverflow handling; disable only to measure cost " \
@@ -2143,14 +2139,6 @@
"% of CompileThreshold) before profiling in the interpreter") \
range(0, 100) \
\
- develop(intx, MaxRecompilationSearchLength, 10, \
- "The maximum number of frames to inspect when searching for " \
- "recompilee") \
- \
- develop(intx, MaxInterpretedSearchLength, 3, \
- "The maximum number of interpreted frames to skip when searching "\
- "for recompilee") \
- \
develop(intx, DesiredMethodLimit, 8000, \
"The desired maximum method size (in bytecodes) after inlining") \
\
--- a/src/hotspot/share/runtime/rframe.cpp Thu Sep 26 17:49:44 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 1997, 2018, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "code/codeCache.hpp"
-#include "interpreter/interpreter.hpp"
-#include "oops/method.inline.hpp"
-#include "oops/oop.inline.hpp"
-#include "oops/symbol.hpp"
-#include "runtime/frame.inline.hpp"
-#include "runtime/rframe.hpp"
-#include "runtime/vframe.hpp"
-#include "runtime/vframe_hp.hpp"
-
-
-static RFrame*const noCaller = (RFrame*) 0x1; // no caller (i.e., initial frame)
-static RFrame*const noCallerYet = (RFrame*) 0x0; // caller not yet computed
-
-RFrame::RFrame(frame fr, JavaThread* thread, RFrame*const callee) :
- _fr(fr), _thread(thread), _callee(callee), _num(callee ? callee->num() + 1 : 0) {
- _caller = (RFrame*)noCallerYet;
- _invocations = 0;
- _distance = 0;
-}
-
-void RFrame::set_distance(int d) {
- assert(is_compiled() || d >= 0, "should be positive");
- _distance = d;
-}
-
-InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, RFrame*const callee)
-: RFrame(fr, thread, callee) {
- RegisterMap map(thread, false);
- _vf = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
- _method = _vf->method();
- assert( _vf->is_interpreted_frame(), "must be interpreted");
- init();
-}
-
-InterpretedRFrame::InterpretedRFrame(frame fr, JavaThread* thread, Method* m)
-: RFrame(fr, thread, NULL) {
- RegisterMap map(thread, false);
- _vf = javaVFrame::cast(vframe::new_vframe(&_fr, &map, thread));
- _method = m;
-
- assert( _vf->is_interpreted_frame(), "must be interpreted");
- init();
-}
-
-CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread, RFrame*const callee)
-: RFrame(fr, thread, callee) {
- init();
-}
-
-CompiledRFrame::CompiledRFrame(frame fr, JavaThread* thread)
-: RFrame(fr, thread, NULL) {
- init();
-}
-
-DeoptimizedRFrame::DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const callee)
-: InterpretedRFrame(fr, thread, callee) {}
-
-RFrame* RFrame::new_RFrame(frame fr, JavaThread* thread, RFrame*const callee) {
- RFrame* rf = NULL;
- int dist = callee ? callee->distance() : -1;
- if (fr.is_interpreted_frame()) {
- rf = new InterpretedRFrame(fr, thread, callee);
- dist++;
- } else if (fr.is_compiled_frame()) {
- // Even deopted frames look compiled because the deopt
- // is invisible until it happens.
- rf = new CompiledRFrame(fr, thread, callee);
- } else {
- assert(false, "Unhandled frame type");
- }
- if (rf != NULL) {
- rf->set_distance(dist);
- rf->init();
- }
- return rf;
-}
-
-RFrame* RFrame::caller() {
- if (_caller != noCallerYet) return (_caller == noCaller) ? NULL : _caller; // already computed caller
-
- // caller not yet computed; do it now
- if (_fr.is_first_java_frame()) {
- _caller = (RFrame*)noCaller;
- return NULL;
- }
-
- RegisterMap map(_thread, false);
- frame sender = _fr.real_sender(&map);
- if (sender.is_java_frame()) {
- _caller = new_RFrame(sender, thread(), this);
- return _caller;
- }
-
- // Real caller is not java related
- _caller = (RFrame*)noCaller;
- return NULL;
-}
-
-int InterpretedRFrame::cost() const {
- return _method->code_size(); // fix this
- //return _method->estimated_inline_cost(_receiverKlass);
-}
-
-int CompiledRFrame::cost() const {
- CompiledMethod* nm = top_method()->code();
- if (nm != NULL) {
- return nm->insts_size();
- } else {
- return top_method()->code_size();
- }
-}
-
-void CompiledRFrame::init() {
- RegisterMap map(thread(), false);
- vframe* vf = vframe::new_vframe(&_fr, &map, thread());
- assert(vf->is_compiled_frame(), "must be compiled");
- _nm = compiledVFrame::cast(vf)->code()->as_nmethod();
- vf = vf->top();
- _vf = javaVFrame::cast(vf);
- _method = CodeCache::find_nmethod(_fr.pc())->method();
- assert(_method, "should have found a method");
-#ifndef PRODUCT
- _invocations = _method->compiled_invocation_count();
-#endif
-}
-
-void InterpretedRFrame::init() {
- _invocations = _method->invocation_count() + _method->backedge_count();
-}
-
-void RFrame::print(const char* kind) {
-#ifndef PRODUCT
-#if COMPILER2_OR_JVMCI
- int cnt = top_method()->interpreter_invocation_count();
-#else
- int cnt = top_method()->invocation_count();
-#endif
- tty->print("%3d %s ", _num, is_interpreted() ? "I" : "C");
- top_method()->print_short_name(tty);
- tty->print_cr(": inv=%5d(%d) cst=%4d", _invocations, cnt, cost());
-#endif
-}
-
-void CompiledRFrame::print() {
- RFrame::print("comp");
-}
-
-void InterpretedRFrame::print() {
- RFrame::print("int.");
-}
-
-void DeoptimizedRFrame::print() {
- RFrame::print("deopt.");
-}
--- a/src/hotspot/share/runtime/rframe.hpp Thu Sep 26 17:49:44 2019 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 1997, 2019, 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.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef SHARE_RUNTIME_RFRAME_HPP
-#define SHARE_RUNTIME_RFRAME_HPP
-
-#include "memory/allocation.hpp"
-#include "runtime/frame.hpp"
-
-// rframes ("recompiler frames") decorate stack frames with some extra information
-// needed by the recompiler. The recompiler views the stack (at the time of recompilation)
-// as a list of rframes.
-
-class RFrame : public ResourceObj {
- protected:
- const frame _fr; // my frame
- JavaThread* const _thread; // thread where frame resides.
- RFrame* _caller; // caller / callee rframes (or NULL)
- RFrame*const _callee;
- const int _num; // stack frame number (0 = most recent)
- int _invocations; // current invocation estimate (for this frame)
- // (i.e., how often was this frame called)
- int _distance; // recompilation search "distance" (measured in # of interpreted frames)
-
- RFrame(frame fr, JavaThread* thread, RFrame*const callee);
- virtual void init() = 0; // compute invocations, loopDepth, etc.
- void print(const char* name);
-
- public:
-
- static RFrame* new_RFrame(frame fr, JavaThread* thread, RFrame*const callee);
-
- virtual bool is_interpreted() const { return false; }
- virtual bool is_compiled() const { return false; }
- int distance() const { return _distance; }
- void set_distance(int d);
- int invocations() const { return _invocations; }
- int num() const { return _num; }
- frame fr() const { return _fr; }
- JavaThread* thread() const { return _thread; }
- virtual int cost() const = 0; // estimated inlining cost (size)
- virtual Method* top_method() const = 0;
- virtual javaVFrame* top_vframe() const = 0;
- virtual nmethod* nm() const { ShouldNotCallThis(); return NULL; }
-
- RFrame* caller();
- RFrame* callee() const { return _callee; }
- RFrame* parent() const; // rframe containing lexical scope (if any)
- virtual void print() = 0;
-
- static int computeSends(Method* m);
- static int computeSends(nmethod* nm);
- static int computeCumulSends(Method* m);
- static int computeCumulSends(nmethod* nm);
-};
-
-class CompiledRFrame : public RFrame { // frame containing a compiled method
- protected:
- nmethod* _nm;
- javaVFrame* _vf; // top vframe; may be NULL (for most recent frame)
- Method* _method; // top method
-
- CompiledRFrame(frame fr, JavaThread* thread, RFrame*const callee);
- void init();
- friend class RFrame;
-
- public:
- CompiledRFrame(frame fr, JavaThread* thread); // for nmethod triggering its counter (callee == NULL)
- bool is_compiled() const { return true; }
- Method* top_method() const { return _method; }
- javaVFrame* top_vframe() const { return _vf; }
- nmethod* nm() const { return _nm; }
- int cost() const;
- void print();
-};
-
-class InterpretedRFrame : public RFrame { // interpreter frame
- protected:
- javaVFrame* _vf; // may be NULL (for most recent frame)
- Method* _method;
-
- InterpretedRFrame(frame fr, JavaThread* thread, RFrame*const callee);
- void init();
- friend class RFrame;
-
- public:
- InterpretedRFrame(frame fr, JavaThread* thread, Method* m); // constructor for method triggering its invocation counter
- bool is_interpreted() const { return true; }
- Method* top_method() const { return _method; }
- javaVFrame* top_vframe() const { return _vf; }
- int cost() const;
- void print();
-};
-
-// treat deoptimized frames as interpreted
-class DeoptimizedRFrame : public InterpretedRFrame {
- protected:
- DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const callee);
- friend class RFrame;
- public:
- void print();
-};
-
-#endif // SHARE_RUNTIME_RFRAME_HPP