Skip to content

Commit c263ea1

Browse files
committed
[Draft][Parser] Enable the new text parser by default
1 parent 133fd8c commit c263ea1

File tree

122 files changed

+2160
-6601
lines changed

Some content is hidden

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

122 files changed

+2160
-6601
lines changed

check.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ def check_expected(actual, expected):
242242
for module, asserts in support.split_wast(wast):
243243
print(' testing split module', split_num)
244244
split_num += 1
245-
support.write_wast('split.wast', module, asserts)
245+
support.write_wast('split.wast', module)
246246
run_opt_test('split.wast') # also that our optimizer doesn't break on it
247-
result_wast_file = shared.binary_format_check('split.wast', verify_final_result=False, original_wast=wast)
247+
result_wast_file = shared.binary_format_check('split.wast', verify_final_result=False)
248248
with open(result_wast_file) as f:
249249
result_wast = f.read()
250250
# add the asserts, and verify that the test still passes

scripts/test/shared.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ def get_tests(test_dir, extensions=[], recursive=False):
457457
# check utilities
458458

459459
def binary_format_check(wast, verify_final_result=True, wasm_as_args=['-g'],
460-
binary_suffix='.fromBinary', original_wast=None):
460+
binary_suffix='.fromBinary'):
461461
# checks we can convert the wast to binary and back
462462

463463
print(' (binary format check)')

src/wasm/wasm-io.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
namespace wasm {
3535

36-
bool useNewWATParser = false;
36+
bool useNewWATParser = true;
3737

3838
#define DEBUG_TYPE "writer"
3939

src/wasm/wasm-ir-builder.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,9 @@ Result<> IRBuilder::makeThrowRef() {
15531553
}
15541554

15551555
Result<> IRBuilder::makeTupleMake(uint32_t arity) {
1556+
if (arity < 2) {
1557+
return Err{"tuple arity must be at least 2"};
1558+
}
15561559
TupleMake curr(wasm.allocator);
15571560
curr.operands.resize(arity);
15581561
CHECK_ERR(visitTupleMake(&curr));
@@ -1561,13 +1564,22 @@ Result<> IRBuilder::makeTupleMake(uint32_t arity) {
15611564
}
15621565

15631566
Result<> IRBuilder::makeTupleExtract(uint32_t arity, uint32_t index) {
1567+
if (index >= arity) {
1568+
return Err{"tuple index out of bounds"};
1569+
}
1570+
if (arity < 2) {
1571+
return Err{"tuple arity must be at least 2"};
1572+
}
15641573
TupleExtract curr;
15651574
CHECK_ERR(visitTupleExtract(&curr, arity));
15661575
push(builder.makeTupleExtract(curr.tuple, index));
15671576
return Ok{};
15681577
}
15691578

15701579
Result<> IRBuilder::makeTupleDrop(uint32_t arity) {
1580+
if (arity < 2) {
1581+
return Err{"tuple arity must be at least 2"};
1582+
}
15711583
Drop curr;
15721584
CHECK_ERR(visitDrop(&curr, arity));
15731585
push(builder.makeDrop(curr.value));

test/ctor-eval/bad-indirect-call3.wast.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(memory $0 256 256)
66
(data $0 (i32.const 10) "waka waka waka waka waka")
77
(table $0 1 1 funcref)
8-
(elem $0 (i32.const 0) $callee)
8+
(elem $implicit-elem (i32.const 0) $callee)
99
(export "sig_mismatch" (func $sig_mismatch))
1010
(func $callee (type $0) (param $0 externref)
1111
(i32.store8

0 commit comments

Comments
 (0)