src/share/vm/runtime/rframe.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 






  25 // rframes ("recompiler frames") decorate stack frames with some extra information
  26 // needed by the recompiler.  The recompiler views the stack (at the time of recompilation)
  27 // as a list of rframes.
  28 
  29 class RFrame : public ResourceObj {
  30  protected:
  31   const frame _fr;                  // my frame
  32   JavaThread* const _thread;        // thread where frame resides.
  33   RFrame* _caller;                  // caller / callee rframes (or NULL)
  34   RFrame*const _callee;
  35   const int _num;                   // stack frame number (0 = most recent)
  36   int _invocations;                 // current invocation estimate (for this frame)
  37                                     // (i.e., how often was this frame called)
  38   int _distance;                    // recompilation search "distance" (measured in # of interpreted frames)
  39 
  40   RFrame(frame fr, JavaThread* thread, RFrame*const callee);
  41   virtual void init() = 0;          // compute invocations, loopDepth, etc.
  42   void print(const char* name);
  43 
  44  public:


  98   void init();
  99   friend class RFrame;
 100 
 101  public:
 102   InterpretedRFrame(frame fr, JavaThread* thread, methodHandle m); // constructor for method triggering its invocation counter
 103   bool is_interpreted() const                { return true; }
 104   methodHandle top_method() const            { return _method; }
 105   javaVFrame* top_vframe() const             { return _vf; }
 106   int cost() const;
 107   void print();
 108 };
 109 
 110 // treat deoptimized frames as interpreted
 111 class DeoptimizedRFrame : public InterpretedRFrame {
 112  protected:
 113   DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const  callee);
 114   friend class RFrame;
 115  public:
 116   void print();
 117 };


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_RFRAME_HPP
  26 #define SHARE_VM_RUNTIME_RFRAME_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/frame.inline.hpp"
  30 
  31 // rframes ("recompiler frames") decorate stack frames with some extra information
  32 // needed by the recompiler.  The recompiler views the stack (at the time of recompilation)
  33 // as a list of rframes.
  34 
  35 class RFrame : public ResourceObj {
  36  protected:
  37   const frame _fr;                  // my frame
  38   JavaThread* const _thread;        // thread where frame resides.
  39   RFrame* _caller;                  // caller / callee rframes (or NULL)
  40   RFrame*const _callee;
  41   const int _num;                   // stack frame number (0 = most recent)
  42   int _invocations;                 // current invocation estimate (for this frame)
  43                                     // (i.e., how often was this frame called)
  44   int _distance;                    // recompilation search "distance" (measured in # of interpreted frames)
  45 
  46   RFrame(frame fr, JavaThread* thread, RFrame*const callee);
  47   virtual void init() = 0;          // compute invocations, loopDepth, etc.
  48   void print(const char* name);
  49 
  50  public:


 104   void init();
 105   friend class RFrame;
 106 
 107  public:
 108   InterpretedRFrame(frame fr, JavaThread* thread, methodHandle m); // constructor for method triggering its invocation counter
 109   bool is_interpreted() const                { return true; }
 110   methodHandle top_method() const            { return _method; }
 111   javaVFrame* top_vframe() const             { return _vf; }
 112   int cost() const;
 113   void print();
 114 };
 115 
 116 // treat deoptimized frames as interpreted
 117 class DeoptimizedRFrame : public InterpretedRFrame {
 118  protected:
 119   DeoptimizedRFrame(frame fr, JavaThread* thread, RFrame*const  callee);
 120   friend class RFrame;
 121  public:
 122   void print();
 123 };
 124 
 125 #endif // SHARE_VM_RUNTIME_RFRAME_HPP