Skip to content

Commit

Permalink
Added SpinPause
Browse files Browse the repository at this point in the history
  • Loading branch information
robehn committed Feb 12, 2024
1 parent 1e4b701 commit 5043aaa
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/hotspot/os_cpu/linux_riscv/os_linux_riscv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#include "prims/jvm_misc.hpp"
#include "runtime/arguments.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/globals.hpp"
#include "runtime/interfaceSupport.inline.hpp"
#include "runtime/java.hpp"
#include "runtime/javaCalls.hpp"
Expand Down Expand Up @@ -406,6 +407,15 @@ static inline void atomic_copy64(const volatile void *src, volatile void *dst) {

extern "C" {
int SpinPause() {
if (UseZihintpause) {
// PAUSE is encoded as a FENCE instruction with pred=W, succ=0, fm=0, rd=x0, and rs1=x0.
// fence w, 0
// To do: __asm__ volatile("pause " : : : "memory");
// We need to compile against march with zihintpause.
// Currently we do not.
__asm__ volatile(".word 0x0100000f " : : : "memory");
return 1;
}
return 0;
}

Expand Down

0 comments on commit 5043aaa

Please sign in to comment.