mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 00:08:39 +09:00
Issue #3049 - Fix loongarch64 wasm runtime plumbing
This commit is contained in:
parent
dfc6a844c6
commit
5f4def4b56
7 changed files with 35 additions and 16 deletions
|
|
@ -3341,7 +3341,9 @@ PerThreadData::setAutoFlushICache(AutoFlushICache* afc)
|
|||
void
|
||||
AutoFlushICache::setRange(uintptr_t start, size_t len)
|
||||
{
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
AutoFlushICache* afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache();
|
||||
MOZ_ASSERT(afc);
|
||||
MOZ_ASSERT(!afc->start_);
|
||||
|
|
@ -3374,7 +3376,8 @@ AutoFlushICache::setRange(uintptr_t start, size_t len)
|
|||
void
|
||||
AutoFlushICache::flush(uintptr_t start, size_t len)
|
||||
{
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || \
|
||||
defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
|
||||
PerThreadData* pt = TlsPerThreadData.get();
|
||||
AutoFlushICache* afc = pt ? pt->PerThreadData::autoFlushICache() : nullptr;
|
||||
if (!afc) {
|
||||
|
|
@ -3401,7 +3404,8 @@ AutoFlushICache::flush(uintptr_t start, size_t len)
|
|||
void
|
||||
AutoFlushICache::setInhibit()
|
||||
{
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || \
|
||||
defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
|
||||
AutoFlushICache* afc = TlsPerThreadData.get()->PerThreadData::autoFlushICache();
|
||||
MOZ_ASSERT(afc);
|
||||
MOZ_ASSERT(afc->start_);
|
||||
|
|
@ -3428,14 +3432,18 @@ AutoFlushICache::setInhibit()
|
|||
// the respective AutoFlushICache dynamic context.
|
||||
//
|
||||
AutoFlushICache::AutoFlushICache(const char* nonce, bool inhibit)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
: start_(0),
|
||||
stop_(0),
|
||||
name_(nonce),
|
||||
inhibit_(inhibit)
|
||||
#endif
|
||||
{
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
PerThreadData* pt = TlsPerThreadData.get();
|
||||
AutoFlushICache* afc = pt->PerThreadData::autoFlushICache();
|
||||
if (afc)
|
||||
|
|
@ -3450,7 +3458,9 @@ AutoFlushICache::AutoFlushICache(const char* nonce, bool inhibit)
|
|||
|
||||
AutoFlushICache::~AutoFlushICache()
|
||||
{
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
PerThreadData* pt = TlsPerThreadData.get();
|
||||
MOZ_ASSERT(pt->PerThreadData::autoFlushICache() == this);
|
||||
|
||||
|
|
|
|||
|
|
@ -747,7 +747,9 @@ struct VMFunction;
|
|||
struct AutoFlushICache
|
||||
{
|
||||
private:
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
uintptr_t start_;
|
||||
uintptr_t stop_;
|
||||
const char* name_;
|
||||
|
|
|
|||
|
|
@ -282,7 +282,8 @@ class RegisterAllocator
|
|||
if (mir->compilingWasm()) {
|
||||
#if defined(JS_CODEGEN_X64)
|
||||
allRegisters_.take(AnyRegister(HeapReg));
|
||||
#elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#elif defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || \
|
||||
defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
|
||||
allRegisters_.take(AnyRegister(HeapReg));
|
||||
allRegisters_.take(AnyRegister(GlobalReg));
|
||||
#elif defined(JS_CODEGEN_ARM64)
|
||||
|
|
|
|||
|
|
@ -7740,7 +7740,8 @@ BaseCompiler::BaseCompiler(const ModuleGeneratorData& mg,
|
|||
availGPR_.take(GlobalReg);
|
||||
#elif defined(JS_CODEGEN_X86)
|
||||
availGPR_.take(ScratchRegX86);
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#elif defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
availGPR_.take(HeapReg);
|
||||
availGPR_.take(GlobalReg);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -649,10 +649,11 @@ ProfilingFrameIterator::ProfilingFrameIterator(const WasmActivation& activation,
|
|||
MOZ_ASSERT(offsetInModule < codeRange->end());
|
||||
uint32_t offsetInCodeRange = offsetInModule - codeRange->begin();
|
||||
void** sp = (void**)state.sp;
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_MIPS32) || \
|
||||
defined(JS_CODEGEN_MIPS64) || defined(JS_CODEGEN_LOONGARCH64)
|
||||
if (offsetInCodeRange < PushedRetAddr || InThunk(*codeRange, offsetInModule)) {
|
||||
// First instruction of the ARM/MIPS function; the return address is
|
||||
// still in lr and fp still holds the caller's fp.
|
||||
// First instruction of the ARM/MIPS/loongarch64 function; the
|
||||
// return address is still in lr and fp still holds the caller's fp.
|
||||
callerPC_ = state.lr;
|
||||
callerFP_ = fp;
|
||||
AssertMatchesCallSite(*activation_, callerPC_, callerFP_, sp - 2);
|
||||
|
|
|
|||
|
|
@ -38,8 +38,10 @@ using mozilla::IsNaN;
|
|||
|
||||
const char wasm::InstanceExportField[] = "exports";
|
||||
|
||||
#if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
// On MIPS, CodeLabels are instruction immediates so InternalLinks only
|
||||
#if defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
// On MIPS and loongarch64, CodeLabels are instruction immediates so
|
||||
// InternalLinks only
|
||||
// patch instruction immediates.
|
||||
LinkData::InternalLink::InternalLink(Kind kind)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -566,11 +566,13 @@ wasm::GenerateImportInterpExit(MacroAssembler& masm, const FuncImport& fi, uint3
|
|||
MOZ_ASSERT(NonVolatileRegs.has(WasmTlsReg));
|
||||
#if defined(JS_CODEGEN_X64) || \
|
||||
defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
MOZ_ASSERT(NonVolatileRegs.has(HeapReg));
|
||||
#endif
|
||||
#if defined(JS_CODEGEN_ARM) || defined(JS_CODEGEN_ARM64) || \
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64)
|
||||
defined(JS_CODEGEN_MIPS32) || defined(JS_CODEGEN_MIPS64) || \
|
||||
defined(JS_CODEGEN_LOONGARCH64)
|
||||
MOZ_ASSERT(NonVolatileRegs.has(GlobalReg));
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue