src/share/vm/runtime/rframe.hpp

Thu, 24 May 2018 19:24:53 +0800

author
aoqi
date
Thu, 24 May 2018 19:24:53 +0800
changeset 8861
2a33b32dd03c
parent 6876
710a3c8b516e
permissions
-rw-r--r--

#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #ifndef SHARE_VM_RUNTIME_RFRAME_HPP
aoqi@0 26 #define SHARE_VM_RUNTIME_RFRAME_HPP
aoqi@0 27
aoqi@0 28 #include "memory/allocation.hpp"
aoqi@0 29 #include "runtime/frame.inline.hpp"
aoqi@0 30
aoqi@0 31 // rframes ("recompiler frames") decorate stack frames with some extra information
aoqi@0 32 // needed by the recompiler. The recompiler views the stack (at the time of recompilation)
aoqi@0 33 // as a list of rframes.
aoqi@0 34
aoqi@0 35 class RFrame : public ResourceObj {
aoqi@0 36 protected:
aoqi@0 37 const frame _fr; // my frame
aoqi@0 38 JavaThread* const _thread; // thread where frame resides.
aoqi@0 39 RFrame* _caller; // caller / callee rframes (or NULL)
aoqi@0 40 RFrame*const _callee;
aoqi@0 41 const int _num; // stack frame number (0 = most recent)
aoqi@0 42 int _invocations; // current invocation estimate (for this frame)
aoqi@0 43 // (i.e., how often was this frame called)
aoqi@0 44 int _distance; // recompilation search "distance" (measured in # of interpreted frames)
aoqi@0 45
aoqi@0 46 RFrame(frame fr, JavaThread* thread, RFrame*const callee);
aoqi@0 47 virtual void init() = 0; // compute invocations, loopDepth, etc.
aoqi@0 48 void print(const char* name);
aoqi@0 49
aoqi@0 50 public:
aoqi@0 51
aoqi@0 52 static RFrame* new_RFrame(frame fr, JavaThread* thread, RFrame*const callee);
aoqi@0 53
aoqi@0 54 virtual bool is_interpreted() const { return false; }
aoqi@0 55 virtual bool is_compiled() const { return false; }
aoqi@0 56 int distance() const { return _distance; }
aoqi@0 57 void set_distance(int d);
aoqi@0 58 int invocations() const { return _invocations; }
aoqi@0 59 int num() const { return _num; }
aoqi@0 60 frame fr() const { return _fr; }
aoqi@0 61 JavaThread* thread() const { return _thread; }
aoqi@0 62 virtual int cost() const = 0; // estimated inlining cost (size)
aoqi@0 63 virtual methodHandle top_method() const = 0;
aoqi@0 64 virtual javaVFrame* top_vframe() const = 0;
aoqi@0 65 virtual nmethod* nm() const { ShouldNotCallThis(); return NULL; }
aoqi@0 66
aoqi@0 67 RFrame* caller();
aoqi@0 68 RFrame* callee() const { return _callee; }
aoqi@0 69 RFrame* parent() const; // rframe containing lexical scope (if any)
aoqi@0 70 virtual void print() = 0;
aoqi@0 71
aoqi@0 72 static int computeSends(Method* m);
aoqi@0 73 static int computeSends(nmethod* nm);
aoqi@0 74 static int computeCumulSends(Method* m);
aoqi@0 75 static int computeCumulSends(nmethod* nm);
aoqi@0 76 };
aoqi@0 77
aoqi@0 78 class CompiledRFrame : public RFrame { // frame containing a compiled method
aoqi@0 79 protected:
aoqi@0 80 nmethod* _nm;
aoqi@0 81 javaVFrame* _vf; // top vframe; may be NULL (for most recent frame)
aoqi@0 82 methodHandle _method; // top method
aoqi@0 83
aoqi@0 84 CompiledRFrame(frame fr, JavaThread* thread, RFrame*const callee);
aoqi@0 85 void init();
aoqi@0 86 friend class RFrame;
aoqi@0 87
aoqi@0 88 public:
aoqi@0 89 CompiledRFrame(frame fr, JavaThread* thread); // for nmethod triggering its counter (callee == NULL)
aoqi@0 90 bool is_compiled() const { return true; }
aoqi@0 91 methodHandle top_method() const { return _method; }
aoqi@0 92 javaVFrame* top_vframe() const { return _vf; }
aoqi@0 93 nmethod* nm() const { return _nm; }
aoqi@0 94 int cost() const;
aoqi@0 95 void print();
aoqi@0 96 };
aoqi@0 97
aoqi@0 98 class InterpretedRFrame : public RFrame { // interpreter frame
aoqi@0 99 protected:
aoqi@0 100 javaVFrame* _vf; // may be NULL (for most recent frame)
aoqi@0 101 methodHandle _method;
aoqi@0 102
aoqi@0 103 InterpretedRFrame(frame fr, JavaThread* thread, RFrame*const callee);
aoqi@0 104 void init();
aoqi@0 105 friend class RFrame;
aoqi@0 106
aoqi@0 107 public:
aoqi@0 108 InterpretedRFrame(frame fr, JavaThread* thread, methodHandle m); // constructor for method triggering its invocation counter
aoqi@0 109 bool is_interpreted() const { return true; }
aoqi@0 110 methodHandle top_method() const { return _method; }
aoqi@0 111 javaVFrame* top_vframe() const { return _vf; }
aoqi@0 112 int cost() const;
aoqi@0 113 void print();
aoqi@0 114 };
aoqi@0 115
aoqi@0 116 // treat deoptimized frames as interpreted
aoqi@0 117 class DeoptimizedRFrame : public InterpretedRFrame {
aoqi@0 118 protected:
aoqi@0 119 DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const callee);
aoqi@0 120 friend class RFrame;
aoqi@0 121 public:
aoqi@0 122 void print();
aoqi@0 123 };
aoqi@0 124
aoqi@0 125 #endif // SHARE_VM_RUNTIME_RFRAME_HPP

mercurial