Commit Graph

1070 Commits

Author SHA1 Message Date
Takeshi Yoneda
962a92fbc7 wazeroir: implements fmt.Stringer for operations (#1203)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
Co-authored-by: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com>
2023-03-06 15:43:35 +09:00
Takeshi Yoneda
ac6ee548d1 ci: adds workflow to cleanup caches in PRs. (#1201)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-06 13:59:19 +09:00
Crypt Keeper
25493fe271 gojs: makes experimental status explicit (#1200)
Before, our README said gojs `GOOS=js compiled wasm` was experimental.
However, as we head to 1.0 we should be more explicit about that.

When we started gojs, there was no likely future where `GOOS=wasi` would
happen in the standard go compiler. This has changed, so we'll only keep
the gojs package around until wasi is usable for two Go releases. Being
in an experimental package helps others know to watch out for this.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-06 09:22:58 +08:00
Crypt Keeper
a9b3301862 gojs: implements remaining link functions (#1198)
This implements the last remaining link functions using the same logic
as WASI. In doing so, this changes the signature for FS.ReadLink to be
more similar to the rest of the functions. Particularly, it stops
reading the result into a buffer.

After this, the only syscalls left to implement in gojs are chown.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-05 16:11:36 +08:00
Edoardo Vacchi
b533540485 build: fix issue with GNU make vs BSD make (#1195)
It looks like $(subst from,to,text) works differently on BSD make
vs GNU make. The behavior we expected for

    $(subst,$(space),$(comma),$(var))

is instead the behavior of `$(patsubst ...)` on GNU Make.

The alternative syntax `$(var: =,)` seems portable across the two
and shows the same behavior.

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-03 09:29:11 +01:00
Takeshi Yoneda
b30c01d56d ci: fixes CLI release flow on main repository (#1193)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-03 11:33:31 +09:00
Edoardo Vacchi
f36d30b82d Ensure nil is accepted as FS config (#1182)
In previous releases, passing a `nil` value as an FS config
did not cause any error. However, in 1.0.0-rc.1 this leads
to the creation of an invalid `adapter{fs: nil}`, which
eventually leads to a panic (nil):

    (f *FileEntry) Stat(st *platform.Stat_t) =>
        (r *lazyDir) file() =>
            r.fs.OpenFile(".", os.O_RDONLY, 0)

with fs == nil

The backwards-compatible fix is to make Adapt()
return UnimplementedFS, and ensuring `nil` is a valid value
that config is able to handle.

However, we may want to consider returning an error somewhere,
because configuring a nil FS may be unintended.

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-03 10:01:31 +08:00
Takeshi Yoneda
4043d58287 ci: polishes fork PR protect (#1191)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-03 09:00:06 +09:00
Crypt Keeper
c8344f2bfe site: move scale to better section (#1190)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-03 07:33:48 +08:00
Edoardo Vacchi
117474c477 refactor binary encoding to its own package (#1187)
move binary encoder to its own package

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-03 07:21:22 +08:00
Edoardo Vacchi
e2660b3f17 ci: do not fail the Windows build if the certificate is missing (#1189)
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-03 07:18:22 +08:00
Takeshi Yoneda
cbb7edf7d6 ci: GH release job in response to tag creations (#1186)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-02 17:34:18 +09:00
Takeshi Yoneda
80958c6766 ci: adds windows packaging and tests (#1185)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-02 13:43:05 +09:00
Crypt Keeper
a4db5b4945 site: adds taubyte to new cloud platform category (#1184)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-02 08:33:45 +08:00
Francis Chuang
fa784dc069 Add mjml-go to community page (#1183)
Signed-off-by: Francis Chuang <francis.chuang@gmail.com>
2023-03-02 08:20:50 +09:00
Crypt Keeper
c0276a6fe9 site: sorts headings by tier and adds trivy (#1181)
This makes the headings mostly in order by tier, like libraries, then
middleware before compiled binaries.

This also adds Trivy, which was one of the original end users of wazero!

cc @knqyf263 who I asked permission from.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-01 17:48:50 +08:00
Crypt Keeper
1bec067588 site: adds dapr to users (#1180)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-03-01 16:56:36 +08:00
Crypt Keeper
e77f24fe31 sysfs: drops os.File special casing for fs.FS to pass wasi-testsuite (#1174)
This adds a wazero adapter which passes wasi-testsuite 100pct on darwin,
linux and windows. While the main change was adding inodes to the wasi
`fd_readdir` dirents, there was a lot of incidental work needed.

Most of the work was troubleshooting in nature, around windows
specifically, but also wrapping of files. This backfills a lot of tests
and reworked how wrapping works, particularly around windows.

To accommodate this, we drop `os.File` special casing except for
`sysfs.DirFS`

Signed-off-by: Adrian Cole <adrian@tetrate.io>
v1.0.0-rc.1
2023-03-01 13:28:57 +08:00
Shivansh Vij
4fd3d9d6e2 Adds scale.sh to users.md (#1179)
Signed-off-by: Shivansh Vij <shivanshvij@loopholelabs.io>
2023-03-01 11:42:12 +09:00
Takeshi Yoneda
5ffc3f61fd ci: artifacts creation check for non windows platforms (#1178)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-03-01 09:54:45 +09:00
Edoardo Vacchi
5598e491f7 Add timeout support in wazero run cli (#1173)
- ensure the module initialization function is evaluated
  regardless if it's WASI or GoJS
- add a `-timeout duration` flag
- ensure flag gets propagated to the rt config builder
  (also ensure cache flag gets propagated to the rt config builder)
- print a message to stderr when the deadline is exceeded
- configure GitHub Actions to use `-timeout=10m` flag
  instead of GHA's `timeout-minutes: 10`

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-03-01 07:46:57 +08:00
Takeshi Yoneda
9c07b2793d Allows to set the version of CLI (#1176)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-28 18:09:41 +09:00
Takeshi Yoneda
599e01b65a fuzz: update README instructions (#1175)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-28 09:13:16 +09:00
Crypt Keeper
3d5b6d609a implements lstat and fixes inode stat on windows go 1.20 (#1168)
gojs: implements lstat

This implements platform.Lstat and uses it in GOOS=js. Notably,
directory listings need to run lstat on their entries to get the correct
inodes back. In GOOS=js, directories are a fan-out of names, then lstat.

This also fixes stat for inodes on directories. We were missing a test
so we didn't know it was broken on windows. The approach used now is
reliable on go 1.20, and we should suggest anyone using windows to
compile with go 1.20.

Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-28 07:20:31 +08:00
Takeshi Yoneda
d955cd7a13 windows: fixes unlinking symlink to dir, rmdir on opened empty dir. (#1172)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-27 16:23:54 +09:00
Crypt Keeper
75aa6b2a6e examples: updates to the latest SDKs (#1169)
This updates our examples to the latest SDKs as particularly this can
help reveal issues around fan-out stats.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-27 09:05:48 +08:00
Takeshi Yoneda
5eab1a7307 compiler: pass runtimeValueLocationStack by values to reduce allocations (#1170)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-27 09:42:45 +09:00
Crypt Keeper
70924aa7a1 Readdir: handles io.EOF (#1166)
This handles EOF even if current and possibly future wasi don't have a
way to propagate an EOF signal. This is mainly to match up with go
semantics and ensure we don't have any error conditions (by adding
tests).

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-26 06:47:10 +08:00
Nuno Cruces
6d0b008e08 site: adds sqlite3 as a user (#1167) 2023-02-26 06:46:52 +08:00
Edoardo Vacchi
94743cc21e Set Memory.Max to min(user-memory-limit, sys-memory-limit) on load (#1165)
Updated `newMemorySizer()` to return the updated value, but also
ensure that an invalid `max` still throws an error (invalid module).

- Minor cleanup to use the `memorySizer` type instead of the full
  func signature for clarity
- Added a wat+wasm under `internal/integration_test/vs/testdata/`
  simply because that's where the other cache-related testdata was.

Closes #1153.

Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
2023-02-25 07:31:23 +08:00
Crypt Keeper
1e7660fc4f wasi: shares more cached stat info to reduce impact of inode requirement (#1161)
We formerly cached only the directory type, to avoid re-stat'ing the
same directory many times. Since we are there, we can also cache the
inode, which is strictly required by wasi and costly to fetch. Note:
this only affects the directory: its contents still need a potential
fan-out of stats which will be handled in another change.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-25 07:28:45 +08:00
Crypt Keeper
118631be9e wasi: updates benchmark to uses sysfs (#1160)
Before, we only tested wrapped filesystems implemented with `fs.FS`.
This adds our native filesystem type, showing the current benchmarks are
about the same for reading a directory, but a lot faster for stat.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-24 16:33:35 +08:00
Crypt Keeper
2ee0c472a1 site: adds mosn as a user (#1162)
thanks @antJack @taoyuanyuan and recently @evacchi for the long term
collaboration on this.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-24 16:33:16 +08:00
Crypt Keeper
3dd8bfd5ee ci: updates to latest zig (#1163)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-24 16:32:43 +08:00
Anuraag Agrawal
13dc2e6b3d Add go-re2 to users.md (#1159)
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
2023-02-24 10:18:46 +08:00
Phil Kedy
304669b6f0 Adding waPC to general purpose plugins list (#1157)
Signed-off-by: Phil Kedy <phil.kedy@gmail.com>
Co-authored-by: Crypt Keeper <64215+codefromthecrypt@users.noreply.github.com>
2023-02-24 10:01:12 +08:00
Clifton Kaznocha
ecb5b1ad03 Close and return immediately if the context is already canceled (#1158)
Signed-off-by: Clifton Kaznocha <ckaznocha@users.noreply.github.com>
Co-authored-by: Clifton Kaznocha <ckaznocha@users.noreply.github.com>
2023-02-24 09:58:07 +08:00
Clifton Kaznocha
f0132ee346 Fix issue with a delayed check of the context cancelation (#1156)
If a context is canceled after a gust func call has returned it could
cause the module to close in some cases. This change ensures that
a delayed check of the context cancelation is ignored.

I've also reduced the cost of context cancelation a bit.

Signed-off-by: Clifton Kaznocha <ckaznocha@users.noreply.github.com>
2023-02-24 09:42:13 +08:00
Achille
9ebbb41adb sys.FileTable => descriptor.Table (#1155)
Signed-off-by: Achille Roussel <achille.roussel@gmail.com>
2023-02-24 08:37:24 +08:00
Crypt Keeper
bb002c862f wasi: adds platform.Dirent in preparation of inode fetching (#1154)
wasi_snapshot_preview1 recently requires fd_readdir to return actual
inode values. On zero, wasi-libc will call fdstat to retrieve them.

This introduces our own `platform.Dirent` type and `Readdir` function
which a later change will allow fetching of inodes.

See https://github.com/WebAssembly/wasi-libc/pull/345

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-23 18:56:27 +08:00
Crypt Keeper
3a06ae38e7 wasi: manually adds dot and dot-dot directory entries (#1152)
This manually adds dot and dot-dot directory entries discarded by
compilers like Go. Doing so complies with the latest interpretation of
wasi preview1 without forcing us to do the same in preview2 or in
GOOS=js. There's a cost penalty of one stat per directory list, which
will be only measurable when using real file I/O.

This should result in us being able to remove the exclusion here
https://github.com/WebAssembly/wasi-testsuite/pull/55/files#diff-8a3ffd323d75a12f8deb01b053f062876d83dda0b89c1fa24b293cee4195bcfd

See https://github.com/WebAssembly/wasi-testsuite/issues/52

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-23 07:24:05 +08:00
Crypt Keeper
55d302accb site: adds community page, seeded with a couple projects (#1151)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-22 16:12:01 +08:00
Crypt Keeper
d5c321e29a adds platform.Readdirnames and uses in gojs (#1149)
This adds `platform.Readdirnames` which is preparation work before doing
something similar for reading the directory. We use this in gojs as it
doesn't actually need dirents, rather just names.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-21 15:56:22 +08:00
Takeshi Yoneda
9bae5a0deb ci: stops building Rust binaries in wasi-testsuite (#1148)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-21 13:29:52 +09:00
Crypt Keeper
fce4c19dff optimizes non-windows stat to avoid opening a file (#1147)
Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-21 12:06:13 +08:00
Crypt Keeper
4ca0858e57 sysfs: adds FS.Stat and companions in platform (#1140)
This centralizes filestat logic by making our own `Stat_t` similar to
`syscall.Stat_t`. This exposes utilities in the platform package and
adds a new function `FS.Stat` which avoids having to use `fs.File` to
get the same info. Doing so at the FS abstraction allows us to optimize
how it is implemented internally using portable means (e.g.
`os.StatFile`) or OS-specific means where necessary, e.g. in windows.

This also ensures `platform.OpenFile` returns syscall.Errno and
centralizes error checking with a new `require.EqualErrno` test.

Signed-off-by: Adrian Cole <adrian@tetrate.io>
2023-02-21 10:13:37 +08:00
Takeshi Yoneda
2587989f0a wazeroir: reduces allocations with controlFrames (#1146)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-21 10:11:49 +09:00
Takeshi Yoneda
f882996106 wazeroir: removes allocations in wasmOpcodeSignature asymptotically (#1145)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-21 09:52:21 +09:00
Takeshi Yoneda
9d8033df1b wazeroir: reuses bytes.Reader (#1143)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-21 08:49:47 +09:00
Takeshi Yoneda
ff5aced9c7 wazeroir: avoids allocation in applyToStack (#1144)
Signed-off-by: Takeshi Yoneda <takeshi@tetrate.io>
2023-02-21 08:40:47 +09:00