diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-03-14 11:38:24 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-03-14 11:38:24 +0900 |
| commit | 59368433336e9e318e55f398384074409d52ee60 (patch) | |
| tree | dff8a50f8b94b4c44719fb431b814c4b6f3c22d5 /src | |
| parent | e58d003863b82cb895d8ee4d0b506d453c88b51f (diff) | |
| download | php-waddiwasi-59368433336e9e318e55f398384074409d52ee60.tar.gz php-waddiwasi-59368433336e9e318e55f398384074409d52ee60.tar.zst php-waddiwasi-59368433336e9e318e55f398384074409d52ee60.zip | |
perf: optimize br_if/br_table
Diffstat (limited to 'src')
| -rw-r--r-- | src/Execution/Runtime.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Execution/Runtime.php b/src/Execution/Runtime.php index 19d5771..44f10ed 100644 --- a/src/Execution/Runtime.php +++ b/src/Execution/Runtime.php @@ -328,7 +328,7 @@ final class Runtime static $debug = 0; // if ($debug >= 3) echo "Exec: " . $instr::opName() . "\n"; - // $start = hrtime(true); + // $startTime = hrtime(true); $result = match ($instr::class) { Instrs\Numeric\F32Abs::class => $this->execInstrNumericF32Abs($instr), @@ -540,7 +540,7 @@ final class Runtime // $this->instrMetrics[$instr::opName()] ??= [0, 0]; // $this->instrMetrics[$instr::opName()][0] += 1; - // $this->instrMetrics[$instr::opName()][1] += hrtime(true) - $start; + // $this->instrMetrics[$instr::opName()][1] += hrtime(true) - $startTime; return $result; } @@ -2097,21 +2097,21 @@ final class Runtime $l = $instr->label; $c = $this->stack->popInt(); if ($c !== 0) { - return $this->execInstr(Instr::Br($l)); + return ControlFlowResult::Br($l); } else { return null; } } - private function execInstrControlBrTable(Instrs\Control\BrTable $instr): ?ControlFlowResult + private function execInstrControlBrTable(Instrs\Control\BrTable $instr): ControlFlowResult { $ls = $instr->labelTable; $ln = $instr->defaultLabel; $i = self::wasmI32ToPhpInt($this->stack->popInt()); if ($i < count($ls)) { - return $this->execInstr(Instr::Br($ls[$i])); + return ControlFlowResult::Br($ls[$i]); } else { - return $this->execInstr(Instr::Br($ln)); + return ControlFlowResult::Br($ln); } } |
