Skip to content

Commit

Permalink
Enable actions for main branch
Browse files Browse the repository at this point in the history
Signed-off-by: HyukWoo Park <[email protected]>
  • Loading branch information
clover2123 committed Nov 1, 2023
1 parent 91093ae commit ab8ca17
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 164 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Actions

on:
push:
branches: [ interp ]
branches: [ main ]
pull_request:
branches: [ interp ]
branches: [ main ]

env:
RUNNER: tools/run-tests.py
Expand Down
5 changes: 5 additions & 0 deletions src/jit/ByteCodeParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@

#include <map>

#if defined(COMPILER_MSVC)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif

namespace Walrus {

#define COMPUTE_OFFSET(idx, offset) \
Expand Down
2 changes: 1 addition & 1 deletion src/jit/FloatConvInl.h
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static void emitConvertFloat(sljit_compiler* compiler, Instruction* instr)
argTypes |= SLJIT_ARG_RETURN(SLJIT_ARG_TYPE_W) | SLJIT_ARG_VALUE(SLJIT_ARG_TYPE_W, 2);
#else /* !SLJIT_64BIT_ARCHITECTURE */
argTypes |= SLJIT_ARG_VALUE(SLJIT_ARG_TYPE_W, 2);
argTypes |= (flags & IsTruncSat) ? SLJIT_ARG_RETURN(SLJIT_ARG_TYPE_VOID) : SLJIT_ARG_RETURN(SLJIT_ARG_TYPE_W);
argTypes |= (flags & IsTruncSat) ? SLJIT_ARG_RETURN(SLJIT_ARG_TYPE_RET_VOID) : SLJIT_ARG_RETURN(SLJIT_ARG_TYPE_W);
#endif /* SLJIT_64BIT_ARCHITECTURE */

sljit_emit_icall(compiler, SLJIT_CALL, argTypes, SLJIT_IMM, addr);
Expand Down
7 changes: 6 additions & 1 deletion src/jit/IntMath32Inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

/* Only included by jit-backend.cc */

#if defined(COMPILER_MSVC)
#include <intrin.h>
#define __builtin_popcount __popcnt
#endif

struct JITArgPair {
JITArgPair(Operand* operand)
{
Expand Down Expand Up @@ -549,7 +554,7 @@ static void emitDivRem64(sljit_compiler* compiler, sljit_s32 opcode, JITArgPair*
break;
}

sljit_s32 argTypes = isImm ? SLJIT_ARGS3(VOID, W, W, W) : SLJIT_ARGS3(W, W, W, W);
sljit_s32 argTypes = isImm ? SLJIT_ARGS3V(W, W, W) : SLJIT_ARGS3(W, W, W, W);
sljit_emit_icall(compiler, SLJIT_CALL, argTypes, SLJIT_IMM, addr);

if (!isImm) {
Expand Down
6 changes: 6 additions & 0 deletions src/jit/IntMath64Inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@

/* Only included by jit-backend.cc */

#if defined(COMPILER_MSVC)
#include <intrin.h>
#define __builtin_popcount __popcnt
#define __builtin_popcountl __popcnt
#endif

static void emitStoreImmediate(sljit_compiler* compiler, Operand* result, Instruction* instr)
{
sljit_sw offset = static_cast<sljit_sw>(result->offset << 2);
Expand Down
2 changes: 1 addition & 1 deletion src/jit/MemoryInl.h
Original file line number Diff line number Diff line change
Expand Up @@ -925,5 +925,5 @@ static void emitDataDrop(sljit_compiler* compiler, Instruction* instr)
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, kContextReg, 0);

sljit_sw addr = GET_FUNC_ADDR(sljit_sw, dropData);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2(VOID, 32, W), SLJIT_IMM, addr);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2V(32, W), SLJIT_IMM, addr);
}
4 changes: 2 additions & 2 deletions src/jit/SimdArm32Inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ static void simdEmitFloatUnaryOpWithCB(sljit_compiler* compiler, JITArg src, JIT
}

sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R1, 0, kFrameReg, 0, SLJIT_IMM, dst.argw);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2(VOID, P, P), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, cb));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2V(P, P), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, cb));
}

static void simdEmitFloatBinaryOpWithCB(sljit_compiler* compiler, JITArg src[2], JITArg dst, binaryCallbackFunction cb)
Expand All @@ -692,7 +692,7 @@ static void simdEmitFloatBinaryOpWithCB(sljit_compiler* compiler, JITArg src[2],
}

sljit_emit_op2(compiler, SLJIT_ADD, SLJIT_R2, 0, kFrameReg, 0, SLJIT_IMM, dst.argw);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3(VOID, P, P, P), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, cb));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3V(P, P, P), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, cb));
}

static void simdEmitF32x4Compare(sljit_compiler* compiler, JITArg src[2], JITArg dst, sljit_s32 opcode, sljit_s32 flag)
Expand Down
2 changes: 1 addition & 1 deletion src/jit/SimdX86Inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ static void simdEmitINeg(sljit_compiler* compiler, uint32_t signOpcode, uint32_t
return;
}

ASSERT(subOpcode = SimdOp::psubq);
ASSERT(subOpcode == SimdOp::psubq);

if (sljit_has_cpu_feature(SLJIT_HAS_AVX)) {
simdEmitSSEOp(compiler, SimdOp::pxor, tmp, tmp);
Expand Down
8 changes: 4 additions & 4 deletions src/jit/TableInl.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ static void emitElemDrop(sljit_compiler* compiler, Instruction* instr)

sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_R0, 0, SLJIT_IMM, static_cast<sljit_sw>(elemDrop->segmentIndex()));
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, kContextReg, 0);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2(VOID, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, dropElement));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2V(32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, dropElement));
}

static void emitTable(sljit_compiler* compiler, Instruction* instr)
Expand All @@ -111,7 +111,7 @@ static void emitTable(sljit_compiler* compiler, Instruction* instr)

sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1), SLJIT_IMM, (reinterpret_cast<TableInit*>(instr->byteCode()))->tableIndex());
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp2), SLJIT_IMM, (reinterpret_cast<TableInit*>(instr->byteCode()))->segmentIndex());
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4(VOID, 32, 32, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, initTable));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4V(32, 32, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, initTable));
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_R0, 0);
sljit_set_label(sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_IMM, ExecutionContext::NoError), context->trapLabel);
break;
Expand All @@ -129,7 +129,7 @@ static void emitTable(sljit_compiler* compiler, Instruction* instr)

sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1), SLJIT_IMM, ((reinterpret_cast<TableCopy*>(instr->byteCode()))->srcIndex()));
sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp2), SLJIT_IMM, ((reinterpret_cast<TableCopy*>(instr->byteCode()))->dstIndex()));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4(VOID, 32, 32, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, copyTable));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4V(32, 32, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, copyTable));
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_R0, 0);
sljit_set_label(sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_IMM, ExecutionContext::NoError), context->trapLabel);
break;
Expand All @@ -138,7 +138,7 @@ static void emitTable(sljit_compiler* compiler, Instruction* instr)
emitLoad3Arguments(compiler, instr->operands());

sljit_emit_op1(compiler, SLJIT_MOV32, SLJIT_MEM1(kContextReg), OffsetOfContextField(tmp1), SLJIT_IMM, ((reinterpret_cast<TableFill*>(instr->byteCode()))->tableIndex()));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4(VOID, 32, P, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, fillTable));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS4V(32, P, 32, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, fillTable));
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, SLJIT_R0, 0);
sljit_set_label(sljit_emit_cmp(compiler, SLJIT_NOT_EQUAL, SLJIT_R0, 0, SLJIT_IMM, ExecutionContext::NoError), context->trapLabel);
break;
Expand Down
2 changes: 1 addition & 1 deletion src/jit/TryCatchInl.h
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static void emitThrow(sljit_compiler* compiler, Instruction* instr)
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R0, 0, SLJIT_IMM, reinterpret_cast<sljit_sw>(instr->byteCode()));
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R1, 0, kFrameReg, 0);
sljit_emit_op1(compiler, SLJIT_MOV, SLJIT_R2, 0, kContextReg, 0);
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3(VOID, W, W, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, throwTag));
sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS3V(W, W, W), SLJIT_IMM, GET_FUNC_ADDR(sljit_sw, throwTag));

CompileContext* context = CompileContext::get(compiler);
sljit_jump* jump = sljit_emit_jump(compiler, SLJIT_JUMP);
Expand Down
143 changes: 0 additions & 143 deletions src/util/MathOperation.cpp

This file was deleted.

14 changes: 7 additions & 7 deletions src/util/MathOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ ALWAYS_INLINE T floatCopysign(ExecutionState& state, T lhs, T rhs)
}
#endif

#if COMPILER_IS_MSVC
#else
#endif

template <typename T>
ALWAYS_INLINE T floatNeg(T val)
Expand Down Expand Up @@ -394,7 +391,7 @@ void resetPrecisionControl(FPControl old_ctrl)
#endif


double convertUint64ToDouble(uint64_t x)
inline double convertUint64ToDouble(uint64_t x)
{
#if defined(WALRUS_X86_64)
// MSVC on x64 generates uint64 -> float conversions but doesn't do
Expand Down Expand Up @@ -425,7 +422,8 @@ double convertUint64ToDouble(uint64_t x)
return static_cast<double>(x);
#endif
}
float convertUint64ToFloat(uint64_t x)

inline float convertUint64ToFloat(uint64_t x)
{
#if defined(WALRUS_X86_64)
// MSVC on x64 generates uint64 -> float conversions but doesn't do
Expand Down Expand Up @@ -456,7 +454,8 @@ float convertUint64ToFloat(uint64_t x)
return static_cast<float>(x);
#endif
}
double convertInt64ToDouble(int64_t x)

inline double convertInt64ToDouble(int64_t x)
{
#if defined(CPU_X86)
double result;
Expand All @@ -467,7 +466,8 @@ double convertInt64ToDouble(int64_t x)
return static_cast<double>(x);
#endif
}
float convertInt64ToFloat(int64_t x)

inline float convertInt64ToFloat(int64_t x)
{
#if defined(CPU_X86)
float result;
Expand Down
2 changes: 1 addition & 1 deletion third_party/sljit

0 comments on commit ab8ca17

Please sign in to comment.