1337444 - wasm: runtime crash involving i64 globals

1337444: Fix regalloc of load/store i64 globals;
This commit is contained in:
win7-7 2025-12-30 06:25:00 +02:00 committed by wuggy
commit 82b486fe9b

View file

@ -4244,22 +4244,37 @@ LIRGenerator::visitWasmBoundsCheck(MWasmBoundsCheck* ins)
void
LIRGenerator::visitWasmLoadGlobalVar(MWasmLoadGlobalVar* ins)
{
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
if (ins->type() == MIRType::Int64)
if (ins->type() == MIRType::Int64) {
#ifdef JS_PUNBOX64
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
#else
LAllocation tlsPtr = useRegister(ins->tlsPtr());
#endif
defineInt64(new(alloc()) LWasmLoadGlobalVarI64(tlsPtr), ins);
else
} else {
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
define(new(alloc()) LWasmLoadGlobalVar(tlsPtr), ins);
}
}
void
LIRGenerator::visitWasmStoreGlobalVar(MWasmStoreGlobalVar* ins)
{
MDefinition* value = ins->value();
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
if (value->type() == MIRType::Int64)
add(new(alloc()) LWasmStoreGlobalVarI64(useInt64RegisterAtStart(value), tlsPtr), ins);
else
add(new(alloc()) LWasmStoreGlobalVar(useRegisterAtStart(value), tlsPtr), ins);
if (value->type() == MIRType::Int64) {
#ifdef JS_PUNBOX64
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
LInt64Allocation valueAlloc = useInt64RegisterAtStart(value);
#else
LAllocation tlsPtr = useRegister(ins->tlsPtr());
LInt64Allocation valueAlloc = useInt64Register(value);
#endif
add(new(alloc()) LWasmStoreGlobalVarI64(valueAlloc, tlsPtr), ins);
} else {
LAllocation tlsPtr = useRegisterAtStart(ins->tlsPtr());
LAllocation valueAlloc = useRegisterAtStart(value);
add(new(alloc()) LWasmStoreGlobalVar(valueAlloc, tlsPtr), ins);
}
}
void