Skip to content

Commit 46c8e95

Browse files
committed
[MERGE #5341 @Cellule] WASM: Update wabt & spectests
Merge pull request #5341 from Cellule:wasm_tests
2 parents fbda525 + 2f4fcc8 commit 46c8e95

File tree

111 files changed

+12298
-10229
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+12298
-10229
lines changed

lib/Backend/IRBuilderAsmJs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1909,7 +1909,7 @@ IRBuilderAsmJs::BuildAsmReg1(Js::OpCodeAsmJs newOpcode, uint32 offset)
19091909
void
19101910
IRBuilderAsmJs::BuildAsmReg1(Js::OpCodeAsmJs newOpcode, uint32 offset, Js::RegSlot dstReg)
19111911
{
1912-
Assert(newOpcode == Js::OpCodeAsmJs::CurrentMemory_Int);
1912+
Assert(newOpcode == Js::OpCodeAsmJs::MemorySize_Int);
19131913
Js::RegSlot dstRegSlot = GetRegSlotFromIntReg(dstReg);
19141914
IR::RegOpnd * dstOpnd = BuildDstOpnd(dstRegSlot, TyInt32);
19151915
IR::IntConstOpnd* constZero = IR::IntConstOpnd::New(0, TyInt32, m_func);

lib/Runtime/ByteCode/OpCodesAsmJs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ MACRO_EXTEND_WMS( Trunc_Db , Double2 , None
302302
MACRO_EXTEND_WMS( Trunc_Flt , Float2 , None )
303303
MACRO_EXTEND_WMS( Nearest_Db , Double2 , None )
304304
MACRO_EXTEND_WMS( Nearest_Flt , Float2 , None )
305-
MACRO_EXTEND_WMS( CurrentMemory_Int , AsmReg1 , None )
305+
MACRO_EXTEND_WMS( MemorySize_Int , AsmReg1 , None )
306306
MACRO_EXTEND_WMS( GrowMemory , Int2 , None )
307307
MACRO_EXTEND ( Unreachable_Void , Empty , OpNoFallThrough )
308308
MACRO_EXTEND_WMS( Conv_Check_DTI , Int1Double1 , None )

lib/Runtime/Language/InterpreterHandlerAsmJs.inl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ EXDEF2_WMS( F1toF1Mem , Trunc_Flt , Wasm::WasmMath::Trunc<float>
256256
EXDEF2_WMS( F1toF1Mem , Nearest_Flt , Wasm::WasmMath::Nearest<float> )
257257
EXDEF2_WMS( D1toD1Mem , Trunc_Db , Wasm::WasmMath::Trunc<double> )
258258
EXDEF2_WMS( D1toD1Mem , Nearest_Db , Wasm::WasmMath::Nearest<double> )
259-
EXDEF2_WMS( VtoI1Mem , CurrentMemory_Int, OP_GetMemorySize )
259+
EXDEF2_WMS( VtoI1Mem , MemorySize_Int , OP_GetMemorySize )
260260
EXDEF2_WMS( I1toI1Mem , GrowMemory , OP_GrowMemory )
261261
EXDEF2 ( EMPTYASMJS , Unreachable_Void , OP_Unreachable )
262262
EXDEF2_WMS( D1toI1Ctx , Conv_Check_DTI , Wasm::WasmMath::F64ToI32<false /* saturating */> )

lib/WasmReader/WasmBinaryOpCodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ WASM_MEMSTORE_OPCODE(I64StoreMem8, 0x3c, L_IL, true, Js::ArrayBufferView::TYPE_
169169
WASM_MEMSTORE_OPCODE(I64StoreMem16, 0x3d, L_IL, true, Js::ArrayBufferView::TYPE_INT16_TO_INT64, "i64.store16")
170170
WASM_MEMSTORE_OPCODE(I64StoreMem32, 0x3e, L_IL, true, Js::ArrayBufferView::TYPE_INT32_TO_INT64, "i64.store32")
171171

172-
WASM_MISC_OPCODE(CurrentMemory, 0x3f, I_I, true, "current_memory")
173-
WASM_MISC_OPCODE(GrowMemory, 0x40, I_I, true, "grow_memory")
172+
WASM_MISC_OPCODE(MemorySize, 0x3f, I_I, true, "memory.size")
173+
WASM_MISC_OPCODE(MemoryGrow, 0x40, I_I, true, "memory.grow")
174174

175175
// Constants
176176
WASM_MISC_OPCODE(I32Const, 0x41, Limit, true, "i32.const")

lib/WasmReader/WasmBinaryReader.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,16 @@ WasmOp WasmBinaryReader::ReadExpr()
437437
break;
438438
case wbNop:
439439
break;
440-
case wbCurrentMemory:
441-
case wbGrowMemory:
440+
case wbMemorySize:
441+
case wbMemoryGrow:
442442
{
443443
// Reserved value currently unused
444444
uint8 reserved = ReadConst<uint8>();
445445
if (reserved != 0)
446446
{
447-
ThrowDecodingError(op == wbCurrentMemory
448-
? _u("current_memory reserved value must be 0")
449-
: _u("grow_memory reserved value must be 0")
447+
ThrowDecodingError(op == wbMemorySize
448+
? _u("memory.size reserved value must be 0")
449+
: _u("memory.grow reserved value must be 0")
450450
);
451451
}
452452
break;

lib/WasmReader/WasmByteCodeGenerator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -770,15 +770,15 @@ void WasmBytecodeGenerator::EmitExpr(WasmOp op)
770770
break;
771771
case wbNop:
772772
return;
773-
case wbCurrentMemory:
773+
case wbMemorySize:
774774
{
775775
SetUsesMemory(0);
776776
Js::RegSlot tempReg = GetRegisterSpace(WasmTypes::I32)->AcquireTmpRegister();
777777
info = EmitInfo(tempReg, WasmTypes::I32);
778-
m_writer->AsmReg1(Js::OpCodeAsmJs::CurrentMemory_Int, tempReg);
778+
m_writer->AsmReg1(Js::OpCodeAsmJs::MemorySize_Int, tempReg);
779779
break;
780780
}
781-
case wbGrowMemory:
781+
case wbMemoryGrow:
782782
{
783783
info = EmitGrowMemory();
784784
break;

lib/wabt/LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187
same "printed page" as the copyright notice for easier
188188
identification within third-party archives.
189189

190-
Copyright 2015 the repository authors, see AUTHORS file.
190+
Copyright [yyyy] [name of copyright owner]
191191

192192
Licensed under the Apache License, Version 2.0 (the "License");
193193
you may not use this file except in compliance with the License.

lib/wabt/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ You can use `-h` to get additional help:
205205
$ out/wasm-interp -h
206206
```
207207

208+
## Running wasm2c
209+
210+
See [wasm2c.md](wasm2c/README.md)
211+
208212
## Running the test suite
209213

210214
See [test/README.md](test/README.md).

lib/wabt/chakra/wabtapi.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class MyErrorHandler : public ErrorHandler
2424
public:
2525
MyErrorHandler() : ErrorHandler(Location::Type::Text) {}
2626

27-
virtual bool OnError(const Location& loc, const std::string& error, const std::string& source_line, size_t source_line_column_offset) override
27+
virtual bool OnError(ErrorLevel level, const Location& loc, const std::string& error, const std::string& source_line, size_t source_line_column_offset) override
2828
{
2929
int colStart = loc.first_column - 1 - (int)source_line_column_offset;
3030
int sourceErrorLength = (loc.last_column - loc.first_column) - 2;
@@ -34,7 +34,8 @@ class MyErrorHandler : public ErrorHandler
3434
sourceErrorLength = 0;
3535
}
3636
char buf[4096];
37-
wabt_snprintf(buf, 4096, "Wast Parsing error:%u:%u:\n%s\n%s\n%*s^%*s^",
37+
wabt_snprintf(buf, 4096, "Wast Parsing %s:%u:%u:\n%s\n%s\n%*s^%*s^",
38+
GetErrorLevelName(level),
3839
loc.line,
3940
loc.first_column,
4041
error.c_str(),
@@ -80,6 +81,9 @@ Features GetWabtFeatures(const ChakraContext& ctx)
8081
{
8182
features.enable_sat_float_to_int();
8283
}
84+
85+
// Enable wabt features that have made it into the spec
86+
features.enable_mutable_globals();
8387
return features;
8488
}
8589

lib/wabt/chakra/windows/config.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
#define HAVE_STRCASECMP 0
3939

4040
/* Whether ENABLE_VIRTUAL_TERMINAL_PROCESSING is defined by windows.h */
41-
#define HAVE_WIN32_VT100 0
41+
#define HAVE_WIN32_VT100 1
4242

4343
#define COMPILER_IS_CLANG 0
4444
#define COMPILER_IS_GNU 0

0 commit comments

Comments
 (0)