Stream: git-wasmtime

Topic: wasmtime / PR #4074 ISLE: add support for implicit `=x` v...


view this post on Zulip Wasmtime GitHub notifications bot (Apr 26 2022 at 23:24):

cfallin opened PR #4074 from isle-var-bind-or-match to main:

Currently, a variable can be named in two different ways in an ISLE
pattern. One can write a pattern like (T x y) that binds the two
args of T with the subpatterns x and y, each of which match
anything and capture the value as a bound variable. Or, one can write
a pattern like (T x =x), where the first arg pattern x captures
the value in x and the second arg pattern =x matches only the same
value that was already captured.

It turns out (thanks to @fitzgen for this insight here [1]) that this
distinction can actually be inferred easily: if x isn't bound, then
mentioning it binds it; otherwise, it matches only the already-bound
variable. There's no concern about ordering (one mention binding
vs. the other) because (i) the value is equal either way, and (ii) the
types at both sites must be the same.

This language tweak seems like it should simplify things nicely! We
can remove the =x syntax later if we want, but this PR doesn't do
so.

[1] https://github.com/bytecodealliance/wasmtime/pull/4071#discussion_r859111513

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Apr 26 2022 at 23:24):

cfallin requested fitzgen for a review on PR #4074.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 00:12):

cfallin updated PR #4074 from isle-var-bind-or-match to main.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:13):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:13):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:13):

fitzgen created PR review comment:

Can we keep a set/map of already-bound variables? Doing a linear search here seems suboptimal.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:16):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:16):

cfallin created PR review comment:

Ah, I think I originally wrote it this way for two reasons:

In practice with a handful of bindings it shouldn't really be a perf concern, I think...

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:20):

cfallin created PR review comment:

(If you still want us to do something better here I'm happy to think about it more, though!)

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:20):

cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:22):

fitzgen submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:22):

fitzgen created PR review comment:

Eh, if it isn't a quick fix then lets leave it and deal with it if/when it actually becomes a problem

view this post on Zulip Wasmtime GitHub notifications bot (Apr 27 2022 at 20:25):

cfallin merged PR #4074.


Last updated: Nov 22 2024 at 16:03 UTC