/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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_VM_RUNTIME_RFRAME_HPP
#define SHARE_VM_RUNTIME_RFRAME_HPP
#include "memory/allocation.hpp"
#include "runtime/frame.inline.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.
protected:
// (i.e., how often was this frame called)
virtual void init() = 0; // compute invocations, loopDepth, etc.
public:
virtual bool is_interpreted() const { return false; }
virtual bool is_compiled() const { return false; }
void set_distance(int d);
virtual int cost() const = 0; // estimated inlining cost (size)
virtual methodHandle top_method() const = 0;
virtual javaVFrame* top_vframe() const = 0;
virtual void print() = 0;
static int computeSends(methodOop m);
static int computeCumulSends(methodOop m);
};
protected:
void init();
friend class RFrame;
public:
CompiledRFrame(frame fr, JavaThread* thread); // for nmethod triggering its counter (callee == NULL)
bool is_compiled() const { return true; }
int cost() const;
void print();
};
protected:
void init();
friend class RFrame;
public:
InterpretedRFrame(frame fr, JavaThread* thread, methodHandle m); // constructor for method triggering its invocation counter
bool is_interpreted() const { return true; }
int cost() const;
void print();
};
// treat deoptimized frames as interpreted
protected:
friend class RFrame;
public:
void print();
};
#endif // SHARE_VM_RUNTIME_RFRAME_HPP