Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testsuite #1738

Merged
merged 1 commit into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/c-writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,9 @@ void CWriter::WriteElemInitializers() {
}
Index elem_segment_index = 0;
for (const ElemSegment* elem_segment : module_->elem_segments) {
if (elem_segment->kind == SegmentKind::Passive) {
continue;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like it might conflict with #1721 (same file altered, diff is extremely close and might overlap) so we should coordinate with @shravanrn

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is very minor. It should be pretty trivial to replicate (or deal with any merge conflicts).

Write("offset = ");
WriteInitExpr(elem_segment->offset);
Write(";", Newline());
Expand Down
6 changes: 6 additions & 0 deletions src/interp/interp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,9 @@ Result Table::Grow(Store& store, u32 count, Ref ref) {
u32 new_size;
if (store.HasValueType(ref, type_.element) &&
CanGrow<u32>(type_.limits, old_size, count, &new_size)) {
// Grow the limits of the table too, so that if it is used as an
// import to another module its new size is honored.
type_.limits.initial += count;
elements_.resize(new_size);
Fill(store, old_size, ref, new_size - old_size);
return Result::Ok;
Expand Down Expand Up @@ -529,6 +532,9 @@ Result Memory::Match(class Store& store,
Result Memory::Grow(u64 count) {
u64 new_pages;
if (CanGrow<u64>(type_.limits, pages_, count, &new_pages)) {
// Grow the limits of the memory too, so that if it is used as an
// import to another module its new size is honored.
type_.limits.initial += count;
#if WABT_BIG_ENDIAN
auto old_size = data_.size();
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/type-checker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ Result TypeChecker::OnCallIndirect(const TypeVector& param_types,
Result TypeChecker::OnFuncRef(Index* out_index) {
Type type;
Result result = PeekType(0, &type);
if (!type.IsIndex()) {
if (!(type == Type::Any || type.IsIndex())) {
TypeVector actual;
if (Succeeded(result)) {
actual.push_back(type);
Expand Down Expand Up @@ -766,7 +766,7 @@ Result TypeChecker::OnRefNullExpr(Type type) {
Result TypeChecker::OnRefIsNullExpr() {
Type type;
Result result = PeekType(0, &type);
if (!type.IsRef()) {
if (!(type == Type::Any || type.IsRef())) {
TypeVector actual;
if (Succeeded(result)) {
actual.push_back(type);
Expand Down
11 changes: 8 additions & 3 deletions test/run-spec-wasm2c.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def F64ToC(f64_bits):


def MangleType(t):
return {'i32': 'i', 'i64': 'j', 'f32': 'f', 'f64': 'd'}[t]
return {'i32': 'i', 'i64': 'j', 'f32': 'f', 'f64': 'd',
'externref': 'e', 'funcref': 'f'}[t]


def MangleTypes(types):
Expand Down Expand Up @@ -237,6 +238,8 @@ def _WriteAssertReturnCommand(self, command):
'f32': 'ASSERT_RETURN_F32',
'i64': 'ASSERT_RETURN_I64',
'f64': 'ASSERT_RETURN_F64',
'externref': 'ASSERT_RETURN_EXTERNREF',
'funcref': 'ASSERT_RETURN_FUNCREF',
}

assert_macro = assert_map[type_]
Expand Down Expand Up @@ -280,6 +283,10 @@ def _Constant(self, const):
return F32ToC(int(value))
elif type_ == 'f64':
return F64ToC(int(value))
elif type_ == 'externref':
return 'externref(%s)' % value
elif type_ == 'funcref':
return 'funcref(%s)' % value
else:
assert False

Expand Down Expand Up @@ -379,8 +386,6 @@ def main(args):
error_cmdline=options.error_cmdline)
wast2json.verbose = options.print_cmd
wast2json.AppendOptionalArgs({'-v': options.verbose})
wast2json.AppendArg('--disable-reference-types')
wast2json.AppendArg('--disable-bulk-memory')

json_file_path = utils.ChangeDir(
utils.ChangeExt(options.file, '.json'), out_dir)
Expand Down
114 changes: 57 additions & 57 deletions test/spec/binary-leb128.txt
Original file line number Diff line number Diff line change
@@ -1,119 +1,119 @@
;;; TOOL: run-interp-spec
;;; STDIN_FILE: third_party/testsuite/binary-leb128.wast
(;; STDOUT ;;;
out/test/spec/binary-leb128.wast:217: assert_malformed passed:
out/test/spec/binary-leb128.wast:218: assert_malformed passed:
000000c: error: unable to read u32 leb128: memory initial page count
out/test/spec/binary-leb128.wast:225: assert_malformed passed:
out/test/spec/binary-leb128.wast:226: assert_malformed passed:
000000e: error: unable to read u32 leb128: memory max page count
out/test/spec/binary-leb128.wast:234: assert_malformed passed:
out/test/spec/binary-leb128.wast:235: assert_malformed passed:
0000010: error: unable to read u32 leb128: data segment flags
out/test/spec/binary-leb128.wast:245: assert_malformed passed:
out/test/spec/binary-leb128.wast:246: assert_malformed passed:
0000011: error: unable to read u32 leb128: elem segment flags
out/test/spec/binary-leb128.wast:256: assert_malformed passed:
out/test/spec/binary-leb128.wast:257: assert_malformed passed:
0000009: error: unable to read u32 leb128: section size
out/test/spec/binary-leb128.wast:267: assert_malformed passed:
out/test/spec/binary-leb128.wast:268: assert_malformed passed:
000000a: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:278: assert_malformed passed:
out/test/spec/binary-leb128.wast:279: assert_malformed passed:
000000c: error: unable to read u32 leb128: function param count
out/test/spec/binary-leb128.wast:290: assert_malformed passed:
out/test/spec/binary-leb128.wast:291: assert_malformed passed:
000000f: error: unable to read u32 leb128: function result count
out/test/spec/binary-leb128.wast:302: assert_malformed passed:
out/test/spec/binary-leb128.wast:303: assert_malformed passed:
0000012: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:317: assert_malformed passed:
out/test/spec/binary-leb128.wast:318: assert_malformed passed:
000001b: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:332: assert_malformed passed:
out/test/spec/binary-leb128.wast:333: assert_malformed passed:
0000026: error: unable to read u32 leb128: import signature index
out/test/spec/binary-leb128.wast:347: assert_malformed passed:
out/test/spec/binary-leb128.wast:348: assert_malformed passed:
0000011: error: unable to read u32 leb128: function signature index
out/test/spec/binary-leb128.wast:359: assert_malformed passed:
out/test/spec/binary-leb128.wast:360: assert_malformed passed:
0000015: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:375: assert_malformed passed:
out/test/spec/binary-leb128.wast:376: assert_malformed passed:
0000019: error: unable to read u32 leb128: export item index
out/test/spec/binary-leb128.wast:391: assert_malformed passed:
out/test/spec/binary-leb128.wast:392: assert_malformed passed:
0000014: error: unable to read u32 leb128: function body count
out/test/spec/binary-leb128.wast:404: assert_malformed passed:
out/test/spec/binary-leb128.wast:405: assert_malformed passed:
0000022: error: unable to read u32 leb128: load offset
out/test/spec/binary-leb128.wast:423: assert_malformed passed:
out/test/spec/binary-leb128.wast:424: assert_malformed passed:
0000021: error: unable to read u32 leb128: load alignment
out/test/spec/binary-leb128.wast:442: assert_malformed passed:
out/test/spec/binary-leb128.wast:443: assert_malformed passed:
0000023: error: unable to read u32 leb128: store alignment
out/test/spec/binary-leb128.wast:461: assert_malformed passed:
out/test/spec/binary-leb128.wast:462: assert_malformed passed:
0000024: error: unable to read u32 leb128: store offset
out/test/spec/binary-leb128.wast:482: assert_malformed passed:
out/test/spec/binary-leb128.wast:483: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:492: assert_malformed passed:
out/test/spec/binary-leb128.wast:493: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:503: assert_malformed passed:
out/test/spec/binary-leb128.wast:504: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:513: assert_malformed passed:
out/test/spec/binary-leb128.wast:514: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:525: assert_malformed passed:
out/test/spec/binary-leb128.wast:526: assert_malformed passed:
000000c: error: unable to read u32 leb128: memory initial page count
out/test/spec/binary-leb128.wast:533: assert_malformed passed:
out/test/spec/binary-leb128.wast:534: assert_malformed passed:
000000c: error: unable to read u32 leb128: memory initial page count
out/test/spec/binary-leb128.wast:541: assert_malformed passed:
out/test/spec/binary-leb128.wast:542: assert_malformed passed:
000000e: error: unable to read u32 leb128: memory max page count
out/test/spec/binary-leb128.wast:550: assert_malformed passed:
out/test/spec/binary-leb128.wast:551: assert_malformed passed:
000000e: error: unable to read u32 leb128: memory max page count
out/test/spec/binary-leb128.wast:559: assert_malformed passed:
out/test/spec/binary-leb128.wast:560: assert_malformed passed:
0000010: error: unable to read u32 leb128: data segment flags
out/test/spec/binary-leb128.wast:570: assert_malformed passed:
out/test/spec/binary-leb128.wast:571: assert_malformed passed:
0000011: error: unable to read u32 leb128: elem segment flags
out/test/spec/binary-leb128.wast:581: assert_malformed passed:
out/test/spec/binary-leb128.wast:582: assert_malformed passed:
0000009: error: unable to read u32 leb128: section size
out/test/spec/binary-leb128.wast:592: assert_malformed passed:
out/test/spec/binary-leb128.wast:593: assert_malformed passed:
000000a: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:603: assert_malformed passed:
out/test/spec/binary-leb128.wast:604: assert_malformed passed:
000000c: error: unable to read u32 leb128: function param count
out/test/spec/binary-leb128.wast:615: assert_malformed passed:
out/test/spec/binary-leb128.wast:616: assert_malformed passed:
000000f: error: unable to read u32 leb128: function result count
out/test/spec/binary-leb128.wast:627: assert_malformed passed:
out/test/spec/binary-leb128.wast:628: assert_malformed passed:
0000012: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:642: assert_malformed passed:
out/test/spec/binary-leb128.wast:643: assert_malformed passed:
000001b: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:657: assert_malformed passed:
out/test/spec/binary-leb128.wast:658: assert_malformed passed:
0000026: error: unable to read u32 leb128: import signature index
out/test/spec/binary-leb128.wast:672: assert_malformed passed:
out/test/spec/binary-leb128.wast:673: assert_malformed passed:
0000011: error: unable to read u32 leb128: function signature index
out/test/spec/binary-leb128.wast:685: assert_malformed passed:
out/test/spec/binary-leb128.wast:686: assert_malformed passed:
0000015: error: unable to read u32 leb128: string length
out/test/spec/binary-leb128.wast:701: assert_malformed passed:
out/test/spec/binary-leb128.wast:702: assert_malformed passed:
0000019: error: unable to read u32 leb128: export item index
out/test/spec/binary-leb128.wast:717: assert_malformed passed:
out/test/spec/binary-leb128.wast:718: assert_malformed passed:
0000014: error: unable to read u32 leb128: function body count
out/test/spec/binary-leb128.wast:730: assert_malformed passed:
out/test/spec/binary-leb128.wast:731: assert_malformed passed:
0000022: error: unable to read u32 leb128: load offset
out/test/spec/binary-leb128.wast:749: assert_malformed passed:
out/test/spec/binary-leb128.wast:750: assert_malformed passed:
0000022: error: unable to read u32 leb128: load offset
out/test/spec/binary-leb128.wast:768: assert_malformed passed:
out/test/spec/binary-leb128.wast:769: assert_malformed passed:
0000021: error: unable to read u32 leb128: load alignment
out/test/spec/binary-leb128.wast:786: assert_malformed passed:
out/test/spec/binary-leb128.wast:787: assert_malformed passed:
0000021: error: unable to read u32 leb128: load alignment
out/test/spec/binary-leb128.wast:805: assert_malformed passed:
out/test/spec/binary-leb128.wast:806: assert_malformed passed:
0000023: error: unable to read u32 leb128: store alignment
out/test/spec/binary-leb128.wast:824: assert_malformed passed:
out/test/spec/binary-leb128.wast:825: assert_malformed passed:
0000023: error: unable to read u32 leb128: store alignment
out/test/spec/binary-leb128.wast:843: assert_malformed passed:
out/test/spec/binary-leb128.wast:844: assert_malformed passed:
0000024: error: unable to read u32 leb128: store offset
out/test/spec/binary-leb128.wast:862: assert_malformed passed:
out/test/spec/binary-leb128.wast:863: assert_malformed passed:
0000024: error: unable to read u32 leb128: store offset
out/test/spec/binary-leb128.wast:884: assert_malformed passed:
out/test/spec/binary-leb128.wast:885: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:894: assert_malformed passed:
out/test/spec/binary-leb128.wast:895: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:904: assert_malformed passed:
out/test/spec/binary-leb128.wast:905: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:914: assert_malformed passed:
out/test/spec/binary-leb128.wast:915: assert_malformed passed:
000000e: error: unable to read i32 leb128: init_expr i32.const value
out/test/spec/binary-leb128.wast:925: assert_malformed passed:
out/test/spec/binary-leb128.wast:926: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:935: assert_malformed passed:
out/test/spec/binary-leb128.wast:936: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:945: assert_malformed passed:
out/test/spec/binary-leb128.wast:946: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:955: assert_malformed passed:
out/test/spec/binary-leb128.wast:956: assert_malformed passed:
000000e: error: unable to read i64 leb128: init_expr i64.const value
out/test/spec/binary-leb128.wast:987: assert_malformed passed:
out/test/spec/binary-leb128.wast:988: assert_malformed passed:
0000019: error: unable to read u32 leb128: opcode
57/57 tests passed.
;;; STDOUT ;;)
Loading