src/share/vm/runtime/frame.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 7009361 Sdiff src/share/vm/runtime

src/share/vm/runtime/frame.hpp

Print this page




  43 #endif
  44 #ifdef TARGET_ARCH_MODEL_zero
  45 # include "adfiles/adGlobals_zero.hpp"
  46 #endif
  47 #ifdef TARGET_ARCH_MODEL_arm
  48 # include "adfiles/adGlobals_arm.hpp"
  49 #endif
  50 #ifdef TARGET_ARCH_MODEL_ppc
  51 # include "adfiles/adGlobals_ppc.hpp"
  52 #endif
  53 #endif
  54 #ifdef ZERO
  55 #ifdef TARGET_ARCH_zero
  56 # include "stack_zero.hpp"
  57 #endif
  58 #endif
  59 
  60 typedef class BytecodeInterpreter* interpreterState;
  61 
  62 class CodeBlob;

  63 class vframeArray;
  64 
  65 
  66 // A frame represents a physical stack frame (an activation).  Frames
  67 // can be C or Java frames, and the Java frames can be interpreted or
  68 // compiled.  In contrast, vframes represent source-level activations,
  69 // so that one physical frame can correspond to multiple source level
  70 // frames because of inlining.
  71 
  72 class frame VALUE_OBJ_CLASS_SPEC {
  73  private:
  74   // Instance variables:
  75   intptr_t* _sp; // stack pointer (from Thread::last_Java_sp)
  76   address   _pc; // program counter (the next instruction after the call)
  77 
  78   CodeBlob* _cb; // CodeBlob that "owns" pc
  79   enum deopt_state {
  80     not_deoptimized,
  81     is_deoptimized,
  82     unknown


 364 
 365   // Tell the smallest value that local_offset_for_compiler will attain.
 366   // This is used to help determine how much stack frame to allocate.
 367   static int min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors);
 368 
 369   // Tells if this register must be spilled during a call.
 370   // On Intel, all registers are smashed by calls.
 371   static bool volatile_across_calls(Register reg);
 372 
 373 
 374   // Safepoints
 375 
 376  public:
 377   oop saved_oop_result(RegisterMap* map) const;
 378   void set_saved_oop_result(RegisterMap* map, oop obj);
 379 
 380   // For debugging
 381  private:
 382   const char* print_name() const;
 383 


 384  public:
 385   void print_value() const { print_value_on(tty,NULL); }
 386   void print_value_on(outputStream* st, JavaThread *thread) const;
 387   void print_on(outputStream* st) const;
 388   void interpreter_frame_print_on(outputStream* st) const;
 389   void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const;
 390 



 391   // Conversion from an VMReg to physical stack location
 392   oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
 393 
 394   // Oops-do's
 395   void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f);
 396   void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
 397 
 398  private:
 399   void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
 400 
 401   // Iteration of oops
 402   void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
 403   void oops_entry_do(OopClosure* f, const RegisterMap* map);
 404   void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map);
 405   int adjust_offset(methodOop method, int index); // helper for above fn
 406  public:
 407   // Memory management
 408   void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); }
 409   void nmethods_do(CodeBlobClosure* cf);
 410 


 455   int pd_oop_map_offset_adjustment() const;
 456 
 457 #ifdef TARGET_ARCH_x86
 458 # include "frame_x86.hpp"
 459 #endif
 460 #ifdef TARGET_ARCH_sparc
 461 # include "frame_sparc.hpp"
 462 #endif
 463 #ifdef TARGET_ARCH_zero
 464 # include "frame_zero.hpp"
 465 #endif
 466 #ifdef TARGET_ARCH_arm
 467 # include "frame_arm.hpp"
 468 #endif
 469 #ifdef TARGET_ARCH_ppc
 470 # include "frame_ppc.hpp"
 471 #endif
 472 
 473 };
 474 









 475 


























 476 //
 477 // StackFrameStream iterates through the frames of a thread starting from
 478 // top most frame. It automatically takes care of updating the location of
 479 // all (callee-saved) registers. Notice: If a thread is stopped at
 480 // a safepoint, all registers are saved, not only the callee-saved ones.
 481 //
 482 // Use:
 483 //
 484 //   for(StackFrameStream fst(thread); !fst.is_done(); fst.next()) {
 485 //     ...
 486 //   }
 487 //
 488 class StackFrameStream : public StackObj {
 489  private:
 490   frame       _fr;
 491   RegisterMap _reg_map;
 492   bool        _is_done;
 493  public:
 494    StackFrameStream(JavaThread *thread, bool update = true);
 495 


  43 #endif
  44 #ifdef TARGET_ARCH_MODEL_zero
  45 # include "adfiles/adGlobals_zero.hpp"
  46 #endif
  47 #ifdef TARGET_ARCH_MODEL_arm
  48 # include "adfiles/adGlobals_arm.hpp"
  49 #endif
  50 #ifdef TARGET_ARCH_MODEL_ppc
  51 # include "adfiles/adGlobals_ppc.hpp"
  52 #endif
  53 #endif
  54 #ifdef ZERO
  55 #ifdef TARGET_ARCH_zero
  56 # include "stack_zero.hpp"
  57 #endif
  58 #endif
  59 
  60 typedef class BytecodeInterpreter* interpreterState;
  61 
  62 class CodeBlob;
  63 class FrameValues;
  64 class vframeArray;
  65 
  66 
  67 // A frame represents a physical stack frame (an activation).  Frames
  68 // can be C or Java frames, and the Java frames can be interpreted or
  69 // compiled.  In contrast, vframes represent source-level activations,
  70 // so that one physical frame can correspond to multiple source level
  71 // frames because of inlining.
  72 
  73 class frame VALUE_OBJ_CLASS_SPEC {
  74  private:
  75   // Instance variables:
  76   intptr_t* _sp; // stack pointer (from Thread::last_Java_sp)
  77   address   _pc; // program counter (the next instruction after the call)
  78 
  79   CodeBlob* _cb; // CodeBlob that "owns" pc
  80   enum deopt_state {
  81     not_deoptimized,
  82     is_deoptimized,
  83     unknown


 365 
 366   // Tell the smallest value that local_offset_for_compiler will attain.
 367   // This is used to help determine how much stack frame to allocate.
 368   static int min_local_offset_for_compiler(int nof_args, int max_nof_locals, int max_nof_monitors);
 369 
 370   // Tells if this register must be spilled during a call.
 371   // On Intel, all registers are smashed by calls.
 372   static bool volatile_across_calls(Register reg);
 373 
 374 
 375   // Safepoints
 376 
 377  public:
 378   oop saved_oop_result(RegisterMap* map) const;
 379   void set_saved_oop_result(RegisterMap* map, oop obj);
 380 
 381   // For debugging
 382  private:
 383   const char* print_name() const;
 384 
 385   void describe_pd(FrameValues& values, int frame_no);
 386 
 387  public:
 388   void print_value() const { print_value_on(tty,NULL); }
 389   void print_value_on(outputStream* st, JavaThread *thread) const;
 390   void print_on(outputStream* st) const;
 391   void interpreter_frame_print_on(outputStream* st) const;
 392   void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const;
 393 
 394   // Add annotated descriptions of memory locations belonging to this frame to values
 395   void describe(FrameValues& values, int frame_no);
 396 
 397   // Conversion from an VMReg to physical stack location
 398   oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
 399 
 400   // Oops-do's
 401   void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f);
 402   void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
 403 
 404  private:
 405   void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
 406 
 407   // Iteration of oops
 408   void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
 409   void oops_entry_do(OopClosure* f, const RegisterMap* map);
 410   void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map);
 411   int adjust_offset(methodOop method, int index); // helper for above fn
 412  public:
 413   // Memory management
 414   void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); }
 415   void nmethods_do(CodeBlobClosure* cf);
 416 


 461   int pd_oop_map_offset_adjustment() const;
 462 
 463 #ifdef TARGET_ARCH_x86
 464 # include "frame_x86.hpp"
 465 #endif
 466 #ifdef TARGET_ARCH_sparc
 467 # include "frame_sparc.hpp"
 468 #endif
 469 #ifdef TARGET_ARCH_zero
 470 # include "frame_zero.hpp"
 471 #endif
 472 #ifdef TARGET_ARCH_arm
 473 # include "frame_arm.hpp"
 474 #endif
 475 #ifdef TARGET_ARCH_ppc
 476 # include "frame_ppc.hpp"
 477 #endif
 478 
 479 };
 480 
 481 #ifdef ASSERT
 482 // A simple class to describe a location on the stack
 483 class FrameValue VALUE_OBJ_CLASS_SPEC {
 484  public:
 485   intptr_t* location;
 486   char* description;
 487   int owner;
 488   int priority;
 489 };
 490 
 491 
 492 // A collection of described stack values that can print a sybolic
 493 // description of the stack memory.  Interpreter frame values can be
 494 // in the caller frames so all the values are collected first and then
 495 // sorted before being printed.
 496 class FrameValues {
 497  private:
 498   GrowableArray<FrameValue> _values;
 499   
 500   static int compare(FrameValue* a, FrameValue* b) {
 501     if (a->location == b->location) {
 502       return a->priority - b->priority;
 503     }
 504     return a->location - b->location;
 505   }
 506 
 507  public:
 508   // Used by frame functions to describe locations.
 509   void describe(int owner, intptr_t* location, const char* description, int priority = 0);
 510 
 511   bool validate();
 512   void print();
 513 };
 514 
 515 #endif
 516 
 517 //
 518 // StackFrameStream iterates through the frames of a thread starting from
 519 // top most frame. It automatically takes care of updating the location of
 520 // all (callee-saved) registers. Notice: If a thread is stopped at
 521 // a safepoint, all registers are saved, not only the callee-saved ones.
 522 //
 523 // Use:
 524 //
 525 //   for(StackFrameStream fst(thread); !fst.is_done(); fst.next()) {
 526 //     ...
 527 //   }
 528 //
 529 class StackFrameStream : public StackObj {
 530  private:
 531   frame       _fr;
 532   RegisterMap _reg_map;
 533   bool        _is_done;
 534  public:
 535    StackFrameStream(JavaThread *thread, bool update = true);
 536 
src/share/vm/runtime/frame.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File