Skip to content

Commit

Permalink
Reduce stack usage of jit
Browse files Browse the repository at this point in the history
Signed-off-by: Zoltan Herczeg [email protected]
  • Loading branch information
Zoltan Herczeg committed Sep 10, 2024
1 parent 52716d7 commit 3a94739
Show file tree
Hide file tree
Showing 10 changed files with 153 additions and 104 deletions.
26 changes: 13 additions & 13 deletions src/jit/Backend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ extern "C" {
#define OffsetOfContextField(field) \
(static_cast<sljit_sw>(offsetof(ExecutionContext, field)))

#define OffsetOfStackTmp(type, field) \
(kStackTmpStart + static_cast<sljit_sw>(offsetof(type, field)))

#if !(defined SLJIT_INDIRECT_CALL && SLJIT_INDIRECT_CALL)
#define GET_FUNC_ADDR(type, func) (reinterpret_cast<type>(func))
#else
Expand All @@ -54,6 +57,7 @@ namespace Walrus {

static const uint8_t kContextReg = SLJIT_S0;
static const uint8_t kFrameReg = SLJIT_S1;
static const sljit_sw kStackTmpStart = 0;

struct JITArg {
JITArg(Operand* operand)
Expand Down Expand Up @@ -1016,6 +1020,7 @@ JITCompiler::JITCompiler(Module* module, uint32_t JITFlags)
, m_options(0)
, m_savedIntegerRegCount(0)
, m_savedFloatRegCount(0)
, m_stackTmpSize(0)
{
if (module->m_jitModule != nullptr) {
ASSERT(module->m_jitModule->m_instanceConstData != nullptr);
Expand Down Expand Up @@ -1459,6 +1464,7 @@ void JITCompiler::clear()
m_first = nullptr;
m_last = nullptr;
m_branchTableSize = 0;
m_stackTmpSize = 0;
#if (defined SLJIT_CONFIG_X86 && SLJIT_CONFIG_X86)
m_context.shuffleOffset = 0;
#endif /* SLJIT_CONFIG_X86 */
Expand Down Expand Up @@ -1495,17 +1501,15 @@ void JITCompiler::emitProlog()
options |= SLJIT_ENTER_USE_VEX;
#endif /* !SLJIT_CONFIG_X86 */

#if (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32)
ASSERT(m_stackTmpSize <= 32);
#else /* !SLJIT_CONFIG_ARM_32 */
ASSERT(m_stackTmpSize <= 16);
#endif /* SLJIT_CONFIG_ARM_32 */

sljit_emit_enter(m_compiler, options, SLJIT_ARGS0(P),
SLJIT_NUMBER_OF_SCRATCH_REGISTERS | SLJIT_ENTER_FLOAT(SLJIT_NUMBER_OF_SCRATCH_FLOAT_REGISTERS),
(m_savedIntegerRegCount + 2) | SLJIT_ENTER_FLOAT(m_savedFloatRegCount), sizeof(ExecutionContext::CallFrame));

// Setup new frame.
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_R0, 0, SLJIT_MEM1(kContextReg), OffsetOfContextField(lastFrame));

sljit_get_local_base(m_compiler, SLJIT_R1, 0, 0);
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_MEM1(kContextReg), OffsetOfContextField(lastFrame), SLJIT_R1, 0);
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_MEM1(SLJIT_SP), offsetof(ExecutionContext::CallFrame, frameStart), kFrameReg, 0);
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_MEM1(SLJIT_SP), offsetof(ExecutionContext::CallFrame, prevFrame), SLJIT_R0, 0);
(m_savedIntegerRegCount + 2) | SLJIT_ENTER_FLOAT(m_savedFloatRegCount), m_stackTmpSize);

m_context.branchTableOffset = 0;
size_t size = func.branchTableSize * sizeof(sljit_up);
Expand Down Expand Up @@ -1543,10 +1547,6 @@ void JITCompiler::emitEpilog()
m_context.earlyReturns.clear();
}

// Restore previous frame.
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_R1, 0, SLJIT_MEM1(SLJIT_SP), offsetof(ExecutionContext::CallFrame, prevFrame));
sljit_emit_op1(m_compiler, SLJIT_MOV_P, SLJIT_MEM1(kContextReg), OffsetOfContextField(lastFrame), SLJIT_R1, 0);

sljit_emit_return(m_compiler, SLJIT_MOV_P, SLJIT_R0, 0);

m_context.emitSlowCases(m_compiler);
Expand Down
23 changes: 23 additions & 0 deletions src/jit/ByteCodeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ static void compileFunction(JITCompiler* compiler)
group = Instruction::Binary;
paramType = ParamTypes::ParamSrc2Dst;
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
compiler->increaseStackTmpSize(16);
info = Instruction::kIsCallback;
requiredInit = OTDivRemI64;
#else /* !SLJIT_32BIT_ARCHITECTURE */
Expand Down Expand Up @@ -787,6 +788,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt32FromFloat32Callback;
compiler->increaseStackTmpSize(4);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt32FromFloat32;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -805,6 +807,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt32FromFloat64Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt32FromFloat64;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -816,6 +819,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat32Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt64FromFloat32;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -827,6 +831,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrcDst;
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat32Callback;
compiler->increaseStackTmpSize(8);
break;
}
case ByteCode::I64TruncF64SOpcode: {
Expand All @@ -835,6 +840,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat64Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt64FromFloat64;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -846,6 +852,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrcDst;
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat64Callback;
compiler->increaseStackTmpSize(8);
break;
}
case ByteCode::I32TruncSatF32UOpcode: {
Expand All @@ -854,6 +861,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt32FromFloat32Callback;
compiler->increaseStackTmpSize(4);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt32FromFloat32;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -865,6 +873,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt32FromFloat64Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt32FromFloat64;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -876,6 +885,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat32Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt64FromFloat32;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -887,6 +897,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
requiredInit = OTConvertInt64FromFloat64Callback;
compiler->increaseStackTmpSize(8);
#else /* !SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertInt64FromFloat64;
#endif /* SLJIT_32BIT_ARCHITECTURE */
Expand All @@ -905,6 +916,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrcDst;
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(8);
#endif /* SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertFloat32FromInt64;
break;
Expand All @@ -922,6 +934,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrcDst;
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(8);
#endif /* SLJIT_32BIT_ARCHITECTURE */
requiredInit = OTConvertFloat64FromInt64;
break;
Expand Down Expand Up @@ -1232,6 +1245,7 @@ static void compileFunction(JITCompiler* compiler)
Instruction* instr = compiler->append(byteCode, Instruction::Table, opcode, 3, 0);
instr->addInfo(Instruction::kIsCallback);
instr->setRequiredRegsDescriptor(OTCallback3Arg);
compiler->increaseStackTmpSize(sizeof(InitTableArguments));

Operand* operands = instr->operands();
operands[0] = STACK_OFFSET(tableInit->srcOffsets()[0]);
Expand All @@ -1251,6 +1265,7 @@ static void compileFunction(JITCompiler* compiler)
Instruction* instr = compiler->append(byteCode, Instruction::Table, opcode, 3, 0);
instr->addInfo(Instruction::kIsCallback);
instr->setRequiredRegsDescriptor(OTCallback3Arg);
compiler->increaseStackTmpSize(sizeof(TableCopyArguments));

Operand* operands = instr->operands();
operands[0] = STACK_OFFSET(tableCopy->srcOffsets()[0]);
Expand All @@ -1264,6 +1279,7 @@ static void compileFunction(JITCompiler* compiler)
Instruction* instr = compiler->append(byteCode, Instruction::Table, opcode, 3, 0);
instr->addInfo(Instruction::kIsCallback);
instr->setRequiredRegsDescriptor(OTCallback3Arg);
compiler->increaseStackTmpSize(sizeof(TableFillArguments));

Operand* operands = instr->operands();
operands[0] = STACK_OFFSET(tableFill->srcOffsets()[0]);
Expand Down Expand Up @@ -1311,6 +1327,7 @@ static void compileFunction(JITCompiler* compiler)
Instruction* instr = compiler->append(byteCode, Instruction::Memory, opcode, 3, 0);
instr->addInfo(Instruction::kIsCallback);
instr->setRequiredRegsDescriptor(OTCallback3Arg);
compiler->increaseStackTmpSize(sizeof(MemoryInitArguments));

Operand* operands = instr->operands();
operands[0] = STACK_OFFSET(memoryInit->srcOffsets()[0]);
Expand Down Expand Up @@ -1654,6 +1671,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrc2Dst;
#if (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32)
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(32);
#endif /* SLJIT_CONFIG_ARM_32 */
requiredInit = OTMinMaxV128;
break;
Expand Down Expand Up @@ -1732,6 +1750,7 @@ static void compileFunction(JITCompiler* compiler)
paramType = ParamTypes::ParamSrcDst;
#if (defined SLJIT_CONFIG_ARM_32 && SLJIT_CONFIG_ARM_32)
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(16);
#endif /* SLJIT_CONFIG_ARM_32 */
requiredInit = OTOp1V128CB;
break;
Expand Down Expand Up @@ -1832,6 +1851,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (opcode == ByteCode::I64AtomicLoadOpcode) {
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(8);
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
if (requiredInit == OTNone) {
Expand All @@ -1855,6 +1875,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (opcode == ByteCode::I64AtomicStoreOpcode) {
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(8);
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
if (requiredInit == OTNone) {
Expand Down Expand Up @@ -1893,6 +1914,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (info == 0) {
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(16);
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
FALLTHROUGH;
Expand Down Expand Up @@ -1938,6 +1960,7 @@ static void compileFunction(JITCompiler* compiler)
#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE)
if (info == 0) {
info = Instruction::kIsCallback;
compiler->increaseStackTmpSize(16);
}
#endif /* SLJIT_32BIT_ARCHITECTURE */
FALLTHROUGH;
Expand Down
31 changes: 31 additions & 0 deletions src/jit/Compiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class BrTableInstruction;
class Label;
class JITModule;
struct CompileContext;
struct ExecutionContext;

// Defined in ObjectType.h.
class FunctionType;
Expand Down Expand Up @@ -544,6 +545,28 @@ struct TrapJump {
sljit_jump* jump;
};

struct MemoryInitArguments {
ExecutionContext* context;
uint32_t segmentIndex;
};

struct InitTableArguments {
ExecutionContext* context;
uint32_t tableIndex;
uint32_t segmentIndex;
};

struct TableCopyArguments {
ExecutionContext* context;
uint32_t srcIndex;
uint32_t dstIndex;
};

struct TableFillArguments {
ExecutionContext* context;
uint32_t tableIndex;
};

struct CompileContext {
CompileContext(Module* module, JITCompiler* compiler);

Expand Down Expand Up @@ -725,6 +748,13 @@ class JITCompiler {
m_branchTableSize += value;
}

void increaseStackTmpSize(uint8_t value)
{
if (m_stackTmpSize < value) {
m_stackTmpSize = value;
}
}

void setModuleFunction(ModuleFunction* moduleFunction)
{
m_moduleFunction = moduleFunction;
Expand Down Expand Up @@ -793,6 +823,7 @@ class JITCompiler {
uint32_t m_options;
uint8_t m_savedIntegerRegCount;
uint8_t m_savedFloatRegCount;
uint8_t m_stackTmpSize;

std::vector<TryBlock> m_tryBlocks;
std::vector<FunctionList> m_functionList;
Expand Down
10 changes: 5 additions & 5 deletions src/jit/FloatConvInl.h
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ static void emitConvertFloat(sljit_compiler* compiler, Instruction* instr)
if (arg.arg == SLJIT_MEM1(kFrameReg)) {
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, kFrameReg, 0, SLJIT_IMM, arg.argw);
} else {
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, kContextReg, 0, SLJIT_IMM, OffsetOfContextField(tmp1));
sljit_get_local_base(compiler, SLJIT_R0, 0, kStackTmpStart);
}

#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
Expand All @@ -737,14 +737,14 @@ static void emitConvertFloat(sljit_compiler* compiler, Instruction* instr)

#if (defined SLJIT_64BIT_ARCHITECTURE && SLJIT_64BIT_ARCHITECTURE)
sljit_s32 movOp = (flags & DestinationIs64Bit) ? SLJIT_MOV : SLJIT_MOV32;
sljit_emit_op1(compiler, movOp, arg.arg, arg.argw, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1));
sljit_emit_op1(compiler, movOp, arg.arg, arg.argw, SLJIT_MEM1(SLJIT_SP), kStackTmpStart);
#else /* !SLJIT_64BIT_ARCHITECTURE */
if (!(flags & DestinationIs64Bit)) {
sljit_emit_op1(compiler, SLJIT_MOV, arg.arg, arg.argw, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1));
sljit_emit_op1(compiler, SLJIT_MOV, arg.arg, arg.argw, SLJIT_MEM1(SLJIT_SP), kStackTmpStart);
return;
}

sljit_emit_op1(compiler, SLJIT_MOV, argPair.arg1, argPair.arg1w, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_LOW_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, argPair.arg2, argPair.arg2w, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_HIGH_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, argPair.arg1, argPair.arg1w, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_LOW_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, argPair.arg2, argPair.arg2w, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_HIGH_OFFSET);
#endif /* SLJIT_32BIT_ARCHITECTURE */
}
18 changes: 9 additions & 9 deletions src/jit/IntMath32Inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -516,34 +516,34 @@ static void emitDivRem64(sljit_compiler* compiler, sljit_s32 opcode, JITArgPair*
}

if (args[0].arg1 != SLJIT_MEM1(kFrameReg)) {
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_LOW_OFFSET, args[0].arg1, args[0].arg1w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_HIGH_OFFSET, args[0].arg2, args[0].arg2w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_LOW_OFFSET, args[0].arg1, args[0].arg1w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_HIGH_OFFSET, args[0].arg2, args[0].arg2w);
}

if (args[1].arg1 != SLJIT_MEM1(kFrameReg)) {
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp2) + WORD_LOW_OFFSET, args[1].arg1, args[1].arg1w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp2) + WORD_HIGH_OFFSET, args[1].arg2, args[1].arg2w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + 8 + WORD_LOW_OFFSET, args[1].arg1, args[1].arg1w);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + 8 + WORD_HIGH_OFFSET, args[1].arg2, args[1].arg2w);
}

if (args[0].arg1 == SLJIT_MEM1(kFrameReg)) {
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, kFrameReg, 0, SLJIT_IMM, args[0].arg1w - WORD_LOW_OFFSET);
} else {
ASSERT(SLJIT_IS_REG(args[0].arg1) || SLJIT_IS_IMM(args[0].arg1));
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R0, 0, kContextReg, 0, SLJIT_IMM, OffsetOfContextField(tmp1));
sljit_get_local_base(compiler, SLJIT_R0, 0, kStackTmpStart);
}

if (args[1].arg1 == SLJIT_MEM1(kFrameReg)) {
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, kFrameReg, 0, SLJIT_IMM, args[1].arg1w - WORD_LOW_OFFSET);
} else {
ASSERT(SLJIT_IS_REG(args[1].arg1) || SLJIT_IS_IMM(args[1].arg1));
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, kContextReg, 0, SLJIT_IMM, OffsetOfContextField(tmp2));
sljit_get_local_base(compiler, SLJIT_R1, 0, kStackTmpStart + 8);
}

if (args[2].arg1 == SLJIT_MEM1(kFrameReg)) {
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R2, 0, kFrameReg, 0, SLJIT_IMM, args[2].arg1w - WORD_LOW_OFFSET);
} else {
ASSERT(SLJIT_IS_REG(args[2].arg1));
sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R2, 0, kContextReg, 0, SLJIT_IMM, OffsetOfContextField(tmp1));
sljit_get_local_base(compiler, SLJIT_R2, 0, kStackTmpStart);
}

switch (opcode) {
Expand Down Expand Up @@ -575,8 +575,8 @@ static void emitDivRem64(sljit_compiler* compiler, sljit_s32 opcode, JITArgPair*
}

if (args[2].arg1 != SLJIT_MEM1(kFrameReg)) {
sljit_emit_op1(compiler, SLJIT_MOV, args[2].arg1, args[2].arg1w, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_LOW_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, args[2].arg2, args[2].arg2w, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1) + WORD_HIGH_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, args[2].arg1, args[2].arg1w, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_LOW_OFFSET);
sljit_emit_op1(compiler, SLJIT_MOV, args[2].arg2, args[2].arg2w, SLJIT_MEM1(SLJIT_SP), kStackTmpStart + WORD_HIGH_OFFSET);
}
}

Expand Down
Loading

0 comments on commit 3a94739

Please sign in to comment.