aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--benchmarks/20240314-1130.log4
-rw-r--r--src/Execution/Runtime.php12
-rw-r--r--traces/20240314-1131.stderr.log86
3 files changed, 96 insertions, 6 deletions
diff --git a/benchmarks/20240314-1130.log b/benchmarks/20240314-1130.log
new file mode 100644
index 0000000..177bac1
--- /dev/null
+++ b/benchmarks/20240314-1130.log
@@ -0,0 +1,4 @@
+Benchmark 1: make run
+ Time (mean ± σ): 3.340 s ± 0.028 s [User: 3.280 s, System: 0.060 s]
+ Range (min … max): 3.310 s … 3.405 s 10 runs
+
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);
}
}
diff --git a/traces/20240314-1131.stderr.log b/traces/20240314-1131.stderr.log
new file mode 100644
index 0000000..ac6cf55
--- /dev/null
+++ b/traces/20240314-1131.stderr.log
@@ -0,0 +1,86 @@
+Decoding...
+Instantiating...
+Executing...
+
+Exit code: 0
+Memory peak usage: 194459424
+
+
+i32.rem_u: 6322 1 6322.000000
+i64.rot_l: 8186 1 8186.000000
+f64.gt: 4830 2 2415.000000
+f64.mul: 5091 2 2545.500000
+i64.eq: 5251 2 2625.500000
+f64.load: 16972 2 8486.000000
+f64.add: 6853 4 1713.250000
+f64.convert_i32_s: 7374 4 1843.500000
+i64.sub: 348978 16 21811.125000
+i64.extend_i32_s: 425288 16 26580.500000
+i64.lt_u: 626512 17 36853.647059
+f64.store: 707457 24 29477.375000
+f64.const: 569306 26 21896.384615
+i32.wrap_i64: 397931 32 12435.343750
+i64.eqz: 867286 42 20649.666667
+i64.gt_u: 536848 46 11670.608696
+i64.or: 657776 46 14299.478261
+i64.shl: 571715 47 12164.148936
+i32.le_s: 733887 49 14977.285714
+i64.xor: 519064 62 8372.000000
+i64.ne: 592240 70 8460.571429
+i32.extend8_s: 703153 78 9014.782051
+i32.load16_s: 937283 81 11571.395062
+memory.size: 747428 130 5749.446154
+i32.ge_s: 700922 134 5230.761194
+i32.ctz: 1237568 155 7984.309677
+i64.and: 528373 226 2337.933628
+i64.shr_u: 527850 239 2208.577406
+i32.extend16_s: 624618 256 2439.914062
+i32.div_u: 1028534 284 3621.598592
+i64.add: 667868 323 2067.702786
+i32.load16_u: 1118098 426 2624.643192
+i64.extend_i32_u: 1303310 592 2201.537162
+i32.gt_s: 1071510 613 1747.977162
+i64.mul: 1321574 842 1569.565321
+i32.store16: 3077241 1998 1540.160661
+i32.lt_s: 2000826 2161 925.879685
+i32.rot_l: 2798699 2203 1270.403541
+i32.clz: 2962669 5130 577.518324
+br_table: 4135033 6061 682.236100
+i64.const: 3301153 9965 331.274762
+call_indirect: 9076279160 12643 717889.674919
+i64.load: 9750484 12927 754.272762
+drop: 4920670 15033 327.324553
+i32.xor: 12283570 18826 652.479018
+return: 6322894 19633 322.054398
+i32.le_u: 11286589 25404 444.283932
+global.get: 8917822 25951 343.640785
+select: 12981798 29114 445.895377
+i32.ge_u: 14766671 33468 441.217611
+i32.store8: 19762710 42849 461.217531
+loop: 8931616664 44110 202485.075130
+global.set: 16805205 51161 328.476867
+i32.shr_u: 19940864 51699 385.710826
+i32.load8_s: 20523529 54242 378.369695
+i32.sub: 22056709 64081 344.200449
+i32.eq: 25245649 66100 381.931150
+br: 22873659 66911 341.851997
+i32.mul: 24614158 68122 361.324653
+call: 33759742778 70579 478325.603621
+i32.or: 41085938 71541 574.299185
+i32.shl: 36304334 86408 420.150148
+i32.ne: 31590631 92660 340.930617
+i32.lt_u: 37697386 101169 372.617956
+i32.gt_u: 41775787 117828 354.548893
+i32.load8_u: 65732748 159431 412.295902
+i32.eqz: 53531123 198278 269.980144
+i32.and: 94849743 249884 379.575095
+i64.store: 196419930 306534 640.776977
+i32.store: 192978984 362806 531.906815
+local.set: 101011767 439632 229.764364
+i32.load: 245886058 564315 435.724831
+block: 72288993518 723450 99922.584170
+br_if: 205318678 732305 280.373175
+local.tee: 166594044 758661 219.589572
+i32.add: 200735063 812466 247.068878
+i32.const: 268142016 1589717 168.672799
+local.get: 532607257 3135728 169.851230