< prev index next >

src/hotspot/share/prims/jvmtiEnvBase.hpp

Print this page




 281   jclass get_jni_class_non_null(Klass* k);
 282 
 283   jint count_locked_objects(JavaThread *java_thread, Handle hobj);
 284   jvmtiError get_locked_objects_in_frame(JavaThread *calling_thread,
 285                                    JavaThread* java_thread,
 286                                    javaVFrame *jvf,
 287                                    GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
 288                                    jint depth);
 289   vframe* vframeFor(JavaThread* java_thread, jint depth);
 290 
 291  public:
 292   // get a field descriptor for the specified class and field
 293   static bool get_field_descriptor(Klass* k, jfieldID field, fieldDescriptor* fd);
 294 
 295   // JVMTI API helper functions which are called at safepoint or thread is suspended.
 296   jvmtiError get_frame_count(JvmtiThreadState *state, jint *count_ptr);
 297   jvmtiError get_frame_location(JavaThread* java_thread, jint depth,
 298                                               jmethodID* method_ptr, jlocation* location_ptr);
 299   jvmtiError get_object_monitor_usage(JavaThread *calling_thread,
 300                                                     jobject object, jvmtiMonitorUsage* info_ptr);



 301   jvmtiError get_stack_trace(JavaThread *java_thread,
 302                                            jint stack_depth, jint max_count,
 303                                            jvmtiFrameInfo* frame_buffer, jint* count_ptr);
 304   jvmtiError get_current_contended_monitor(JavaThread *calling_thread,
 305                                                          JavaThread *java_thread,
 306                                                          jobject *monitor_ptr);
 307   jvmtiError get_owned_monitors(JavaThread *calling_thread, JavaThread* java_thread,
 308                           GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list);
 309   jvmtiError check_top_frame(JavaThread* current_thread, JavaThread* java_thread,
 310                              jvalue value, TosState tos, Handle* ret_ob_h);
 311   jvmtiError force_early_return(JavaThread* java_thread, jvalue value, TosState tos);
 312 };
 313 
 314 // This class is the only safe means of iterating through environments.
 315 // Note that this iteratation includes invalid environments pending
 316 // deallocation -- in fact, some uses depend on this behavior.
 317 
 318 class JvmtiEnvIterator : public StackObj {
 319  private:
 320   bool _entry_was_marked;


 546 
 547 // VM operation to count stack frames at safepoint.
 548 class VM_GetFrameCount : public VM_Operation {
 549 private:
 550   JvmtiEnv *_env;
 551   JvmtiThreadState *_state;
 552   jint *_count_ptr;
 553   jvmtiError _result;
 554 
 555 public:
 556   VM_GetFrameCount(JvmtiEnv *env, JvmtiThreadState *state, jint *count_ptr) {
 557     _env = env;
 558     _state = state;
 559     _count_ptr = count_ptr;
 560   }
 561   VMOp_Type type() const { return VMOp_GetFrameCount; }
 562   jvmtiError result()    { return _result; }
 563   void doit();
 564 };
 565 
 566 // VM operation to frame location at safepoint.
 567 class VM_GetFrameLocation : public VM_Operation {
 568 private:
 569   JvmtiEnv *_env;
 570   JavaThread* _java_thread;
 571   jint _depth;
 572   jmethodID* _method_ptr;
 573   jlocation* _location_ptr;
 574   jvmtiError _result;
 575 
 576 public:
 577   VM_GetFrameLocation(JvmtiEnv *env, JavaThread* java_thread, jint depth,
 578                       jmethodID* method_ptr, jlocation* location_ptr) {
 579     _env = env;
 580     _java_thread = java_thread;
 581     _depth = depth;
 582     _method_ptr = method_ptr;
 583     _location_ptr = location_ptr;
 584   }
 585   VMOp_Type type() const { return VMOp_GetFrameLocation; }





























































































 586   jvmtiError result()    { return _result; }
 587   void doit();
 588 };
 589 
 590 
 591 // ResourceTracker
 592 //
 593 // ResourceTracker works a little like a ResourceMark. All allocates
 594 // using the resource tracker are recorded. If an allocate using the
 595 // resource tracker fails the destructor will free any resources
 596 // that were allocated using the tracker.
 597 // The motive for this class is to avoid messy error recovery code
 598 // in situations where multiple allocations are done in sequence. If
 599 // the second or subsequent allocation fails it avoids any code to
 600 // release memory allocated in the previous calls.
 601 //
 602 // Usage :-
 603 //   ResourceTracker rt(env);
 604 //   :
 605 //   err = rt.allocate(1024, &ptr);




 281   jclass get_jni_class_non_null(Klass* k);
 282 
 283   jint count_locked_objects(JavaThread *java_thread, Handle hobj);
 284   jvmtiError get_locked_objects_in_frame(JavaThread *calling_thread,
 285                                    JavaThread* java_thread,
 286                                    javaVFrame *jvf,
 287                                    GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitors_list,
 288                                    jint depth);
 289   vframe* vframeFor(JavaThread* java_thread, jint depth);
 290 
 291  public:
 292   // get a field descriptor for the specified class and field
 293   static bool get_field_descriptor(Klass* k, jfieldID field, fieldDescriptor* fd);
 294 
 295   // JVMTI API helper functions which are called at safepoint or thread is suspended.
 296   jvmtiError get_frame_count(JvmtiThreadState *state, jint *count_ptr);
 297   jvmtiError get_frame_location(JavaThread* java_thread, jint depth,
 298                                               jmethodID* method_ptr, jlocation* location_ptr);
 299   jvmtiError get_object_monitor_usage(JavaThread *calling_thread,
 300                                                     jobject object, jvmtiMonitorUsage* info_ptr);
 301   jvmtiError get_stack_trace(javaVFrame *jvf,
 302                              jint stack_depth, jint max_count,
 303                              jvmtiFrameInfo* frame_buffer, jint* count_ptr);
 304   jvmtiError get_stack_trace(JavaThread *java_thread,
 305                                            jint stack_depth, jint max_count,
 306                                            jvmtiFrameInfo* frame_buffer, jint* count_ptr);
 307   jvmtiError get_current_contended_monitor(JavaThread *calling_thread,
 308                                                          JavaThread *java_thread,
 309                                                          jobject *monitor_ptr);
 310   jvmtiError get_owned_monitors(JavaThread *calling_thread, JavaThread* java_thread,
 311                           GrowableArray<jvmtiMonitorStackDepthInfo*> *owned_monitors_list);
 312   jvmtiError check_top_frame(JavaThread* current_thread, JavaThread* java_thread,
 313                              jvalue value, TosState tos, Handle* ret_ob_h);
 314   jvmtiError force_early_return(JavaThread* java_thread, jvalue value, TosState tos);
 315 };
 316 
 317 // This class is the only safe means of iterating through environments.
 318 // Note that this iteratation includes invalid environments pending
 319 // deallocation -- in fact, some uses depend on this behavior.
 320 
 321 class JvmtiEnvIterator : public StackObj {
 322  private:
 323   bool _entry_was_marked;


 549 
 550 // VM operation to count stack frames at safepoint.
 551 class VM_GetFrameCount : public VM_Operation {
 552 private:
 553   JvmtiEnv *_env;
 554   JvmtiThreadState *_state;
 555   jint *_count_ptr;
 556   jvmtiError _result;
 557 
 558 public:
 559   VM_GetFrameCount(JvmtiEnv *env, JvmtiThreadState *state, jint *count_ptr) {
 560     _env = env;
 561     _state = state;
 562     _count_ptr = count_ptr;
 563   }
 564   VMOp_Type type() const { return VMOp_GetFrameCount; }
 565   jvmtiError result()    { return _result; }
 566   void doit();
 567 };
 568 
 569 // VM operation get to frame location at safepoint.
 570 class VM_GetFrameLocation : public VM_Operation {
 571 private:
 572   JvmtiEnv *_env;
 573   JavaThread* _java_thread;
 574   jint _depth;
 575   jmethodID* _method_ptr;
 576   jlocation* _location_ptr;
 577   jvmtiError _result;
 578 
 579 public:
 580   VM_GetFrameLocation(JvmtiEnv *env, JavaThread* java_thread, jint depth,
 581                       jmethodID* method_ptr, jlocation* location_ptr) {
 582     _env = env;
 583     _java_thread = java_thread;
 584     _depth = depth;
 585     _method_ptr = method_ptr;
 586     _location_ptr = location_ptr;
 587   }
 588   VMOp_Type type() const { return VMOp_GetFrameLocation; }
 589   jvmtiError result()    { return _result; }
 590   void doit();
 591 };
 592 
 593 // VM operation get to get fiber thread at safepoint.
 594 class VM_GetFiberThread : public VM_Operation {
 595 private:
 596   JavaThread* _current_thread;
 597   Handle _fiber_h;
 598   jthread* _carrier_thread_ptr;
 599   jvmtiError _result;
 600 
 601 public:
 602   VM_GetFiberThread(JavaThread* current_thread, Handle fiber_h, jthread* carrier_thread_ptr) {
 603     _current_thread = current_thread;
 604     _fiber_h = fiber_h;
 605     _carrier_thread_ptr = carrier_thread_ptr;
 606     _result = JVMTI_ERROR_NONE;
 607   }
 608   VMOp_Type type() const { return VMOp_GetFiberThread; }
 609   jvmtiError result()    { return _result; }
 610   void doit();
 611 };
 612 
 613 // VM operation to get fiber stack trace at safepoint.
 614 class VM_GetFiberStackTrace : public VM_Operation {
 615 private:
 616   JvmtiEnv *_env;
 617   Handle _fiber_h;
 618   jint _start_depth;
 619   jint _max_count;
 620   jvmtiFrameInfo *_frame_buffer;
 621   jint *_count_ptr;
 622   jvmtiError _result;
 623 
 624 public:
 625   VM_GetFiberStackTrace(JvmtiEnv *env, Handle fiber_h,
 626                         jint start_depth, jint max_count,
 627                         jvmtiFrameInfo* frame_buffer, jint* count_ptr) {
 628     _env = env;
 629     _fiber_h = fiber_h;
 630     _start_depth = start_depth;
 631     _max_count = max_count;
 632     _frame_buffer = frame_buffer;
 633     _count_ptr = count_ptr;
 634     _result = JVMTI_ERROR_NONE;
 635   }
 636   jvmtiError result() { return _result; }
 637   VMOp_Type type() const { return VMOp_GetFiberStackTrace; }
 638   void doit();
 639 };
 640 
 641 // VM operation to count fiber stack frames at safepoint.
 642 class VM_GetFiberFrameCount : public VM_Operation {
 643 private:
 644   JvmtiEnv *_env;
 645   Handle _fiber_h;
 646   jint *_count_ptr;
 647   jvmtiError _result;
 648 
 649 public:
 650   VM_GetFiberFrameCount(JvmtiEnv *env, Handle fiber_h, jint *count_ptr) {
 651     _env = env;
 652     _fiber_h = fiber_h;
 653     _count_ptr = count_ptr;
 654     _result = JVMTI_ERROR_NONE;
 655   }
 656   VMOp_Type type() const { return VMOp_GetFiberFrameCount; }
 657   jvmtiError result()    { return _result; }
 658   void doit();
 659 };
 660 
 661 // VM operation get to fiber frame location at safepoint.
 662 class VM_GetFiberFrameLocation : public VM_Operation {
 663 private:
 664   JvmtiEnv *_env;
 665   Handle _fiber_h;
 666   jint _depth;
 667   jmethodID* _method_ptr;
 668   jlocation* _location_ptr;
 669   jvmtiError _result;
 670 
 671 public:
 672   VM_GetFiberFrameLocation(JvmtiEnv *env, Handle fiber_h, jint depth,
 673                            jmethodID* method_ptr, jlocation* location_ptr) {
 674     _env = env;
 675     _fiber_h = fiber_h;
 676     _depth = depth;
 677     _method_ptr = method_ptr;
 678     _location_ptr = location_ptr;
 679     _result = JVMTI_ERROR_NONE;
 680   }
 681   VMOp_Type type() const { return VMOp_GetFiberFrameLocation; }
 682   jvmtiError result()    { return _result; }
 683   void doit();
 684 };
 685 
 686 
 687 // ResourceTracker
 688 //
 689 // ResourceTracker works a little like a ResourceMark. All allocates
 690 // using the resource tracker are recorded. If an allocate using the
 691 // resource tracker fails the destructor will free any resources
 692 // that were allocated using the tracker.
 693 // The motive for this class is to avoid messy error recovery code
 694 // in situations where multiple allocations are done in sequence. If
 695 // the second or subsequent allocation fails it avoids any code to
 696 // release memory allocated in the previous calls.
 697 //
 698 // Usage :-
 699 //   ResourceTracker rt(env);
 700 //   :
 701 //   err = rt.allocate(1024, &ptr);


< prev index next >