From 4696a560c577877f3a4c09cea549bf702f0ce7dc Mon Sep 17 00:00:00 2001 From: HyukWoo Park Date: Fri, 27 Sep 2024 16:31:20 +0900 Subject: [PATCH] Merge extended features in default Signed-off-by: HyukWoo Park --- .github/workflows/actions.yml | 21 ------------- build/config.cmake | 4 --- src/interpreter/ByteCode.h | 10 ------ src/interpreter/Interpreter.cpp | 2 -- src/jit/Backend.cpp | 2 -- src/jit/ByteCodeParser.cpp | 8 ----- src/jit/Compiler.h | 2 -- src/jit/MemoryInl.h | 55 ++------------------------------- src/jit/MemoryUtilInl.h | 4 --- src/parser/WASMParser.cpp | 34 -------------------- src/runtime/JITExec.cpp | 2 -- src/runtime/JITExec.h | 2 -- src/runtime/Memory.cpp | 3 -- src/runtime/Memory.h | 8 +---- src/runtime/Store.cpp | 2 -- src/runtime/Store.h | 8 ----- tools/run-tests.py | 2 +- 17 files changed, 4 insertions(+), 165 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index c1fef49ff..634ff4ecb 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -252,27 +252,6 @@ jobs: uses: mxschmitt/action-tmate@v3 timeout-minutes: 15 - build-test-extended-feature: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: true - - name: Install Packages - run: | - sudo apt update - sudo apt install -y ninja-build gcc-multilib g++-multilib - - name: Build x64 - env: - BUILD_OPTIONS: -DWALRUS_ARCH=x64 -DWALRUS_HOST=linux -DWALRUS_MODE=debug -DWALRUS_OUTPUT=shell -DWALRUS_EXTENDED_FEATURES=ON -GNinja - run: | - cmake -H. -Bout/extended $BUILD_OPTIONS - ninja -Cout/extended - - name: Run Tests - run: | - $RUNNER --engine="$GITHUB_WORKSPACE/out/extended/walrus" wasm-test-extended - $RUNNER --jit --engine="$GITHUB_WORKSPACE/out/extended/walrus" wasm-test-extended - build-test-performance: runs-on: ubuntu-latest steps: diff --git a/build/config.cmake b/build/config.cmake index 7836bfa56..a1453a325 100644 --- a/build/config.cmake +++ b/build/config.cmake @@ -36,10 +36,6 @@ IF (${WALRUS_OUTPUT} STREQUAL "shared_lib" AND ${WALRUS_HOST} STREQUAL "android" SET (WALRUS_LDFLAGS ${WALRUS_LDFLAGS} -shared) ENDIF() -IF (WALRUS_EXTENDED_FEATURES) - SET (WALRUS_DEFINITIONS ${WALRUS_DEFINITIONS} -DENABLE_EXTENDED_FEATURES) -ENDIF() - ####################################################### # FLAGS FOR ADDITIONAL FUNCTION ####################################################### diff --git a/src/interpreter/ByteCode.h b/src/interpreter/ByteCode.h index 29209252f..154e63836 100644 --- a/src/interpreter/ByteCode.h +++ b/src/interpreter/ByteCode.h @@ -506,7 +506,6 @@ class FunctionType; F(I8X16Shuffle) // Extended Features -#if defined(ENABLE_EXTENDED_FEATURES) #define FOR_EACH_BYTECODE_ATOMIC_LOAD_OP(F) \ F(I32AtomicLoad, uint32_t, uint32_t) \ F(I64AtomicLoad, uint64_t, uint64_t) \ @@ -588,13 +587,6 @@ class FunctionType; F(MemoryAtomicWait32) \ F(MemoryAtomicWait64) \ F(AtomicFence) -#else // Extended Features -#define FOR_EACH_BYTECODE_ATOMIC_LOAD_OP(F) -#define FOR_EACH_BYTECODE_ATOMIC_STORE_OP(F) -#define FOR_EACH_BYTECODE_ATOMIC_RMW_OP(F) -#define FOR_EACH_BYTECODE_ATOMIC_RMW_CMPXCHG_OP(F) -#define FOR_EACH_BYTECODE_ATOMIC_OTHER(F) -#endif // Extended Features #define FOR_EACH_BYTECODE(F) \ FOR_EACH_BYTECODE_OP(F) \ @@ -1740,7 +1732,6 @@ class SIMDReplaceLane : public ByteCode { }; -#if defined(ENABLE_EXTENDED_FEATURES) class AtomicRmw : public ByteCode { public: AtomicRmw(Opcode opcode, uint32_t offset, ByteCodeStackOffset src0, ByteCodeStackOffset src1, ByteCodeStackOffset dst) @@ -1857,7 +1848,6 @@ class AtomicFence : public ByteCode { protected: uint32_t m_offset; }; -#endif #if !defined(NDEBUG) #define DEFINE_RMW_BYTECODE_DUMP(name) \ diff --git a/src/interpreter/Interpreter.cpp b/src/interpreter/Interpreter.cpp index f3af061f5..1caf802e1 100644 --- a/src/interpreter/Interpreter.cpp +++ b/src/interpreter/Interpreter.cpp @@ -1036,7 +1036,6 @@ ByteCodeStackOffset* Interpreter::interpret(ExecutionState& state, FOR_EACH_BYTECODE_ATOMIC_RMW_OP(ATOMIC_MEMORY_RMW_OPERATION) FOR_EACH_BYTECODE_ATOMIC_RMW_CMPXCHG_OP(ATOMIC_MEMORY_RMW_CMPXCHG_OPERATION) -#if defined(ENABLE_EXTENDED_FEATURES) DEFINE_OPCODE(MemoryAtomicWait32) : { @@ -1084,7 +1083,6 @@ ByteCodeStackOffset* Interpreter::interpret(ExecutionState& state, ADD_PROGRAM_COUNTER(AtomicFence); NEXT_INSTRUCTION(); } -#endif // FOR_EACH_BYTECODE_SIMD_ETC_OP DEFINE_OPCODE(V128BitSelect) diff --git a/src/jit/Backend.cpp b/src/jit/Backend.cpp index 0465b1c3b..a869143f0 100644 --- a/src/jit/Backend.cpp +++ b/src/jit/Backend.cpp @@ -1251,7 +1251,6 @@ void JITCompiler::compileFunction(JITFunction* jitFunc, bool isExternal) emitStackInit(m_compiler, item->asInstruction()); break; } -#if defined(ENABLE_EXTENDED_FEATURES) case Instruction::Atomic: { emitAtomic(m_compiler, item->asInstruction()); break; @@ -1268,7 +1267,6 @@ void JITCompiler::compileFunction(JITFunction* jitFunc, bool isExternal) emitAtomicNotify(m_compiler, item->asInstruction()); break; } -#endif /* ENABLE_EXTENDED_FEATURES */ default: { switch (item->asInstruction()->opcode()) { case ByteCode::SelectOpcode: { diff --git a/src/jit/ByteCodeParser.cpp b/src/jit/ByteCodeParser.cpp index d421218b3..6c71ebead 100644 --- a/src/jit/ByteCodeParser.cpp +++ b/src/jit/ByteCodeParser.cpp @@ -230,7 +230,6 @@ static bool isFloatGlobal(uint32_t globalIndex, Module* module) #endif /* SLJIT_32BIT_ARCHITECTURE */ -#if defined(ENABLE_EXTENDED_FEATURES) #define OPERAND_TYPE_LIST_EXTENDED \ OL5(OTAtomicRmwI32, /* SSDTT */ I32, I32, I32 | TMP, PTR, I32 | S1) \ OL5(OTAtomicRmwI64, /* SSDTT */ I32, I64, I64 | TMP, PTR, I64 | S1) \ @@ -239,9 +238,6 @@ static bool isFloatGlobal(uint32_t globalIndex, Module* module) OL6(OTAtomicWaitI32, /* SSSDTT */ I32, I32, I64, I32, PTR, I32 | S0) \ OL6(OTAtomicWaitI64, /* SSSDTT */ I32, I64, I64, I32, PTR, I64 | S0) \ OL5(OTAtomicNotify, /* SSDTT */ I32, I32, I32, PTR, I32 | S0) -#else /* !ENABLE_EXTENDED_FEATURES */ -#define OPERAND_TYPE_LIST_EXTENDED -#endif /* ENABLE_EXTENDED_FEATURES */ #define OPERAND_TYPE_LIST_SIMD \ OL2(OTOp1V128, /* SD */ V128 | NOTMP, V128 | TMP | S0) \ @@ -1374,12 +1370,10 @@ static void compileFunction(JITCompiler* compiler) instr->addInfo(Instruction::kIsCallback); break; } -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::AtomicFenceOpcode: { group = Instruction::AtomicFence; FALLTHROUGH; } -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::UnreachableOpcode: { compiler->append(byteCode, group, opcode, 0, 0); break; @@ -1854,7 +1848,6 @@ static void compileFunction(JITCompiler* compiler) #endif /* SLJIT_CONFIG_X86 */ break; } -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicLoadOpcode: case ByteCode::I32AtomicLoad8UOpcode: case ByteCode::I32AtomicLoad16UOpcode: { @@ -2039,7 +2032,6 @@ static void compileFunction(JITCompiler* compiler) operands[2] = STACK_OFFSET(memoryAtomicNotify->dstOffset()); break; } -#endif /* ENABLE_EXTENDED_FEATURES */ default: { ASSERT_NOT_REACHED(); break; diff --git a/src/jit/Compiler.h b/src/jit/Compiler.h index 8c30aa602..d6b424688 100644 --- a/src/jit/Compiler.h +++ b/src/jit/Compiler.h @@ -107,14 +107,12 @@ class InstructionListItem { ShiftSIMD, // Special type for initializing values from the stack StackInit, -#if defined(ENABLE_EXTENDED_FEATURES) // Atomic memory operations (e.g. I32AtomicRmwAdd, I64AtomicRmw16OrU) Atomic, // Special types for thread synchronization operations AtomicFence, AtomicWait, AtomicNotify, -#endif /* ENABLE_EXTENDED_FEATURES */ }; virtual ~InstructionListItem() {} diff --git a/src/jit/MemoryInl.h b/src/jit/MemoryInl.h index e069b5e28..59d2dcd06 100644 --- a/src/jit/MemoryInl.h +++ b/src/jit/MemoryInl.h @@ -27,11 +27,9 @@ struct MemAddress { #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) DontUseOffsetReg = 1 << 4, #endif /* SLJIT_32BIT_ARCHITECTURE */ -#if defined(ENABLE_EXTENDED_FEATURES) CheckNaturalAlignment = 1 << 5, // Limits the resulting addressing mode to a base register with no offset. AbsoluteAddress = 1 << 6, -#endif /* ENABLE_EXTENDED_FEATURES */ }; MemAddress(uint32_t options, uint8_t baseReg, uint8_t offsetReg, uint8_t sourceReg) @@ -62,9 +60,7 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u ASSERT(context->compiler->hasMemory0()); ASSERT(!(options & LoadInteger) || baseReg != sourceReg); ASSERT(!(options & LoadInteger) || offsetReg != sourceReg); -#if defined(ENABLE_EXTENDED_FEATURES) ASSERT(!(options & CheckNaturalAlignment) || size != 1); -#endif /* ENABLE_EXTENDED_FEATURES */ if (UNLIKELY(context->maximumMemorySize < size)) { // This memory load is never successful. @@ -98,12 +94,10 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u return; } -#if defined(ENABLE_EXTENDED_FEATURES) if ((options & CheckNaturalAlignment) && (offset & (size - 1)) != 0) { context->appendTrapJump(ExecutionContext::UnalignedAtomicError, sljit_emit_jump(compiler, SLJIT_NOT_ZERO)); return; } -#endif /* ENABLE_EXTENDED_FEATURES */ if (offset + size <= context->initialMemorySize) { ASSERT(baseReg != 0); @@ -113,12 +107,10 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u memArg.argw = offset; load(compiler); -#if defined(ENABLE_EXTENDED_FEATURES) if (options & AbsoluteAddress) { sljit_emit_op2(compiler, SLJIT_ADD, baseReg, 0, baseReg, 0, SLJIT_IMM, offset); memArg.argw = 0; } -#endif /* ENABLE_EXTENDED_FEATURES */ return; } @@ -141,12 +133,10 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u memArg.arg = SLJIT_MEM1(baseReg); memArg.argw = -static_cast(size); -#if defined(ENABLE_EXTENDED_FEATURES) if (options & AbsoluteAddress) { sljit_emit_op2(compiler, SLJIT_SUB, baseReg, 0, baseReg, 0, SLJIT_IMM, static_cast(size)); memArg.argw = 0; } -#endif /* ENABLE_EXTENDED_FEATURES */ return; } @@ -188,28 +178,22 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u memArg.arg = SLJIT_MEM2(baseReg, offsetReg); memArg.argw = 0; -#if defined(ENABLE_EXTENDED_FEATURES) if (options & CheckNaturalAlignment) { sljit_emit_op2u(compiler, SLJIT_AND | SLJIT_SET_Z, offsetReg, 0, SLJIT_IMM, size - 1); context->appendTrapJump(ExecutionContext::UnalignedAtomicError, sljit_emit_jump(compiler, SLJIT_NOT_ZERO)); } -#endif /* ENABLE_EXTENDED_FEATURES */ uint32_t checkedOptions = 0; #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) checkedOptions |= DontUseOffsetReg; #endif /* SLJIT_32BIT_ARCHITECTURE */ -#if defined(ENABLE_EXTENDED_FEATURES) checkedOptions |= AbsoluteAddress; -#endif /* ENABLE_EXTENDED_FEATURES */ -#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) || (defined(ENABLE_EXTENDED_FEATURES)) if (options & checkedOptions) { sljit_emit_op2(compiler, SLJIT_ADD, baseReg, 0, baseReg, 0, offsetReg, 0); memArg.arg = SLJIT_MEM1(baseReg); } -#endif /* SLJIT_32BIT_ARCHITECTURE || ENABLE_EXTENDED_FEATURES */ return; } @@ -218,22 +202,18 @@ void MemAddress::check(sljit_compiler* compiler, Operand* offsetOperand, sljit_u sljit_emit_op2(compiler, SLJIT_ADD, baseReg, 0, baseReg, 0, offsetReg, 0); -#if defined(ENABLE_EXTENDED_FEATURES) if (options & CheckNaturalAlignment) { sljit_emit_op2u(compiler, SLJIT_AND | SLJIT_SET_Z, offsetReg, 0, SLJIT_IMM, size - 1); context->appendTrapJump(ExecutionContext::UnalignedAtomicError, sljit_emit_jump(compiler, SLJIT_NOT_ZERO)); } -#endif /* ENABLE_EXTENDED_FEATURES */ memArg.arg = SLJIT_MEM1(baseReg); memArg.argw = -static_cast(size); -#if defined(ENABLE_EXTENDED_FEATURES) if (options & AbsoluteAddress) { sljit_emit_op2(compiler, SLJIT_SUB, baseReg, 0, baseReg, 0, SLJIT_IMM, static_cast(size)); memArg.argw = 0; } -#endif /* ENABLE_EXTENDED_FEATURES */ } void MemAddress::load(sljit_compiler* compiler) @@ -266,7 +246,7 @@ void MemAddress::load(sljit_compiler* compiler) #endif /* HAS_SIMD */ } -#if defined(ENABLE_EXTENDED_FEATURES) && (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) +#if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) static void atomicRmwLoad64(int64_t* shared_p, uint64_t* result) { std::atomic* shared = reinterpret_cast*>(shared_p); @@ -335,7 +315,7 @@ static void emitAtomicLoadStore64(sljit_compiler* compiler, Instruction* instr) sljit_emit_op1(compiler, SLJIT_MOV, valueArgPair.arg2, valueArgPair.arg2w, SLJIT_MEM1(SLJIT_SP), stackTmpStart + WORD_HIGH_OFFSET); } } -#endif /* ENABLE_EXTENDED_FEATURES && SLJIT_32BIT_ARCHITECTURE */ +#endif /* SLJIT_32BIT_ARCHITECTURE */ static void emitLoad(sljit_compiler* compiler, Instruction* instr) { @@ -356,11 +336,9 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = (instr->info() & Instruction::kHasFloatOperand) ? SLJIT_MOV_F64 : SLJIT_MOV; size = 8; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicLoadOpcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32LoadOpcode: opcode = SLJIT_MOV32; size = 4; @@ -369,10 +347,8 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = SLJIT_MOV32_S8; size = 1; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicLoad8UOpcode: FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32Load8UOpcode: opcode = SLJIT_MOV32_U8; size = 1; @@ -381,16 +357,13 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = SLJIT_MOV32_S16; size = 2; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicLoad16UOpcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32Load16UOpcode: opcode = SLJIT_MOV32_U16; size = 2; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicLoadOpcode: #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) emitAtomicLoadStore64(compiler, instr); @@ -398,7 +371,6 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) #endif /* SLJIT_32BIT_ARCHITECTURE */ options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64LoadOpcode: opcode = SLJIT_MOV; size = 8; @@ -407,10 +379,8 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = SLJIT_MOV_S8; size = 1; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicLoad8UOpcode: FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Load8UOpcode: opcode = SLJIT_MOV_U8; size = 1; @@ -419,11 +389,9 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = SLJIT_MOV_S16; size = 2; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicLoad16UOpcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Load16UOpcode: opcode = SLJIT_MOV_U16; size = 2; @@ -432,11 +400,9 @@ static void emitLoad(sljit_compiler* compiler, Instruction* instr) opcode = SLJIT_MOV_S32; size = 4; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicLoad32UOpcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Load32UOpcode: opcode = SLJIT_MOV_U32; size = 4; @@ -736,33 +702,26 @@ static void emitStore(sljit_compiler* compiler, Instruction* instr) opcode = (instr->info() & Instruction::kHasFloatOperand) ? SLJIT_MOV_F64 : SLJIT_MOV; size = 8; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicStoreOpcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32StoreOpcode: opcode = SLJIT_MOV32; size = 4; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicStore8Opcode: FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32Store8Opcode: opcode = SLJIT_MOV32_U8; size = 1; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I32AtomicStore16Opcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I32Store16Opcode: opcode = SLJIT_MOV32_U16; size = 2; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicStoreOpcode: #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) emitAtomicLoadStore64(compiler, instr); @@ -770,33 +729,26 @@ static void emitStore(sljit_compiler* compiler, Instruction* instr) #endif /* SLJIT_32BIT_ARCHITECTURE */ options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64StoreOpcode: opcode = SLJIT_MOV; size = 8; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicStore8Opcode: FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Store8Opcode: opcode = SLJIT_MOV_U8; size = 1; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicStore16Opcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Store16Opcode: opcode = SLJIT_MOV_U16; size = 2; break; -#if defined(ENABLE_EXTENDED_FEATURES) case ByteCode::I64AtomicStore32Opcode: options |= MemAddress::CheckNaturalAlignment; FALLTHROUGH; -#endif /* ENABLE_EXTENDED_FEATURES */ case ByteCode::I64Store32Opcode: opcode = SLJIT_MOV_U32; size = 4; @@ -1006,7 +958,6 @@ static void emitStore(sljit_compiler* compiler, Instruction* instr) sljit_emit_op1(compiler, opcode, addr.memArg.arg, addr.memArg.argw, addr.loadArg.arg, addr.loadArg.argw); } -#if defined(ENABLE_EXTENDED_FEATURES) #if (defined SLJIT_32BIT_ARCHITECTURE && SLJIT_32BIT_ARCHITECTURE) static void atomicRmwAdd64(uint64_t* shared_p, uint64_t* value, uint64_t* result) @@ -1664,5 +1615,3 @@ static void emitAtomicNotify(sljit_compiler* compiler, Instruction* instr) MOVE_FROM_REG(compiler, SLJIT_MOV, dst.arg, dst.argw, SLJIT_R0); } - -#endif /* ENABLE_EXTENDED_FEATURES */ diff --git a/src/jit/MemoryUtilInl.h b/src/jit/MemoryUtilInl.h index 483121f39..03377a50b 100644 --- a/src/jit/MemoryUtilInl.h +++ b/src/jit/MemoryUtilInl.h @@ -155,11 +155,7 @@ static void emitDataDrop(sljit_compiler* compiler, Instruction* instr) sljit_emit_icall(compiler, SLJIT_CALL, SLJIT_ARGS2V(32, W), SLJIT_IMM, addr); } -#if defined(ENABLE_EXTENDED_FEATURES) - static void emitAtomicFence(sljit_compiler* compiler) { sljit_emit_op0(compiler, SLJIT_MEMORY_BARRIER); } - -#endif /* ENABLE_EXTENDED_FEATURES */ diff --git a/src/parser/WASMParser.cpp b/src/parser/WASMParser.cpp index b4e56105e..98c731011 100644 --- a/src/parser/WASMParser.cpp +++ b/src/parser/WASMParser.cpp @@ -2161,7 +2161,6 @@ class WASMBinaryReader : public wabt::WASMBinaryReaderDelegate { } // Extended Features -#if defined(ENABLE_EXTENDED_FEATURES) virtual void OnAtomicLoadExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override { auto code = static_cast(opcode); @@ -2289,39 +2288,6 @@ class WASMBinaryReader : public wabt::WASMBinaryReaderDelegate { auto dst = computeExprResultPosition(WASMCodeInfo::codeTypeToValueType(g_wasmCodeInfo[opcode].m_resultType)); pushByteCode(Walrus::MemoryAtomicNotify(offset, src0, src1, dst), code); } -#else // Extended Features - virtual void OnAtomicLoadExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } - - virtual void OnAtomicStoreExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } - - virtual void OnAtomicRmwExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } - - virtual void OnAtomicCmpxchgExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } - virtual void OnAtomicWaitExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } - virtual void OnAtomicFenceExpr(uint32_t consistency_model) override - { - ASSERT_NOT_REACHED(); - } - virtual void OnAtomicNotifyExpr(int opcode, Index memidx, Address alignmentLog2, Address offset) override - { - ASSERT_NOT_REACHED(); - } -#endif // Extended Features virtual void OnRefFuncExpr(Index func_index) override { diff --git a/src/runtime/JITExec.cpp b/src/runtime/JITExec.cpp index 25a485ac8..35321077d 100644 --- a/src/runtime/JITExec.cpp +++ b/src/runtime/JITExec.cpp @@ -70,14 +70,12 @@ ByteCodeStackOffset* JITFunction::call(ExecutionState& state, Instance* instance case ExecutionContext::UnreachableError: Trap::throwException(state, "unreachable executed"); return resultOffsets; -#if defined(ENABLE_EXTENDED_FEATURES) case ExecutionContext::UnalignedAtomicError: Trap::throwException(state, "unaligned atomic"); return resultOffsets; case ExecutionContext::ExpectedSharedMemError: Trap::throwException(state, "expected shared memory"); return resultOffsets; -#endif /* ENABLE_EXTENDED_FEATURES */ default: Trap::throwException(state, "unknown exception"); return resultOffsets; diff --git a/src/runtime/JITExec.h b/src/runtime/JITExec.h index 9f9920154..45ff84b5f 100644 --- a/src/runtime/JITExec.h +++ b/src/runtime/JITExec.h @@ -42,10 +42,8 @@ struct ExecutionContext { IndirectCallTypeMismatchError, InvalidConversionToIntegerError, UnreachableError, -#if defined(ENABLE_EXTENDED_FEATURES) UnalignedAtomicError, ExpectedSharedMemError, -#endif /* ENABLE_EXTENDED_FEATURES */ // These three in this order must be the last items of the list. GenericTrap, // Error code received in SLJIT_R0. diff --git a/src/runtime/Memory.cpp b/src/runtime/Memory.cpp index 19343adfd..682247d76 100644 --- a/src/runtime/Memory.cpp +++ b/src/runtime/Memory.cpp @@ -233,7 +233,6 @@ void Memory::fillMemory(uint32_t start, uint8_t value, uint32_t size) #endif } -#if defined(ENABLE_EXTENDED_FEATURES) void Memory::checkAtomicAccess(ExecutionState& state, uint32_t offset, uint32_t size, uint32_t addend) const { checkAccess(state, offset, size, addend); @@ -246,6 +245,4 @@ void Memory::throwUnsharedMemoryException(ExecutionState& state) const { Trap::throwException(state, "expected shared memory"); } -#endif - } // namespace Walrus diff --git a/src/runtime/Memory.h b/src/runtime/Memory.h index 30c89eb28..02e5215f2 100644 --- a/src/runtime/Memory.h +++ b/src/runtime/Memory.h @@ -20,10 +20,8 @@ #include "util/BitOperation.h" #include "runtime/ExecutionState.h" #include "runtime/Object.h" -#if defined(ENABLE_EXTENDED_FEATURES) #include "runtime/Store.h" #include -#endif namespace Walrus { @@ -150,8 +148,7 @@ class Memory : public Extern { #endif } -#if defined(ENABLE_EXTENDED_FEATURES) - enum AtomicRmwOp{ + enum AtomicRmwOp { Add, Sub, And, @@ -291,7 +288,6 @@ class Memory : public Extern { waiter->m_mutex.unlock(); *out = realCount; } -#endif #ifdef CPU_ARM32 @@ -334,10 +330,8 @@ class Memory : public Extern { } } -#if defined(ENABLE_EXTENDED_FEATURES) void checkAtomicAccess(ExecutionState& state, uint32_t offset, uint32_t size, uint32_t addend = 0) const; void throwUnsharedMemoryException(ExecutionState& state) const; -#endif uint64_t m_sizeInByte; uint64_t m_reservedSizeInByte; diff --git a/src/runtime/Store.cpp b/src/runtime/Store.cpp index 69cfc7dd8..ef3b8f412 100644 --- a/src/runtime/Store.cpp +++ b/src/runtime/Store.cpp @@ -97,7 +97,6 @@ FunctionType* Store::getDefaultFunctionType(Value::Type type) return g_defaultFunctionTypes[type]; } -#if defined(ENABLE_EXTENDED_FEATURES) Waiter* Store::getWaiter(void* address) { std::lock_guard guard(m_waiterListLock); @@ -111,5 +110,4 @@ Waiter* Store::getWaiter(void* address) m_waiterList.push_back(waiter); return waiter; } -#endif } // namespace Walrus diff --git a/src/runtime/Store.h b/src/runtime/Store.h index 3efca8f29..ddb9ff229 100644 --- a/src/runtime/Store.h +++ b/src/runtime/Store.h @@ -19,10 +19,8 @@ #include "util/Vector.h" #include "runtime/Value.h" -#if defined(ENABLE_EXTENDED_FEATURES) #include #include -#endif namespace Walrus { @@ -32,7 +30,6 @@ class Instance; class Extern; class FunctionType; -#if defined(ENABLE_EXTENDED_FEATURES) struct Waiter { struct WaiterItem { WaiterItem(Waiter* waiter) @@ -53,7 +50,6 @@ struct Waiter { std::condition_variable m_condition; std::vector m_waiterItemList; }; -#endif class Store { public: @@ -88,9 +84,7 @@ class Store { return m_instances.back(); } -#if defined(ENABLE_EXTENDED_FEATURES) Waiter* getWaiter(void* address); -#endif private: Engine* m_engine; @@ -101,10 +95,8 @@ class Store { // default FunctionTypes used for initialization of Data, Element and Global static FunctionType* g_defaultFunctionTypes[Value::Type::NUM]; -#if defined(ENABLE_EXTENDED_FEATURES) std::mutex m_waiterListLock; std::vector m_waiterList; -#endif }; } // namespace Walrus diff --git a/tools/run-tests.py b/tools/run-tests.py index 00767f94f..892b04052 100755 --- a/tools/run-tests.py +++ b/tools/run-tests.py @@ -154,7 +154,7 @@ def run_jit_tests(engine): if fail_total > 0: raise Exception("basic wasm-test-core failed") -@runner('wasm-test-extended', default=False) +@runner('wasm-test-extended', default=True) def run_extended_tests(engine): TEST_DIR = join(PROJECT_SOURCE_DIR, 'test', 'extended')