src/share/vm/runtime/frame.hpp

Print this page




   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 typedef class BytecodeInterpreter* interpreterState;
  26 
  27 class CodeBlob;
  28 class vframeArray;
  29 
  30 
  31 // A frame represents a physical stack frame (an activation).  Frames
  32 // can be C or Java frames, and the Java frames can be interpreted or
  33 // compiled.  In contrast, vframes represent source-level activations,
  34 // so that one physical frame can correspond to multiple source level
  35 // frames because of inlining.
  36 
  37 class frame VALUE_OBJ_CLASS_SPEC {
  38  private:
  39   // Instance variables:
  40   intptr_t* _sp; // stack pointer (from Thread::last_Java_sp)
  41   address   _pc; // program counter (the next instruction after the call)
  42 
  43   CodeBlob* _cb; // CodeBlob that "owns" pc
  44   enum deopt_state {


 402   };
 403   static ZapDeadClosure _zap_dead;
 404 
 405  public:
 406   // Zapping
 407   void zap_dead_locals            (JavaThread* thread, const RegisterMap* map);
 408   void zap_dead_interpreted_locals(JavaThread* thread, const RegisterMap* map);
 409   void zap_dead_compiled_locals   (JavaThread* thread, const RegisterMap* map);
 410   void zap_dead_entry_locals      (JavaThread* thread, const RegisterMap* map);
 411   void zap_dead_deoptimized_locals(JavaThread* thread, const RegisterMap* map);
 412 # endif
 413   // Verification
 414   void verify(const RegisterMap* map);
 415   static bool verify_return_pc(address x);
 416   static bool is_bci(intptr_t bcx);
 417   // Usage:
 418   // assert(frame::verify_return_pc(return_address), "must be a return pc");
 419 
 420   int pd_oop_map_offset_adjustment() const;
 421 
 422 # include "incls/_frame_pd.hpp.incl"









 423 };
 424 
 425 
 426 //
 427 // StackFrameStream iterates through the frames of a thread starting from
 428 // top most frame. It automatically takes care of updating the location of
 429 // all (callee-saved) registers. Notice: If a thread is stopped at
 430 // a safepoint, all registers are saved, not only the callee-saved ones.
 431 //
 432 // Use:
 433 //
 434 //   for(StackFrameStream fst(thread); !fst.is_done(); fst.next()) {
 435 //     ...
 436 //   }
 437 //
 438 class StackFrameStream : public StackObj {
 439  private:
 440   frame       _fr;
 441   RegisterMap _reg_map;
 442   bool        _is_done;
 443  public:
 444    StackFrameStream(JavaThread *thread, bool update = true);
 445 
 446   // Iteration
 447   bool is_done()                  { return (_is_done) ? true : (_is_done = _fr.is_first_frame(), false); }
 448   void next()                     { if (!_is_done) _fr = _fr.sender(&_reg_map); }
 449 
 450   // Query
 451   frame *current()                { return &_fr; }
 452   RegisterMap* register_map()     { return &_reg_map; }
 453 };




   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_FRAME_HPP
  26 #define SHARE_VM_RUNTIME_FRAME_HPP
  27 
  28 #include "asm/assembler.hpp"
  29 #include "oops/methodOop.hpp"
  30 #include "runtime/basicLock.hpp"
  31 #include "runtime/monitorChunk.hpp"
  32 #include "runtime/registerMap.hpp"
  33 #include "utilities/top.hpp"
  34 #ifdef COMPILER2
  35 #ifdef TARGET_ARCH_MODEL_x86_32
  36 # include "adfiles/adGlobals_x86_32.hpp"
  37 #endif
  38 #ifdef TARGET_ARCH_MODEL_x86_64
  39 # include "adfiles/adGlobals_x86_64.hpp"
  40 #endif
  41 #ifdef TARGET_ARCH_MODEL_sparc
  42 # include "adfiles/adGlobals_sparc.hpp"
  43 #endif
  44 #ifdef TARGET_ARCH_MODEL_zero
  45 # include "adfiles/adGlobals_zero.hpp"
  46 #endif
  47 #endif
  48 #ifdef ZERO
  49 #ifdef TARGET_ARCH_zero
  50 # include "stack_zero.hpp"
  51 #endif
  52 #endif
  53 
  54 typedef class BytecodeInterpreter* interpreterState;
  55 
  56 class CodeBlob;
  57 class vframeArray;
  58 
  59 
  60 // A frame represents a physical stack frame (an activation).  Frames
  61 // can be C or Java frames, and the Java frames can be interpreted or
  62 // compiled.  In contrast, vframes represent source-level activations,
  63 // so that one physical frame can correspond to multiple source level
  64 // frames because of inlining.
  65 
  66 class frame VALUE_OBJ_CLASS_SPEC {
  67  private:
  68   // Instance variables:
  69   intptr_t* _sp; // stack pointer (from Thread::last_Java_sp)
  70   address   _pc; // program counter (the next instruction after the call)
  71 
  72   CodeBlob* _cb; // CodeBlob that "owns" pc
  73   enum deopt_state {


 431   };
 432   static ZapDeadClosure _zap_dead;
 433 
 434  public:
 435   // Zapping
 436   void zap_dead_locals            (JavaThread* thread, const RegisterMap* map);
 437   void zap_dead_interpreted_locals(JavaThread* thread, const RegisterMap* map);
 438   void zap_dead_compiled_locals   (JavaThread* thread, const RegisterMap* map);
 439   void zap_dead_entry_locals      (JavaThread* thread, const RegisterMap* map);
 440   void zap_dead_deoptimized_locals(JavaThread* thread, const RegisterMap* map);
 441 # endif
 442   // Verification
 443   void verify(const RegisterMap* map);
 444   static bool verify_return_pc(address x);
 445   static bool is_bci(intptr_t bcx);
 446   // Usage:
 447   // assert(frame::verify_return_pc(return_address), "must be a return pc");
 448 
 449   int pd_oop_map_offset_adjustment() const;
 450 
 451 #ifdef TARGET_ARCH_x86
 452 # include "frame_x86.hpp"
 453 #endif
 454 #ifdef TARGET_ARCH_sparc
 455 # include "frame_sparc.hpp"
 456 #endif
 457 #ifdef TARGET_ARCH_zero
 458 # include "frame_zero.hpp"
 459 #endif
 460 
 461 };
 462 
 463 
 464 //
 465 // StackFrameStream iterates through the frames of a thread starting from
 466 // top most frame. It automatically takes care of updating the location of
 467 // all (callee-saved) registers. Notice: If a thread is stopped at
 468 // a safepoint, all registers are saved, not only the callee-saved ones.
 469 //
 470 // Use:
 471 //
 472 //   for(StackFrameStream fst(thread); !fst.is_done(); fst.next()) {
 473 //     ...
 474 //   }
 475 //
 476 class StackFrameStream : public StackObj {
 477  private:
 478   frame       _fr;
 479   RegisterMap _reg_map;
 480   bool        _is_done;
 481  public:
 482    StackFrameStream(JavaThread *thread, bool update = true);
 483 
 484   // Iteration
 485   bool is_done()                  { return (_is_done) ? true : (_is_done = _fr.is_first_frame(), false); }
 486   void next()                     { if (!_is_done) _fr = _fr.sender(&_reg_map); }
 487 
 488   // Query
 489   frame *current()                { return &_fr; }
 490   RegisterMap* register_map()     { return &_reg_map; }
 491 };
 492 
 493 #endif // SHARE_VM_RUNTIME_FRAME_HPP