commit 4ad393869182f7e4609a67d6a1e2cc33b3c54cbc
parent 0ecdad9c6337c60ddc973951460fa639f6921057
Author: Rong "Mantle" Bao <webmaster@csmantle.top>
Date: Wed, 15 Oct 2025 14:13:00 +0000
Bug 1993666 - [loong64] Part 1: Implement WASM JSPI stack switching for loong64-simulator. r=yury
Differential Revision: https://phabricator.services.mozilla.com/D268247
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/js/src/wasm/WasmPI.cpp b/js/src/wasm/WasmPI.cpp
@@ -53,6 +53,10 @@
# include "jit/riscv64/Simulator-riscv64.h"
#endif
+#ifdef JS_CODEGEN_LOONG64
+# include "jit/loong64/Simulator-loong64.h"
+#endif
+
#ifdef XP_WIN
# include "util/WindowsWrapper.h"
#endif
@@ -132,7 +136,7 @@ void SuspenderObjectData::switchSimulatorToSuspendable() {
}
# endif
-# ifdef JS_SIMULATOR_RISCV64
+# if defined(JS_SIMULATOR_RISCV64) || defined(JS_SIMULATOR_LOONG64)
void SuspenderObjectData::switchSimulatorToMain() {
suspendableSP_ = (void*)Simulator::Current()->getRegister(Simulator::sp);
suspendableFP_ = (void*)Simulator::Current()->getRegister(Simulator::fp);
@@ -573,7 +577,7 @@ bool CallOnMainStack(JSContext* cx, CallOnMainStackFn fn, void* data) {
# ifdef JS_SIMULATOR
# if defined(JS_SIMULATOR_ARM64) || defined(JS_SIMULATOR_ARM) || \
- defined(JS_SIMULATOR_RISCV64)
+ defined(JS_SIMULATOR_RISCV64) || defined(JS_SIMULATOR_LOONG64)
// The simulator is using its own stack, however switching is needed for
// virtual registers.
stacks->switchSimulatorToMain();
diff --git a/js/src/wasm/WasmPI.h b/js/src/wasm/WasmPI.h
@@ -199,7 +199,7 @@ class SuspenderObjectData
#endif
#if defined(JS_SIMULATOR_ARM64) || defined(JS_SIMULATOR_ARM) || \
- defined(JS_SIMULATOR_RISCV64)
+ defined(JS_SIMULATOR_RISCV64) || defined(JS_SIMULATOR_LOONG64)
void switchSimulatorToMain();
void switchSimulatorToSuspendable();
#endif