Issue #3049 - Add loongarch64 JIT link-time compatibility stubs

This commit is contained in:
Basilisk-Dev 2026-04-24 00:38:15 -04:00 committed by wuggy
commit 97db44c6be
3 changed files with 73 additions and 0 deletions

View file

@ -1442,6 +1442,12 @@ void MacroAssembler::wasmBoundsCheck(Condition cond, Register index, L label) {
MOZ_CRASH("wasm bounds checks are not supported on loongarch64 yet");
}
void MacroAssembler::wasmPatchBoundsCheck(uint8_t* patchAt, uint32_t limit) {
(void)patchAt;
(void)limit;
MOZ_CRASH("wasm bounds checks are not supported on loongarch64 yet");
}
void MacroAssembler::memoryBarrier(MemoryBarrierBits barrier) {
if (barrier == MembarNobits) {
return;

View file

@ -22,6 +22,33 @@
namespace js {
namespace jit {
void MacroAssembler::alignFrameForICArguments(AfterICSaveLive& aic) {
if (framePushed() % ABIStackAlignment != 0) {
aic.alignmentPadding = ABIStackAlignment - (framePushed() % ABIStackAlignment);
reserveStack(aic.alignmentPadding);
} else {
aic.alignmentPadding = 0;
}
MOZ_ASSERT(framePushed() % ABIStackAlignment == 0);
}
void MacroAssembler::restoreFrameAlignmentForICArguments(AfterICSaveLive& aic) {
if (aic.alignmentPadding != 0) {
freeStack(aic.alignmentPadding);
}
}
FrameSizeClass FrameSizeClass::FromDepth(uint32_t frameDepth) {
(void)frameDepth;
return FrameSizeClass::None();
}
FrameSizeClass FrameSizeClass::ClassLimit() { return FrameSizeClass(0); }
uint32_t FrameSizeClass::frameSize() const {
MOZ_CRASH("loongarch64 does not use frame size classes");
}
void MacroAssembler::clampDoubleToUint8(FloatRegister input, Register output) {
ScratchRegisterScope scratch(asMasm());
ScratchDoubleScope fpscratch(asMasm());
@ -2409,6 +2436,27 @@ void MacroAssembler::patchFarJump(CodeOffset farJump, uint32_t targetOffset) {
*u32 = targetOffset - farJump.offset();
}
void MacroAssembler::repatchFarJump(uint8_t* code, uint32_t farJumpOffset,
uint32_t targetOffset) {
uint32_t* u32 = reinterpret_cast<uint32_t*>(code + farJumpOffset);
*u32 = targetOffset - farJumpOffset;
}
CodeOffset MacroAssembler::nopPatchableToNearJump() {
MOZ_CRASH("wasm patchable jumps are not supported on loongarch64");
}
void MacroAssembler::patchNopToNearJump(uint8_t* jump, uint8_t* target) {
(void)jump;
(void)target;
MOZ_CRASH("wasm patchable jumps are not supported on loongarch64");
}
void MacroAssembler::patchNearJumpToNop(uint8_t* jump) {
(void)jump;
MOZ_CRASH("wasm patchable jumps are not supported on loongarch64");
}
void MacroAssembler::call(wasm::SymbolicAddress target) {
movePtr(target, CallReg);
call(CallReg);

View file

@ -21,6 +21,7 @@
#include "mozilla/ArrayUtils.h"
#include "wasm/WasmCode.h"
#include "wasm/WasmBaselineCompile.h"
#include "wasm/WasmIonCompile.h"
#include "jit/MacroAssembler-inl.h"
@ -1098,3 +1099,21 @@ wasm::GenerateThrowStub(MacroAssembler& masm, Label* throwLabel)
offsets.end = masm.currentOffset();
return offsets;
}
#if defined(JS_CODEGEN_LOONGARCH64)
bool
js::wasm::BaselineCanCompile(const FunctionGenerator* fg)
{
(void)fg;
return false;
}
bool
js::wasm::CompileFunction(IonCompileTask* task)
{
(void)task;
return false;
}
#endif