8327990: [macosx-aarch64] Various tests fail with -XX:+AssertWXAtThreadSync
Reviewed-by: dholmes, stuefe, mdoerr, tholenstein, aph
This commit is contained in:
parent
43080173e8
commit
e41bc42deb
src/hotspot/share
jfr
instrumentation
jni
recorder
support
writers
prims
@ -156,6 +156,8 @@ void JfrJvmtiAgent::retransform_classes(JNIEnv* env, jobjectArray classes_array,
|
||||
return;
|
||||
}
|
||||
ResourceMark rm(THREAD);
|
||||
// WXWrite is needed before entering the vm below and in callee methods.
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, THREAD));
|
||||
jclass* const classes = create_classes_array(classes_count, CHECK);
|
||||
assert(classes != nullptr, "invariant");
|
||||
for (jint i = 0; i < classes_count; i++) {
|
||||
|
@ -104,7 +104,9 @@ NO_TRANSITION_END
|
||||
NO_TRANSITION(void, jfr_set_enabled(JNIEnv* env, jclass jvm, jlong event_type_id, jboolean enabled))
|
||||
JfrEventSetting::set_enabled(event_type_id, JNI_TRUE == enabled);
|
||||
if (EventOldObjectSample::eventId == event_type_id) {
|
||||
ThreadInVMfromNative transition(JavaThread::thread_from_jni_environment(env));
|
||||
JavaThread* thread = JavaThread::thread_from_jni_environment(env);
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, thread));
|
||||
ThreadInVMfromNative transition(thread);
|
||||
if (JNI_TRUE == enabled) {
|
||||
LeakProfiler::start(JfrOptionSet::old_object_queue_size());
|
||||
} else {
|
||||
|
@ -699,6 +699,8 @@ void JfrRecorderService::emit_leakprofiler_events(int64_t cutoff_ticks, bool emi
|
||||
// and serializes all event emit checkpoint events to the same segment.
|
||||
JfrRotationLock lock;
|
||||
// Take the rotation lock before the transition.
|
||||
ThreadInVMfromNative transition(JavaThread::current());
|
||||
JavaThread* current_thread = JavaThread::current();
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
|
||||
ThreadInVMfromNative transition(current_thread);
|
||||
LeakProfiler::emit_events(cutoff_ticks, emit_all, skip_bfs);
|
||||
}
|
||||
|
@ -291,6 +291,7 @@ void JfrStorage::register_full(BufferPtr buffer, Thread* thread) {
|
||||
JavaThread* jt = JavaThread::cast(thread);
|
||||
if (jt->thread_state() == _thread_in_native) {
|
||||
// Transition java thread to vm so it can issue a notify.
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
ThreadInVMfromNative transition(jt);
|
||||
_post_box.post(MSG_FULLBUFFER);
|
||||
return;
|
||||
|
@ -56,6 +56,7 @@ void* JfrIntrinsicSupport::write_checkpoint(JavaThread* jt) {
|
||||
assert(JfrThreadLocal::is_vthread(jt), "invariant");
|
||||
const u2 vthread_thread_local_epoch = JfrThreadLocal::vthread_epoch(jt);
|
||||
const u2 current_epoch = ThreadIdAccess::current_epoch();
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
if (vthread_thread_local_epoch == current_epoch) {
|
||||
// After the epoch test in the intrinsic, the thread sampler interleaved
|
||||
// and suspended the thread. As part of taking a sample, it updated
|
||||
|
@ -123,6 +123,7 @@ void JfrJavaEventWriter::flush(jobject writer, jint used, jint requested, JavaTh
|
||||
u1* const new_current_position = is_valid ? buffer->pos() + used : buffer->pos();
|
||||
assert(start_pos_offset != invalid_offset, "invariant");
|
||||
// can safepoint here
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, jt));
|
||||
ThreadInVMfromNative transition(jt);
|
||||
oop const w = JNIHandles::resolve_non_null(writer);
|
||||
assert(w != nullptr, "invariant");
|
||||
|
@ -382,6 +382,7 @@ JvmtiExport::get_jvmti_interface(JavaVM *jvm, void **penv, jint version) {
|
||||
if (JvmtiEnv::get_phase() == JVMTI_PHASE_LIVE) {
|
||||
JavaThread* current_thread = JavaThread::current();
|
||||
// transition code: native to VM
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
|
||||
ThreadInVMfromNative __tiv(current_thread);
|
||||
VM_ENTRY_BASE(jvmtiEnv*, JvmtiExport::get_jvmti_interface, current_thread)
|
||||
debug_only(VMNativeEntryWrapper __vew;)
|
||||
|
@ -130,6 +130,7 @@ static jvmtiError JNICALL GetCarrierThread(const jvmtiEnv* env, ...) {
|
||||
thread_ptr = va_arg(ap, jthread*);
|
||||
va_end(ap);
|
||||
|
||||
MACOS_AARCH64_ONLY(ThreadWXEnable __wx(WXWrite, current_thread));
|
||||
ThreadInVMfromNative tiv(current_thread);
|
||||
JvmtiVTMSTransitionDisabler disabler;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user