Skip to content

Commit 0b443cc

Browse files
jbertholdrv-auditorbbyalcinkaya
authored
Use two rules for 'select' to avoid if-then-else on valstack (#655)
* Use two rules for 'select' to avoid if-then-else on valstack --------- Co-authored-by: devops <[email protected]> Co-authored-by: Burak Bilge Yalçınkaya <[email protected]>
1 parent ffb03f9 commit 0b443cc

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

package/version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.68
1+
0.1.69

pykwasm/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "pykwasm"
7-
version = "0.1.68"
7+
version = "0.1.69"
88
description = ""
99
authors = [
1010
"Runtime Verification, Inc. <[email protected]>",

pykwasm/src/pykwasm/kdist/wasm-semantics/wasm.md

+8-3
Original file line numberDiff line numberDiff line change
@@ -449,11 +449,16 @@ The `select` operator picks one of the second or third stack values based on the
449449
<valstack> _ : VALSTACK => VALSTACK </valstack>
450450
451451
rule <instrs> select => .K ... </instrs>
452-
<valstack> < i32 > C : V2 : V1 : VALSTACK
453-
=> #if C =/=Int 0 #then V1 #else V2 #fi : VALSTACK
452+
<valstack> < i32 > C : V2 : V1 : VALSTACK
453+
=> V2 : VALSTACK
454454
</valstack>
455-
requires #sameType(V1, V2)
455+
requires C ==Int 0 andBool #sameType(V1, V2)
456456
457+
rule <instrs> select => .K ... </instrs>
458+
<valstack> < i32 > C : V2 : V1 : VALSTACK
459+
=> V1 : VALSTACK
460+
</valstack>
461+
requires C =/=Int 0 andBool #sameType(V1, V2)
457462
```
458463

459464
Structured Control Flow

0 commit comments

Comments
 (0)