72 // frame for stack walking. The implementation of this constructor is platform
73 // dependent (i.e. SPARC doesn't need an 'fp' argument an will ignore it) but
74 // we want to keep the signature generic because pns() is shared code.
75 frame(void* sp, void* fp, void* pc);
76 #endif
77
78 // Accessors
79
80 // pc: Returns the pc at which this frame will continue normally.
81 // It must point at the beginning of the next instruction to execute.
82 address pc() const { return _pc; }
83
84 // This returns the pc that if you were in the debugger you'd see. Not
85 // the idealized value in the frame object. This undoes the magic conversion
86 // that happens for deoptimized frames. In addition it makes the value the
87 // hardware would want to see in the native frame. The only user (at this point)
88 // is deoptimization. It likely no one else should ever use it.
89 address raw_pc() const;
90
91 void set_pc( address newpc );
92
93 intptr_t* sp() const { return _sp; }
94 void set_sp( intptr_t* newsp ) { _sp = newsp; }
95
96
97 CodeBlob* cb() const { return _cb; }
98
99 // patching operations
100 void patch_pc(Thread* thread, address pc);
101
102 // Every frame needs to return a unique id which distinguishes it from all other frames.
103 // For sparc and ia32 use sp. ia64 can have memory frames that are empty so multiple frames
104 // will have identical sp values. For ia64 the bsp (fp) value will serve. No real frame
105 // should have an id() of NULL so it is a distinguishing value for an unmatchable frame.
106 // We also have relationals which allow comparing a frame to anoth frame's id() allow
107 // us to distinguish younger (more recent activation) from older (less recent activations)
108 // A NULL id is only valid when comparing for equality.
109
110 intptr_t* id(void) const;
111 bool is_younger(intptr_t* id) const;
353 void print_value_on(outputStream* st, JavaThread *thread) const;
354 void print_on(outputStream* st) const;
355 void interpreter_frame_print_on(outputStream* st) const;
356 void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const;
357 static void print_C_frame(outputStream* st, char* buf, int buflen, address pc);
358
359 // Add annotated descriptions of memory locations belonging to this frame to values
360 void describe(FrameValues& values, int frame_no);
361
362 // Conversion from a VMReg to physical stack location
363 oop* oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const;
364
365 // Oops-do's
366 void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
367 void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
368
369 private:
370 void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
371
372 // Iteration of oops
373 void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map, bool use_interpreter_oop_map_cache);
374 void oops_entry_do(OopClosure* f, const RegisterMap* map);
375 void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, const RegisterMap* map);
376 int adjust_offset(Method* method, int index); // helper for above fn
377 public:
378 // Memory management
379 void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, map, true); }
380 void nmethods_do(CodeBlobClosure* cf);
381
382 // RedefineClasses support for finding live interpreted methods on the stack
383 void metadata_do(void f(Metadata*));
384
385 // Verification
386 void verify(const RegisterMap* map);
387 static bool verify_return_pc(address x);
388 // Usage:
389 // assert(frame::verify_return_pc(return_address), "must be a return pc");
390
391 NOT_PRODUCT(void pd_ps();) // platform dependent frame printing
392
393 #include CPU_HEADER(frame)
394
395 };
396
397 #ifndef PRODUCT
398 // A simple class to describe a location on the stack
399 class FrameValue {
|
72 // frame for stack walking. The implementation of this constructor is platform
73 // dependent (i.e. SPARC doesn't need an 'fp' argument an will ignore it) but
74 // we want to keep the signature generic because pns() is shared code.
75 frame(void* sp, void* fp, void* pc);
76 #endif
77
78 // Accessors
79
80 // pc: Returns the pc at which this frame will continue normally.
81 // It must point at the beginning of the next instruction to execute.
82 address pc() const { return _pc; }
83
84 // This returns the pc that if you were in the debugger you'd see. Not
85 // the idealized value in the frame object. This undoes the magic conversion
86 // that happens for deoptimized frames. In addition it makes the value the
87 // hardware would want to see in the native frame. The only user (at this point)
88 // is deoptimization. It likely no one else should ever use it.
89 address raw_pc() const;
90
91 void set_pc( address newpc );
92 void set_pc_preserve_deopt( address newpc );
93
94 intptr_t* sp() const { return _sp; }
95 void set_sp( intptr_t* newsp ) { _sp = newsp; }
96
97
98 CodeBlob* cb() const { return _cb; }
99
100 // patching operations
101 void patch_pc(Thread* thread, address pc);
102
103 // Every frame needs to return a unique id which distinguishes it from all other frames.
104 // For sparc and ia32 use sp. ia64 can have memory frames that are empty so multiple frames
105 // will have identical sp values. For ia64 the bsp (fp) value will serve. No real frame
106 // should have an id() of NULL so it is a distinguishing value for an unmatchable frame.
107 // We also have relationals which allow comparing a frame to anoth frame's id() allow
108 // us to distinguish younger (more recent activation) from older (less recent activations)
109 // A NULL id is only valid when comparing for equality.
110
111 intptr_t* id(void) const;
112 bool is_younger(intptr_t* id) const;
354 void print_value_on(outputStream* st, JavaThread *thread) const;
355 void print_on(outputStream* st) const;
356 void interpreter_frame_print_on(outputStream* st) const;
357 void print_on_error(outputStream* st, char* buf, int buflen, bool verbose = false) const;
358 static void print_C_frame(outputStream* st, char* buf, int buflen, address pc);
359
360 // Add annotated descriptions of memory locations belonging to this frame to values
361 void describe(FrameValues& values, int frame_no);
362
363 // Conversion from a VMReg to physical stack location
364 oop* oopmapreg_to_location(VMReg reg, const RegisterMap* reg_map) const;
365
366 // Oops-do's
367 void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
368 void oops_interpreted_do(OopClosure* f, const RegisterMap* map, bool query_oop_map_cache = true);
369
370 private:
371 void oops_interpreted_arguments_do(Symbol* signature, bool has_receiver, OopClosure* f);
372
373 // Iteration of oops
374 void oops_do_internal(OopClosure* f, CodeBlobClosure* cf, DerivedOopClosure* df, RegisterMap* map, bool use_interpreter_oop_map_cache);
375 void oops_entry_do(OopClosure* f, const RegisterMap* map);
376 void oops_code_blob_do(OopClosure* f, CodeBlobClosure* cf, DerivedOopClosure* df, const RegisterMap* map);
377 int adjust_offset(Method* method, int index); // helper for above fn
378 public:
379 // Memory management
380 void oops_do(OopClosure* f, CodeBlobClosure* cf, RegisterMap* map) { oops_do_internal(f, cf, NULL, map, true); }
381 void oops_do(OopClosure* f, CodeBlobClosure* cf, DerivedOopClosure* df, RegisterMap* map) { oops_do_internal(f, cf, df, map, true); }
382 void nmethods_do(CodeBlobClosure* cf);
383
384 // RedefineClasses support for finding live interpreted methods on the stack
385 void metadata_do(void f(Metadata*));
386
387 // Verification
388 void verify(const RegisterMap* map);
389 static bool verify_return_pc(address x);
390 // Usage:
391 // assert(frame::verify_return_pc(return_address), "must be a return pc");
392
393 NOT_PRODUCT(void pd_ps();) // platform dependent frame printing
394
395 #include CPU_HEADER(frame)
396
397 };
398
399 #ifndef PRODUCT
400 // A simple class to describe a location on the stack
401 class FrameValue {
|