hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
changeset 23180 e87156376bed
parent 22797 a4bbf1828275
child 27880 afb974a04396
equal deleted inserted replaced
23179:c9ebeb289d1c 23180:e87156376bed
    27 
    27 
    28 #include "classfile/classLoader.hpp"
    28 #include "classfile/classLoader.hpp"
    29 #include "prims/jvmtiEnvThreadState.hpp"
    29 #include "prims/jvmtiEnvThreadState.hpp"
    30 #include "prims/jvmtiEventController.hpp"
    30 #include "prims/jvmtiEventController.hpp"
    31 #include "prims/jvmtiThreadState.hpp"
    31 #include "prims/jvmtiThreadState.hpp"
       
    32 #include "prims/jvmtiThreadState.inline.hpp"
    32 #include "runtime/fieldDescriptor.hpp"
    33 #include "runtime/fieldDescriptor.hpp"
    33 #include "runtime/frame.hpp"
    34 #include "runtime/frame.hpp"
    34 #include "runtime/handles.inline.hpp"
    35 #include "runtime/handles.inline.hpp"
    35 #include "runtime/thread.hpp"
    36 #include "runtime/thread.hpp"
    36 #include "runtime/vm_operations.hpp"
    37 #include "runtime/vm_operations.hpp"
   332   }
   333   }
   333   JvmtiEnv* first()                 { return JvmtiEnvBase::head_environment(); }
   334   JvmtiEnv* first()                 { return JvmtiEnvBase::head_environment(); }
   334   JvmtiEnv* next(JvmtiEnvBase* env) { return env->next_environment(); }
   335   JvmtiEnv* next(JvmtiEnvBase* env) { return env->next_environment(); }
   335 };
   336 };
   336 
   337 
       
   338 // VM operation to update for pop top frame.
       
   339 class VM_UpdateForPopTopFrame : public VM_Operation {
       
   340 private:
       
   341   JvmtiThreadState* _state;
       
   342   jvmtiError _result;
       
   343 
       
   344 public:
       
   345   VM_UpdateForPopTopFrame(JvmtiThreadState* state) {
       
   346     _state = state;
       
   347     _result = JVMTI_ERROR_NONE;
       
   348   }
       
   349   VMOp_Type type() const { return VMOp_UpdateForPopTopFrame; }
       
   350   jvmtiError result() { return _result; }
       
   351   void doit() {
       
   352     JavaThread* jt = _state->get_thread();
       
   353     if (Threads::includes(jt) && !jt->is_exiting() && jt->threadObj() != NULL) {
       
   354       _state->update_for_pop_top_frame();
       
   355     } else {
       
   356       _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
       
   357     }
       
   358   }
       
   359 };
       
   360 
       
   361 // VM operation to set frame pop.
       
   362 class VM_SetFramePop : public VM_Operation {
       
   363 private:
       
   364   JvmtiEnv *_env;
       
   365   JvmtiThreadState* _state;
       
   366   jint _depth;
       
   367   jvmtiError _result;
       
   368 
       
   369 public:
       
   370   VM_SetFramePop(JvmtiEnv *env, JvmtiThreadState* state, jint depth) {
       
   371     _env = env;
       
   372     _state = state;
       
   373     _depth = depth;
       
   374     _result = JVMTI_ERROR_NONE;
       
   375   }
       
   376   // Nested operation must be allowed for the VM_EnterInterpOnlyMode that is
       
   377   // called from the JvmtiEventControllerPrivate::recompute_thread_enabled.
       
   378   bool allow_nested_vm_operations() const { return true; }
       
   379   VMOp_Type type() const { return VMOp_SetFramePop; }
       
   380   jvmtiError result() { return _result; }
       
   381   void doit() {
       
   382     JavaThread* jt = _state->get_thread();
       
   383     if (Threads::includes(jt) && !jt->is_exiting() && jt->threadObj() != NULL) {
       
   384       int frame_number = _state->count_frames() - _depth;
       
   385       _state->env_thread_state((JvmtiEnvBase*)_env)->set_frame_pop(frame_number);
       
   386     } else {
       
   387       _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
       
   388     }
       
   389   }
       
   390 };
       
   391 
   337 
   392 
   338 // VM operation to get monitor information with stack depth.
   393 // VM operation to get monitor information with stack depth.
   339 class VM_GetOwnedMonitorInfo : public VM_Operation {
   394 class VM_GetOwnedMonitorInfo : public VM_Operation {
   340 private:
   395 private:
   341   JvmtiEnv *_env;
   396   JvmtiEnv *_env;