diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-04-29 22:33:27 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-04-29 22:33:27 +0900 |
| commit | a6e1225bdaee353f764ec471e2d613a2d5b893b0 (patch) | |
| tree | f0ed5d25cff8974affc621b34a69d5c2858b0a2a /src | |
| parent | 327bf214fe0485d5d1a9de4963573c1c9ec1725e (diff) | |
| download | php-waddiwasi-a6e1225bdaee353f764ec471e2d613a2d5b893b0.tar.gz php-waddiwasi-a6e1225bdaee353f764ec471e2d613a2d5b893b0.tar.zst php-waddiwasi-a6e1225bdaee353f764ec471e2d613a2d5b893b0.zip | |
fix: loop op
Also remove work-around for wrong implementation.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Execution/Runtime.php | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 945c187..55fbbfb 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -2388,9 +2388,8 @@ final class Runtime $instrs = $instr->body; $f = $this->stack->currentFrame(); $bt = self::expandBlockType($blockType, $f->module); - assert(count($bt->params->types) === 0); - $n = count($bt->results->types); - $l = new Label($n); + $m = count($bt->params->types); + $l = new Label($m); while (true) { $result = $this->execInstrs($instrs, $l); if ($result === null) { @@ -2398,16 +2397,10 @@ final class Runtime } elseif ($result === -1) { return -1; } elseif ($result === 0) { - if ($n === 1) { - if ($this->stack->top() instanceof Label) { - // WORKAROUND: - $this->stack->pushValue(0); - } - } - $this->deactivateLabel($n); + $this->deactivateLabel($m); continue; } else { - $this->deactivateLabel($n); + $this->deactivateLabel($m); return $result - 1; } } |
