< prev index next >
src/hotspot/share/runtime/thread.hpp
Print this page
rev 60137 : 8227745: Enable Escape Analysis for Better Performance in the Presence of JVMTI Agents
Reviewed-by: mdoerr, goetz
@@ -78,11 +78,11 @@
class vframeArray;
class vframe;
class javaVFrame;
class DeoptResourceMark;
-class jvmtiDeferredLocalVariableSet;
+class JvmtiDeferredUpdates;
class ThreadClosure;
class ICRefillVerifier;
class IdealGraphPrinter;
@@ -288,11 +288,12 @@
_ext_suspended = 0x40000000U, // thread has self-suspended
_has_async_exception = 0x00000001U, // there is a pending async exception
_critical_native_unlock = 0x00000002U, // Must call back to unlock JNI critical lock
- _trace_flag = 0x00000004U // call tracing backend
+ _trace_flag = 0x00000004U, // call tracing backend
+ _obj_deopt = 0x00000008U // suspend for object reallocation and relocking for JVMTI agent
};
// various suspension related flags - atomically updated
// overloaded for async exception checking in check_special_condition_for_native_trans.
volatile uint32_t _suspend_flags;
@@ -539,10 +540,13 @@
inline void clear_critical_native_unlock();
inline void set_trace_flag();
inline void clear_trace_flag();
+ inline void set_obj_deopt_flag();
+ inline void clear_obj_deopt_flag();
+
// Support for Unhandled Oop detection
// Add the field for both, fastdebug and debug, builds to keep
// Thread's fields layout the same.
// Note: CHECK_UNHANDLED_OOPS is defined only for fastdebug build.
#ifdef CHECK_UNHANDLED_OOPS
@@ -613,10 +617,12 @@
JFR_ONLY(DEFINE_THREAD_LOCAL_ACCESSOR_JFR;)
bool is_trace_suspend() { return (_suspend_flags & _trace_flag) != 0; }
+ bool is_obj_deopt_suspend() { return (_suspend_flags & _obj_deopt) != 0; }
+
// VM operation support
int vm_operation_ticket() { return ++_vm_operation_started_count; }
int vm_operation_completed_count() { return _vm_operation_completed_count; }
void increment_vm_operation_completed_count() { _vm_operation_completed_count++; }
@@ -1051,15 +1057,14 @@
DeoptResourceMark* _deopt_mark; // Holds special ResourceMark for deoptimization
CompiledMethod* _deopt_nmethod; // CompiledMethod that is currently being deoptimized
vframeArray* _vframe_array_head; // Holds the heap of the active vframeArrays
vframeArray* _vframe_array_last; // Holds last vFrameArray we popped
- // Because deoptimization is lazy we must save jvmti requests to set locals
- // in compiled frames until we deoptimize and we have an interpreter frame.
- // This holds the pointer to array (yeah like there might be more than one) of
- // description of compiled vframes that have locals that need to be updated.
- GrowableArray<jvmtiDeferredLocalVariableSet*>* _deferred_locals_updates;
+ // Holds updates by JVMTI agents for compiled frames that cannot be performed immediately. They
+ // will be carried out as soon as possible, which, in most cases, is just before deoptimization of
+ // the frame, when control returns to it.
+ JvmtiDeferredUpdates* _jvmti_deferred_updates;
// Handshake value for fixing 6243940. We need a place for the i2c
// adapter to store the callee Method*. This value is NEVER live
// across a gc point so it does NOT have to be gc'd
// The handshake is open ended since we can't be certain that it will
@@ -1370,10 +1375,14 @@
// Suspend/resume support for JavaThread
private:
inline void set_ext_suspended();
inline void clear_ext_suspended();
+ // Synchronize with another thread (most likely a JVMTI agent) that is deoptimizing objects of the
+ // current thread, i.e. reverts optimizations based on escape analysis.
+ void wait_for_object_deoptimization();
+
public:
void java_suspend(); // higher-level suspension logic called by the public APIs
void java_resume(); // higher-level resume logic called by the public APIs
int java_suspend_self(); // low-level self-suspension mechanics
@@ -1434,11 +1443,11 @@
return (_suspend_flags & _external_suspend) != 0;
}
// Whenever a thread transitions from native to vm/java it must suspend
// if external|deopt suspend is present.
bool is_suspend_after_native() const {
- return (_suspend_flags & (_external_suspend JFR_ONLY(| _trace_flag))) != 0;
+ return (_suspend_flags & (_external_suspend | _obj_deopt JFR_ONLY(| _trace_flag))) != 0;
}
// external suspend request is completed
bool is_ext_suspended() const {
return (_suspend_flags & _ext_suspended) != 0;
@@ -1507,11 +1516,11 @@
// we will see the new flag value the next time through. It's also
// possible that the external suspend request is dropped after
// we have checked is_external_suspend(), we will recheck its value
// under SR_lock in java_suspend_self().
return (_special_runtime_exit_condition != _no_async_condition) ||
- is_external_suspend() || is_trace_suspend();
+ is_external_suspend() || is_trace_suspend() || is_obj_deopt_suspend();
}
void set_pending_unsafe_access_error() { _special_runtime_exit_condition = _async_unsafe_access_error; }
inline void set_pending_async_exception(oop e);
@@ -1524,12 +1533,12 @@
// unpack the head must contain the vframe array to unpack.
void set_vframe_array_head(vframeArray* value) { _vframe_array_head = value; }
vframeArray* vframe_array_head() const { return _vframe_array_head; }
// Side structure for deferring update of java frame locals until deopt occurs
- GrowableArray<jvmtiDeferredLocalVariableSet*>* deferred_locals() const { return _deferred_locals_updates; }
- void set_deferred_locals(GrowableArray<jvmtiDeferredLocalVariableSet *>* vf) { _deferred_locals_updates = vf; }
+ JvmtiDeferredUpdates* deferred_updates() const { return _jvmti_deferred_updates; }
+ void set_deferred_updates(JvmtiDeferredUpdates* du) { _jvmti_deferred_updates = du; }
// These only really exist to make debugging deopt problems simpler
void set_vframe_array_last(vframeArray* value) { _vframe_array_last = value; }
vframeArray* vframe_array_last() const { return _vframe_array_last; }
< prev index next >