diff options
| author | nsfisis <nsfisis@gmail.com> | 2024-07-11 02:26:51 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2024-07-11 02:26:51 +0900 |
| commit | 6120682ace94e080f2113419cde93a1af6c7d89f (patch) | |
| tree | eac7c20364b4fdb7490b46edb9dccb87a6cd076a /examples/rubyvm-on-php-on-wasm | |
| parent | 1870a964cb3586558a4a8282a7625ca3a5b09254 (diff) | |
| download | php-waddiwasi-6120682ace94e080f2113419cde93a1af6c7d89f.tar.gz php-waddiwasi-6120682ace94e080f2113419cde93a1af6c7d89f.tar.zst php-waddiwasi-6120682ace94e080f2113419cde93a1af6c7d89f.zip | |
feat: update php from 8.2.10 to 8.3.9
Diffstat (limited to 'examples/rubyvm-on-php-on-wasm')
| -rw-r--r-- | examples/rubyvm-on-php-on-wasm/php-wasm.php | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/examples/rubyvm-on-php-on-wasm/php-wasm.php b/examples/rubyvm-on-php-on-wasm/php-wasm.php index e0c3a77..59c911e 100644 --- a/examples/rubyvm-on-php-on-wasm/php-wasm.php +++ b/examples/rubyvm-on-php-on-wasm/php-wasm.php @@ -45,6 +45,7 @@ $imports = [ 'invoke_iiiiiiiiii' => makeHostFunc('(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) -> (i32)', hostFunc__env__invoke_iiiiiiiiii(...)), 'strftime' => makeHostFunc('(i32, i32, i32, i32) -> (i32)', hostFunc__env__strftime(...)), 'getaddrinfo' => makeHostFunc('(i32, i32, i32, i32) -> (i32)', hostFunc__env__getaddrinfo(...)), + 'posix_spawnp' => makeHostFunc('(i32, i32, i32, i32, i32, i32) -> (i32)', hostFunc__env__posix_spawnp(...)), 'getdtablesize' => makeHostFunc('() -> (i32)', hostFunc__env__getdtablesize(...)), 'getprotobyname' => makeHostFunc('(i32) -> (i32)', hostFunc__env__getprotobyname(...)), 'getprotobynumber' => makeHostFunc('(i32) -> (i32)', hostFunc__env__getprotobynumber(...)), @@ -62,7 +63,6 @@ $imports = [ '__syscall_chmod' => makeHostFunc('(i32, i32) -> (i32)', hostFunc__env____syscall_chmod(...)), '__syscall_fchownat' => makeHostFunc('(i32, i32, i32, i32, i32) -> (i32)', hostFunc__env____syscall_fchownat(...)), '__syscall_dup' => makeHostFunc('(i32) -> (i32)', hostFunc__env____syscall_dup(...)), - '__syscall_dup3' => makeHostFunc('(i32, i32, i32) -> (i32)', hostFunc__env____syscall_dup3(...)), '_emscripten_memcpy_js' => makeHostFunc('(i32, i32, i32) -> ()', hostFunc__env___emscripten_memcpy_js(...)), 'emscripten_date_now' => makeHostFunc('() -> (f64)', hostFunc__env__emscripten_date_now(...)), '_emscripten_get_now_is_monotonic' => makeHostFunc('() -> (i32)', hostFunc__env___emscripten_get_now_is_monotonic(...)), @@ -782,6 +782,12 @@ function hostFunc__env__getaddrinfo(Runtime $runtime): void throw new \RuntimeException('env::getaddrinfo: not implemented'); } +// Type: (i32, i32, i32, i32, i32, i32) -> (i32) +function hostFunc__env__posix_spawnp(Runtime $runtime): void +{ + throw new \RuntimeException('env::posix_spawnp: not implemented'); +} + // Type: () -> (i32) function hostFunc__env__getdtablesize(Runtime $runtime): void { @@ -907,6 +913,10 @@ function hostFunc__env____syscall_ioctl(Runtime $runtime): void // Type: (i32) -> (i32) function hostFunc__wasi_snapshot_preview1__fd_close(Runtime $runtime, int $fd): int { + if ($fd === -1) { + // should report an error? + return 0; + } $file = fsGetVFileFromFd($fd); \assert($file !== null); $file->close(); @@ -1033,12 +1043,6 @@ function hostFunc__env____syscall_dup(Runtime $runtime, int $oldFd): int return fsDup($oldFd); } -// Type: (i32, i32, i32) -> (i32) -function hostFunc__env____syscall_dup3(Runtime $runtime): void -{ - throw new \RuntimeException('env::__syscall_dup3: not implemented'); -} - // Type: (i32, i32, i32) -> () function hostFunc__env___emscripten_memcpy_js(Runtime $runtime, int $dest, int $src, int $num): void { @@ -1058,15 +1062,15 @@ function hostFunc__env__emscripten_date_now(Runtime $runtime): float } // Type: () -> (i32) -function hostFunc__env___emscripten_get_now_is_monotonic(Runtime $runtime): void +function hostFunc__env___emscripten_get_now_is_monotonic(Runtime $runtime): int { - throw new \RuntimeException('env::_emscripten_get_now_is_monotonic: not implemented'); + return 1; } // Type: () -> (f64) -function hostFunc__env__emscripten_get_now(Runtime $runtime): void +function hostFunc__env__emscripten_get_now(Runtime $runtime): float { - throw new \RuntimeException('env::emscripten_get_now: not implemented'); + return round(microtime(true) * 1000); } // Type: (i32) -> (i32) |
