From 0cf8c73ece11e857aefc2c33e531cf81531995de Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 15 Mar 2024 18:43:20 +0900 Subject: chore: remove debug code --- examples/php-on-wasm/php-wasm.php | 14 -------------- 1 file changed, 14 deletions(-) (limited to 'examples') diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index c82862f..9072bf0 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/php-on-wasm/php-wasm.php @@ -6,7 +6,6 @@ require_once __DIR__ . '/../../vendor/autoload.php'; use Nsfisis\Waddiwasi\BinaryFormat\Decoder; use Nsfisis\Waddiwasi\BinaryFormat\InvalidBinaryFormatException; -use Nsfisis\Waddiwasi\Debug\Debug; use Nsfisis\Waddiwasi\Execution\ExternVal; use Nsfisis\Waddiwasi\Execution\FuncInst; use Nsfisis\Waddiwasi\Execution\Refs; @@ -26,16 +25,13 @@ EOS; $wasmBinary = file_get_contents(__DIR__ . '/php-wasm.wasm'); \assert($wasmBinary !== false); -fprintf(STDERR, "Decoding...\n"); try { $module = (new Decoder($wasmBinary))->decode(); - // Debug::printImports($module); } catch (InvalidBinaryFormatException $e) { fprintf(STDERR, $e->getMessage() . "\n"); exit(1); } -fprintf(STDERR, "Instantiating...\n"); $hostFuncs = [ makeHostFunc('(i32, i32, i32) -> (i32)', hostFunc__env__invoke_iii(...)), makeHostFunc('(i32, i32, i32, i32, i32) -> (i32)', hostFunc__env__invoke_iiiii(...)), @@ -140,19 +136,11 @@ foreach ($hostFuncs as $hostFunc) { $runtime = Runtime::instantiate($store, $module, $externVals); $codePtr = allocateStringOnWasmMemory($runtime, PHP_HELLO_WORLD); -fprintf(STDERR, "Executing...\n"); $results = $runtime->invoke("php_wasm_run", [$codePtr]); \assert(\count($results) === 1); $exitCode = $results[0]; \assert(\is_int($exitCode)); -fprintf(STDERR, "Exit code: $exitCode\n"); -fprintf(STDERR, "Memory peak usage: %s\n", memory_get_peak_usage()); -fprintf(STDERR, "\n\n"); -foreach ($runtime->getInstrMetrics() as $instr => [$count, $time]) { - fprintf(STDERR, "%s: %d %d %f\n", $instr, $time, $count, $time / $count); -} - function allocateStringOnWasmMemory(Runtime $runtime, string $str): int { // Plus 1 for the null terminator in C. @@ -788,8 +776,6 @@ function hostFunc__env____syscall_openat(Runtime $runtime): void $mode = 0; } - // echo "syscall_openat: $path, $flags, $mode\n"; - // no such file $runtime->stack->pushValue(-44); } -- cgit v1.2.3-70-g09d2