src/share/vm/runtime/rframe.hpp

Wed, 31 Jan 2018 19:24:57 -0500

author
dbuck
date
Wed, 31 Jan 2018 19:24:57 -0500
changeset 9289
427b2fb1944f
parent 4037
da91efe96a93
child 6876
710a3c8b516e
permissions
-rw-r--r--

8189170: Add option to disable stack overflow checking in primordial thread for use with JNI_CreateJavaJVM
Reviewed-by: dcubed

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

mercurial