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

Merge bytecodealliance:main into wenyongh:main #362

Merged
merged 2 commits into from Oct 14, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/spec_test.yml
Expand Up @@ -11,6 +11,8 @@ on:
- "core/shared/**"
- "wamr-compiler/**"
- "product-mini/**"
- "tests/wamr-test-suites/spec-test-script/**"
- "tests/wamr-test-suites/test_wamr.sh"
# will be triggered on push events
push:
paths:
Expand All @@ -19,6 +21,8 @@ on:
- "core/shared/**"
- "wamr-compiler/**"
- "product-mini/**"
- "tests/wamr-test-suites/spec-test-script/**"
- "tests/wamr-test-suites/test_wamr.sh"
# allow to be triggered manually
workflow_dispatch:

Expand Down
Expand Up @@ -62,6 +62,8 @@ typedef uint64_t __wasi_device_t;
typedef uint64_t __wasi_dircookie_t;
#define __WASI_DIRCOOKIE_START (0)

typedef uint32_t __wasi_dirnamlen_t;

typedef uint16_t __wasi_errno_t;
#define __WASI_ESUCCESS (0)
#define __WASI_E2BIG (1)
Expand Down Expand Up @@ -182,7 +184,7 @@ typedef uint16_t __wasi_fstflags_t;

typedef uint64_t __wasi_inode_t;

typedef uint32_t __wasi_linkcount_t;
typedef uint64_t __wasi_linkcount_t __attribute__((aligned(8)));

typedef uint32_t __wasi_lookupflags_t;
#define __WASI_LOOKUP_SYMLINK_FOLLOW (0x00000001)
Expand All @@ -198,35 +200,38 @@ typedef uint16_t __wasi_riflags_t;
#define __WASI_SOCK_RECV_WAITALL (0x0002)

typedef uint64_t __wasi_rights_t;
#define __WASI_RIGHT_FD_DATASYNC (0x0000000000000001)
#define __WASI_RIGHT_FD_READ (0x0000000000000002)
#define __WASI_RIGHT_FD_SEEK (0x0000000000000004)
#define __WASI_RIGHT_FD_FDSTAT_SET_FLAGS (0x0000000000000008)
#define __WASI_RIGHT_FD_SYNC (0x0000000000000010)
#define __WASI_RIGHT_FD_TELL (0x0000000000000020)
#define __WASI_RIGHT_FD_WRITE (0x0000000000000040)
#define __WASI_RIGHT_FD_ADVISE (0x0000000000000080)
#define __WASI_RIGHT_FD_ALLOCATE (0x0000000000000100)
#define __WASI_RIGHT_PATH_CREATE_DIRECTORY (0x0000000000000200)
#define __WASI_RIGHT_PATH_CREATE_FILE (0x0000000000000400)
#define __WASI_RIGHT_PATH_LINK_SOURCE (0x0000000000000800)
#define __WASI_RIGHT_PATH_LINK_TARGET (0x0000000000001000)
#define __WASI_RIGHT_PATH_OPEN (0x0000000000002000)
#define __WASI_RIGHT_FD_READDIR (0x0000000000004000)
#define __WASI_RIGHT_PATH_READLINK (0x0000000000008000)
#define __WASI_RIGHT_PATH_RENAME_SOURCE (0x0000000000010000)
#define __WASI_RIGHT_PATH_RENAME_TARGET (0x0000000000020000)
#define __WASI_RIGHT_PATH_FILESTAT_GET (0x0000000000040000)
#define __WASI_RIGHT_PATH_FILESTAT_SET_SIZE (0x0000000000080000)
#define __WASI_RIGHT_PATH_FILESTAT_SET_TIMES (0x0000000000100000)
#define __WASI_RIGHT_FD_FILESTAT_GET (0x0000000000200000)
#define __WASI_RIGHT_FD_FILESTAT_SET_SIZE (0x0000000000400000)
#define __WASI_RIGHT_FD_FILESTAT_SET_TIMES (0x0000000000800000)
#define __WASI_RIGHT_PATH_SYMLINK (0x0000000001000000)
#define __WASI_RIGHT_PATH_REMOVE_DIRECTORY (0x0000000002000000)
#define __WASI_RIGHT_PATH_UNLINK_FILE (0x0000000004000000)
#define __WASI_RIGHT_POLL_FD_READWRITE (0x0000000008000000)
#define __WASI_RIGHT_SOCK_SHUTDOWN (0x0000000010000000)

// Observe that WASI defines rights in the plural form
// TODO - re-factor to use RIGHTS instead of RIGHT
#define __WASI_RIGHT_FD_DATASYNC ((__wasi_rights_t)(1 << 0))
#define __WASI_RIGHT_FD_READ ((__wasi_rights_t)(1 << 1))
#define __WASI_RIGHT_FD_SEEK ((__wasi_rights_t)(1 << 2))
#define __WASI_RIGHT_FD_FDSTAT_SET_FLAGS ((__wasi_rights_t)(1 << 3))
#define __WASI_RIGHT_FD_SYNC ((__wasi_rights_t)(1 << 4))
#define __WASI_RIGHT_FD_TELL ((__wasi_rights_t)(1 << 5))
#define __WASI_RIGHT_FD_WRITE ((__wasi_rights_t)(1 << 6))
#define __WASI_RIGHT_FD_ADVISE ((__wasi_rights_t)(1 << 7))
#define __WASI_RIGHT_FD_ALLOCATE ((__wasi_rights_t)(1 << 8))
#define __WASI_RIGHT_PATH_CREATE_DIRECTORY ((__wasi_rights_t)(1 << 9))
#define __WASI_RIGHT_PATH_CREATE_FILE ((__wasi_rights_t)(1 << 10))
#define __WASI_RIGHT_PATH_LINK_SOURCE ((__wasi_rights_t)(1 << 11))
#define __WASI_RIGHT_PATH_LINK_TARGET ((__wasi_rights_t)(1 << 12))
#define __WASI_RIGHT_PATH_OPEN ((__wasi_rights_t)(1 << 13))
#define __WASI_RIGHT_FD_READDIR ((__wasi_rights_t)(1 << 14))
#define __WASI_RIGHT_PATH_READLINK ((__wasi_rights_t)(1 << 15))
#define __WASI_RIGHT_PATH_RENAME_SOURCE ((__wasi_rights_t)(1 << 16))
#define __WASI_RIGHT_PATH_RENAME_TARGET ((__wasi_rights_t)(1 << 17))
#define __WASI_RIGHT_PATH_FILESTAT_GET ((__wasi_rights_t)(1 << 18))
#define __WASI_RIGHT_PATH_FILESTAT_SET_SIZE ((__wasi_rights_t)(1 << 19))
#define __WASI_RIGHT_PATH_FILESTAT_SET_TIMES ((__wasi_rights_t)(1 << 20))
#define __WASI_RIGHT_FD_FILESTAT_GET ((__wasi_rights_t)(1 << 21))
#define __WASI_RIGHT_FD_FILESTAT_SET_SIZE ((__wasi_rights_t)(1 << 22))
#define __WASI_RIGHT_FD_FILESTAT_SET_TIMES ((__wasi_rights_t)(1 << 23))
#define __WASI_RIGHT_PATH_SYMLINK ((__wasi_rights_t)(1 << 24))
#define __WASI_RIGHT_PATH_REMOVE_DIRECTORY ((__wasi_rights_t)(1 << 25))
#define __WASI_RIGHT_PATH_UNLINK_FILE ((__wasi_rights_t)(1 << 26))
#define __WASI_RIGHT_POLL_FD_READWRITE ((__wasi_rights_t)(1 << 27))
#define __WASI_RIGHT_SOCK_SHUTDOWN ((__wasi_rights_t)(1 << 28))

typedef uint16_t __wasi_roflags_t;
#define __WASI_SOCK_RECV_DATA_TRUNCATED (0x0001)
Expand Down Expand Up @@ -292,7 +297,7 @@ struct argv_environ_values;
typedef struct __wasi_dirent_t {
__wasi_dircookie_t d_next;
__wasi_inode_t d_ino;
uint32_t d_namlen;
__wasi_dirnamlen_t d_namlen;
__wasi_filetype_t d_type;
} __wasi_dirent_t __attribute__((aligned(8)));
_Static_assert(offsetof(__wasi_dirent_t, d_next) == 0, "non-wasi data layout");
Expand Down Expand Up @@ -380,16 +385,16 @@ _Static_assert(offsetof(__wasi_filestat_t, st_ino) == 8, "non-wasi data layout")
_Static_assert(
offsetof(__wasi_filestat_t, st_filetype) == 16, "non-wasi data layout");
_Static_assert(
offsetof(__wasi_filestat_t, st_nlink) == 20, "non-wasi data layout");
offsetof(__wasi_filestat_t, st_nlink) == 24, "non-wasi data layout");
_Static_assert(
offsetof(__wasi_filestat_t, st_size) == 24, "non-wasi data layout");
offsetof(__wasi_filestat_t, st_size) == 32, "non-wasi data layout");
_Static_assert(
offsetof(__wasi_filestat_t, st_atim) == 32, "non-wasi data layout");
offsetof(__wasi_filestat_t, st_atim) == 40, "non-wasi data layout");
_Static_assert(
offsetof(__wasi_filestat_t, st_mtim) == 40, "non-wasi data layout");
offsetof(__wasi_filestat_t, st_mtim) == 48, "non-wasi data layout");
_Static_assert(
offsetof(__wasi_filestat_t, st_ctim) == 48, "non-wasi data layout");
_Static_assert(sizeof(__wasi_filestat_t) == 56, "non-wasi data layout");
offsetof(__wasi_filestat_t, st_ctim) == 56, "non-wasi data layout");
_Static_assert(sizeof(__wasi_filestat_t) == 64, "non-wasi data layout");
_Static_assert(_Alignof(__wasi_filestat_t) == 8, "non-wasi data layout");

typedef struct __wasi_ciovec_t {
Expand Down
7 changes: 3 additions & 4 deletions tests/wamr-test-suites/spec-test-script/runtest.py
Expand Up @@ -901,10 +901,9 @@ def compile_wast_to_wasm(form, wast_tempfile, wasm_tempfile, opts):
"--no-check",
wast_tempfile, "-o", wasm_tempfile ]

# optional arguments
if opts.ref_types:
cmd.append("--enable-reference-types")
cmd.append("--enable-bulk-memory")
# remove reference-type and bulk-memory enabling options since a WABT
# commit 30c1e983d30b33a8004b39fd60cbd64477a7956c
# Enable reference types by default (#1729)

log("Running: %s" % " ".join(cmd))
try:
Expand Down
Expand Up @@ -163,9 +163,24 @@ index b9fa438c..a5711dd3 100644
;; 1 elem segment declared, 2 given
(assert_malformed
diff --git a/test/core/elem.wast b/test/core/elem.wast
index 1ea2b061..f5440e07 100644
index 1ea2b061..8eded377 100644
--- a/test/core/elem.wast
+++ b/test/core/elem.wast
@@ -12,10 +12,10 @@
(elem 0x0 (i32.const 0) $f $f)
(elem 0x000 (offset (i32.const 0)))
(elem 0 (offset (i32.const 0)) $f $f)
- (elem $t (i32.const 0))
- (elem $t (i32.const 0) $f $f)
- (elem $t (offset (i32.const 0)))
- (elem $t (offset (i32.const 0)) $f $f)
+ (elem (i32.const 0))
+ (elem (i32.const 0) $f $f)
+ (elem (offset (i32.const 0)))
+ (elem (offset (i32.const 0)) $f $f)
)

;; Basic use
@@ -354,6 +354,7 @@
(assert_return (invoke $module1 "call-8") (i32.const 65))
(assert_return (invoke $module1 "call-9") (i32.const 66))
Expand Down
3 changes: 2 additions & 1 deletion tests/wamr-test-suites/test_wamr.sh
Expand Up @@ -290,7 +290,8 @@ function spec_test()

# fetch spec for threads proposal
git fetch threads
git reset --hard HEAD
# [interpreter] Threading (#179) Fri Aug 6 18:02:59 2021 +0200
git reset --hard 0d115b494d640eb0c1c352941fd14ca0bad926d3
git checkout threads/main

git apply ../../spec-test-script/thread_proposal_ignore_cases.patch
Expand Down