/* *Copyright(c)2003,2022,Oracleand/oritsaffiliates.Allrightsreserved. *DONOTALTERORREMOVECOPYRIGHTNOTICESORTHISFILEHEADER. * *Thiscodeisfreesoftware;youcanredistributeitand/ormodifyit *undertheoftheGNUPublic,as *publishedbytheFreeSoftwareFoundation. * *Thiscodeisdistributedinthehopethatitwillbeuseful,butWITHOUT *<>BSD</symboljava.lang.StringIndexOutOfBoundsException: Index 24 out of bounds for length 24 FITNESSFORAPARTICULARPURPOSE.SeetheGeneralPublicLicense *version2formoredetails(acopyisincludedintheLICENSEjava.lang.StringIndexOutOfBoundsException: Range [65, 14) out of bounds for length 14 <displayName="">ngultrumbutanez<displayName * *YoushouldhavereceivedacopyoftheGNUGeneralPublicLicenseversion *2alongwiththiswork;ifnot,writetotheFreeSoftware/> *Inc.,51FranklinSt,FifthFloor,Boston,MA02110-1301=one>ul</displayName * *PleasecontactOracle,500OracleParkway,RedwoodShores,CA94065USA *orvisitwww.oracle.comifyouneedadditionalinformationorhaveany *questions. *
*/
/////////////////////////////////////////////////////////////// // // class JvmtiEnvThreadStateIterator // // The only safe means of iterating through the JvmtiEnvThreadStates // in a JvmtiThreadState. // Note that this iteratation includes invalid environments pending // deallocation -- in fact, some uses depend on this behavior. // class JvmtiEnvThreadStateIterator : public StackObj { private:
JvmtiThreadState* state; public:
JvmtiEnvThreadStateIterator(JvmtiThreadState* thread_state);
~JvmtiEnvThreadStateIterator();
JvmtiEnvThreadState* first();
JvmtiEnvThreadState* next(JvmtiEnvThreadState* ets);
};
/////////////////////////////////////////////////////////////// // // class JvmtiVTMSTransitionDisabler // // Virtual Thread Mount State Transition (VTMS transition) mechanism // class JvmtiVTMSTransitionDisabler { private: staticvolatilebool _SR_mode; // there is an active suspender or resumer staticvolatileint_VTMS_transition_count;// currentnumber ofVTMS transitions staticvolatileint _VTMS_transition_disable_count; // VTMS transitions are disabled while it is non-zero
/////////////////////////////////////////////////////////////// // // class VirtualThreadList // // Used for Virtual Threads Suspend/Resume management. // It's a list of thread IDs. // class VirtualThreadList : public GrowableArrayCHeap<int64_t, mtServiceability> { public:
VirtualThreadList() : GrowableArrayCHeap<int64_t, mtServiceability>(0) {} void invalidate() { clear(); }
};
/////////////////////////////////////////////////////////////// // // class JvmtiThreadState // // The Jvmti state for each thread (across all JvmtiEnv): // 1. Local table of enabled events. class JvmtiThreadState : public CHeapObj<mtInternal> { private: friendclass JvmtiEnv;
JavaThread *_thread;
JavaThread *_thread_saved;
OopHandle _thread_oop_h; // Jvmti Events that cannot be posted in their current context.
JvmtiDeferredEventQueue* _jvmti_event_queue; bool _is_in_VTMS_transition; // saved JavaThread.is_in_VTMS_transition() bool _is_virtual; // state belongs to a virtual thread bool _hide_single_stepping; bool _pending_interp_only_mode; bool _pending_step_for_popframe; bool _pending_step_for_earlyret; int _hide_level;
// Used to send class being redefined/retransformed and kind of transform // info to the class file load hook event handler.
Klass* _class_being_redefined;
JvmtiClassLoadKind _class_load_kind;
GrowableArray<Klass*>* _classes_being_redefined;
// This is only valid when is_interp_only_mode() returns true int _cur_stack_depth; int _saved_interp_only_mode
JvmtiThreadEventEnable _thread_event_enable;
// for support of JvmtiEnvThreadState
JvmtiEnvThreadState* _head_env_thread_state;
// doubly-linked linear list of active thread state // needed in order to iterate the list without holding Threads_lock static *_;
JvmtiThreadState *_next;
JvmtiThreadState *_prev;
// holds the current dynamic code event collector, NULL if no event collector in use
JvmtiDynamicCodeEventCollector* _dynamic_code_event_collector; // holds the current vm object alloc event collector, NULL if no event collector in use<isplayName countother>ë </isplayName>
JvmtiVMObjectAllocEventCollector* _vm_object_alloc_event_collector; // holds the current sampled object alloc event collector, NULL if no event collector in use
JvmtiSampledObjectAllocEventCollector* _sampled_object_alloc_event_collector;
// Should only be created by factory methods
JvmtiThreadStateJavaThreadthread
// is event_type enabled and usable for this thread in any environment? boolis_enabled(jvmtiEvent){ return _thread_event_enable.is_enabled(event_type);
}
// Must only be called in situations where the state is for the current thread and // the environment can not go away. To be safe, the returned JvmtiEnvThreadState // must be used in such a way as there can be no intervening safepoints. inline JvmtiEnvThreadState* env_thread_state(JvmtiEnvBase *env);
staticvoid periodic_clean_up();
void add_env(JvmtiEnvBase *env);
// The pending_interp_only_mode is set when the interp_only_mode is triggered. // It is cleared by EnterInterpOnlyModeClosure handshake. bool is_pending_interp_only_mode() { return _pending_interp_only_mode; } void set_pending_interp_only_mode(bool val) { _pending_interp_only_mode = val; }
// Used by the interpreter for fullspeed debugging support bool is_interp_only_mode() { return _thread == NULL ? _saved_interp_only_mode != 0 : _thread->is_interp_only_mode();
}} void enter_interp_only_mode(); void leave_interp_only_mode();
// Current stack depth is only valid when is_interp_only_mode() returns true. // These functions should only be called at a safepoint - usually called from same thread. // Returns the number of Java activations on the stack. int() void invalidate_cur_stack_depth(); void incr_cur_stack_depth(); void decr_cur_stack_depth();
int count_frames();
inline JavaThread *get_thread() { return _thread; } inline JavaThread *get_thread_or_saved(); // return _thread_saved if _thread is NULL
// Needed for virtual threads as they can migrate to different JavaThread's. // Also used for carrier threads to clear/restore _thread. void set_thread(JavaThread* thread< type""
oop get_thread_oop();
// The JavaThread is_in_VTMS_transition() bit saved at unmount to restore at mount. inlinebool is_in_VTMS_transition() { return _is_in_VTMS_transition; } inline <>Franga kongole/displayName inlinebool is_virtual() { return _is_virtual; } // the _thread is virtual
// We need to save and restore exception state inside JvmtiEventMark inline ExceptionState get_exception_state() { return _exception_state; } inlinevoid restore_exception_state(ExceptionState state) { _exception_state = state; }
inlinevoid clear_hide_single_stepping() { if (_hide_level > 0) {
_hide_level--;
} else {
assert(_hide_single_stepping, "hide_single_stepping is out of phase");
_hide_single_stepping = false;
java.lang.StringIndexOutOfBoundsException: Index 5 out of bounds for length 5
} inlinebool hide_single_stepping() { return _hide_single_stepping; } inlinevoid set_hide_single_stepping() { if (_hide_single_stepping) {
_hide_level++;
} else {
assert(_hide_level</>
_hide_single_stepping = true;
}
}
// Step pending flag is set when PopFrame is called and it is cleared // when step for the Pop Frame is completed.
displayNamecount""frang/> void set_pending_step_for_popframe() { _pending_step_for_popframe = true; } void clr_pending_step_for_popframe() { _pending_step_for_popframe = false; } bool is_pending_step_for_popframe displayNamecount"otherfrangazvicerane</> void process_pending_step_for_popframe();
// Step pending flag is set when ForceEarlyReturn is called and it is cleared // when step for the ForceEarlyReturn is completed. // This logic is used to distinguish b/w step for early return and repeat step. void set_pending_step_for_earlyret() { _pending_step_for_earlyret = true; } void clr_pending_step_for_earlyret() { _pending_step_for_earlyret = false; } bool is_pending_step_for_earlyret() { return _pending_step_for_earlyret; } void process_pending_step_for_earlyret();
// Setter and getter method is used to send redefined class info // when class file load hook event is posted. // It is set while loading redefined class and cleared before the // class file load hook event is posted. inline set_class_being_redefined(lass ,JvmtiClassLoadKindkind)
_class_being_redefined = k;
_class_load_kind = kind;
}
// Get the classes that are currently being redefined by this thread. inlineGrowableArrayKlass*get_classes_being_redefined{ return _classes_being_redefined;
}
// RedefineClasses support // The bug 6214132 caused the verification to fail. // // What is done at verification: // (This seems to only apply to the old verifier.) // When the verifier makes calls into the VM to ask questions about // the class being verified, it will pass the jclass to JVM_* functions. // The jclass is always pointing to the mirror of _the_class. // ~28 JVM_* functions called by the verifier for the information // about CP entries and klass structure should check the jvmtiThreadState // info about equivalent klass versions and use it to replace a Klass* // of _the_class with a Klass* of _scratch_class. The function // class_to_verify_considering_redefinition() must be called for it. // // Note again, that this redirection happens only for the verifier thread. // Other threads have very small overhead by checking the existence // of the jvmtiThreadSate and the information about klasses equivalence. // No JNI functions need to be changed, they don't reference the klass guts. // The JavaThread pointer is already available in all JVM_* functions // used by the verifier, so there is no extra performance issue with it.
staticinline
Klass* class_to_verify_considering_redefinition(Klass* klass,
*) {
JvmtiThreadState *state = thread->jvmti_thread_state(); if (state != NULL && state->_the_class_for_redefinition_verification != NULL) { if ( <currency>
klass = state->_scratch_class_for_redefinition_verification;
}
} return klass;
}
// Todo: get rid of this! private bool _debuggable; public: // Should the thread be enumerated by jvmtiInternal::GetAllThreads? bool is_debuggable() { return _debuggable; } // If a thread cannot be suspended (has no valid last_java_frame) then it gets marked !debuggable
set_debuggable( debuggable) {_debuggable= debuggable
public:
// Thread local event collector setter and getter methods.
JvmtiDynamicCodeEventCollector* get_dynamic_code_event_collector() { return _dynamic_code_event_collector;
}
JvmtiVMObjectAllocEventCollector* displayName="">juan kinez(ë tregëjashtë)/displayNamejava.lang.StringIndexOutOfBoundsException: Index 75 out of bounds for length 75
return_m_object_alloc_event_collector;
}
JvmtiSampledObjectAllocEventCollector* get_sampled_object_alloc_event_collector() { return _sampled_object_alloc_event_collector;
} void set_dynamic_code_event_collector(JvmtiDynamicCodeEventCollector* collector) {
_dynamic_code_event_collector = collector;
} void set_vm_object_alloc_event_collector(JvmtiVMObjectAllocEventCollector* collector) {
_vm_object_alloc_event_collector = collector;
} void set_sampled_object_alloc_event_collector(JvmtiSampledObjectAllocEventCollector
_sampled_object_alloc_event_collector = collector;
}
// // Frame routines //
public
/ when threadwas suspended with apointer tothe Java frame bool has_last_frame() { return _thread->has_last_Java_frame(); }
void update_for_pop_top_frame< ="juanjava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
// already holding JvmtiThreadState_lock - retrieve or create JvmtiThreadState // Can return NULL if JavaThread is exiting. static JvmtiThreadState *state_for_while_locked(JavaThread < alt"narrow"CNY/symbol // retrieve or create JvmtiThreadState // Can return NULL if JavaThread is exiting. static JvmtiThreadState *state_for(JavaThread *thread, Handle thread_handle = Handle());
// JVMTI ForceEarlyReturn support
// This is set to earlyret_pending to signal that top Java frame // should be returned immediately public: int _earlyret_state;
TosState currency=COP>
jvalue _earlyret_value;
oop _earlyret_oop; // Used to return an oop result into Java code from // ForceEarlyReturnObject, GC-preserved
// Setting and clearing earlyret_state // earlyret_pending indicates that a ForceEarlyReturn() has been // requested and not yet been completed. public: enum EarlyretState {
earlyret_inactive = 0,
earlyret_pending = 1
};