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 | |
| 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
| -rw-r--r-- | examples/compile-php-to-wasm/Dockerfile | 2 | ||||
| -rw-r--r-- | examples/compile-php-to-wasm/php-wasm.js | 36 | ||||
| -rwxr-xr-x | examples/compile-php-to-wasm/php-wasm.wasm | bin | 4838583 -> 4941810 bytes | |||
| -rw-r--r-- | examples/php-on-wasm/php-wasm.php | 30 | ||||
| -rw-r--r-- | examples/rubyvm-on-php-on-wasm/php-wasm.php | 26 |
5 files changed, 44 insertions, 50 deletions
diff --git a/examples/compile-php-to-wasm/Dockerfile b/examples/compile-php-to-wasm/Dockerfile index 18e703f..db8dd0d 100644 --- a/examples/compile-php-to-wasm/Dockerfile +++ b/examples/compile-php-to-wasm/Dockerfile @@ -1,6 +1,6 @@ FROM emscripten/emsdk:3.1.62 -RUN git clone --depth=1 --branch=php-8.2.10 https://github.com/php/php-src +RUN git clone --depth=1 --branch=php-8.3.9 https://github.com/php/php-src RUN apt-get update && \ apt-get install -y --no-install-recommends \ diff --git a/examples/compile-php-to-wasm/php-wasm.js b/examples/compile-php-to-wasm/php-wasm.js index 6e8cc58..264f7f9 100644 --- a/examples/compile-php-to-wasm/php-wasm.js +++ b/examples/compile-php-to-wasm/php-wasm.js @@ -4785,23 +4785,6 @@ function dbg(...args) { } } - function ___syscall_dup3(fd, newfd, flags) { - try { - - var old = SYSCALLS.getStreamFromFD(fd); - assert(!flags); - if (old.fd === newfd) return -28; - // Check newfd is within range of valid open file descriptors. - if (newfd < 0 || newfd >= FS.MAX_OPEN_FDS) return -8; - var existing = FS.getStream(newfd); - if (existing) FS.close(existing); - return FS.dupStream(old, newfd).fd; - } catch (e) { - if (typeof FS == 'undefined' || !(e.name === 'ErrnoError')) throw e; - return -e.errno; - } - } - function ___syscall_faccessat(dirfd, path, amode, flags) { try { @@ -6557,6 +6540,13 @@ function dbg(...args) { } _makecontext.stub = true; + /** @type {function(...*):?} */ + function _posix_spawnp( + ) { + abort('missing function: posix_spawnp'); + } + _posix_spawnp.stub = true; + var arraySum = (array, index) => { @@ -6976,8 +6966,6 @@ var wasmImports = { /** @export */ __syscall_dup: ___syscall_dup, /** @export */ - __syscall_dup3: ___syscall_dup3, - /** @export */ __syscall_faccessat: ___syscall_faccessat, /** @export */ __syscall_fchownat: ___syscall_fchownat, @@ -7138,6 +7126,8 @@ var wasmImports = { /** @export */ makecontext: _makecontext, /** @export */ + posix_spawnp: _posix_spawnp, + /** @export */ proc_exit: _proc_exit, /** @export */ strptime: _strptime, @@ -7322,10 +7312,10 @@ function invoke_iiiiiiiiii(index,a1,a2,a3,a4,a5,a6,a7,a8,a9) { } } -function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) { +function invoke_viidii(index,a1,a2,a3,a4,a5) { var sp = stackSave(); try { - getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6); + getWasmTableEntry(index)(a1,a2,a3,a4,a5); } catch(e) { stackRestore(sp); if (e !== e+0) throw e; @@ -7333,10 +7323,10 @@ function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) { } } -function invoke_viidii(index,a1,a2,a3,a4,a5) { +function invoke_viiiiii(index,a1,a2,a3,a4,a5,a6) { var sp = stackSave(); try { - getWasmTableEntry(index)(a1,a2,a3,a4,a5); + getWasmTableEntry(index)(a1,a2,a3,a4,a5,a6); } catch(e) { stackRestore(sp); if (e !== e+0) throw e; diff --git a/examples/compile-php-to-wasm/php-wasm.wasm b/examples/compile-php-to-wasm/php-wasm.wasm Binary files differindex b33d7d1..d3238d0 100755 --- a/examples/compile-php-to-wasm/php-wasm.wasm +++ b/examples/compile-php-to-wasm/php-wasm.wasm diff --git a/examples/php-on-wasm/php-wasm.php b/examples/php-on-wasm/php-wasm.php index 787037c..de9dd91 100644 --- a/examples/php-on-wasm/php-wasm.php +++ b/examples/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(...)), @@ -436,6 +436,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 { @@ -536,9 +542,9 @@ function hostFunc__env____syscall_ioctl(Runtime $runtime): void } // Type: (i32) -> (i32) -function hostFunc__wasi_snapshot_preview1__fd_close(Runtime $runtime): void +function hostFunc__wasi_snapshot_preview1__fd_close(Runtime $runtime, int $fd): int { - throw new \RuntimeException('wasi_snapshot_preview1::fd_close: not implemented'); + return 0; } // Type: (i32, i32, i32, i32) -> (i32) @@ -619,12 +625,6 @@ function hostFunc__env____syscall_dup(Runtime $runtime): void throw new \RuntimeException('env::__syscall_dup: not implemented'); } -// 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 { @@ -638,21 +638,21 @@ function hostFunc__env___emscripten_memcpy_js(Runtime $runtime, int $dest, int $ } // Type: () -> (f64) -function hostFunc__env__emscripten_date_now(Runtime $runtime): void +function hostFunc__env__emscripten_date_now(Runtime $runtime): float { - throw new \RuntimeException('env::emscripten_date_now: not implemented'); + return round(microtime(true) * 1000); } // 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) 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) |
