Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/hotspot/cpu/aarch64/javaFrameAnchor_aarch64.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
// 3 - restoring an old state (javaCalls)

void clear(void) {
// No fencing required, the members are declared volatile so the compiler will not reorder and
// the profiler always reads from the same thread and should observe the state in program order.

// clearing _last_Java_sp must be first
_last_Java_sp = nullptr;
OrderAccess::release();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You still need a compiler fence here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not, if this is the same thread as readers. I don't know what it's for.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OrderAccess::release() is more than a compiler barrier on AArch64. I am guessing this was copied from x86 or one of the others where that same function is a compiler barrier? Should I move compiler_barrier from the random source files its in, into globalDefinitions, and use that?

_last_Java_fp = nullptr;
_last_Java_pc = nullptr;
}
Expand All @@ -54,9 +56,10 @@
// To act like previous version (pd_cache_state) don't null _last_Java_sp
// unless the value is changing
//
// No fencing required, the members are declared volatile so the compiler will not reorder and
// the profiler always reads from the same thread and should observe the state in program order.
Copy link
Member

@dean-long dean-long Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think copy() is ever called. Can we remove it?

if (_last_Java_sp != src->_last_Java_sp) {
_last_Java_sp = nullptr;
OrderAccess::release();
}
_last_Java_fp = src->_last_Java_fp;
_last_Java_pc = src->_last_Java_pc;
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -634,12 +634,13 @@ void MacroAssembler::set_last_Java_frame(Register last_java_sp,
last_java_sp = esp;
}

str(last_java_sp, Address(rthread, JavaThread::last_Java_sp_offset()));

// last_java_fp is optional
if (last_java_fp->is_valid()) {
str(last_java_fp, Address(rthread, JavaThread::last_Java_fp_offset()));
}

// Must be last so profiler will always see valid frame if has_last_frame() is true
str(last_java_sp, Address(rthread, JavaThread::last_Java_sp_offset()));
}

void MacroAssembler::set_last_Java_frame(Register last_java_sp,
Expand Down