diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml
index 0c42290f3..3db00c5e6 100644
--- a/.github/workflows/benchmark.yaml
+++ b/.github/workflows/benchmark.yaml
@@ -16,7 +16,7 @@ jobs:
include:
- build: linux
os: ubuntu-latest
- rust: 1.46.0
+ rust: 1.47.0
env:
CARGO_SCCACHE_VERSION: 0.2.13
SCCACHE_AZURE_BLOB_CONTAINER: wasmerstoragesccacheblob
diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml
index ad8947392..7592c46b0 100644
--- a/.github/workflows/main.yaml
+++ b/.github/workflows/main.yaml
@@ -38,33 +38,38 @@ jobs:
strategy:
fail-fast: false
matrix:
- build: [linux, macos, windows, linux-aarch64]
+ build: [linux, macos, macos-arm64, windows, linux-aarch64]
include:
- build: linux
os: ubuntu-18.04
- rust: 1.46.0
- llvm_url: 'https://github.com/wasmerio/llvm-build/releases/download/10.x/Ubuntu1604_Release.tar.xz'
- # llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz'
+ rust: 1.47.0
+ llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-amd64.tar.gz'
artifact_name: 'wasmer-linux-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_linux'
run_integration_tests: true
- build: macos
os: macos-latest
- rust: 1.46.0
- llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-x86_64-apple-darwin.tar.xz'
- artifact_name: 'wasmer-macos-amd64'
+ rust: 1.47.0
+ llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/darwin-amd64.tar.gz'
+ artifact_name: 'wasmer-darwin-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_mac'
run_integration_tests: true
+ - build: macos-arm64
+ os: macos-11.0
+ rust: nightly
+ target: aarch64-apple-darwin
+ artifact_name: 'wasmer-darwin-arm64'
- build: windows
os: windows-latest
- rust: 1.46.0
+ rust: 1.47.0
+ llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/windows-amd64.tar.gz'
artifact_name: 'wasmer-windows-amd64'
cross_compilation_artifact_name: 'cross_compiled_from_win'
run_integration_tests: true
- build: linux-aarch64
os: [self-hosted, linux, ARM64]
- rust: 1.46.0
- llvm_url: 'https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/clang+llvm-10.0.0-aarch64-linux-gnu.tar.xz'
+ rust: 1.47.0
+ llvm_url: 'https://github.com/wasmerio/llvm-custom-builds/releases/download/10.x/linux-aarch64.tar.gz'
artifact_name: 'wasmer-linux-aarch64'
run_integration_tests: false
env:
@@ -83,72 +88,52 @@ jobs:
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
+ target: ${{ matrix.target }}
override: true
- - name: Configure cargo data directory
- # After this point, all cargo registry and crate data is stored in
- # $GITHUB_WORKSPACE/.cargo_home. This allows us to cache only the files
- # that are needed during the build process. Additionally, this works
- # around a bug in the 'cache' action that causes directories outside of
- # the workspace dir to be saved/restored incorrectly.
- run: echo "CARGO_HOME=$(pwd)/.cargo_home" >> $GITHUB_ENV
- - name: Cache
- uses: actions/cache@master
- with:
- # Note: crates from the git repo always get rebuilt
- # so we cache only those subdirectories of target/{debug|release} that
- # contain the build output for crates that come from the registry.
- path: |-
- .cargo_home
- target/*/.*
- target/*/build
- target/*/deps
- key: ${{ matrix.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.lock') }}
- restore-keys: |
- ${{ matrix.os }}-${{ matrix.rust }}-
- # # Install sccache
- # - uses: actions/cache@master
- # with:
- # path: ${{ runner.tool_cache }}/cargo-sccache
- # key: cargo-sccache-bin-${{ env.CARGO_SCCACHE_VERSION }}
- # - name: Install sccache
- # run: |
- # echo "${{ runner.tool_cache }}/cargo-sccache/bin" >> $GITHUB_PATH
- # cargo install sccache --version ${{ env.CARGO_SCCACHE_VERSION }} --root ${{ runner.tool_cache }}/cargo-sccache
- # - name: Start sccache
- # run: |
- # ${{ runner.tool_cache }}/cargo-sccache/bin/sccache --start-server
- # ${{ runner.tool_cache }}/cargo-sccache/bin/sscache -s
- # echo "RUSTC_WRAPPER=${{ runner.tool_cache }}/cargo-sccache/bin/sccache" >> $GITHUB_ENV
+ - name: Setup Rust target
+ run: |
+ cat << EOF > .cargo/config.toml
+ [build]
+ target = "${{ matrix.target }}"
+ EOF
+ if: matrix.target
+ - uses: Swatinem/rust-cache@v1
- name: Install LLVM (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
run: |
choco install llvm
- # run: |
- # curl --proto '=https' --tlsv1.2 -sSf https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/LLVM-10.0.0-win64.exe -L -o llvm-installer.exe
- # 7z x llvm-installer.exe -oC:/llvm-10
- # echo C:/llvm-10/bin >> $GITHUB_PATH
- # echo "LLVM_SYS_100_PREFIX=C:/llvm-10" >> $GITHUB_ENV
- # echo "LIBCLANG_PATH=C:/llvm-10/bin/libclang.dll" >> $GITHUB_ENV
- - name: Install LLVM (Unix)
- if: matrix.os != 'windows-latest'
+ - name: Install LLVM
+ if: matrix.os != 'windows-latest' && matrix.os != 'macos-11.0'
+ shell: bash
run: |
- curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.xz
- mkdir -p ${{ env.LLVM_DIR }}
- tar xf llvm.tar.xz --strip-components=1 -C ${{ env.LLVM_DIR }}
+ curl --proto '=https' --tlsv1.2 -sSf ${{ matrix.llvm_url }} -L -o llvm.tar.gz
+ mkdir ${{ env.LLVM_DIR }}
+ tar xf llvm.tar.gz --strip-components=1 -C ${{ env.LLVM_DIR }}
echo "${{ env.LLVM_DIR }}/bin" >> $GITHUB_PATH
echo "LLVM_SYS_100_PREFIX=${{ env.LLVM_DIR }}" >> $GITHUB_ENV
env:
LLVM_DIR: ${{ github.workspace }}/llvm-10
- name: Set up dependencies for Mac OS
- run: brew install automake
- if: matrix.os == 'macos-latest'
- - run: make test
- - name: Build and Test C API
+ run: |
+ brew install automake
+ if: matrix.os == 'macos-latest' || matrix.os == 'macos-11.0'
+ - name: Test
+ run: |
+ make test
+ if: matrix.target != 'aarch64-apple-darwin'
+ - name: Test C API
run: |
make test-capi
+ if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin' # we can't test yet on Apple Silicon or Windows
+ - name: Build C API
+ run: |
make build-capi
- if: matrix.os != 'windows-latest'
+ if: matrix.os != 'windows-latest' && matrix.target != 'aarch64-apple-darwin'
+ - name: Build C API
+ run: |
+ make build-capi-cranelift-system-libffi
+ if: matrix.target == 'aarch64-apple-darwin'
- name: Build C API on Windows
run: make build-capi
if: matrix.os == 'windows-latest'
@@ -159,13 +144,19 @@ jobs:
run: |
make build-wapm
if: needs.setup.outputs.DOING_RELEASE == '1'
- - name: Package Wasmer for integration tests
- run: make package-without-wapm-for-integration-tests
- if: needs.setup.outputs.DOING_RELEASE != '1'
- - name: Package Wasmer
+ - name: Copy target binaries
run: |
- make package
- if: needs.setup.outputs.DOING_RELEASE == '1'
+ mkdir -p target/release
+ cp target/${{matrix.target}}/release/wasmer* target/release
+ cp target/${{matrix.target}}/release/libwasmer* target/release
+ if [ -d "wapm-cli" ]; then
+ mkdir -p wapm-cli/target/release
+ cp wapm-cli/target/${{matrix.target}}/release/wapm* wapm-cli/target/release
+ fi
+ if: matrix.target
+ - name: Dist
+ run: |
+ make distribution
- name: Run integration tests (Windows)
shell: cmd
run: |
@@ -220,7 +211,6 @@ jobs:
path: cross
- name: Upload Artifacts
uses: actions/upload-artifact@v2
- if: needs.setup.outputs.DOING_RELEASE == '1'
with:
name: ${{ matrix.artifact_name }}
path: dist
@@ -300,7 +290,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
- asset_path: artifacts/wasmer-windows-amd64/wasmer-windows.exe
+ asset_path: artifacts/wasmer-windows-amd64/WasmerInstaller.exe
asset_name: wasmer-windows.exe
asset_content_type: application/vnd.microsoft.portable-executable
- name: Upload Release Asset Linux amd64
@@ -310,19 +300,29 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: artifacts/wasmer-linux-amd64/wasmer-linux-amd64.tar.gz
+ asset_path: artifacts/wasmer-linux-amd64/wasmer.tar.gz
asset_name: wasmer-linux-amd64.tar.gz
asset_content_type: application/gzip
- - name: Upload Release Asset Mac
- id: upload-release-asset-mac
+ - name: Upload Release Asset Mac amd64
+ id: upload-release-asset-mac-amd64
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: artifacts/wasmer-macos-amd64/wasmer-darwin-amd64.tar.gz
+ asset_path: artifacts/wasmer-darwin-amd64/wasmer.tar.gz
asset_name: wasmer-darwin-amd64.tar.gz
asset_content_type: application/gzip
+ - name: Upload Release Asset Mac arm64
+ id: upload-release-asset-mac-arm64
+ uses: actions/upload-release-asset@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ upload_url: ${{ steps.create_release.outputs.upload_url }}
+ asset_path: artifacts/wasmer-darwin-amd64/wasmer.tar.gz
+ asset_name: wasmer-darwin-arm64.tar.gz
+ asset_content_type: application/gzip
- name: Upload Release Asset Linux aarch64
id: upload-release-asset-linux-aarch64
uses: actions/upload-release-asset@v1
@@ -330,7 +330,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
- asset_path: artifacts/wasmer-linux-aarch64/wasmer-linux-aarch64.tar.gz
+ asset_path: artifacts/wasmer-linux-aarch64/wasmer.tar.gz
asset_name: wasmer-linux-aarch64.tar.gz
asset_content_type: application/gzip
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 10f893045..71c945933 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,10 +9,14 @@
### Added
+- [#1831](https://github.com/wasmerio/wasmer/pull/1831) Added support for Apple Silicon chips (`arm64-apple-darwin`)
- [#1649](https://github.com/wasmerio/wasmer/pull/1649) Add outline of migration to 1.0.0 docs.
### Changed
+- [#1838](https://github.com/wasmerio/wasmer/pull/1838) Deprecate `WasiEnv::state_mut`: prefer `WasiEnv::state` instead.
+- [#1663](https://github.com/wasmerio/wasmer/pull/1663) Function environments passed to host functions now must be passed by `&` instead of `&mut`. This is a breaking change. This change fixes a race condition when a host function is called from multiple threads. If you need mutability in your environment, consider using `std::sync::Mutex` or other synchronization primitives.
+- [#1830](https://github.com/wasmerio/wasmer/pull/1830) Minimum supported Rust version bumped to 1.47.0
- [#1810](https://github.com/wasmerio/wasmer/pull/1810) Make the `state` field of `WasiEnv` public
### Fixed
diff --git a/Cargo.lock b/Cargo.lock
index f99a82755..1c124e705 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -71,9 +71,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]]
name = "assert_cmd"
-version = "1.0.1"
+version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c88b9ca26f9c16ec830350d309397e74ee9abdfd8eb1f71cb6ecc71a3fc818da"
+checksum = "3dc1679af9a1ab4bea16f228b05d18f8363f8327b1fa8db00d2760cfafc6b61e"
dependencies = [
"doc-comment",
"predicates",
@@ -107,15 +107,15 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "backtrace"
-version = "0.3.54"
+version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2baad346b2d4e94a24347adeee9c7a93f412ee94b9cc26e5b59dea23848e9f28"
+checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598"
dependencies = [
"addr2line",
"cfg-if 1.0.0",
"libc",
"miniz_oxide",
- "object 0.22.0",
+ "object",
"rustc-demangle",
]
@@ -129,30 +129,6 @@ dependencies = [
"serde",
]
-[[package]]
-name = "bindgen"
-version = "0.52.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57"
-dependencies = [
- "bitflags",
- "cexpr",
- "cfg-if 0.1.10",
- "clang-sys",
- "clap",
- "env_logger",
- "lazy_static",
- "lazycell",
- "log",
- "peeking_take_while",
- "proc-macro2",
- "quote",
- "regex",
- "rustc-hash",
- "shlex",
- "which 3.1.1",
-]
-
[[package]]
name = "bitflags"
version = "1.2.1"
@@ -243,18 +219,9 @@ dependencies = [
[[package]]
name = "cc"
-version = "1.0.62"
+version = "1.0.65"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f1770ced377336a88a67c473594ccc14eca6f4559217c34f64aac8f83d641b40"
-
-[[package]]
-name = "cexpr"
-version = "0.3.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
-dependencies = [
- "nom 4.2.3",
-]
+checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15"
[[package]]
name = "cfg-if"
@@ -268,17 +235,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-[[package]]
-name = "clang-sys"
-version = "0.28.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
-dependencies = [
- "glob",
- "libc",
- "libloading 0.5.2",
-]
-
[[package]]
name = "clap"
version = "2.33.3"
@@ -352,7 +308,16 @@ version = "0.67.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f065f6889758f817f61a230220d1811ba99a9762af2fb69ae23048314f75ff2"
dependencies = [
- "cranelift-entity",
+ "cranelift-entity 0.67.0",
+]
+
+[[package]]
+name = "cranelift-bforest"
+version = "0.68.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0"
+dependencies = [
+ "cranelift-entity 0.68.0",
]
[[package]]
@@ -362,28 +327,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "510aa2ab4307644100682b94e449940a0ea15c5887f1d4b9678b8dd5ef31e736"
dependencies = [
"byteorder",
- "cranelift-bforest",
- "cranelift-codegen-meta",
- "cranelift-codegen-shared",
- "cranelift-entity",
+ "cranelift-bforest 0.67.0",
+ "cranelift-codegen-meta 0.67.0",
+ "cranelift-codegen-shared 0.67.0",
+ "cranelift-entity 0.67.0",
"gimli 0.21.0",
"hashbrown 0.7.2",
"log",
- "regalloc",
+ "regalloc 0.0.30",
"serde",
"smallvec",
"target-lexicon",
"thiserror",
]
+[[package]]
+name = "cranelift-codegen"
+version = "0.68.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1"
+dependencies = [
+ "byteorder",
+ "cranelift-bforest 0.68.0",
+ "cranelift-codegen-meta 0.68.0",
+ "cranelift-codegen-shared 0.68.0",
+ "cranelift-entity 0.68.0",
+ "gimli 0.22.0",
+ "hashbrown 0.9.1",
+ "log",
+ "regalloc 0.0.31",
+ "smallvec",
+ "target-lexicon",
+ "thiserror",
+]
+
[[package]]
name = "cranelift-codegen-meta"
version = "0.67.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4cb0c7e87c60d63b35f9670c15479ee4a5e557dd127efab88b2f9b2ca83c9a0"
dependencies = [
- "cranelift-codegen-shared",
- "cranelift-entity",
+ "cranelift-codegen-shared 0.67.0",
+ "cranelift-entity 0.67.0",
+]
+
+[[package]]
+name = "cranelift-codegen-meta"
+version = "0.68.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7"
+dependencies = [
+ "cranelift-codegen-shared 0.68.0",
+ "cranelift-entity 0.68.0",
]
[[package]]
@@ -392,23 +387,35 @@ version = "0.67.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60636227098693e06de8d6d88beea2a7d32ecf8a8030dacdb57c68e06f381826"
+[[package]]
+name = "cranelift-codegen-shared"
+version = "0.68.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938"
+
[[package]]
name = "cranelift-entity"
version = "0.67.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6156db73e0c9f65f80c512988d63ec736be0dee3dd66bf951e3e28aed9dc02d3"
+
+[[package]]
+name = "cranelift-entity"
+version = "0.68.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6"
dependencies = [
"serde",
]
[[package]]
name = "cranelift-frontend"
-version = "0.67.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e09cd158c9a820a4cc14a34076811da225cce1d31dc6d03c5ef85b91aef560b9"
+checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8"
dependencies = [
- "cranelift-codegen",
- "hashbrown 0.7.2",
+ "cranelift-codegen 0.68.0",
+ "hashbrown 0.9.1",
"log",
"smallvec",
"target-lexicon",
@@ -482,27 +489,26 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
-version = "0.9.0"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f"
+checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d"
dependencies = [
"cfg-if 1.0.0",
"const_fn",
"crossbeam-utils",
"lazy_static",
- "memoffset",
+ "memoffset 0.6.1",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
-version = "0.8.0"
+version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
+checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d"
dependencies = [
"autocfg 1.0.1",
"cfg-if 1.0.0",
- "const_fn",
"lazy_static",
]
@@ -670,19 +676,6 @@ dependencies = [
"syn",
]
-[[package]]
-name = "env_logger"
-version = "0.7.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
-dependencies = [
- "atty",
- "humantime",
- "log",
- "regex",
- "termcolor",
-]
-
[[package]]
name = "erased-serde"
version = "0.3.12"
@@ -746,7 +739,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -787,6 +780,15 @@ name = "gimli"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+dependencies = [
+ "indexmap",
+]
+
+[[package]]
+name = "gimli"
+version = "0.22.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
dependencies = [
"fallible-iterator",
"indexmap",
@@ -865,15 +867,6 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35"
-[[package]]
-name = "humantime"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
-dependencies = [
- "quick-error",
-]
-
[[package]]
name = "ident_case"
version = "1.0.1"
@@ -919,9 +912,9 @@ dependencies = [
[[package]]
name = "inline-c"
-version = "0.1.2"
+version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6acf1564e52050c9f7102e87951265c4c8012873181998be24640cb6b5e3f77c"
+checksum = "f3f35c2ef14070ed26ac0c6ff16e22d12b35bf1a6a97dcbd1a693b56aa87a61c"
dependencies = [
"assert_cmd",
"cc",
@@ -945,9 +938,9 @@ dependencies = [
[[package]]
name = "instant"
-version = "0.1.8"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613"
+checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec"
dependencies = [
"cfg-if 1.0.0",
]
@@ -1004,12 +997,6 @@ version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
-[[package]]
-name = "lazycell"
-version = "1.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
-
[[package]]
name = "leb128"
version = "0.2.4"
@@ -1024,9 +1011,9 @@ checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]]
name = "libffi"
-version = "0.9.0"
+version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c18efe55925cc7f83bf60a61394696a734ae90e668d1f2bbd954354416fec6f2"
+checksum = "bafef83ee22d51c27348aaf6b2da007a32b9f5004809d09271432e5ea2a795dd"
dependencies = [
"abort_on_panic",
"libc",
@@ -1035,24 +1022,12 @@ dependencies = [
[[package]]
name = "libffi-sys"
-version = "0.9.1"
+version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f00e48ce437c5741a4da3b51738498343b5158c37bfa02bcb969efcc44e4e06"
+checksum = "3b6d65142f1c3b06ca3f4216da4d32b3124d14d932cef8dfd8792037acd2160b"
dependencies = [
- "bindgen",
"cc",
"make-cmd",
- "pkg-config",
-]
-
-[[package]]
-name = "libloading"
-version = "0.5.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
-dependencies = [
- "cc",
- "winapi",
]
[[package]]
@@ -1080,9 +1055,9 @@ dependencies = [
[[package]]
name = "lock_api"
-version = "0.4.1"
+version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
+checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312"
dependencies = [
"scopeguard",
]
@@ -1142,6 +1117,15 @@ dependencies = [
"autocfg 1.0.1",
]
+[[package]]
+name = "memoffset"
+version = "0.6.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87"
+dependencies = [
+ "autocfg 1.0.1",
+]
+
[[package]]
name = "minifb"
version = "0.19.1"
@@ -1192,22 +1176,12 @@ dependencies = [
[[package]]
name = "nom"
-version = "4.2.3"
+version = "6.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
+checksum = "88034cfd6b4a0d54dd14f4a507eceee36c0b70e5a02236c4e4df571102be17f0"
dependencies = [
"memchr",
- "version_check 0.1.5",
-]
-
-[[package]]
-name = "nom"
-version = "5.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ffb4262d26ed83a1c0a33a38fe2bb15797329c85770da05e6b828ddb782627af"
-dependencies = [
- "memchr",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -1269,20 +1243,14 @@ dependencies = [
[[package]]
name = "object"
-version = "0.21.1"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
+checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
dependencies = [
"crc32fast",
"indexmap",
]
-[[package]]
-name = "object"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397"
-
[[package]]
name = "once_cell"
version = "1.5.2"
@@ -1291,9 +1259,9 @@ checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0"
[[package]]
name = "oorandom"
-version = "11.1.2"
+version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a170cebd8021a008ea92e4db85a72f80b35df514ec664b296fdcbb654eac0b2c"
+checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
[[package]]
name = "orbclient"
@@ -1307,9 +1275,9 @@ dependencies = [
[[package]]
name = "parking_lot"
-version = "0.11.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
+checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb"
dependencies = [
"instant",
"lock_api",
@@ -1350,12 +1318,6 @@ dependencies = [
"proc-macro-hack",
]
-[[package]]
-name = "peeking_take_while"
-version = "0.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
-
[[package]]
name = "pest"
version = "2.1.3"
@@ -1367,9 +1329,9 @@ dependencies = [
[[package]]
name = "pin-project-lite"
-version = "0.1.11"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
+checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c"
[[package]]
name = "pkg-config"
@@ -1440,7 +1402,7 @@ dependencies = [
"proc-macro2",
"quote",
"syn",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -1451,7 +1413,7 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
- "version_check 0.9.2",
+ "version_check",
]
[[package]]
@@ -1469,12 +1431,6 @@ dependencies = [
"unicode-xid",
]
-[[package]]
-name = "quick-error"
-version = "1.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
-
[[package]]
name = "quote"
version = "1.0.7"
@@ -1708,6 +1664,17 @@ dependencies = [
"smallvec",
]
+[[package]]
+name = "regalloc"
+version = "0.0.31"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
+dependencies = [
+ "log",
+ "rustc-hash",
+ "smallvec",
+]
+
[[package]]
name = "regex"
version = "1.4.2"
@@ -1934,17 +1901,11 @@ dependencies = [
"serde",
]
-[[package]]
-name = "shlex"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
-
[[package]]
name = "smallvec"
-version = "1.4.2"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
+checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85"
[[package]]
name = "stable_deref_trait"
@@ -1996,9 +1957,9 @@ checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd"
[[package]]
name = "syn"
-version = "1.0.48"
+version = "1.0.51"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
+checksum = "3b4f34193997d92804d359ed09953e25d5138df6bcc055a71bf68ee89fdf9223"
dependencies = [
"proc-macro2",
"quote",
@@ -2025,15 +1986,6 @@ dependencies = [
"winapi",
]
-[[package]]
-name = "termcolor"
-version = "1.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
-dependencies = [
- "winapi-util",
-]
-
[[package]]
name = "test-generator"
version = "0.1.0"
@@ -2112,11 +2064,11 @@ dependencies = [
[[package]]
name = "tracing"
-version = "0.1.21"
+version = "0.1.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27"
+checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3"
dependencies = [
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
"log",
"pin-project-lite",
"tracing-attributes",
@@ -2187,9 +2139,9 @@ checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
[[package]]
name = "unicode-segmentation"
-version = "1.7.0"
+version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "db8716a166f290ff49dabc18b44aa407cb7c6dbe1aa0971b44b8a24b0ca35aae"
+checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
[[package]]
name = "unicode-width"
@@ -2209,12 +2161,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
-[[package]]
-name = "version_check"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
-
[[package]]
name = "version_check"
version = "0.9.2"
@@ -2430,9 +2376,10 @@ dependencies = [
name = "wasmer-compiler-cranelift"
version = "1.0.0-alpha5"
dependencies = [
- "cranelift-codegen",
+ "cranelift-codegen 0.67.0",
+ "cranelift-codegen 0.68.0",
"cranelift-frontend",
- "gimli 0.21.0",
+ "gimli 0.22.0",
"hashbrown 0.9.1",
"lazy_static",
"more-asserts",
@@ -2460,7 +2407,7 @@ dependencies = [
"rayon",
"regex",
"rustc_version 0.2.3",
- "semver 0.9.0",
+ "semver 0.11.0",
"smallvec",
"target-lexicon",
"wasmer-compiler",
@@ -2553,7 +2500,7 @@ dependencies = [
"bincode",
"cfg-if 0.1.10",
"leb128",
- "libloading 0.6.5",
+ "libloading",
"serde",
"tempfile",
"tracing",
@@ -2562,7 +2509,7 @@ dependencies = [
"wasmer-object",
"wasmer-types",
"wasmer-vm",
- "which 4.0.2",
+ "which",
]
[[package]]
@@ -2572,7 +2519,7 @@ dependencies = [
"bincode",
"cfg-if 0.1.10",
"leb128",
- "libloading 0.6.5",
+ "libloading",
"serde",
"tempfile",
"tracing",
@@ -2604,7 +2551,7 @@ dependencies = [
name = "wasmer-object"
version = "1.0.0-alpha5"
dependencies = [
- "object 0.21.1",
+ "object",
"thiserror",
"wasmer-compiler",
"wasmer-types",
@@ -2614,7 +2561,7 @@ dependencies = [
name = "wasmer-types"
version = "1.0.0-alpha5"
dependencies = [
- "cranelift-entity",
+ "cranelift-entity 0.68.0",
"serde",
]
@@ -2627,7 +2574,7 @@ dependencies = [
"cfg-if 0.1.10",
"indexmap",
"libc",
- "memoffset",
+ "memoffset 0.5.6",
"more-asserts",
"region",
"serde",
@@ -2824,15 +2771,6 @@ dependencies = [
"wasm-bindgen",
]
-[[package]]
-name = "which"
-version = "3.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
-dependencies = [
- "libc",
-]
-
[[package]]
name = "which"
version = "4.0.2"
@@ -2888,11 +2826,11 @@ dependencies = [
[[package]]
name = "xcursor"
-version = "0.3.2"
+version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3a481cfdefd35e1c50073ae33a8000d695c98039544659f5dc5dd71311b0d01"
+checksum = "3a9a231574ae78801646617cefd13bfe94be907c0e4fa979cfd8b770aa3c5d08"
dependencies = [
- "nom 5.1.2",
+ "nom",
]
[[package]]
diff --git a/Cargo.toml b/Cargo.toml
index 035a4b242..c6c0fa4e3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -248,3 +248,8 @@ required-features = ["cranelift"]
name = "imported-function-env"
path = "examples/imports_function_env.rs"
required-features = ["cranelift"]
+
+[[example]]
+name = "hello-world"
+path = "examples/hello_world.rs"
+required-features = ["cranelift"]
diff --git a/Makefile b/Makefile
index 3a564329a..dcbff79f7 100644
--- a/Makefile
+++ b/Makefile
@@ -16,14 +16,14 @@ compilers := cranelift
test_compilers_engines :=
# Autodetect LLVM from llvm-config
-ifneq (, $(shell which llvm-config))
+ifneq (, $(shell which llvm-config 2>/dev/null))
LLVM_VERSION := $(shell llvm-config --version)
# If findstring is not empty, then it have found the value
ifneq (, $(findstring 10,$(LLVM_VERSION)))
compilers += llvm
endif
else
- ifneq (, $(shell which llvm-config-10))
+ ifneq (, $(shell which llvm-config-10 2>/dev/null))
compilers += llvm
endif
endif
@@ -51,6 +51,10 @@ ifeq ($(ARCH), aarch64)
endif
endif
+ifeq ($(ARCH), arm64)
+ test_compilers_engines += cranelift-jit
+endif
+
compilers := $(filter-out ,$(compilers))
test_compilers_engines := $(filter-out ,$(test_compilers_engines))
@@ -82,10 +86,17 @@ build-wasmer:
build-wasmer-debug:
cargo build --manifest-path lib/cli/Cargo.toml $(compiler_features)
-WAPM_VERSION = v0.5.0
-build-wapm:
- git clone --branch $(WAPM_VERSION) https://github.com/wasmerio/wapm-cli.git
+WAPM_VERSION = master # v0.5.0
+get-wapm:
+ [ -d "wapm-cli" ] || git clone --branch $(WAPM_VERSION) https://github.com/wasmerio/wapm-cli.git
+
+build-wapm: get-wapm
+ifeq ($(UNAME_S), Darwin)
+ # We build it without bundling sqlite, as is included by default in macos
+ cargo build --release --manifest-path wapm-cli/Cargo.toml --no-default-features --features "packagesigning telemetry update-notifications"
+else
cargo build --release --manifest-path wapm-cli/Cargo.toml --features "telemetry update-notifications"
+endif
build-docs:
cargo doc --release $(compiler_features) --document-private-items --no-deps --workspace
@@ -257,13 +268,13 @@ test-integration:
#############
package-wapm:
+ifneq ($(OS), Windows_NT)
mkdir -p "package/bin"
- cp ./wapm-cli/target/release/wapm package/bin/
-ifeq ($(OS), Windows_NT)
- echo ""
-else
- echo "#!/bin/bash\nwapm execute \"\$$@\"" > package/bin/wax
- chmod +x package/bin/wax
+ if [ -d "wapm-cli" ]; then \
+ cp wapm-cli/target/release/wapm package/bin/; \
+ echo "#!/bin/bash\nwapm execute \"\$$@\"" > package/bin/wax; \
+ chmod +x package/bin/wax; \
+ fi
endif
package-wasmer:
@@ -307,22 +318,21 @@ package-docs: build-docs build-docs-capi
echo '' > package/docs/crates/index.html
package: package-wapm package-wasmer package-capi
+
+distribution: package
cp LICENSE package/LICENSE
cp ATTRIBUTIONS.md package/ATTRIBUTIONS
mkdir -p dist
ifeq ($(OS), Windows_NT)
iscc scripts/windows-installer/wasmer.iss
- cp scripts/windows-installer/WasmerInstaller.exe dist/wasmer-windows.exe
+ cp scripts/windows-installer/WasmerInstaller.exe dist/
else
cp LICENSE package/LICENSE
cp ATTRIBUTIONS.md package/ATTRIBUTIONS
tar -C package -zcvf wasmer.tar.gz bin lib include LICENSE ATTRIBUTIONS
- cp ./wasmer.tar.gz ./dist/$(shell ./scripts/binary-name.sh)
+ mv wasmer.tar.gz dist/
endif
-# command for simulating installing Wasmer without wapm.
-package-without-wapm-for-integration-tests: package-wasmer package-capi
-
#################
# Miscellaneous #
#################
diff --git a/docs/migration_to_1.0.0.md b/docs/migration_to_1.0.0.md
index ba59eae49..247e605a7 100644
--- a/docs/migration_to_1.0.0.md
+++ b/docs/migration_to_1.0.0.md
@@ -222,7 +222,7 @@ struct Env {
counter: Arc>,
}
-fn get_counter(env: &mut Env) -> i32 {
+fn get_counter(env: &Env) -> i32 {
*env.counter.borrow()
}
@@ -343,4 +343,4 @@ you'll be able to delegate most of the work to Wasmer:
[memory-pointers]: https://docs.wasmer.io/integrations/examples/memory-pointers
[host-functions]: https://docs.wasmer.io/integrations/examples/host-functions
[errors]: https://docs.wasmer.io/integrations/examples/errors
-[exit-early]: https://docs.wasmer.io/integrations/examples/exit-early
\ No newline at end of file
+[exit-early]: https://docs.wasmer.io/integrations/examples/exit-early
diff --git a/examples/README.md b/examples/README.md
index ab5df2842..9624d3658 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -39,7 +39,21 @@ example.
### Basics
-1. [**Instantiating a module**][instance], explains the basics of using Wasmer
+1. [**Hello World**][hello-world], explains the core concepts of the Wasmer
+ API for compiling and executing WebAssembly.
+
+ _Keywords_: introduction, instance, module.
+
+
+ Execute the example
+
+ ```shell
+ $ cargo run --example hello-world --release --features "cranelift"
+ ```
+
+
+
+2. [**Instantiating a module**][instance], explains the basics of using Wasmer
and how to create an instance out of a Wasm module.
_Keywords_: instance, module.
@@ -53,7 +67,7 @@ example.
-2. [**Handling errors**][errors], explains the basics of interacting with
+3. [**Handling errors**][errors], explains the basics of interacting with
Wasm module memory.
_Keywords_: memory, module.
@@ -67,7 +81,7 @@ example.
-3. [**Interacting with memory**][memory], explains the basics of interacting with
+4. [**Interacting with memory**][memory], explains the basics of interacting with
Wasm module memory.
_Keywords_: memory, module.
diff --git a/examples/engine_cross_compilation.rs b/examples/engine_cross_compilation.rs
index 272da2cfc..7396bf0f9 100644
--- a/examples/engine_cross_compilation.rs
+++ b/examples/engine_cross_compilation.rs
@@ -99,7 +99,11 @@ fn main() -> Result<(), Box> {
}
#[test]
-#[cfg(not(windows))]
+#[cfg(not(any(
+ windows,
+ // We don't support yet crosscompilation in macOS with Apple Silicon
+ all(target_os = "macos", target_arch = "aarch64")
+)))]
fn test_cross_compilation() -> Result<(), Box> {
main()
}
diff --git a/examples/hello_world.rs b/examples/hello_world.rs
new file mode 100644
index 000000000..e490ad802
--- /dev/null
+++ b/examples/hello_world.rs
@@ -0,0 +1,85 @@
+//! This is a simple example introducing the core concepts of the Wasmer API.
+//!
+//! You can run the example directly by executing the following in the Wasmer root:
+//!
+//! ```shell
+//! cargo run --example hello-world --release --features "cranelift"
+//! ```
+
+use wasmer::{imports, wat2wasm, Function, Instance, Module, NativeFunc, Store};
+use wasmer_compiler_cranelift::Cranelift;
+use wasmer_engine_jit::JIT;
+
+fn main() -> anyhow::Result<()> {
+ // First we create a simple Wasm program to use with Wasmer.
+ // We use the WebAssembly text format and use `wasmer::wat2wasm` to compile
+ // it into a WebAssembly binary.
+ //
+ // Most WebAssembly programs come from compiling source code in a high level
+ // language and will already be in the binary format.
+ let wasm_bytes = wat2wasm(
+ br#"
+(module
+ ;; First we define a type with no parameters and no results.
+ (type $no_args_no_rets_t (func (param) (result)))
+
+ ;; Then we declare that we want to import a function named "env" "say_hello" with
+ ;; that type signature.
+ (import "env" "say_hello" (func $say_hello (type $no_args_no_rets_t)))
+
+ ;; Finally we create an entrypoint that calls our imported function.
+ (func $run (type $no_args_no_rets_t)
+ (call $say_hello))
+ ;; And mark it as an exported function named "run".
+ (export "run" (func $run)))
+"#,
+ )?;
+
+ // Next we create the `Store`, the top level type in the Wasmer API.
+ //
+ // Note that we don't need to specify the engine/compiler if we want to use
+ // the default provided by Wasmer.
+ // You can use `Store::default()` for that.
+ //
+ // However for the purposes of showing what's happening, we create a compiler
+ // (`Cranelift`) and pass it to an engine (`JIT`). We then pass the engine to
+ // the store and are now ready to compile and run WebAssembly!
+ let store = Store::new(&JIT::new(&Cranelift::default()).engine());
+ // We then use our store and Wasm bytes to compile a `Module`.
+ // A `Module` is a compiled WebAssembly module that isn't ready to execute yet.
+ let module = Module::new(&store, wasm_bytes)?;
+
+ // Next we'll set up our `Module` so that we can execute it.
+
+ // We define a function to act as our "env" "say_hello" function imported in the
+ // Wasm program above.
+ fn say_hello_world() {
+ println!("Hello, world!")
+ }
+
+ // We then create an import object so that the `Module`'s imports can be satisfied.
+ let import_object = imports! {
+ // We use the default namespace "env".
+ "env" => {
+ // And call our function "say_hello".
+ "say_hello" => Function::new_native(&store, say_hello_world),
+ }
+ };
+
+ // We then use the `Module` and the import object to create an `Instance`.
+ //
+ // An `Instance` is a compiled WebAssembly module that has been set up
+ // and is ready to execute.
+ let instance = Instance::new(&module, &import_object)?;
+ // We get the `NativeFunc` with no parameters and no results from the instance.
+ //
+ // Recall that the Wasm module exported a function named "run", this is getting
+ // that exported function from the `Instance`.
+ let run_func: NativeFunc<(), ()> = instance.exports.get_native_function("run")?;
+
+ // Finally, we call our exported Wasm function which will call our "say_hello"
+ // function and return.
+ run_func.call()?;
+
+ Ok(())
+}
diff --git a/examples/imports_function_env.rs b/examples/imports_function_env.rs
index 88caf3c6e..7aa4dc559 100644
--- a/examples/imports_function_env.rs
+++ b/examples/imports_function_env.rs
@@ -74,10 +74,10 @@ fn main() -> Result<(), Box> {
}
// Create the functions
- fn get_counter(env: &mut Env) -> i32 {
+ fn get_counter(env: &Env) -> i32 {
*env.counter.borrow()
}
- fn add_to_counter(env: &mut Env, add: i32) -> i32 {
+ fn add_to_counter(env: &Env, add: i32) -> i32 {
let mut counter_ref = env.counter.borrow_mut();
*counter_ref += add;
diff --git a/lib/api/Cargo.toml b/lib/api/Cargo.toml
index 2b364806e..c026d6a10 100644
--- a/lib/api/Cargo.toml
+++ b/lib/api/Cargo.toml
@@ -67,6 +67,8 @@ llvm = [
"wasmer-compiler-llvm",
"compiler",
]
+# enables internal features used by the deprecated API.
+deprecated = []
default-compiler = []
default-engine = []
diff --git a/lib/api/src/externals/function.rs b/lib/api/src/externals/function.rs
index 02ae4465e..b65462e3a 100644
--- a/lib/api/src/externals/function.rs
+++ b/lib/api/src/externals/function.rs
@@ -6,7 +6,9 @@ use crate::FunctionType;
use crate::NativeFunc;
use crate::RuntimeError;
pub use inner::{FromToNativeWasmType, HostFunction, WasmTypeList, WithEnv, WithoutEnv};
-use std::cell::RefCell;
+#[cfg(feature = "deprecated")]
+pub use inner::{UnsafeMutableEnv, WithUnsafeMutableEnv};
+
use std::cmp::max;
use std::fmt;
use wasmer_vm::{
@@ -125,11 +127,11 @@ impl Function {
#[allow(clippy::cast_ptr_alignment)]
pub fn new_with_env(store: &Store, ty: &FunctionType, env: Env, func: F) -> Self
where
- F: Fn(&mut Env, &[Val]) -> Result, RuntimeError> + 'static,
+ F: Fn(&Env, &[Val]) -> Result, RuntimeError> + 'static,
Env: Sized + 'static,
{
let dynamic_ctx = VMDynamicFunctionContext::from_context(VMDynamicFunctionWithEnv {
- env: RefCell::new(env),
+ env: Box::new(env),
func: Box::new(func),
function_type: ty.clone(),
});
@@ -214,7 +216,7 @@ impl Function {
/// };
/// let env = Env { multiplier: 2 };
///
- /// fn sum_and_multiply(env: &mut Env, a: i32, b: i32) -> i32 {
+ /// fn sum_and_multiply(env: &Env, a: i32, b: i32) -> i32 {
/// (a + b) * env.multiplier
/// }
///
@@ -254,6 +256,47 @@ impl Function {
}
}
+ /// Function used by the deprecated API to call a function with a `&mut` Env.
+ ///
+ /// This is not a stable API and may be broken at any time.
+ ///
+ /// # Safety
+ /// - This function is only safe to use from the deprecated API.
+ #[doc(hidden)]
+ #[cfg(feature = "deprecated")]
+ pub unsafe fn new_native_with_unsafe_mutable_env(
+ store: &Store,
+ env: Env,
+ func: F,
+ ) -> Self
+ where
+ F: HostFunction,
+ Args: WasmTypeList,
+ Rets: WasmTypeList,
+ Env: UnsafeMutableEnv + 'static,
+ {
+ let function = inner::Function::::new(func);
+ let address = function.address();
+
+ let box_env = Box::new(env);
+ let vmctx = VMFunctionEnvironment {
+ host_env: Box::into_raw(box_env) as *mut _,
+ };
+ let signature = function.ty();
+
+ Self {
+ store: store.clone(),
+ definition: FunctionDefinition::Host(HostFunctionDefinition { has_env: true }),
+ exported: ExportFunction {
+ address,
+ kind: VMFunctionKind::Static,
+ vmctx,
+ signature,
+ call_trampoline: None,
+ },
+ }
+ }
+
/// Returns the [`FunctionType`] of the `Function`.
///
/// # Example
@@ -628,8 +671,8 @@ where
{
function_type: FunctionType,
#[allow(clippy::type_complexity)]
- func: Box Result, RuntimeError> + 'static>,
- env: RefCell,
+ func: Box Result, RuntimeError> + 'static>,
+ env: Box,
}
impl VMDynamicFunction for VMDynamicFunctionWithEnv
@@ -637,9 +680,7 @@ where
Env: Sized + 'static,
{
fn call(&self, args: &[Val]) -> Result, RuntimeError> {
- // TODO: the `&mut *self.env.as_ptr()` is likely invoking some "mild"
- // undefined behavior due to how it's used in the static fn call
- unsafe { (*self.func)(&mut *self.env.as_ptr(), &args) }
+ (*self.func)(&*self.env, &args)
}
fn function_type(&self) -> &FunctionType {
&self.function_type
@@ -979,6 +1020,14 @@ mod inner {
fn function_body_ptr(self) -> *const VMFunctionBody;
}
+ /// Marker trait to limit what the hidden APIs needed for the deprecated API
+ /// can be used on.
+ ///
+ /// Marks an environment as being passed by `&mut`.
+ #[cfg(feature = "deprecated")]
+ #[doc(hidden)]
+ pub unsafe trait UnsafeMutableEnv: Sized {}
+
/// Empty trait to specify the kind of `HostFunction`: With or
/// without an environment.
///
@@ -994,6 +1043,18 @@ mod inner {
impl HostFunctionKind for WithEnv {}
+ /// An empty struct to help Rust typing to determine
+ /// when a `HostFunction` has an environment.
+ ///
+ /// This environment is passed by `&mut` and exists solely for the deprecated
+ /// API.
+ #[cfg(feature = "deprecated")]
+ #[doc(hidden)]
+ pub struct WithUnsafeMutableEnv;
+
+ #[cfg(feature = "deprecated")]
+ impl HostFunctionKind for WithUnsafeMutableEnv {}
+
/// An empty struct to help Rust typing to determine
/// when a `HostFunction` does not have an environment.
pub struct WithoutEnv;
@@ -1187,6 +1248,52 @@ mod inner {
Rets: WasmTypeList,
RetsAsResult: IntoResult,
Env: Sized,
+ Func: Fn(&Env, $( $x , )*) -> RetsAsResult + Send + 'static,
+ {
+ #[allow(non_snake_case)]
+ fn function_body_ptr(self) -> *const VMFunctionBody {
+ /// This is a function that wraps the real host
+ /// function. Its address will be used inside the
+ /// runtime.
+ extern fn func_wrapper<$( $x, )* Rets, RetsAsResult, Env, Func>( env: &Env, $( $x: $x::Native, )* ) -> Rets::CStruct
+ where
+ $( $x: FromToNativeWasmType, )*
+ Rets: WasmTypeList,
+ RetsAsResult: IntoResult,
+ Env: Sized,
+ Func: Fn(&Env, $( $x ),* ) -> RetsAsResult + 'static
+ {
+ let func: &Func = unsafe { &*(&() as *const () as *const Func) };
+
+ let result = panic::catch_unwind(AssertUnwindSafe(|| {
+ func(env, $( FromToNativeWasmType::from_native($x) ),* ).into_result()
+ }));
+
+ match result {
+ Ok(Ok(result)) => return result.into_c_struct(),
+ Ok(Err(trap)) => unsafe { raise_user_trap(Box::new(trap)) },
+ Err(panic) => unsafe { resume_panic(panic) },
+ }
+ }
+
+ func_wrapper::< $( $x, )* Rets, RetsAsResult, Env, Self > as *const VMFunctionBody
+ }
+ }
+
+ // Implement `HostFunction` for a function that has the same arity than the tuple.
+ // This specific function has an environment.
+ #[doc(hidden)]
+ #[cfg(feature = "deprecated")]
+ #[allow(unused_parens)]
+ impl< $( $x, )* Rets, RetsAsResult, Env, Func >
+ HostFunction<( $( $x ),* ), Rets, WithUnsafeMutableEnv, Env>
+ for
+ Func
+ where
+ $( $x: FromToNativeWasmType, )*
+ Rets: WasmTypeList,
+ RetsAsResult: IntoResult,
+ Env: UnsafeMutableEnv,
Func: Fn(&mut Env, $( $x , )*) -> RetsAsResult + Send + 'static,
{
#[allow(non_snake_case)]
@@ -1218,7 +1325,6 @@ mod inner {
func_wrapper::< $( $x, )* Rets, RetsAsResult, Env, Self > as *const VMFunctionBody
}
}
-
};
}
diff --git a/lib/api/src/externals/mod.rs b/lib/api/src/externals/mod.rs
index 370a3173d..c95218700 100644
--- a/lib/api/src/externals/mod.rs
+++ b/lib/api/src/externals/mod.rs
@@ -6,6 +6,9 @@ mod table;
pub use self::function::{
FromToNativeWasmType, Function, HostFunction, WasmTypeList, WithEnv, WithoutEnv,
};
+
+#[cfg(feature = "deprecated")]
+pub use self::function::{UnsafeMutableEnv, WithUnsafeMutableEnv};
pub use self::global::Global;
pub use self::memory::Memory;
pub use self::table::Table;
diff --git a/lib/api/src/lib.rs b/lib/api/src/lib.rs
index 264b58ceb..7bb9d2178 100644
--- a/lib/api/src/lib.rs
+++ b/lib/api/src/lib.rs
@@ -46,6 +46,8 @@ pub mod internals {
//! `wasmer-vm`. Please don't use any of this types directly, as
//! they might change frequently or be removed in the future.
+ #[cfg(feature = "deprecated")]
+ pub use crate::externals::{UnsafeMutableEnv, WithUnsafeMutableEnv};
pub use crate::externals::{WithEnv, WithoutEnv};
}
diff --git a/lib/api/tests/externals.rs b/lib/api/tests/externals.rs
index 29f1ce5e2..befce02f5 100644
--- a/lib/api/tests/externals.rs
+++ b/lib/api/tests/externals.rs
@@ -211,10 +211,10 @@ fn function_new_env() -> Result<()> {
#[derive(Clone)]
struct MyEnv {};
let my_env = MyEnv {};
- let function = Function::new_native_with_env(&store, my_env.clone(), |_env: &mut MyEnv| {});
+ let function = Function::new_native_with_env(&store, my_env.clone(), |_env: &MyEnv| {});
assert_eq!(function.ty().clone(), FunctionType::new(vec![], vec![]));
let function =
- Function::new_native_with_env(&store, my_env.clone(), |_env: &mut MyEnv, _a: i32| {});
+ Function::new_native_with_env(&store, my_env.clone(), |_env: &MyEnv, _a: i32| {});
assert_eq!(
function.ty().clone(),
FunctionType::new(vec![Type::I32], vec![])
@@ -222,14 +222,14 @@ fn function_new_env() -> Result<()> {
let function = Function::new_native_with_env(
&store,
my_env.clone(),
- |_env: &mut MyEnv, _a: i32, _b: i64, _c: f32, _d: f64| {},
+ |_env: &MyEnv, _a: i32, _b: i64, _c: f32, _d: f64| {},
);
assert_eq!(
function.ty().clone(),
FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![])
);
let function =
- Function::new_native_with_env(&store, my_env.clone(), |_env: &mut MyEnv| -> i32 { 1 });
+ Function::new_native_with_env(&store, my_env.clone(), |_env: &MyEnv| -> i32 { 1 });
assert_eq!(
function.ty().clone(),
FunctionType::new(vec![], vec![Type::I32])
@@ -237,7 +237,7 @@ fn function_new_env() -> Result<()> {
let function = Function::new_native_with_env(
&store,
my_env.clone(),
- |_env: &mut MyEnv| -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) },
+ |_env: &MyEnv| -> (i32, i64, f32, f64) { (1, 2, 3.0, 4.0) },
);
assert_eq!(
function.ty().clone(),
@@ -279,7 +279,7 @@ fn function_new_dynamic_env() -> Result<()> {
&store,
&function_type,
my_env.clone(),
- |_env: &mut MyEnv, _values: &[Value]| unimplemented!(),
+ |_env: &MyEnv, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty().clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32], vec![]);
@@ -287,7 +287,7 @@ fn function_new_dynamic_env() -> Result<()> {
&store,
&function_type,
my_env.clone(),
- |_env: &mut MyEnv, _values: &[Value]| unimplemented!(),
+ |_env: &MyEnv, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty().clone(), function_type);
let function_type = FunctionType::new(vec![Type::I32, Type::I64, Type::F32, Type::F64], vec![]);
@@ -295,7 +295,7 @@ fn function_new_dynamic_env() -> Result<()> {
&store,
&function_type,
my_env.clone(),
- |_env: &mut MyEnv, _values: &[Value]| unimplemented!(),
+ |_env: &MyEnv, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty().clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32]);
@@ -303,7 +303,7 @@ fn function_new_dynamic_env() -> Result<()> {
&store,
&function_type,
my_env.clone(),
- |_env: &mut MyEnv, _values: &[Value]| unimplemented!(),
+ |_env: &MyEnv, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty().clone(), function_type);
let function_type = FunctionType::new(vec![], vec![Type::I32, Type::I64, Type::F32, Type::F64]);
@@ -311,7 +311,7 @@ fn function_new_dynamic_env() -> Result<()> {
&store,
&function_type,
my_env.clone(),
- |_env: &mut MyEnv, _values: &[Value]| unimplemented!(),
+ |_env: &MyEnv, _values: &[Value]| unimplemented!(),
);
assert_eq!(function.ty().clone(), function_type);
Ok(())
diff --git a/lib/c-api/Cargo.toml b/lib/c-api/Cargo.toml
index b3d904c8c..b355db449 100644
--- a/lib/c-api/Cargo.toml
+++ b/lib/c-api/Cargo.toml
@@ -30,7 +30,7 @@ wasmer-types = { version = "1.0.0-alpha5", path = "../wasmer-types" }
cfg-if = "1.0"
lazy_static = "1"
libc = { version = "^0.2", default-features = false }
-libffi = { version = "0.9", optional = true }
+libffi = { version = "1.0", optional = true }
serde = { version = "1", optional = true, features = ["derive"] }
thiserror = "1"
typetag = { version = "0.1", optional = true }
diff --git a/lib/c-api/src/deprecated/import/mod.rs b/lib/c-api/src/deprecated/import/mod.rs
index 09eb562c0..8dae55800 100644
--- a/lib/c-api/src/deprecated/import/mod.rs
+++ b/lib/c-api/src/deprecated/import/mod.rs
@@ -45,10 +45,10 @@ pub(crate) struct CAPIImportObject {
/// but the new/current API does not. So we store them here to pass them to the Instance
/// to allow functions to access this data for backwards compatibilty.
pub(crate) imported_memories: Vec<*mut Memory>,
- /// List of pointers to `LegacyEnv`s used to patch imported functions to be able to
+ /// List of pointers to `UnsafeMutableEnv`s used to patch imported functions to be able to
/// pass a the "vmctx" as the first argument.
/// Needed here because of extending import objects.
- pub(crate) instance_pointers_to_update: Vec>,
+ pub(crate) instance_pointers_to_update: Vec>,
}
#[repr(C)]
@@ -399,7 +399,7 @@ pub unsafe extern "C" fn wasmer_import_object_imports_destroy(
let function_wrapper: Box =
Box::from_raw(import.value.func as *mut _);
let _: Box = Box::from_raw(function_wrapper.func.as_ptr());
- let _: Box = Box::from_raw(function_wrapper.legacy_env.as_ptr());
+ let _: Box = Box::from_raw(function_wrapper.legacy_env.as_ptr());
}
wasmer_import_export_kind::WASM_GLOBAL => {
let _: Box = Box::from_raw(import.value.global as *mut _);
@@ -635,11 +635,11 @@ pub unsafe extern "C" fn wasmer_import_func_params_arity(
/// struct used to pass in context to functions (which must be back-patched)
#[derive(Debug, Default)]
-pub(crate) struct LegacyEnv {
+pub(crate) struct UnsafeMutableEnv {
pub(crate) instance_ptr: Option>,
}
-impl LegacyEnv {
+impl UnsafeMutableEnv {
pub(crate) fn ctx_ptr(&self) -> *mut CAPIInstance {
self.instance_ptr
.map(|p| p.as_ptr())
@@ -647,13 +647,13 @@ impl LegacyEnv {
}
}
-/// struct used to hold on to `LegacyEnv` pointer as well as the function.
-/// we need to do this to initialize the context ptr inside of `LegacyEnv` when
+/// struct used to hold on to `UnsafeMutableEnv` pointer as well as the function.
+/// we need to do this to initialize the context ptr inside of `UnsafeMutableEnv` when
/// instantiating the module.
#[derive(Debug)]
pub(crate) struct FunctionWrapper {
pub(crate) func: NonNull,
- pub(crate) legacy_env: NonNull,
+ pub(crate) legacy_env: NonNull,
}
/// Creates new host function, aka imported function. `func` is a
@@ -690,7 +690,7 @@ pub unsafe extern "C" fn wasmer_import_func_new(
let store = get_global_store();
- let env_ptr = Box::into_raw(Box::new(LegacyEnv::default()));
+ let env_ptr = Box::into_raw(Box::new(UnsafeMutableEnv::default()));
let func = Function::new_with_env(store, &func_type, &mut *env_ptr, move |env, args| {
use libffi::high::call::{call, Arg};
diff --git a/lib/c-api/src/wasm_c_api/externals/function.rs b/lib/c-api/src/wasm_c_api/externals/function.rs
index fab547f9f..b49b26afd 100644
--- a/lib/c-api/src/wasm_c_api/externals/function.rs
+++ b/lib/c-api/src/wasm_c_api/externals/function.rs
@@ -100,42 +100,41 @@ pub unsafe extern "C" fn wasm_func_new_with_env(
let func_sig = &function_type.inner().function_type;
let num_rets = func_sig.results().len();
- let inner_callback =
- move |env: &mut *mut c_void, args: &[Val]| -> Result, RuntimeError> {
- let processed_args: wasm_val_vec_t = args
- .into_iter()
- .map(TryInto::try_into)
- .collect::, _>>()
- .expect("Argument conversion failed")
- .into();
-
- let mut results: wasm_val_vec_t = vec![
- wasm_val_t {
- kind: wasm_valkind_enum::WASM_I64 as _,
- of: wasm_val_inner { int64_t: 0 },
- };
- num_rets
- ]
+ let inner_callback = move |env: &*mut c_void, args: &[Val]| -> Result, RuntimeError> {
+ let processed_args: wasm_val_vec_t = args
+ .into_iter()
+ .map(TryInto::try_into)
+ .collect::, _>>()
+ .expect("Argument conversion failed")
.into();
- let trap = callback(*env, &processed_args, &mut results);
+ let mut results: wasm_val_vec_t = vec![
+ wasm_val_t {
+ kind: wasm_valkind_enum::WASM_I64 as _,
+ of: wasm_val_inner { int64_t: 0 },
+ };
+ num_rets
+ ]
+ .into();
- if !trap.is_null() {
- let trap: Box = Box::from_raw(trap);
+ let trap = callback(*env, &processed_args, &mut results);
- return Err(trap.inner);
- }
+ if !trap.is_null() {
+ let trap: Box = Box::from_raw(trap);
- let processed_results = results
- .into_slice()
- .expect("Failed to convert `results` into a slice")
- .into_iter()
- .map(TryInto::try_into)
- .collect::, _>>()
- .expect("Result conversion failed");
+ return Err(trap.inner);
+ }
- Ok(processed_results)
- };
+ let processed_results = results
+ .into_slice()
+ .expect("Failed to convert `results` into a slice")
+ .into_iter()
+ .map(TryInto::try_into)
+ .collect::, _>>()
+ .expect("Result conversion failed");
+
+ Ok(processed_results)
+ };
let function = Function::new_with_env(&store.inner, &func_sig, env, inner_callback);
diff --git a/lib/compiler-cranelift/Cargo.toml b/lib/compiler-cranelift/Cargo.toml
index a32658c91..621682ed7 100644
--- a/lib/compiler-cranelift/Cargo.toml
+++ b/lib/compiler-cranelift/Cargo.toml
@@ -15,15 +15,15 @@ edition = "2018"
wasmer-compiler = { path = "../compiler", version = "1.0.0-alpha5", features = ["translator"], default-features = false }
wasmer-vm = { path = "../vm", version = "1.0.0-alpha5" }
wasmer-types = { path = "../wasmer-types", version = "1.0.0-alpha5", default-features = false, features = ["std"] }
-cranelift-codegen = { version = "0.67", default-features = false, features = ["x86", "arm64"] }
-cranelift-frontend = { version = "0.67", default-features = false }
+cranelift-codegen = { version = "0.68", default-features = false, features = ["x86", "arm64"] }
+cranelift-frontend = { version = "0.68", default-features = false }
tracing = "0.1"
hashbrown = { version = "0.9", optional = true }
rayon = "1.5"
serde = { version = "1.0", features = ["derive"] }
more-asserts = "0.2"
-gimli = { version = "0.21", optional = true }
-smallvec = "1.0.0"
+gimli = { version = "0.22", optional = true }
+smallvec = "1.5"
[dev-dependencies]
target-lexicon = { version = "0.11", default-features = false }
diff --git a/lib/compiler-cranelift/src/translator/unwind.rs b/lib/compiler-cranelift/src/translator/unwind.rs
index 50b61b0e9..052ea8592 100644
--- a/lib/compiler-cranelift/src/translator/unwind.rs
+++ b/lib/compiler-cranelift/src/translator/unwind.rs
@@ -49,6 +49,6 @@ pub(crate) fn compiled_function_unwind_info(
Ok(CraneliftUnwindInfo::WindowsX64(data))
}
Some(UnwindInfo::SystemV(unwind)) => Ok(CraneliftUnwindInfo::FDE(unwind)),
- None => Ok(CraneliftUnwindInfo::None),
+ Some(_) | None => Ok(CraneliftUnwindInfo::None),
}
}
diff --git a/lib/compiler-llvm/Cargo.toml b/lib/compiler-llvm/Cargo.toml
index d4e72f50a..afe70e7b1 100644
--- a/lib/compiler-llvm/Cargo.toml
+++ b/lib/compiler-llvm/Cargo.toml
@@ -16,7 +16,7 @@ wasmer-compiler = { path = "../compiler", version = "1.0.0-alpha5", features = [
wasmer-vm = { path = "../vm", version = "1.0.0-alpha5" }
wasmer-types = { path = "../wasmer-types", version = "1.0.0-alpha5" }
target-lexicon = { version = "0.11", default-features = false }
-smallvec = "1"
+smallvec = "1.5"
goblin = "0.2"
libc = { version = "^0.2", default-features = false }
byteorder = "1"
@@ -32,7 +32,7 @@ features = ["llvm10-0", "target-x86", "target-aarch64"]
cc = "1.0"
lazy_static = "1.4"
regex = "1.3"
-semver = "0.9"
+semver = "0.11"
rustc_version = "0.2"
[features]
diff --git a/lib/compiler-singlepass/Cargo.toml b/lib/compiler-singlepass/Cargo.toml
index abf006743..7a889bc54 100644
--- a/lib/compiler-singlepass/Cargo.toml
+++ b/lib/compiler-singlepass/Cargo.toml
@@ -23,7 +23,7 @@ dynasm = "1.0"
dynasmrt = "1.0"
lazy_static = "1.4"
byteorder = "1.3"
-smallvec = "1"
+smallvec = "1.5"
[badges]
maintenance = { status = "actively-developed" }
diff --git a/lib/compiler-singlepass/src/codegen_x64.rs b/lib/compiler-singlepass/src/codegen_x64.rs
index a4f8dc9b4..150c57886 100644
--- a/lib/compiler-singlepass/src/codegen_x64.rs
+++ b/lib/compiler-singlepass/src/codegen_x64.rs
@@ -5129,11 +5129,8 @@ impl<'a> FuncGen<'a> {
&& self.config.enable_nan_canonicalization
&& fp.canonicalization.is_some()
{
- self.canonicalize_nan(
- fp.canonicalization.unwrap().to_size(),
- params[index],
- params[index],
- );
+ let size = fp.canonicalization.unwrap().to_size();
+ self.canonicalize_nan(size, params[index], params[index]);
}
self.fp_stack.pop().unwrap();
} else {
@@ -5230,11 +5227,8 @@ impl<'a> FuncGen<'a> {
&& self.config.enable_nan_canonicalization
&& fp.canonicalization.is_some()
{
- self.canonicalize_nan(
- fp.canonicalization.unwrap().to_size(),
- params[index],
- params[index],
- );
+ let size = fp.canonicalization.unwrap().to_size();
+ self.canonicalize_nan(size, params[index], params[index]);
}
self.fp_stack.pop().unwrap();
} else {
diff --git a/lib/compiler/Cargo.toml b/lib/compiler/Cargo.toml
index 64339fb9a..5e47a2b0d 100644
--- a/lib/compiler/Cargo.toml
+++ b/lib/compiler/Cargo.toml
@@ -20,7 +20,7 @@ hashbrown = { version = "0.9", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
thiserror = "1.0"
serde_bytes = { version = "0.11", optional = true }
-smallvec = "1.4"
+smallvec = "1.5"
[target.'cfg(any(target_arch = "x86", target_arch = "x86_64"))'.dependencies]
raw-cpuid = "7.0"
diff --git a/lib/deprecated/runtime-core/Cargo.lock b/lib/deprecated/runtime-core/Cargo.lock
index 8b2331c57..c686070e5 100644
--- a/lib/deprecated/runtime-core/Cargo.lock
+++ b/lib/deprecated/runtime-core/Cargo.lock
@@ -6,7 +6,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
dependencies = [
- "gimli 0.22.0",
+ "gimli",
]
[[package]]
@@ -120,6 +120,12 @@ dependencies = [
"bitflags",
]
+[[package]]
+name = "const_fn"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
+
[[package]]
name = "constant_time_eq"
version = "0.1.5"
@@ -128,28 +134,27 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "cranelift-bforest"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9413a2c6bdb01ab8acc867421bd7343ddea491d015453f4e56f4f60c816d120"
+checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0"
dependencies = [
"cranelift-entity",
]
[[package]]
name = "cranelift-codegen"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f28d389588c2375bb95292e0bc6cbf010e7f30fb4e9734738b576521b737826a"
+checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1"
dependencies = [
"byteorder",
"cranelift-bforest",
"cranelift-codegen-meta",
"cranelift-codegen-shared",
"cranelift-entity",
- "gimli 0.21.0",
+ "gimli",
"log",
"regalloc",
- "serde",
"smallvec",
"target-lexicon",
"thiserror",
@@ -157,9 +162,9 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74dd3cf6f107c1df4c2b8aab91ec4181aee7ff17289673fcbec63325e7e40a83"
+checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7"
dependencies = [
"cranelift-codegen-shared",
"cranelift-entity",
@@ -167,24 +172,24 @@ dependencies = [
[[package]]
name = "cranelift-codegen-shared"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaf050fab2dbf324544489443ff3cc8c67c9420c8902ec6628bd906bd7393e9"
+checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938"
[[package]]
name = "cranelift-entity"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f07eb8aa0a5da94b56339e4e3052c496a3df4354357cd5da8c7b02c6e8f1dc1d"
+checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6"
dependencies = [
"serde",
]
[[package]]
name = "cranelift-frontend"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f6fe1d3e968576f4b60d23f40ee90281f8de2cdf23d2110f3b0296ff420555e"
+checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8"
dependencies = [
"cranelift-codegen",
"log",
@@ -202,50 +207,49 @@ dependencies = [
]
[[package]]
-name = "crossbeam-deque"
-version = "0.7.3"
+name = "crossbeam-channel"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
+checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [
+ "cfg-if 1.0.0",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
+dependencies = [
+ "cfg-if 1.0.0",
"crossbeam-epoch",
"crossbeam-utils",
- "maybe-uninit",
]
[[package]]
name = "crossbeam-epoch"
-version = "0.8.2"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
+checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f"
dependencies = [
- "autocfg",
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
+ "const_fn",
"crossbeam-utils",
"lazy_static",
- "maybe-uninit",
"memoffset",
"scopeguard",
]
-[[package]]
-name = "crossbeam-queue"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
-dependencies = [
- "cfg-if 0.1.10",
- "crossbeam-utils",
- "maybe-uninit",
-]
-
[[package]]
name = "crossbeam-utils"
-version = "0.7.2"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
+checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
dependencies = [
"autocfg",
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
+ "const_fn",
"lazy_static",
]
@@ -392,21 +396,15 @@ dependencies = [
[[package]]
name = "gimli"
-version = "0.21.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
dependencies = [
"fallible-iterator",
"indexmap",
"stable_deref_trait",
]
-[[package]]
-name = "gimli"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
-
[[package]]
name = "goblin"
version = "0.2.3"
@@ -570,12 +568,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
[[package]]
name = "memchr"
version = "2.3.3"
@@ -637,20 +629,20 @@ dependencies = [
[[package]]
name = "object"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
+checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
+
+[[package]]
+name = "object"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
dependencies = [
"crc32fast",
"indexmap",
]
-[[package]]
-name = "object"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
-
[[package]]
name = "once_cell"
version = "1.4.0"
@@ -793,9 +785,9 @@ dependencies = [
[[package]]
name = "rayon"
-version = "1.3.1"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
+checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
dependencies = [
"autocfg",
"crossbeam-deque",
@@ -805,12 +797,12 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.7.1"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
+checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
dependencies = [
+ "crossbeam-channel",
"crossbeam-deque",
- "crossbeam-queue",
"crossbeam-utils",
"lazy_static",
"num_cpus",
@@ -824,9 +816,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "regalloc"
-version = "0.0.26"
+version = "0.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c03092d79e0fd610932d89ed53895a38c0dd3bcd317a0046e69940de32f1d95"
+checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
dependencies = [
"log",
"rustc-hash",
@@ -1011,9 +1003,9 @@ dependencies = [
[[package]]
name = "target-lexicon"
-version = "0.10.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
+checksum = "4ee5a98e506fb7231a304c3a1bd7c132a55016cf65001e0282480665870dfcb9"
[[package]]
name = "tempfile"
@@ -1115,7 +1107,7 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasmer"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cfg-if 0.1.10",
"indexmap",
@@ -1137,7 +1129,7 @@ dependencies = [
[[package]]
name = "wasmer-cache"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"blake3",
"hex",
@@ -1148,7 +1140,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"enumset",
"raw-cpuid",
@@ -1164,14 +1156,15 @@ dependencies = [
[[package]]
name = "wasmer-compiler-cranelift"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cranelift-codegen",
"cranelift-frontend",
- "gimli 0.21.0",
+ "gimli",
"more-asserts",
"rayon",
"serde",
+ "smallvec",
"tracing",
"wasmer-compiler",
"wasmer-types",
@@ -1180,7 +1173,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler-llvm"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"byteorder",
"cc",
@@ -1202,7 +1195,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler-singlepass"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"byteorder",
"dynasm",
@@ -1219,7 +1212,7 @@ dependencies = [
[[package]]
name = "wasmer-engine"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"backtrace",
"bincode",
@@ -1237,7 +1230,7 @@ dependencies = [
[[package]]
name = "wasmer-engine-jit"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"bincode",
"cfg-if 0.1.10",
@@ -1253,7 +1246,7 @@ dependencies = [
[[package]]
name = "wasmer-engine-native"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"bincode",
"cfg-if 0.1.10",
@@ -1272,9 +1265,9 @@ dependencies = [
[[package]]
name = "wasmer-object"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
- "object 0.19.0",
+ "object 0.21.1",
"thiserror",
"wasmer-compiler",
"wasmer-types",
@@ -1300,7 +1293,7 @@ dependencies = [
[[package]]
name = "wasmer-types"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cranelift-entity",
"serde",
@@ -1308,7 +1301,7 @@ dependencies = [
[[package]]
name = "wasmer-vm"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"backtrace",
"cc",
@@ -1326,9 +1319,9 @@ dependencies = [
[[package]]
name = "wasmparser"
-version = "0.57.0"
+version = "0.65.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6"
+checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf"
[[package]]
name = "wast"
diff --git a/lib/deprecated/runtime-core/Cargo.toml b/lib/deprecated/runtime-core/Cargo.toml
index 12d26452c..432676017 100644
--- a/lib/deprecated/runtime-core/Cargo.toml
+++ b/lib/deprecated/runtime-core/Cargo.toml
@@ -15,7 +15,7 @@ maintenance = { status = "deprecated" }
[dependencies]
wasmer-types = { path = "../../wasmer-types", version = "1.0.0-alpha5" }
-wasmer = { path = "../../api", version = "1.0.0-alpha5" }
+wasmer = { path = "../../api", version = "1.0.0-alpha5", features = ["deprecated"] }
wasmer-cache = { path = "../../cache", version = "1.0.0-alpha5" }
wasmer-compiler = { path = "../../compiler", version = "1.0.0-alpha5", features = ["translator"] }
wasmer-compiler-llvm = { path = "../../compiler-llvm", version = "1.0.0-alpha5", optional = true }
diff --git a/lib/deprecated/runtime-core/src/typed_func.rs b/lib/deprecated/runtime-core/src/typed_func.rs
index a1b8d7468..5396d608c 100644
--- a/lib/deprecated/runtime-core/src/typed_func.rs
+++ b/lib/deprecated/runtime-core/src/typed_func.rs
@@ -6,6 +6,7 @@ use crate::{
};
use std::marker::PhantomData;
+pub use new::wasmer::internals::UnsafeMutableEnv;
pub use new::wasmer::{HostFunction, WasmTypeList};
/// Represents a function that can be used by WebAssembly.
@@ -27,17 +28,19 @@ where
/// Creates a new `Func`.
pub fn new(func: F) -> Self
where
- F: HostFunction,
+ F: HostFunction + Send,
{
// Create an empty `vm::Ctx`, that is going to be overwritten by `Instance::new`.
let ctx = unsafe { vm::Ctx::new_uninit() };
Self {
- new_function: new::wasmer::Function::new_native_with_env::(
- &get_global_store(),
- ctx,
- func,
- ),
+ new_function: unsafe {
+ new::wasmer::Function::new_native_with_unsafe_mutable_env::(
+ &get_global_store(),
+ ctx,
+ func,
+ )
+ },
_phantom: PhantomData,
}
}
@@ -234,35 +237,36 @@ use std::{
/// `module::Module::instantiate`.
pub(crate) struct DynamicCtx {
pub(crate) vmctx: Rc>,
+ inner_func:
+ Box Result, RuntimeError> + Send + 'static>,
}
impl DynamicFunc {
/// Create a new `DynamicFunc`.
pub fn new(signature: &FuncSig, func: F) -> Self
where
- F: Fn(&mut vm::Ctx, &[Value]) -> Result, RuntimeError> + 'static,
+ F: Fn(&mut vm::Ctx, &[Value]) -> Result, RuntimeError> + Send + 'static,
{
// Create an empty `vm::Ctx`, that is going to be overwritten by `Instance::new`.
let ctx = DynamicCtx {
vmctx: Rc::new(RefCell::new(unsafe { vm::Ctx::new_uninit() })),
+ inner_func: Box::new(func),
};
- Self {
- new_function: new::wasmer::Function::new_with_env(
- &get_global_store(),
- signature,
- ctx,
- // Wrapper to safely extract a `&mut vm::Ctx` to pass
- // to `func`.
- move |dyn_ctx: &mut DynamicCtx,
- params: &[Value]|
- -> Result, RuntimeError> {
- let cell: Rc> = dyn_ctx.vmctx.clone();
- let mut vmctx: RefMut = cell.borrow_mut();
+ // Wrapper to safely extract a `&mut vm::Ctx` to pass
+ // to `func`.
+ fn inner(dyn_ctx: &DynamicCtx, params: &[Value]) -> Result, RuntimeError> {
+ let cell: Rc> = dyn_ctx.vmctx.clone();
+ let mut vmctx: RefMut = cell.borrow_mut();
- func(vmctx.deref_mut(), params)
- },
- ),
+ (dyn_ctx.inner_func)(vmctx.deref_mut(), params)
+ }
+
+ Self {
+ new_function: new::wasmer::Function::new_with_env::<
+ fn(&DynamicCtx, &[Value]) -> Result, RuntimeError>,
+ DynamicCtx,
+ >(&get_global_store(), signature, ctx, inner),
}
}
diff --git a/lib/deprecated/runtime-core/src/vm.rs b/lib/deprecated/runtime-core/src/vm.rs
index 8b129e3c6..21650d94e 100644
--- a/lib/deprecated/runtime-core/src/vm.rs
+++ b/lib/deprecated/runtime-core/src/vm.rs
@@ -1,6 +1,8 @@
-use crate::module::ModuleInfo;
+use crate::{module::ModuleInfo, new};
use std::{ffi::c_void, ptr};
+use new::wasmer::internals::UnsafeMutableEnv;
+
/// The context of the currently running WebAssembly instance.
///
/// This is implicitly passed to every WebAssembly function.
@@ -38,6 +40,9 @@ pub struct Ctx {
pub data_finalizer: Option,
}
+/// We mark `Ctx` as a legacy env that can be passed by `&mut`.
+unsafe impl UnsafeMutableEnv for Ctx {}
+
impl Ctx {
pub(crate) unsafe fn new_uninit() -> Self {
Self {
diff --git a/lib/deprecated/runtime/Cargo.lock b/lib/deprecated/runtime/Cargo.lock
index e4cfe7113..b7baa2a4b 100644
--- a/lib/deprecated/runtime/Cargo.lock
+++ b/lib/deprecated/runtime/Cargo.lock
@@ -6,7 +6,7 @@ version = "0.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072"
dependencies = [
- "gimli 0.22.0",
+ "gimli",
]
[[package]]
@@ -120,6 +120,12 @@ dependencies = [
"bitflags",
]
+[[package]]
+name = "const_fn"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab"
+
[[package]]
name = "constant_time_eq"
version = "0.1.5"
@@ -128,28 +134,27 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
[[package]]
name = "cranelift-bforest"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9413a2c6bdb01ab8acc867421bd7343ddea491d015453f4e56f4f60c816d120"
+checksum = "9221545c0507dc08a62b2d8b5ffe8e17ac580b0a74d1813b496b8d70b070fbd0"
dependencies = [
"cranelift-entity",
]
[[package]]
name = "cranelift-codegen"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f28d389588c2375bb95292e0bc6cbf010e7f30fb4e9734738b576521b737826a"
+checksum = "7e9936ea608b6cd176f107037f6adbb4deac933466fc7231154f96598b2d3ab1"
dependencies = [
"byteorder",
"cranelift-bforest",
"cranelift-codegen-meta",
"cranelift-codegen-shared",
"cranelift-entity",
- "gimli 0.21.0",
+ "gimli",
"log",
"regalloc",
- "serde",
"smallvec",
"target-lexicon",
"thiserror",
@@ -157,9 +162,9 @@ dependencies = [
[[package]]
name = "cranelift-codegen-meta"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74dd3cf6f107c1df4c2b8aab91ec4181aee7ff17289673fcbec63325e7e40a83"
+checksum = "4ef2b2768568306540f4c8db3acce9105534d34c4a1e440529c1e702d7f8c8d7"
dependencies = [
"cranelift-codegen-shared",
"cranelift-entity",
@@ -167,24 +172,24 @@ dependencies = [
[[package]]
name = "cranelift-codegen-shared"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "efaf050fab2dbf324544489443ff3cc8c67c9420c8902ec6628bd906bd7393e9"
+checksum = "6759012d6d19c4caec95793f052613e9d4113e925e7f14154defbac0f1d4c938"
[[package]]
name = "cranelift-entity"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f07eb8aa0a5da94b56339e4e3052c496a3df4354357cd5da8c7b02c6e8f1dc1d"
+checksum = "86badbce14e15f52a45b666b38abe47b204969dd7f8fb7488cb55dd46b361fa6"
dependencies = [
"serde",
]
[[package]]
name = "cranelift-frontend"
-version = "0.65.0"
+version = "0.68.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f6fe1d3e968576f4b60d23f40ee90281f8de2cdf23d2110f3b0296ff420555e"
+checksum = "b608bb7656c554d0a4cf8f50c7a10b857e80306f6ff829ad6d468a7e2323c8d8"
dependencies = [
"cranelift-codegen",
"log",
@@ -202,50 +207,49 @@ dependencies = [
]
[[package]]
-name = "crossbeam-deque"
-version = "0.7.3"
+name = "crossbeam-channel"
+version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
+checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775"
dependencies = [
+ "cfg-if 1.0.0",
+ "crossbeam-utils",
+]
+
+[[package]]
+name = "crossbeam-deque"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9"
+dependencies = [
+ "cfg-if 1.0.0",
"crossbeam-epoch",
"crossbeam-utils",
- "maybe-uninit",
]
[[package]]
name = "crossbeam-epoch"
-version = "0.8.2"
+version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
+checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f"
dependencies = [
- "autocfg",
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
+ "const_fn",
"crossbeam-utils",
"lazy_static",
- "maybe-uninit",
"memoffset",
"scopeguard",
]
-[[package]]
-name = "crossbeam-queue"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
-dependencies = [
- "cfg-if 0.1.10",
- "crossbeam-utils",
- "maybe-uninit",
-]
-
[[package]]
name = "crossbeam-utils"
-version = "0.7.2"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
+checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5"
dependencies = [
"autocfg",
- "cfg-if 0.1.10",
+ "cfg-if 1.0.0",
+ "const_fn",
"lazy_static",
]
@@ -392,21 +396,15 @@ dependencies = [
[[package]]
name = "gimli"
-version = "0.21.0"
+version = "0.22.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c"
+checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
dependencies = [
"fallible-iterator",
"indexmap",
"stable_deref_trait",
]
-[[package]]
-name = "gimli"
-version = "0.22.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724"
-
[[package]]
name = "goblin"
version = "0.2.3"
@@ -570,12 +568,6 @@ dependencies = [
"libc",
]
-[[package]]
-name = "maybe-uninit"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00"
-
[[package]]
name = "memchr"
version = "2.3.3"
@@ -637,20 +629,20 @@ dependencies = [
[[package]]
name = "object"
-version = "0.19.0"
+version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9cbca9424c482ee628fa549d9c812e2cd22f1180b9222c9200fdfa6eb31aecb2"
+checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
+
+[[package]]
+name = "object"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37fd5004feb2ce328a52b0b3d01dbf4ffff72583493900ed15f22d4111c51693"
dependencies = [
"crc32fast",
"indexmap",
]
-[[package]]
-name = "object"
-version = "0.20.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5"
-
[[package]]
name = "once_cell"
version = "1.4.0"
@@ -793,9 +785,9 @@ dependencies = [
[[package]]
name = "rayon"
-version = "1.3.1"
+version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62f02856753d04e03e26929f820d0a0a337ebe71f849801eea335d464b349080"
+checksum = "8b0d8e0819fadc20c74ea8373106ead0600e3a67ef1fe8da56e39b9ae7275674"
dependencies = [
"autocfg",
"crossbeam-deque",
@@ -805,12 +797,12 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.7.1"
+version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e92e15d89083484e11353891f1af602cc661426deb9564c298b270c726973280"
+checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a"
dependencies = [
+ "crossbeam-channel",
"crossbeam-deque",
- "crossbeam-queue",
"crossbeam-utils",
"lazy_static",
"num_cpus",
@@ -824,9 +816,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce"
[[package]]
name = "regalloc"
-version = "0.0.26"
+version = "0.0.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c03092d79e0fd610932d89ed53895a38c0dd3bcd317a0046e69940de32f1d95"
+checksum = "571f7f397d61c4755285cd37853fe8e03271c243424a907415909379659381c5"
dependencies = [
"log",
"rustc-hash",
@@ -1011,9 +1003,9 @@ dependencies = [
[[package]]
name = "target-lexicon"
-version = "0.10.0"
+version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
+checksum = "4ee5a98e506fb7231a304c3a1bd7c132a55016cf65001e0282480665870dfcb9"
[[package]]
name = "tempfile"
@@ -1115,7 +1107,7 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasmer"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cfg-if 0.1.10",
"indexmap",
@@ -1137,7 +1129,7 @@ dependencies = [
[[package]]
name = "wasmer-cache"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"blake3",
"hex",
@@ -1148,7 +1140,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"enumset",
"raw-cpuid",
@@ -1164,14 +1156,15 @@ dependencies = [
[[package]]
name = "wasmer-compiler-cranelift"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cranelift-codegen",
"cranelift-frontend",
- "gimli 0.21.0",
+ "gimli",
"more-asserts",
"rayon",
"serde",
+ "smallvec",
"tracing",
"wasmer-compiler",
"wasmer-types",
@@ -1180,7 +1173,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler-llvm"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"byteorder",
"cc",
@@ -1202,7 +1195,7 @@ dependencies = [
[[package]]
name = "wasmer-compiler-singlepass"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"byteorder",
"dynasm",
@@ -1219,7 +1212,7 @@ dependencies = [
[[package]]
name = "wasmer-engine"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"backtrace",
"bincode",
@@ -1237,7 +1230,7 @@ dependencies = [
[[package]]
name = "wasmer-engine-jit"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"bincode",
"cfg-if 0.1.10",
@@ -1253,7 +1246,7 @@ dependencies = [
[[package]]
name = "wasmer-engine-native"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"bincode",
"cfg-if 0.1.10",
@@ -1272,9 +1265,9 @@ dependencies = [
[[package]]
name = "wasmer-object"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
- "object 0.19.0",
+ "object 0.21.1",
"thiserror",
"wasmer-compiler",
"wasmer-types",
@@ -1307,7 +1300,7 @@ dependencies = [
[[package]]
name = "wasmer-types"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"cranelift-entity",
"serde",
@@ -1315,7 +1308,7 @@ dependencies = [
[[package]]
name = "wasmer-vm"
-version = "1.0.0-alpha4"
+version = "1.0.0-alpha5"
dependencies = [
"backtrace",
"cc",
@@ -1333,9 +1326,9 @@ dependencies = [
[[package]]
name = "wasmparser"
-version = "0.57.0"
+version = "0.65.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "32fddd575d477c6e9702484139cf9f23dcd554b06d185ed0f56c857dd3a47aa6"
+checksum = "87cc2fe6350834b4e528ba0901e7aa405d78b89dc1fa3145359eb4de0e323fcf"
[[package]]
name = "wast"
diff --git a/lib/emscripten/src/bitwise.rs b/lib/emscripten/src/bitwise.rs
index fb9c20b66..5343dfe1c 100644
--- a/lib/emscripten/src/bitwise.rs
+++ b/lib/emscripten/src/bitwise.rs
@@ -2,7 +2,7 @@ use crate::emscripten_target;
use crate::EmEnv;
///emscripten: _llvm_bswap_i64
-pub fn _llvm_bswap_i64(ctx: &mut EmEnv, _low: i32, high: i32) -> i32 {
+pub fn _llvm_bswap_i64(ctx: &EmEnv, _low: i32, high: i32) -> i32 {
debug!("emscripten::_llvm_bswap_i64");
emscripten_target::setTempRet0(ctx, _low.swap_bytes());
high.swap_bytes()
diff --git a/lib/emscripten/src/emscripten_target.rs b/lib/emscripten/src/emscripten_target.rs
index 2458cc8f2..5981866ef 100644
--- a/lib/emscripten/src/emscripten_target.rs
+++ b/lib/emscripten/src/emscripten_target.rs
@@ -5,31 +5,31 @@ use crate::EmEnv;
#[cfg(target_os = "linux")]
use libc::getdtablesize;
-pub fn asm_const_i(_ctx: &mut EmEnv, _val: i32) -> i32 {
+pub fn asm_const_i(_ctx: &EmEnv, _val: i32) -> i32 {
debug!("emscripten::asm_const_i: {}", _val);
0
}
-pub fn exit_with_live_runtime(_ctx: &mut EmEnv) {
+pub fn exit_with_live_runtime(_ctx: &EmEnv) {
debug!("emscripten::exit_with_live_runtime");
}
-pub fn setTempRet0(ctx: &mut EmEnv, val: i32) {
+pub fn setTempRet0(ctx: &EmEnv, val: i32) {
trace!("emscripten::setTempRet0: {}", val);
get_emscripten_data(ctx).temp_ret_0 = val;
}
-pub fn getTempRet0(ctx: &mut EmEnv) -> i32 {
+pub fn getTempRet0(ctx: &EmEnv) -> i32 {
trace!("emscripten::getTempRet0");
get_emscripten_data(ctx).temp_ret_0
}
-pub fn _alarm(_ctx: &mut EmEnv, _seconds: u32) -> i32 {
+pub fn _alarm(_ctx: &EmEnv, _seconds: u32) -> i32 {
debug!("emscripten::_alarm({})", _seconds);
0
}
-pub fn _atexit(_ctx: &mut EmEnv, _func: i32) -> i32 {
+pub fn _atexit(_ctx: &EmEnv, _func: i32) -> i32 {
debug!("emscripten::_atexit");
// TODO: implement atexit properly
// __ATEXIT__.unshift({
@@ -38,38 +38,38 @@ pub fn _atexit(_ctx: &mut EmEnv, _func: i32) -> i32 {
// });
0
}
-pub fn __Unwind_Backtrace(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn __Unwind_Backtrace(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
debug!("emscripten::__Unwind_Backtrace");
0
}
-pub fn __Unwind_FindEnclosingFunction(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn __Unwind_FindEnclosingFunction(_ctx: &EmEnv, _a: i32) -> i32 {
debug!("emscripten::__Unwind_FindEnclosingFunction");
0
}
-pub fn __Unwind_GetIPInfo(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn __Unwind_GetIPInfo(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
debug!("emscripten::__Unwind_GetIPInfo");
0
}
-pub fn ___cxa_find_matching_catch_2(_ctx: &mut EmEnv) -> i32 {
+pub fn ___cxa_find_matching_catch_2(_ctx: &EmEnv) -> i32 {
debug!("emscripten::___cxa_find_matching_catch_2");
0
}
-pub fn ___cxa_find_matching_catch_3(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn ___cxa_find_matching_catch_3(_ctx: &EmEnv, _a: i32) -> i32 {
debug!("emscripten::___cxa_find_matching_catch_3");
0
}
-pub fn ___cxa_free_exception(_ctx: &mut EmEnv, _a: i32) {
+pub fn ___cxa_free_exception(_ctx: &EmEnv, _a: i32) {
debug!("emscripten::___cxa_free_exception");
}
-pub fn ___resumeException(_ctx: &mut EmEnv, _a: i32) {
+pub fn ___resumeException(_ctx: &EmEnv, _a: i32) {
debug!("emscripten::___resumeException");
}
-pub fn _dladdr(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _dladdr(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_dladdr");
0
}
pub fn ___gxx_personality_v0(
- _ctx: &mut EmEnv,
+ _ctx: &EmEnv,
_a: i32,
_b: i32,
_c: i32,
@@ -82,25 +82,25 @@ pub fn ___gxx_personality_v0(
}
#[cfg(target_os = "linux")]
-pub fn _getdtablesize(_ctx: &mut EmEnv) -> i32 {
+pub fn _getdtablesize(_ctx: &EmEnv) -> i32 {
debug!("emscripten::getdtablesize");
unsafe { getdtablesize() }
}
#[cfg(not(target_os = "linux"))]
-pub fn _getdtablesize(_ctx: &mut EmEnv) -> i32 {
+pub fn _getdtablesize(_ctx: &EmEnv) -> i32 {
debug!("emscripten::getdtablesize");
-1
}
-pub fn _gethostbyaddr(_ctx: &mut EmEnv, _addr: i32, _addrlen: i32, _atype: i32) -> i32 {
+pub fn _gethostbyaddr(_ctx: &EmEnv, _addr: i32, _addrlen: i32, _atype: i32) -> i32 {
debug!("emscripten::gethostbyaddr");
0
}
-pub fn _gethostbyname(_ctx: &mut EmEnv, _name: i32) -> i32 {
+pub fn _gethostbyname(_ctx: &EmEnv, _name: i32) -> i32 {
debug!("emscripten::gethostbyname_r");
0
}
pub fn _gethostbyname_r(
- _ctx: &mut EmEnv,
+ _ctx: &EmEnv,
_name: i32,
_ret: i32,
_buf: i32,
@@ -112,12 +112,12 @@ pub fn _gethostbyname_r(
0
}
// NOTE: php.js has proper impl; libc has proper impl for linux
-pub fn _getloadavg(_ctx: &mut EmEnv, _loadavg: i32, _nelem: i32) -> i32 {
+pub fn _getloadavg(_ctx: &EmEnv, _loadavg: i32, _nelem: i32) -> i32 {
debug!("emscripten::getloadavg");
0
}
pub fn _getnameinfo(
- _ctx: &mut EmEnv,
+ _ctx: &EmEnv,
_addr: i32,
_addrlen: i32,
_host: i32,
@@ -170,73 +170,65 @@ macro_rules! invoke_no_return {
}
// Invoke functions
-pub fn invoke_i(ctx: &mut EmEnv, index: i32) -> i32 {
+pub fn invoke_i(ctx: &EmEnv, index: i32) -> i32 {
debug!("emscripten::invoke_i");
invoke!(ctx, dyn_call_i, index)
}
-pub fn invoke_ii(ctx: &mut EmEnv, index: i32, a1: i32) -> i32 {
+pub fn invoke_ii(ctx: &EmEnv, index: i32, a1: i32) -> i32 {
debug!("emscripten::invoke_ii");
invoke!(ctx, dyn_call_ii, index, a1)
}
-pub fn invoke_iii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) -> i32 {
+pub fn invoke_iii(ctx: &EmEnv, index: i32, a1: i32, a2: i32) -> i32 {
debug!("emscripten::invoke_iii");
invoke!(ctx, dyn_call_iii, index, a1, a2)
}
-pub fn invoke_iiii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
+pub fn invoke_iiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
debug!("emscripten::invoke_iiii");
invoke!(ctx, dyn_call_iiii, index, a1, a2, a3)
}
-pub fn invoke_iifi(ctx: &mut EmEnv, index: i32, a1: i32, a2: f64, a3: i32) -> i32 {
+pub fn invoke_iifi(ctx: &EmEnv, index: i32, a1: i32, a2: f64, a3: i32) -> i32 {
debug!("emscripten::invoke_iifi");
invoke!(ctx, dyn_call_iifi, index, a1, a2, a3)
}
-pub fn invoke_v(ctx: &mut EmEnv, index: i32) {
+pub fn invoke_v(ctx: &EmEnv, index: i32) {
debug!("emscripten::invoke_v");
invoke_no_return!(ctx, dyn_call_v, index);
}
-pub fn invoke_vi(ctx: &mut EmEnv, index: i32, a1: i32) {
+pub fn invoke_vi(ctx: &EmEnv, index: i32, a1: i32) {
debug!("emscripten::invoke_vi");
invoke_no_return!(ctx, dyn_call_vi, index, a1);
}
-pub fn invoke_vii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) {
+pub fn invoke_vii(ctx: &EmEnv, index: i32, a1: i32, a2: i32) {
debug!("emscripten::invoke_vii");
invoke_no_return!(ctx, dyn_call_vii, index, a1, a2);
}
-pub fn invoke_viii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) {
+pub fn invoke_viii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) {
debug!("emscripten::invoke_viii");
invoke_no_return!(ctx, dyn_call_viii, index, a1, a2, a3);
}
-pub fn invoke_viiii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
+pub fn invoke_viiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
debug!("emscripten::invoke_viiii");
invoke_no_return!(ctx, dyn_call_viiii, index, a1, a2, a3, a4);
}
-pub fn invoke_dii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) -> f64 {
+pub fn invoke_dii(ctx: &EmEnv, index: i32, a1: i32, a2: i32) -> f64 {
debug!("emscripten::invoke_dii");
invoke!(ctx, dyn_call_dii, index, a1, a2)
}
-pub fn invoke_diiii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> f64 {
+pub fn invoke_diiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> f64 {
debug!("emscripten::invoke_diiii");
invoke!(ctx, dyn_call_diiii, index, a1, a2, a3, a4)
}
-pub fn invoke_iiiii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
+pub fn invoke_iiiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
debug!("emscripten::invoke_iiiii");
invoke!(ctx, dyn_call_iiiii, index, a1, a2, a3, a4)
}
-pub fn invoke_iiiiii(
- ctx: &mut EmEnv,
- index: i32,
- a1: i32,
- a2: i32,
- a3: i32,
- a4: i32,
- a5: i32,
-) -> i32 {
+pub fn invoke_iiiiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) -> i32 {
debug!("emscripten::invoke_iiiiii");
invoke!(ctx, dyn_call_iiiiii, index, a1, a2, a3, a4, a5)
}
pub fn invoke_iiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -249,7 +241,7 @@ pub fn invoke_iiiiiii(
invoke!(ctx, dyn_call_iiiiiii, index, a1, a2, a3, a4, a5, a6)
}
pub fn invoke_iiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -263,7 +255,7 @@ pub fn invoke_iiiiiiii(
invoke!(ctx, dyn_call_iiiiiiii, index, a1, a2, a3, a4, a5, a6, a7)
}
pub fn invoke_iiiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -290,7 +282,7 @@ pub fn invoke_iiiiiiiii(
)
}
pub fn invoke_iiiiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -319,7 +311,7 @@ pub fn invoke_iiiiiiiiii(
)
}
pub fn invoke_iiiiiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -349,16 +341,16 @@ pub fn invoke_iiiiiiiiiii(
a10
)
}
-pub fn invoke_vd(ctx: &mut EmEnv, index: i32, a1: f64) {
+pub fn invoke_vd(ctx: &EmEnv, index: i32, a1: f64) {
debug!("emscripten::invoke_vd");
invoke_no_return!(ctx, dyn_call_vd, index, a1)
}
-pub fn invoke_viiiii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
+pub fn invoke_viiiii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
debug!("emscripten::invoke_viiiii");
invoke_no_return!(ctx, dyn_call_viiiii, index, a1, a2, a3, a4, a5)
}
pub fn invoke_viiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -371,7 +363,7 @@ pub fn invoke_viiiiii(
invoke_no_return!(ctx, dyn_call_viiiiii, index, a1, a2, a3, a4, a5, a6)
}
pub fn invoke_viiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -385,7 +377,7 @@ pub fn invoke_viiiiiii(
invoke_no_return!(ctx, dyn_call_viiiiiii, index, a1, a2, a3, a4, a5, a6, a7)
}
pub fn invoke_viiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -412,7 +404,7 @@ pub fn invoke_viiiiiiii(
)
}
pub fn invoke_viiiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -441,7 +433,7 @@ pub fn invoke_viiiiiiiii(
)
}
pub fn invoke_viiiiiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -472,23 +464,23 @@ pub fn invoke_viiiiiiiiii(
)
}
-pub fn invoke_iij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
+pub fn invoke_iij(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
debug!("emscripten::invoke_iij");
invoke!(ctx, dyn_call_iij, index, a1, a2, a3)
}
-pub fn invoke_iji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
+pub fn invoke_iji(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
debug!("emscripten::invoke_iji");
invoke!(ctx, dyn_call_iji, index, a1, a2, a3)
}
-pub fn invoke_iiji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
+pub fn invoke_iiji(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
debug!("emscripten::invoke_iiji");
invoke!(ctx, dyn_call_iiji, index, a1, a2, a3, a4)
}
pub fn invoke_iiijj(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -500,7 +492,7 @@ pub fn invoke_iiijj(
debug!("emscripten::invoke_iiijj");
invoke!(ctx, dyn_call_iiijj, index, a1, a2, a3, a4, a5, a6)
}
-pub fn invoke_j(ctx: &mut EmEnv, index: i32) -> i32 {
+pub fn invoke_j(ctx: &EmEnv, index: i32) -> i32 {
debug!("emscripten::invoke_j");
if let Some(dyn_call_j) = &get_emscripten_data(ctx).dyn_call_j {
dyn_call_j.call(index).unwrap()
@@ -508,7 +500,7 @@ pub fn invoke_j(ctx: &mut EmEnv, index: i32) -> i32 {
panic!("dyn_call_j is set to None");
}
}
-pub fn invoke_ji(ctx: &mut EmEnv, index: i32, a1: i32) -> i32 {
+pub fn invoke_ji(ctx: &EmEnv, index: i32, a1: i32) -> i32 {
debug!("emscripten::invoke_ji");
if let Some(dyn_call_ji) = &get_emscripten_data(ctx).dyn_call_ji {
dyn_call_ji.call(index, a1).unwrap()
@@ -516,7 +508,7 @@ pub fn invoke_ji(ctx: &mut EmEnv, index: i32, a1: i32) -> i32 {
panic!("dyn_call_ji is set to None");
}
}
-pub fn invoke_jii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) -> i32 {
+pub fn invoke_jii(ctx: &EmEnv, index: i32, a1: i32, a2: i32) -> i32 {
debug!("emscripten::invoke_jii");
if let Some(dyn_call_jii) = &get_emscripten_data(ctx).dyn_call_jii {
dyn_call_jii.call(index, a1, a2).unwrap()
@@ -525,7 +517,7 @@ pub fn invoke_jii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) -> i32 {
}
}
-pub fn invoke_jij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
+pub fn invoke_jij(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
debug!("emscripten::invoke_jij");
if let Some(dyn_call_jij) = &get_emscripten_data(ctx).dyn_call_jij {
dyn_call_jij.call(index, a1, a2, a3).unwrap()
@@ -533,7 +525,7 @@ pub fn invoke_jij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) -> i32
panic!("dyn_call_jij is set to None");
}
}
-pub fn invoke_jjj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
+pub fn invoke_jjj(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
debug!("emscripten::invoke_jjj");
if let Some(dyn_call_jjj) = &get_emscripten_data(ctx).dyn_call_jjj {
dyn_call_jjj.call(index, a1, a2, a3, a4).unwrap()
@@ -541,7 +533,7 @@ pub fn invoke_jjj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i3
panic!("dyn_call_jjj is set to None");
}
}
-pub fn invoke_viiij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
+pub fn invoke_viiij(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
debug!("emscripten::invoke_viiij");
if let Some(dyn_call_viiij) = &get_emscripten_data(ctx).dyn_call_viiij {
dyn_call_viiij.call(index, a1, a2, a3, a4, a5).unwrap();
@@ -550,7 +542,7 @@ pub fn invoke_viiij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4:
}
}
pub fn invoke_viiijiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -572,7 +564,7 @@ pub fn invoke_viiijiiii(
}
}
pub fn invoke_viiijiiiiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -595,7 +587,7 @@ pub fn invoke_viiijiiiiii(
panic!("dyn_call_viiijiiiiii is set to None");
}
}
-pub fn invoke_viij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
+pub fn invoke_viij(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
debug!("emscripten::invoke_viij");
if let Some(dyn_call_viij) = &get_emscripten_data(ctx).dyn_call_viij {
dyn_call_viij.call(index, a1, a2, a3, a4).unwrap();
@@ -603,7 +595,7 @@ pub fn invoke_viij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i
panic!("dyn_call_viij is set to None");
}
}
-pub fn invoke_viiji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
+pub fn invoke_viiji(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
debug!("emscripten::invoke_viiji");
if let Some(dyn_call_viiji) = &get_emscripten_data(ctx).dyn_call_viiji {
dyn_call_viiji.call(index, a1, a2, a3, a4, a5).unwrap();
@@ -612,7 +604,7 @@ pub fn invoke_viiji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4:
}
}
pub fn invoke_viijiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -631,16 +623,7 @@ pub fn invoke_viijiii(
panic!("dyn_call_viijiii is set to None");
}
}
-pub fn invoke_viijj(
- ctx: &mut EmEnv,
- index: i32,
- a1: i32,
- a2: i32,
- a3: i32,
- a4: i32,
- a5: i32,
- a6: i32,
-) {
+pub fn invoke_viijj(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32, a6: i32) {
debug!("emscripten::invoke_viijj");
if let Some(dyn_call_viijj) = &get_emscripten_data(ctx).dyn_call_viijj {
dyn_call_viijj.call(index, a1, a2, a3, a4, a5, a6).unwrap();
@@ -648,7 +631,7 @@ pub fn invoke_viijj(
panic!("dyn_call_viijj is set to None");
}
}
-pub fn invoke_vj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) {
+pub fn invoke_vj(ctx: &EmEnv, index: i32, a1: i32, a2: i32) {
debug!("emscripten::invoke_vj");
if let Some(dyn_call_vj) = &get_emscripten_data(ctx).dyn_call_vj {
dyn_call_vj.call(index, a1, a2).unwrap();
@@ -656,11 +639,11 @@ pub fn invoke_vj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32) {
panic!("dyn_call_vj is set to None");
}
}
-pub fn invoke_vjji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
+pub fn invoke_vjji(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
debug!("emscripten::invoke_vjji");
invoke_no_return!(ctx, dyn_call_vjji, index, a1, a2, a3, a4, a5)
}
-pub fn invoke_vij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) {
+pub fn invoke_vij(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32) {
debug!("emscripten::invoke_vij");
if let Some(dyn_call_vij) = &get_emscripten_data(ctx).dyn_call_vij {
dyn_call_vij.call(index, a1, a2, a3).unwrap();
@@ -668,7 +651,7 @@ pub fn invoke_vij(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32) {
panic!("dyn_call_vij is set to None");
}
}
-pub fn invoke_viji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
+pub fn invoke_viji(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) {
debug!("emscripten::invoke_viji");
if let Some(dyn_call_viji) = &get_emscripten_data(ctx).dyn_call_viji {
dyn_call_viji.call(index, a1, a2, a3, a4).unwrap()
@@ -677,7 +660,7 @@ pub fn invoke_viji(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i
}
}
pub fn invoke_vijiii(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
@@ -693,7 +676,7 @@ pub fn invoke_vijiii(
panic!("dyn_call_vijiii is set to None");
}
}
-pub fn invoke_vijj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
+pub fn invoke_vijj(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i32, a5: i32) {
debug!("emscripten::invoke_vijj");
if let Some(dyn_call_vijj) = &get_emscripten_data(ctx).dyn_call_vijj {
dyn_call_vijj.call(index, a1, a2, a3, a4, a5).unwrap()
@@ -701,20 +684,20 @@ pub fn invoke_vijj(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: i32, a4: i
panic!("dyn_call_vijj is set to None");
}
}
-pub fn invoke_vidd(ctx: &mut EmEnv, index: i32, a1: i32, a2: f64, a3: f64) {
+pub fn invoke_vidd(ctx: &EmEnv, index: i32, a1: i32, a2: f64, a3: f64) {
debug!("emscripten::invoke_viid");
invoke_no_return!(ctx, dyn_call_vidd, index, a1, a2, a3);
}
-pub fn invoke_viid(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: f64) {
+pub fn invoke_viid(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: f64) {
debug!("emscripten::invoke_viid");
invoke_no_return!(ctx, dyn_call_viid, index, a1, a2, a3);
}
-pub fn invoke_viidii(ctx: &mut EmEnv, index: i32, a1: i32, a2: i32, a3: f64, a4: i32, a5: i32) {
+pub fn invoke_viidii(ctx: &EmEnv, index: i32, a1: i32, a2: i32, a3: f64, a4: i32, a5: i32) {
debug!("emscripten::invoke_viidii");
invoke_no_return!(ctx, dyn_call_viidii, index, a1, a2, a3, a4, a5);
}
pub fn invoke_viidddddddd(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
index: i32,
a1: i32,
a2: i32,
diff --git a/lib/emscripten/src/env/mod.rs b/lib/emscripten/src/env/mod.rs
index ad04d8dc7..b329c39a9 100644
--- a/lib/emscripten/src/env/mod.rs
+++ b/lib/emscripten/src/env/mod.rs
@@ -23,7 +23,7 @@ use std::os::raw::c_int;
use crate::EmEnv;
use wasmer::ValueType;
-pub fn call_malloc(ctx: &mut EmEnv, size: u32) -> u32 {
+pub fn call_malloc(ctx: &EmEnv, size: u32) -> u32 {
get_emscripten_data(ctx)
.malloc
.as_ref()
@@ -33,11 +33,11 @@ pub fn call_malloc(ctx: &mut EmEnv, size: u32) -> u32 {
}
#[warn(dead_code)]
-pub fn call_malloc_with_cast(ctx: &mut EmEnv, size: u32) -> WasmPtr {
+pub fn call_malloc_with_cast(ctx: &EmEnv, size: u32) -> WasmPtr {
WasmPtr::new(call_malloc(ctx, size))
}
-pub fn call_memalign(ctx: &mut EmEnv, alignment: u32, size: u32) -> u32 {
+pub fn call_memalign(ctx: &EmEnv, alignment: u32, size: u32) -> u32 {
if let Some(memalign) = &get_emscripten_data(ctx).memalign {
memalign.call(alignment, size).unwrap()
} else {
@@ -45,7 +45,7 @@ pub fn call_memalign(ctx: &mut EmEnv, alignment: u32, size: u32) -> u32 {
}
}
-pub fn call_memset(ctx: &mut EmEnv, pointer: u32, value: u32, size: u32) -> u32 {
+pub fn call_memset(ctx: &EmEnv, pointer: u32, value: u32, size: u32) -> u32 {
get_emscripten_data(ctx)
.memset
.as_ref()
@@ -54,16 +54,16 @@ pub fn call_memset(ctx: &mut EmEnv, pointer: u32, value: u32, size: u32) -> u32
.unwrap()
}
-pub(crate) fn get_emscripten_data<'a>(ctx: &'a mut EmEnv) -> &'a mut EmscriptenData<'static> {
+pub(crate) fn get_emscripten_data<'a>(ctx: &'a EmEnv) -> &'a mut EmscriptenData<'static> {
unsafe { &mut **ctx.data }
}
-pub fn _getpagesize(_ctx: &mut EmEnv) -> u32 {
+pub fn _getpagesize(_ctx: &EmEnv) -> u32 {
debug!("emscripten::_getpagesize");
16384
}
-pub fn _times(ctx: &mut EmEnv, buffer: u32) -> u32 {
+pub fn _times(ctx: &EmEnv, buffer: u32) -> u32 {
if buffer != 0 {
call_memset(ctx, buffer, 0, 16);
}
@@ -71,7 +71,7 @@ pub fn _times(ctx: &mut EmEnv, buffer: u32) -> u32 {
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___build_environment(ctx: &mut EmEnv, environ: c_int) {
+pub fn ___build_environment(ctx: &EmEnv, environ: c_int) {
debug!("emscripten::___build_environment {}", environ);
const MAX_ENV_VALUES: u32 = 64;
const TOTAL_ENV_SIZE: u32 = 1024;
@@ -123,13 +123,13 @@ pub fn ___build_environment(ctx: &mut EmEnv, environ: c_int) {
}
}
-pub fn ___assert_fail(_ctx: &mut EmEnv, _a: c_int, _b: c_int, _c: c_int, _d: c_int) {
+pub fn ___assert_fail(_ctx: &EmEnv, _a: c_int, _b: c_int, _c: c_int, _d: c_int) {
debug!("emscripten::___assert_fail {} {} {} {}", _a, _b, _c, _d);
// TODO: Implement like emscripten expects regarding memory/page size
// TODO raise an error
}
-pub fn _pathconf(ctx: &mut EmEnv, path_addr: c_int, name: c_int) -> c_int {
+pub fn _pathconf(ctx: &EmEnv, path_addr: c_int, name: c_int) -> c_int {
debug!(
"emscripten::_pathconf {} {} - UNIMPLEMENTED",
path_addr, name
@@ -150,7 +150,7 @@ pub fn _pathconf(ctx: &mut EmEnv, path_addr: c_int, name: c_int) -> c_int {
}
}
-pub fn _fpathconf(_ctx: &mut EmEnv, _fildes: c_int, name: c_int) -> c_int {
+pub fn _fpathconf(_ctx: &EmEnv, _fildes: c_int, name: c_int) -> c_int {
debug!("emscripten::_fpathconf {} {}", _fildes, name);
match name {
0 => 32000,
diff --git a/lib/emscripten/src/env/unix/mod.rs b/lib/emscripten/src/env/unix/mod.rs
index 775805d67..16746e5e4 100644
--- a/lib/emscripten/src/env/unix/mod.rs
+++ b/lib/emscripten/src/env/unix/mod.rs
@@ -15,7 +15,7 @@ use crate::EmEnv;
// #[no_mangle]
/// emscripten: _getenv // (name: *const char) -> *const c_char;
-pub fn _getenv(ctx: &mut EmEnv, name: i32) -> u32 {
+pub fn _getenv(ctx: &EmEnv, name: i32) -> u32 {
debug!("emscripten::_getenv");
let name_addr = emscripten_memory_pointer!(ctx.memory(0), name) as *const c_char;
@@ -31,7 +31,7 @@ pub fn _getenv(ctx: &mut EmEnv, name: i32) -> u32 {
}
/// emscripten: _setenv // (name: *const char, name: *const value, overwrite: int);
-pub fn _setenv(ctx: &mut EmEnv, name: c_int, value: c_int, overwrite: c_int) -> c_int {
+pub fn _setenv(ctx: &EmEnv, name: c_int, value: c_int, overwrite: c_int) -> c_int {
debug!("emscripten::_setenv");
let name_addr = emscripten_memory_pointer!(ctx.memory(0), name) as *const c_char;
@@ -44,7 +44,7 @@ pub fn _setenv(ctx: &mut EmEnv, name: c_int, value: c_int, overwrite: c_int) ->
}
/// emscripten: _putenv // (name: *const char);
-pub fn _putenv(ctx: &mut EmEnv, name: c_int) -> c_int {
+pub fn _putenv(ctx: &EmEnv, name: c_int) -> c_int {
debug!("emscripten::_putenv");
let name_addr = emscripten_memory_pointer!(ctx.memory(0), name) as *const c_char;
@@ -55,7 +55,7 @@ pub fn _putenv(ctx: &mut EmEnv, name: c_int) -> c_int {
}
/// emscripten: _unsetenv // (name: *const char);
-pub fn _unsetenv(ctx: &mut EmEnv, name: c_int) -> c_int {
+pub fn _unsetenv(ctx: &EmEnv, name: c_int) -> c_int {
debug!("emscripten::_unsetenv");
let name_addr = emscripten_memory_pointer!(ctx.memory(0), name) as *const c_char;
@@ -66,7 +66,7 @@ pub fn _unsetenv(ctx: &mut EmEnv, name: c_int) -> c_int {
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _getpwnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
+pub fn _getpwnam(ctx: &EmEnv, name_ptr: c_int) -> c_int {
debug!("emscripten::_getpwnam {}", name_ptr);
#[cfg(feature = "debug")]
let _ = name_ptr;
@@ -106,7 +106,7 @@ pub fn _getpwnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _getgrnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
+pub fn _getgrnam(ctx: &EmEnv, name_ptr: c_int) -> c_int {
debug!("emscripten::_getgrnam {}", name_ptr);
#[repr(C)]
@@ -137,14 +137,14 @@ pub fn _getgrnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
}
}
-pub fn _sysconf(_ctx: &mut EmEnv, name: c_int) -> i32 {
+pub fn _sysconf(_ctx: &EmEnv, name: c_int) -> i32 {
debug!("emscripten::_sysconf {}", name);
// TODO: Implement like emscripten expects regarding memory/page size
unsafe { sysconf(name) as i32 } // TODO review i64
}
// this may be a memory leak, probably not though because emscripten does the same thing
-pub fn _gai_strerror(ctx: &mut EmEnv, ecode: i32) -> i32 {
+pub fn _gai_strerror(ctx: &EmEnv, ecode: i32) -> i32 {
debug!("emscripten::_gai_strerror({})", ecode);
let cstr = unsafe { std::ffi::CStr::from_ptr(libc::gai_strerror(ecode)) };
@@ -164,7 +164,7 @@ pub fn _gai_strerror(ctx: &mut EmEnv, ecode: i32) -> i32 {
}
pub fn _getaddrinfo(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
node_ptr: WasmPtr,
service_str_ptr: WasmPtr,
hints_ptr: WasmPtr,
diff --git a/lib/emscripten/src/env/windows/mod.rs b/lib/emscripten/src/env/windows/mod.rs
index f7783bcf8..874d5e5e6 100644
--- a/lib/emscripten/src/env/windows/mod.rs
+++ b/lib/emscripten/src/env/windows/mod.rs
@@ -17,7 +17,7 @@ extern "C" {
// #[no_mangle]
/// emscripten: _getenv // (name: *const char) -> *const c_char;
-pub fn _getenv(ctx: &mut EmEnv, name: u32) -> u32 {
+pub fn _getenv(ctx: &EmEnv, name: u32) -> u32 {
debug!("emscripten::_getenv");
let name_string = read_string_from_wasm(ctx.memory(0), name);
debug!("=> name({:?})", name_string);
@@ -29,7 +29,7 @@ pub fn _getenv(ctx: &mut EmEnv, name: u32) -> u32 {
}
/// emscripten: _setenv // (name: *const char, name: *const value, overwrite: int);
-pub fn _setenv(ctx: &mut EmEnv, name: u32, value: u32, _overwrite: u32) -> c_int {
+pub fn _setenv(ctx: &EmEnv, name: u32, value: u32, _overwrite: u32) -> c_int {
debug!("emscripten::_setenv");
// setenv does not exist on windows, so we hack it with _putenv
let name = read_string_from_wasm(ctx.memory(0), name);
@@ -43,7 +43,7 @@ pub fn _setenv(ctx: &mut EmEnv, name: u32, value: u32, _overwrite: u32) -> c_int
}
/// emscripten: _putenv // (name: *const char);
-pub fn _putenv(ctx: &mut EmEnv, name: c_int) -> c_int {
+pub fn _putenv(ctx: &EmEnv, name: c_int) -> c_int {
debug!("emscripten::_putenv");
let name_addr = emscripten_memory_pointer!(ctx.memory(0), name) as *const c_char;
debug!("=> name({:?})", unsafe {
@@ -53,7 +53,7 @@ pub fn _putenv(ctx: &mut EmEnv, name: c_int) -> c_int {
}
/// emscripten: _unsetenv // (name: *const char);
-pub fn _unsetenv(ctx: &mut EmEnv, name: u32) -> c_int {
+pub fn _unsetenv(ctx: &EmEnv, name: u32) -> c_int {
debug!("emscripten::_unsetenv");
let name = read_string_from_wasm(ctx.memory(0), name);
// no unsetenv on windows, so use putenv with an empty value
@@ -65,7 +65,7 @@ pub fn _unsetenv(ctx: &mut EmEnv, name: u32) -> c_int {
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _getpwnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
+pub fn _getpwnam(ctx: &EmEnv, name_ptr: c_int) -> c_int {
debug!("emscripten::_getpwnam {}", name_ptr);
#[cfg(not(feature = "debug"))]
let _ = name_ptr;
@@ -99,7 +99,7 @@ pub fn _getpwnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _getgrnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
+pub fn _getgrnam(ctx: &EmEnv, name_ptr: c_int) -> c_int {
debug!("emscripten::_getgrnam {}", name_ptr);
#[cfg(not(feature = "debug"))]
let _ = name_ptr;
@@ -125,7 +125,7 @@ pub fn _getgrnam(ctx: &mut EmEnv, name_ptr: c_int) -> c_int {
}
}
-pub fn _sysconf(_ctx: &mut EmEnv, name: c_int) -> c_long {
+pub fn _sysconf(_ctx: &EmEnv, name: c_int) -> c_long {
debug!("emscripten::_sysconf {}", name);
#[cfg(not(feature = "debug"))]
let _ = name;
@@ -133,13 +133,13 @@ pub fn _sysconf(_ctx: &mut EmEnv, name: c_int) -> c_long {
0
}
-pub fn _gai_strerror(_ctx: &mut EmEnv, _ecode: i32) -> i32 {
+pub fn _gai_strerror(_ctx: &EmEnv, _ecode: i32) -> i32 {
debug!("emscripten::_gai_strerror({}) - stub", _ecode);
-1
}
pub fn _getaddrinfo(
- _ctx: &mut EmEnv,
+ _ctx: &EmEnv,
_node_ptr: WasmPtr,
_service_str_ptr: WasmPtr,
_hints_ptr: WasmPtr,
diff --git a/lib/emscripten/src/errno.rs b/lib/emscripten/src/errno.rs
index c1e54170b..fcbbe22df 100644
--- a/lib/emscripten/src/errno.rs
+++ b/lib/emscripten/src/errno.rs
@@ -1,7 +1,7 @@
// use std::collections::HashMap;
use crate::EmEnv;
-pub fn ___seterrno(_ctx: &mut EmEnv, _value: i32) {
+pub fn ___seterrno(_ctx: &EmEnv, _value: i32) {
debug!("emscripten::___seterrno {}", _value);
// TODO: Incomplete impl
eprintln!("failed to set errno!");
diff --git a/lib/emscripten/src/exception.rs b/lib/emscripten/src/exception.rs
index f968addc4..1f781dd65 100644
--- a/lib/emscripten/src/exception.rs
+++ b/lib/emscripten/src/exception.rs
@@ -3,54 +3,54 @@ use super::process::_abort;
use crate::EmEnv;
/// emscripten: ___cxa_allocate_exception
-pub fn ___cxa_allocate_exception(ctx: &mut EmEnv, size: u32) -> u32 {
+pub fn ___cxa_allocate_exception(ctx: &EmEnv, size: u32) -> u32 {
debug!("emscripten::___cxa_allocate_exception");
env::call_malloc(ctx, size as _)
}
-pub fn ___cxa_current_primary_exception(_ctx: &mut EmEnv) -> u32 {
+pub fn ___cxa_current_primary_exception(_ctx: &EmEnv) -> u32 {
debug!("emscripten::___cxa_current_primary_exception");
unimplemented!("emscripten::___cxa_current_primary_exception")
}
-pub fn ___cxa_decrement_exception_refcount(_ctx: &mut EmEnv, _a: u32) {
+pub fn ___cxa_decrement_exception_refcount(_ctx: &EmEnv, _a: u32) {
debug!("emscripten::___cxa_decrement_exception_refcount({})", _a);
unimplemented!("emscripten::___cxa_decrement_exception_refcount({})", _a)
}
-pub fn ___cxa_increment_exception_refcount(_ctx: &mut EmEnv, _a: u32) {
+pub fn ___cxa_increment_exception_refcount(_ctx: &EmEnv, _a: u32) {
debug!("emscripten::___cxa_increment_exception_refcount({})", _a);
unimplemented!("emscripten::___cxa_increment_exception_refcount({})", _a)
}
-pub fn ___cxa_rethrow_primary_exception(_ctx: &mut EmEnv, _a: u32) {
+pub fn ___cxa_rethrow_primary_exception(_ctx: &EmEnv, _a: u32) {
debug!("emscripten::___cxa_rethrow_primary_exception({})", _a);
unimplemented!("emscripten::___cxa_rethrow_primary_exception({})", _a)
}
/// emscripten: ___cxa_throw
/// TODO: We don't have support for exceptions yet
-pub fn ___cxa_throw(ctx: &mut EmEnv, _ptr: u32, _ty: u32, _destructor: u32) {
+pub fn ___cxa_throw(ctx: &EmEnv, _ptr: u32, _ty: u32, _destructor: u32) {
debug!("emscripten::___cxa_throw");
eprintln!("Throwing exceptions not yet implemented: aborting!");
_abort(ctx);
}
-pub fn ___cxa_begin_catch(_ctx: &mut EmEnv, _exception_object_ptr: u32) -> i32 {
+pub fn ___cxa_begin_catch(_ctx: &EmEnv, _exception_object_ptr: u32) -> i32 {
debug!("emscripten::___cxa_begin_catch");
-1
}
-pub fn ___cxa_end_catch(_ctx: &mut EmEnv) {
+pub fn ___cxa_end_catch(_ctx: &EmEnv) {
debug!("emscripten::___cxa_end_catch");
}
-pub fn ___cxa_uncaught_exception(_ctx: &mut EmEnv) -> i32 {
+pub fn ___cxa_uncaught_exception(_ctx: &EmEnv) -> i32 {
debug!("emscripten::___cxa_uncaught_exception");
-1
}
-pub fn ___cxa_pure_virtual(_ctx: &mut EmEnv) {
+pub fn ___cxa_pure_virtual(_ctx: &EmEnv) {
debug!("emscripten::___cxa_pure_virtual");
// ABORT = true
panic!("Pure virtual function called!");
diff --git a/lib/emscripten/src/exec.rs b/lib/emscripten/src/exec.rs
index 46a3331f2..529b9943f 100644
--- a/lib/emscripten/src/exec.rs
+++ b/lib/emscripten/src/exec.rs
@@ -4,7 +4,7 @@ use libc::execvp as libc_execvp;
use std::cell::Cell;
use std::ffi::CString;
-pub fn execvp(ctx: &mut EmEnv, command_name_offset: u32, argv_offset: u32) -> i32 {
+pub fn execvp(ctx: &EmEnv, command_name_offset: u32, argv_offset: u32) -> i32 {
// a single reference to re-use
let emscripten_memory = ctx.memory(0);
@@ -41,13 +41,13 @@ pub fn execvp(ctx: &mut EmEnv, command_name_offset: u32, argv_offset: u32) -> i3
}
/// execl
-pub fn execl(_ctx: &mut EmEnv, _path_ptr: i32, _arg0_ptr: i32, _varargs: VarArgs) -> i32 {
+pub fn execl(_ctx: &EmEnv, _path_ptr: i32, _arg0_ptr: i32, _varargs: VarArgs) -> i32 {
debug!("emscripten::execl");
-1
}
/// execle
-pub fn execle(_ctx: &mut EmEnv, _path_ptr: i32, _arg0_ptr: i32, _varargs: VarArgs) -> i32 {
+pub fn execle(_ctx: &EmEnv, _path_ptr: i32, _arg0_ptr: i32, _varargs: VarArgs) -> i32 {
debug!("emscripten::execle");
-1
}
diff --git a/lib/emscripten/src/exit.rs b/lib/emscripten/src/exit.rs
index b9b69a9dc..9518d2567 100644
--- a/lib/emscripten/src/exit.rs
+++ b/lib/emscripten/src/exit.rs
@@ -1,7 +1,7 @@
use crate::EmEnv;
// __exit
-pub fn exit(_ctx: &mut EmEnv, value: i32) {
+pub fn exit(_ctx: &EmEnv, value: i32) {
debug!("emscripten::exit {}", value);
::std::process::exit(value);
}
diff --git a/lib/emscripten/src/inet.rs b/lib/emscripten/src/inet.rs
index 79d2e946e..ff0267d88 100644
--- a/lib/emscripten/src/inet.rs
+++ b/lib/emscripten/src/inet.rs
@@ -1,6 +1,6 @@
use crate::EmEnv;
-pub fn addr(_ctx: &mut EmEnv, _cp: i32) -> i32 {
+pub fn addr(_ctx: &EmEnv, _cp: i32) -> i32 {
debug!("inet::addr({})", _cp);
0
}
diff --git a/lib/emscripten/src/io/mod.rs b/lib/emscripten/src/io/mod.rs
index e783bf29b..3c0a9d63b 100644
--- a/lib/emscripten/src/io/mod.rs
+++ b/lib/emscripten/src/io/mod.rs
@@ -13,19 +13,19 @@ pub use self::windows::*;
use crate::EmEnv;
/// getprotobyname
-pub fn getprotobyname(_ctx: &mut EmEnv, _name_ptr: i32) -> i32 {
+pub fn getprotobyname(_ctx: &EmEnv, _name_ptr: i32) -> i32 {
debug!("emscripten::getprotobyname");
unimplemented!("emscripten::getprotobyname")
}
/// getprotobynumber
-pub fn getprotobynumber(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn getprotobynumber(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::getprotobynumber");
unimplemented!("emscripten::getprotobynumber")
}
/// sigdelset
-pub fn sigdelset(ctx: &mut EmEnv, set: i32, signum: i32) -> i32 {
+pub fn sigdelset(ctx: &EmEnv, set: i32, signum: i32) -> i32 {
debug!("emscripten::sigdelset");
let memory = ctx.memory(0);
#[allow(clippy::cast_ptr_alignment)]
@@ -37,7 +37,7 @@ pub fn sigdelset(ctx: &mut EmEnv, set: i32, signum: i32) -> i32 {
}
/// sigfillset
-pub fn sigfillset(ctx: &mut EmEnv, set: i32) -> i32 {
+pub fn sigfillset(ctx: &EmEnv, set: i32) -> i32 {
debug!("emscripten::sigfillset");
let memory = ctx.memory(0);
#[allow(clippy::cast_ptr_alignment)]
@@ -51,13 +51,13 @@ pub fn sigfillset(ctx: &mut EmEnv, set: i32) -> i32 {
}
/// tzset
-pub fn tzset(_ctx: &mut EmEnv) {
+pub fn tzset(_ctx: &EmEnv) {
debug!("emscripten::tzset - stub");
//unimplemented!("emscripten::tzset - stub")
}
/// strptime
-pub fn strptime(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn strptime(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::strptime");
unimplemented!("emscripten::strptime")
}
diff --git a/lib/emscripten/src/io/unix.rs b/lib/emscripten/src/io/unix.rs
index 4591accd8..62190653f 100644
--- a/lib/emscripten/src/io/unix.rs
+++ b/lib/emscripten/src/io/unix.rs
@@ -6,12 +6,12 @@ use std::mem;
use crate::EmEnv;
/// putchar
-pub fn putchar(_ctx: &mut EmEnv, chr: i32) {
+pub fn putchar(_ctx: &EmEnv, chr: i32) {
unsafe { libc::putchar(chr) };
}
/// printf
-pub fn printf(ctx: &mut EmEnv, memory_offset: i32, extra: i32) -> i32 {
+pub fn printf(ctx: &EmEnv, memory_offset: i32, extra: i32) -> i32 {
debug!("emscripten::printf {}, {}", memory_offset, extra);
unsafe {
let addr = emscripten_memory_pointer!(ctx.memory(0), memory_offset) as _;
@@ -20,7 +20,7 @@ pub fn printf(ctx: &mut EmEnv, memory_offset: i32, extra: i32) -> i32 {
}
/// chroot
-pub fn chroot(ctx: &mut EmEnv, name_ptr: i32) -> i32 {
+pub fn chroot(ctx: &EmEnv, name_ptr: i32) -> i32 {
debug!("emscripten::chroot");
let name = emscripten_memory_pointer!(ctx.memory(0), name_ptr) as *const i8;
unsafe { _chroot(name as *const _) }
@@ -28,7 +28,7 @@ pub fn chroot(ctx: &mut EmEnv, name_ptr: i32) -> i32 {
/// getpwuid
#[allow(clippy::cast_ptr_alignment)]
-pub fn getpwuid(ctx: &mut EmEnv, uid: i32) -> i32 {
+pub fn getpwuid(ctx: &EmEnv, uid: i32) -> i32 {
debug!("emscripten::getpwuid {}", uid);
#[repr(C)]
diff --git a/lib/emscripten/src/io/windows.rs b/lib/emscripten/src/io/windows.rs
index a29677b90..e0507ead8 100644
--- a/lib/emscripten/src/io/windows.rs
+++ b/lib/emscripten/src/io/windows.rs
@@ -14,12 +14,12 @@ use crate::EmEnv;
//}
/// putchar
-pub fn putchar(_ctx: &mut EmEnv, chr: i32) {
+pub fn putchar(_ctx: &EmEnv, chr: i32) {
unsafe { libc::putchar(chr) };
}
/// printf
-pub fn printf(_ctx: &mut EmEnv, memory_offset: i32, extra: i32) -> i32 {
+pub fn printf(_ctx: &EmEnv, memory_offset: i32, extra: i32) -> i32 {
debug!("emscripten::printf {}, {}", memory_offset, extra);
#[cfg(not(feature = "debug"))]
{
@@ -34,13 +34,13 @@ pub fn printf(_ctx: &mut EmEnv, memory_offset: i32, extra: i32) -> i32 {
}
/// chroot
-pub fn chroot(_ctx: &mut EmEnv, _name_ptr: i32) -> i32 {
+pub fn chroot(_ctx: &EmEnv, _name_ptr: i32) -> i32 {
debug!("emscripten::chroot");
unimplemented!("emscripten::chroot")
}
/// getpwuid
-pub fn getpwuid(_ctx: &mut EmEnv, _uid: i32) -> i32 {
+pub fn getpwuid(_ctx: &EmEnv, _uid: i32) -> i32 {
debug!("emscripten::getpwuid");
unimplemented!("emscripten::getpwuid")
}
diff --git a/lib/emscripten/src/jmp.rs b/lib/emscripten/src/jmp.rs
index def2346d4..c3b6dcb58 100644
--- a/lib/emscripten/src/jmp.rs
+++ b/lib/emscripten/src/jmp.rs
@@ -9,7 +9,7 @@ use std::fmt;
use wasmer::RuntimeError;
/// setjmp
-pub fn __setjmp(ctx: &mut EmEnv, _env_addr: u32) -> c_int {
+pub fn __setjmp(ctx: &EmEnv, _env_addr: u32) -> c_int {
debug!("emscripten::__setjmp (setjmp)");
abort_with_message(ctx, "missing function: _setjmp");
unreachable!()
@@ -32,7 +32,7 @@ pub fn __setjmp(ctx: &mut EmEnv, _env_addr: u32) -> c_int {
/// longjmp
#[allow(unreachable_code)]
-pub fn __longjmp(ctx: &mut EmEnv, _env_addr: u32, _val: c_int) {
+pub fn __longjmp(ctx: &EmEnv, _env_addr: u32, _val: c_int) {
debug!("emscripten::__longjmp (longmp)");
abort_with_message(ctx, "missing function: _longjmp");
// unsafe {
@@ -59,7 +59,7 @@ impl Error for LongJumpRet {}
/// _longjmp
// This function differs from the js implementation, it should return Result<(), &'static str>
#[allow(unreachable_code)]
-pub fn _longjmp(ctx: &mut EmEnv, env_addr: i32, val: c_int) {
+pub fn _longjmp(ctx: &EmEnv, env_addr: i32, val: c_int) {
let val = if val == 0 { 1 } else { val };
get_emscripten_data(ctx)
.set_threw
diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs
index 4f33c6572..fc7edf409 100644
--- a/lib/emscripten/src/lib.rs
+++ b/lib/emscripten/src/lib.rs
@@ -423,7 +423,7 @@ pub fn set_up_emscripten(instance: &mut Instance) -> Result<(), RuntimeError> {
/// If you don't want to set it up yourself, consider using [`run_emscripten_instance`].
pub fn emscripten_call_main(
instance: &mut Instance,
- env: &mut EmEnv,
+ env: &EmEnv,
path: &str,
args: &[&str],
) -> Result<(), RuntimeError> {
@@ -500,7 +500,7 @@ pub fn run_emscripten_instance(
Ok(())
}
-fn store_module_arguments(ctx: &mut EmEnv, args: Vec<&str>) -> (u32, u32) {
+fn store_module_arguments(ctx: &EmEnv, args: Vec<&str>) -> (u32, u32) {
let argc = args.len() + 1;
let mut args_slice = vec![0; argc];
@@ -649,7 +649,7 @@ impl EmscriptenGlobals {
pub fn generate_emscripten_env(
store: &Store,
globals: &mut EmscriptenGlobals,
- env: &mut EmEnv,
+ env: &EmEnv,
) -> ImportObject {
let abort_on_cannot_grow_memory_export = if globals.data.use_old_abort_on_cannot_grow_memory {
Function::new_native_with_env(
@@ -1148,7 +1148,7 @@ pub fn generate_emscripten_env(
import_object
}
-pub fn nullfunc(ctx: &mut EmEnv, _x: u32) {
+pub fn nullfunc(ctx: &EmEnv, _x: u32) {
use crate::process::abort_with_message;
debug!("emscripten::nullfunc_i {}", _x);
abort_with_message(
diff --git a/lib/emscripten/src/libc.rs b/lib/emscripten/src/libc.rs
index 1ba382130..81d67971d 100644
--- a/lib/emscripten/src/libc.rs
+++ b/lib/emscripten/src/libc.rs
@@ -49,14 +49,14 @@ pub fn killpg(_a: i32, _b: i32) -> i32 {
}
#[cfg(unix)]
-pub fn pathconf(ctx: &mut EmEnv, path_ptr: i32, name: i32) -> i32 {
+pub fn pathconf(ctx: &EmEnv, path_ptr: i32, name: i32) -> i32 {
debug!("emscripten::pathconf");
let path = emscripten_memory_pointer!(ctx.memory(0), path_ptr) as *const i8;
unsafe { libc::pathconf(path as *const _, name).try_into().unwrap() }
}
#[cfg(not(unix))]
-pub fn pathconf(_ctx: &mut EmEnv, _path_ptr: i32, _name: i32) -> i32 {
+pub fn pathconf(_ctx: &EmEnv, _path_ptr: i32, _name: i32) -> i32 {
debug!("emscripten::pathconf");
0
}
diff --git a/lib/emscripten/src/linking.rs b/lib/emscripten/src/linking.rs
index 03ad29fc5..5ca49e85e 100644
--- a/lib/emscripten/src/linking.rs
+++ b/lib/emscripten/src/linking.rs
@@ -3,25 +3,25 @@ use crate::EmEnv;
// TODO: Need to implement.
/// emscripten: dlopen(filename: *const c_char, flag: c_int) -> *mut c_void
-pub fn _dlopen(_ctx: &mut EmEnv, _filename: u32, _flag: u32) -> i32 {
+pub fn _dlopen(_ctx: &EmEnv, _filename: u32, _flag: u32) -> i32 {
debug!("emscripten::_dlopen");
-1
}
/// emscripten: dlclose(handle: *mut c_void) -> c_int
-pub fn _dlclose(_ctx: &mut EmEnv, _filename: u32) -> i32 {
+pub fn _dlclose(_ctx: &EmEnv, _filename: u32) -> i32 {
debug!("emscripten::_dlclose");
-1
}
/// emscripten: dlsym(handle: *mut c_void, symbol: *const c_char) -> *mut c_void
-pub fn _dlsym(_ctx: &mut EmEnv, _filepath: u32, _symbol: u32) -> i32 {
+pub fn _dlsym(_ctx: &EmEnv, _filepath: u32, _symbol: u32) -> i32 {
debug!("emscripten::_dlsym");
-1
}
/// emscripten: dlerror() -> *mut c_char
-pub fn _dlerror(_ctx: &mut EmEnv) -> i32 {
+pub fn _dlerror(_ctx: &EmEnv) -> i32 {
debug!("emscripten::_dlerror");
-1
}
diff --git a/lib/emscripten/src/lock.rs b/lib/emscripten/src/lock.rs
index 6058ac8e8..f83b12e38 100644
--- a/lib/emscripten/src/lock.rs
+++ b/lib/emscripten/src/lock.rs
@@ -2,21 +2,21 @@ use crate::EmEnv;
use libc::c_int;
// NOTE: Not implemented by Emscripten
-pub fn ___lock(_ctx: &mut EmEnv, _what: c_int) {
+pub fn ___lock(_ctx: &EmEnv, _what: c_int) {
debug!("emscripten::___lock {}", _what);
}
// NOTE: Not implemented by Emscripten
-pub fn ___unlock(_ctx: &mut EmEnv, _what: c_int) {
+pub fn ___unlock(_ctx: &EmEnv, _what: c_int) {
debug!("emscripten::___unlock {}", _what);
}
// NOTE: Not implemented by Emscripten
-pub fn ___wait(_ctx: &mut EmEnv, _which: u32, _varargs: u32, _three: u32, _four: u32) {
+pub fn ___wait(_ctx: &EmEnv, _which: u32, _varargs: u32, _three: u32, _four: u32) {
debug!("emscripten::___wait");
}
-pub fn _flock(_ctx: &mut EmEnv, _fd: u32, _op: u32) -> u32 {
+pub fn _flock(_ctx: &EmEnv, _fd: u32, _op: u32) -> u32 {
debug!("emscripten::_flock");
0
}
diff --git a/lib/emscripten/src/math.rs b/lib/emscripten/src/math.rs
index 056075714..6328e1853 100644
--- a/lib/emscripten/src/math.rs
+++ b/lib/emscripten/src/math.rs
@@ -62,7 +62,7 @@ pub fn _llvm_fma_f64(value: f64, a: f64, b: f64) -> f64 {
value.mul_add(a, b)
}
-pub fn _emscripten_random(_ctx: &mut EmEnv) -> f64 {
+pub fn _emscripten_random(_ctx: &EmEnv) -> f64 {
debug!("emscripten::_emscripten_random");
-1.0
}
diff --git a/lib/emscripten/src/memory.rs b/lib/emscripten/src/memory.rs
index 066cb1669..028d136bc 100644
--- a/lib/emscripten/src/memory.rs
+++ b/lib/emscripten/src/memory.rs
@@ -6,7 +6,7 @@ use libc::{c_int, c_void, memcpy, size_t};
use wasmer::{Pages, WASM_MAX_PAGES, WASM_MIN_PAGES, WASM_PAGE_SIZE};
/// emscripten: _emscripten_memcpy_big
-pub fn _emscripten_memcpy_big(ctx: &mut EmEnv, dest: u32, src: u32, len: u32) -> u32 {
+pub fn _emscripten_memcpy_big(ctx: &EmEnv, dest: u32, src: u32, len: u32) -> u32 {
debug!(
"emscripten::_emscripten_memcpy_big {}, {}, {}",
dest, src, len
@@ -20,7 +20,7 @@ pub fn _emscripten_memcpy_big(ctx: &mut EmEnv, dest: u32, src: u32, len: u32) ->
}
/// emscripten: _emscripten_get_heap_size
-pub fn _emscripten_get_heap_size(ctx: &mut EmEnv) -> u32 {
+pub fn _emscripten_get_heap_size(ctx: &EmEnv) -> u32 {
trace!("emscripten::_emscripten_get_heap_size");
let result = ctx.memory(0).size().bytes().0 as u32;
trace!("=> {}", result);
@@ -38,7 +38,7 @@ fn align_up(mut val: usize, multiple: usize) -> usize {
/// emscripten: _emscripten_resize_heap
/// Note: this function only allows growing the size of heap
-pub fn _emscripten_resize_heap(ctx: &mut EmEnv, requested_size: u32) -> u32 {
+pub fn _emscripten_resize_heap(ctx: &EmEnv, requested_size: u32) -> u32 {
debug!("emscripten::_emscripten_resize_heap {}", requested_size);
let current_memory_pages = ctx.memory(0).size();
let current_memory = current_memory_pages.bytes().0 as u32;
@@ -69,7 +69,7 @@ pub fn _emscripten_resize_heap(ctx: &mut EmEnv, requested_size: u32) -> u32 {
}
/// emscripten: sbrk
-pub fn sbrk(ctx: &mut EmEnv, increment: i32) -> i32 {
+pub fn sbrk(ctx: &EmEnv, increment: i32) -> i32 {
debug!("emscripten::sbrk");
// let old_dynamic_top = 0;
// let new_dynamic_top = 0;
@@ -97,7 +97,7 @@ pub fn sbrk(ctx: &mut EmEnv, increment: i32) -> i32 {
}
/// emscripten: getTotalMemory
-pub fn get_total_memory(_ctx: &mut EmEnv) -> u32 {
+pub fn get_total_memory(_ctx: &EmEnv) -> u32 {
debug!("emscripten::get_total_memory");
// instance.memories[0].current_pages()
// TODO: Fix implementation
@@ -105,7 +105,7 @@ pub fn get_total_memory(_ctx: &mut EmEnv) -> u32 {
}
/// emscripten: enlargeMemory
-pub fn enlarge_memory(_ctx: &mut EmEnv) -> u32 {
+pub fn enlarge_memory(_ctx: &EmEnv) -> u32 {
debug!("emscripten::enlarge_memory");
// instance.memories[0].grow(100);
// TODO: Fix implementation
@@ -113,7 +113,7 @@ pub fn enlarge_memory(_ctx: &mut EmEnv) -> u32 {
}
/// emscripten: abortOnCannotGrowMemory
-pub fn abort_on_cannot_grow_memory(ctx: &mut EmEnv, _requested_size: u32) -> u32 {
+pub fn abort_on_cannot_grow_memory(ctx: &EmEnv, _requested_size: u32) -> u32 {
debug!(
"emscripten::abort_on_cannot_grow_memory {}",
_requested_size
@@ -123,32 +123,32 @@ pub fn abort_on_cannot_grow_memory(ctx: &mut EmEnv, _requested_size: u32) -> u32
}
/// emscripten: abortOnCannotGrowMemory
-pub fn abort_on_cannot_grow_memory_old(ctx: &mut EmEnv) -> u32 {
+pub fn abort_on_cannot_grow_memory_old(ctx: &EmEnv) -> u32 {
debug!("emscripten::abort_on_cannot_grow_memory");
abort_with_message(ctx, "Cannot enlarge memory arrays!");
0
}
/// emscripten: segfault
-pub fn segfault(ctx: &mut EmEnv) {
+pub fn segfault(ctx: &EmEnv) {
debug!("emscripten::segfault");
abort_with_message(ctx, "segmentation fault");
}
/// emscripten: alignfault
-pub fn alignfault(ctx: &mut EmEnv) {
+pub fn alignfault(ctx: &EmEnv) {
debug!("emscripten::alignfault");
abort_with_message(ctx, "alignment fault");
}
/// emscripten: ftfault
-pub fn ftfault(ctx: &mut EmEnv) {
+pub fn ftfault(ctx: &EmEnv) {
debug!("emscripten::ftfault");
abort_with_message(ctx, "Function table mask error");
}
/// emscripten: ___map_file
-pub fn ___map_file(_ctx: &mut EmEnv, _one: u32, _two: u32) -> c_int {
+pub fn ___map_file(_ctx: &EmEnv, _one: u32, _two: u32) -> c_int {
debug!("emscripten::___map_file");
// NOTE: TODO: Em returns -1 here as well. May need to implement properly
-1
diff --git a/lib/emscripten/src/process.rs b/lib/emscripten/src/process.rs
index 39b88d273..f5fe4eb07 100644
--- a/lib/emscripten/src/process.rs
+++ b/lib/emscripten/src/process.rs
@@ -7,33 +7,33 @@ type PidT = c_int;
use crate::EmEnv;
-pub fn abort_with_message(ctx: &mut EmEnv, message: &str) {
+pub fn abort_with_message(ctx: &EmEnv, message: &str) {
debug!("emscripten::abort_with_message");
println!("{}", message);
_abort(ctx);
}
/// The name of this call is `abort` but we want to avoid conflicts with libc::abort
-pub fn em_abort(ctx: &mut EmEnv, arg: u32) {
+pub fn em_abort(ctx: &EmEnv, arg: u32) {
debug!("emscripten::abort");
eprintln!("Program aborted with value {}", arg);
_abort(ctx);
}
-pub fn _abort(_ctx: &mut EmEnv) {
+pub fn _abort(_ctx: &EmEnv) {
debug!("emscripten::_abort");
unsafe {
abort();
}
}
-pub fn _prctl(ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _prctl(ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
debug!("emscripten::_prctl");
abort_with_message(ctx, "missing function: prctl");
-1
}
-pub fn _fork(_ctx: &mut EmEnv) -> PidT {
+pub fn _fork(_ctx: &EmEnv) -> PidT {
debug!("emscripten::_fork");
// unsafe {
// fork()
@@ -41,132 +41,132 @@ pub fn _fork(_ctx: &mut EmEnv) -> PidT {
-1
}
-pub fn _endgrent(_ctx: &mut EmEnv) {
+pub fn _endgrent(_ctx: &EmEnv) {
debug!("emscripten::_endgrent");
}
-pub fn _execve(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _execve(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_execve");
-1
}
#[allow(unreachable_code)]
-pub fn _exit(_ctx: &mut EmEnv, status: c_int) {
+pub fn _exit(_ctx: &EmEnv, status: c_int) {
// -> !
debug!("emscripten::_exit {}", status);
unsafe { exit(status) }
}
-pub fn _kill(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _kill(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_kill");
-1
}
-pub fn _sched_yield(_ctx: &mut EmEnv) -> i32 {
+pub fn _sched_yield(_ctx: &EmEnv) -> i32 {
debug!("emscripten::_sched_yield");
-1
}
-pub fn _llvm_stacksave(_ctx: &mut EmEnv) -> i32 {
+pub fn _llvm_stacksave(_ctx: &EmEnv) -> i32 {
debug!("emscripten::_llvm_stacksave");
-1
}
-pub fn _llvm_stackrestore(_ctx: &mut EmEnv, _one: i32) {
+pub fn _llvm_stackrestore(_ctx: &EmEnv, _one: i32) {
debug!("emscripten::_llvm_stackrestore");
}
-pub fn _raise(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _raise(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_raise");
-1
}
-pub fn _sem_init(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _sem_init(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_sem_init: {}, {}, {}", _one, _two, _three);
0
}
-pub fn _sem_destroy(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _sem_destroy(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_sem_destroy");
0
}
-pub fn _sem_post(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _sem_post(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_sem_post");
-1
}
-pub fn _sem_wait(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _sem_wait(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_sem_post");
-1
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _getgrent(_ctx: &mut EmEnv) -> c_int {
+pub fn _getgrent(_ctx: &EmEnv) -> c_int {
debug!("emscripten::_getgrent");
-1
}
-pub fn _setgrent(_ctx: &mut EmEnv) {
+pub fn _setgrent(_ctx: &EmEnv) {
debug!("emscripten::_setgrent");
}
-pub fn _setgroups(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _setgroups(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_setgroups");
-1
}
-pub fn _setitimer(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _setitimer(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_setitimer");
-1
}
-pub fn _usleep(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _usleep(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_usleep");
-1
}
-pub fn _nanosleep(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _nanosleep(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_nanosleep");
-1
}
-pub fn _utime(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _utime(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_utime");
-1
}
-pub fn _utimes(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _utimes(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_utimes");
-1
}
-pub fn _wait(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _wait(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_wait");
-1
}
-pub fn _wait3(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _wait3(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_wait3");
-1
}
-pub fn _wait4(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
+pub fn _wait4(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
debug!("emscripten::_wait4");
-1
}
-pub fn _waitid(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
+pub fn _waitid(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32, _d: i32) -> i32 {
debug!("emscripten::_waitid");
-1
}
-pub fn _waitpid(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _waitpid(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_waitpid");
-1
}
-pub fn abort_stack_overflow(ctx: &mut EmEnv, _what: c_int) {
+pub fn abort_stack_overflow(ctx: &EmEnv, _what: c_int) {
debug!("emscripten::abort_stack_overflow");
// TODO: Message incomplete. Need to finish em runtime data first
abort_with_message(
@@ -175,24 +175,24 @@ pub fn abort_stack_overflow(ctx: &mut EmEnv, _what: c_int) {
);
}
-pub fn _llvm_trap(ctx: &mut EmEnv) {
+pub fn _llvm_trap(ctx: &EmEnv) {
debug!("emscripten::_llvm_trap");
abort_with_message(ctx, "abort!");
}
-pub fn _llvm_eh_typeid_for(_ctx: &mut EmEnv, _type_info_addr: u32) -> i32 {
+pub fn _llvm_eh_typeid_for(_ctx: &EmEnv, _type_info_addr: u32) -> i32 {
debug!("emscripten::_llvm_eh_typeid_for");
-1
}
-pub fn _system(_ctx: &mut EmEnv, _one: i32) -> c_int {
+pub fn _system(_ctx: &EmEnv, _one: i32) -> c_int {
debug!("emscripten::_system");
// TODO: May need to change this Em impl to a working version
eprintln!("Can't call external programs");
EAGAIN
}
-pub fn _popen(_ctx: &mut EmEnv, _one: i32, _two: i32) -> c_int {
+pub fn _popen(_ctx: &EmEnv, _one: i32, _two: i32) -> c_int {
debug!("emscripten::_popen");
// TODO: May need to change this Em impl to a working version
eprintln!("Missing function: popen");
diff --git a/lib/emscripten/src/pthread.rs b/lib/emscripten/src/pthread.rs
index 17c14f6ef..c4ab3d6b1 100644
--- a/lib/emscripten/src/pthread.rs
+++ b/lib/emscripten/src/pthread.rs
@@ -1,16 +1,11 @@
use crate::EmEnv;
-pub fn _pthread_attr_destroy(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_attr_destroy(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_attr_destroy");
0
}
-pub fn _pthread_attr_getstack(
- _ctx: &mut EmEnv,
- _stackaddr: i32,
- _stacksize: i32,
- _other: i32,
-) -> i32 {
+pub fn _pthread_attr_getstack(_ctx: &EmEnv, _stackaddr: i32, _stacksize: i32, _other: i32) -> i32 {
trace!(
"emscripten::_pthread_attr_getstack({}, {}, {})",
_stackaddr,
@@ -23,175 +18,175 @@ pub fn _pthread_attr_getstack(
0
}
-pub fn _pthread_attr_init(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_attr_init(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_attr_init({})", _a);
0
}
-pub fn _pthread_attr_setstacksize(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_attr_setstacksize(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_attr_setstacksize");
0
}
-pub fn _pthread_cleanup_pop(_ctx: &mut EmEnv, _a: i32) {
+pub fn _pthread_cleanup_pop(_ctx: &EmEnv, _a: i32) {
trace!("emscripten::_pthread_cleanup_pop");
}
-pub fn _pthread_cleanup_push(_ctx: &mut EmEnv, _a: i32, _b: i32) {
+pub fn _pthread_cleanup_push(_ctx: &EmEnv, _a: i32, _b: i32) {
trace!("emscripten::_pthread_cleanup_push");
}
-pub fn _pthread_cond_destroy(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_cond_destroy(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_cond_destroy");
0
}
-pub fn _pthread_cond_init(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_cond_init(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_cond_init");
0
}
-pub fn _pthread_cond_signal(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_cond_signal(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_cond_signal");
0
}
-pub fn _pthread_cond_timedwait(_ctx: &mut EmEnv, _a: i32, _b: i32, _c: i32) -> i32 {
+pub fn _pthread_cond_timedwait(_ctx: &EmEnv, _a: i32, _b: i32, _c: i32) -> i32 {
trace!("emscripten::_pthread_cond_timedwait");
0
}
-pub fn _pthread_cond_wait(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_cond_wait(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_cond_wait");
0
}
-pub fn _pthread_condattr_destroy(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_condattr_destroy(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_condattr_destroy");
0
}
-pub fn _pthread_condattr_init(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_condattr_init(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_condattr_init");
0
}
-pub fn _pthread_condattr_setclock(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_condattr_setclock(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_condattr_setclock");
0
}
-pub fn _pthread_create(_ctx: &mut EmEnv, _a: i32, _b: i32, _c: i32, _d: i32) -> i32 {
+pub fn _pthread_create(_ctx: &EmEnv, _a: i32, _b: i32, _c: i32, _d: i32) -> i32 {
trace!("emscripten::_pthread_create");
// 11 seems to mean "no"
11
}
-pub fn _pthread_detach(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_detach(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_detach");
0
}
-pub fn _pthread_equal(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_equal(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_equal");
0
}
-pub fn _pthread_exit(_ctx: &mut EmEnv, _a: i32) {
+pub fn _pthread_exit(_ctx: &EmEnv, _a: i32) {
trace!("emscripten::_pthread_exit");
}
-pub fn _pthread_getattr_np(_ctx: &mut EmEnv, _thread: i32, _attr: i32) -> i32 {
+pub fn _pthread_getattr_np(_ctx: &EmEnv, _thread: i32, _attr: i32) -> i32 {
trace!("emscripten::_pthread_getattr_np({}, {})", _thread, _attr);
0
}
-pub fn _pthread_getspecific(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_getspecific(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_getspecific");
0
}
-pub fn _pthread_join(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_join(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_join");
0
}
-pub fn _pthread_self(_ctx: &mut EmEnv) -> i32 {
+pub fn _pthread_self(_ctx: &EmEnv) -> i32 {
trace!("emscripten::_pthread_self");
0
}
-pub fn _pthread_key_create(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_key_create(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_key_create");
0
}
-pub fn _pthread_mutex_destroy(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_mutex_destroy(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_mutex_destroy");
0
}
-pub fn _pthread_mutex_init(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_mutex_init(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_mutex_init");
0
}
-pub fn _pthread_mutexattr_destroy(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_mutexattr_destroy(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_mutexattr_destroy");
0
}
-pub fn _pthread_mutexattr_init(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_mutexattr_init(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_mutexattr_init");
0
}
-pub fn _pthread_mutexattr_settype(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_mutexattr_settype(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_mutexattr_settype");
0
}
-pub fn _pthread_once(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_once(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_once");
0
}
-pub fn _pthread_rwlock_destroy(_ctx: &mut EmEnv, _rwlock: i32) -> i32 {
+pub fn _pthread_rwlock_destroy(_ctx: &EmEnv, _rwlock: i32) -> i32 {
trace!("emscripten::_pthread_rwlock_destroy({})", _rwlock);
0
}
-pub fn _pthread_rwlock_init(_ctx: &mut EmEnv, _rwlock: i32, _attr: i32) -> i32 {
+pub fn _pthread_rwlock_init(_ctx: &EmEnv, _rwlock: i32, _attr: i32) -> i32 {
trace!("emscripten::_pthread_rwlock_init({}, {})", _rwlock, _attr);
0
}
-pub fn _pthread_rwlock_rdlock(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_rwlock_rdlock(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_rwlock_rdlock");
0
}
-pub fn _pthread_rwlock_unlock(_ctx: &mut EmEnv, _a: i32) -> i32 {
+pub fn _pthread_rwlock_unlock(_ctx: &EmEnv, _a: i32) -> i32 {
trace!("emscripten::_pthread_rwlock_unlock");
0
}
-pub fn _pthread_rwlock_wrlock(_ctx: &mut EmEnv, _rwlock: i32) -> i32 {
+pub fn _pthread_rwlock_wrlock(_ctx: &EmEnv, _rwlock: i32) -> i32 {
trace!("emscripten::_pthread_rwlock_wrlock({})", _rwlock);
0
}
-pub fn _pthread_setcancelstate(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_setcancelstate(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_setcancelstate");
0
}
-pub fn _pthread_setspecific(_ctx: &mut EmEnv, _a: i32, _b: i32) -> i32 {
+pub fn _pthread_setspecific(_ctx: &EmEnv, _a: i32, _b: i32) -> i32 {
trace!("emscripten::_pthread_setspecific");
0
}
-pub fn _pthread_sigmask(_ctx: &mut EmEnv, _a: i32, _b: i32, _c: i32) -> i32 {
+pub fn _pthread_sigmask(_ctx: &EmEnv, _a: i32, _b: i32, _c: i32) -> i32 {
trace!("emscripten::_pthread_sigmask");
0
}
diff --git a/lib/emscripten/src/signal.rs b/lib/emscripten/src/signal.rs
index 16d365860..34fd22416 100644
--- a/lib/emscripten/src/signal.rs
+++ b/lib/emscripten/src/signal.rs
@@ -2,7 +2,7 @@
use crate::EmEnv;
#[allow(clippy::cast_ptr_alignment)]
-pub fn _sigemptyset(ctx: &mut EmEnv, set: u32) -> i32 {
+pub fn _sigemptyset(ctx: &EmEnv, set: u32) -> i32 {
debug!("emscripten::_sigemptyset");
let set_addr = emscripten_memory_pointer!(ctx.memory(0), set) as *mut u32;
unsafe {
@@ -11,18 +11,18 @@ pub fn _sigemptyset(ctx: &mut EmEnv, set: u32) -> i32 {
0
}
-pub fn _sigaction(_ctx: &mut EmEnv, _signum: u32, _act: u32, _oldact: u32) -> i32 {
+pub fn _sigaction(_ctx: &EmEnv, _signum: u32, _act: u32, _oldact: u32) -> i32 {
debug!("emscripten::_sigaction {}, {}, {}", _signum, _act, _oldact);
0
}
-pub fn _siginterrupt(_ctx: &mut EmEnv, _a: u32, _b: u32) -> i32 {
+pub fn _siginterrupt(_ctx: &EmEnv, _a: u32, _b: u32) -> i32 {
debug!("emscripten::_siginterrupt {}, {}", _a, _b);
0
}
#[allow(clippy::cast_ptr_alignment)]
-pub fn _sigaddset(ctx: &mut EmEnv, set: u32, signum: u32) -> i32 {
+pub fn _sigaddset(ctx: &EmEnv, set: u32, signum: u32) -> i32 {
debug!("emscripten::_sigaddset {}, {}", set, signum);
let set_addr = emscripten_memory_pointer!(ctx.memory(0), set) as *mut u32;
unsafe {
@@ -31,17 +31,17 @@ pub fn _sigaddset(ctx: &mut EmEnv, set: u32, signum: u32) -> i32 {
0
}
-pub fn _sigsuspend(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _sigsuspend(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_sigsuspend");
-1
}
-pub fn _sigprocmask(_ctx: &mut EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
+pub fn _sigprocmask(_ctx: &EmEnv, _one: i32, _two: i32, _three: i32) -> i32 {
debug!("emscripten::_sigprocmask");
0
}
-pub fn _signal(_ctx: &mut EmEnv, _sig: u32, _two: i32) -> i32 {
+pub fn _signal(_ctx: &EmEnv, _sig: u32, _two: i32) -> i32 {
debug!("emscripten::_signal ({})", _sig);
0
}
diff --git a/lib/emscripten/src/syscalls/mod.rs b/lib/emscripten/src/syscalls/mod.rs
index dc1b4d2f3..1922e2496 100644
--- a/lib/emscripten/src/syscalls/mod.rs
+++ b/lib/emscripten/src/syscalls/mod.rs
@@ -52,7 +52,7 @@ use std::io::Error;
use std::slice;
/// exit
-pub fn ___syscall1(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) {
+pub fn ___syscall1(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) {
debug!("emscripten::___syscall1 (exit) {}", _which);
let status: i32 = varargs.get(ctx);
unsafe {
@@ -61,7 +61,7 @@ pub fn ___syscall1(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) {
}
/// read
-pub fn ___syscall3(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall3(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
// -> ssize_t
debug!("emscripten::___syscall3 (read) {}", _which);
let fd: i32 = varargs.get(ctx);
@@ -75,7 +75,7 @@ pub fn ___syscall3(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
}
/// write
-pub fn ___syscall4(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall4(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall4 (write) {}", _which);
let fd: i32 = varargs.get(ctx);
let buf: i32 = varargs.get(ctx);
@@ -86,7 +86,7 @@ pub fn ___syscall4(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_in
}
/// close
-pub fn ___syscall6(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall6(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall6 (close) {}", _which);
let fd: i32 = varargs.get(ctx);
debug!("fd: {}", fd);
@@ -94,7 +94,7 @@ pub fn ___syscall6(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_in
}
// chdir
-pub fn ___syscall12(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall12(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall12 (chdir) {}", _which);
let path_ptr = varargs.get_str(ctx);
let real_path_owned = get_cstr_path(ctx, path_ptr as *const _);
@@ -112,59 +112,59 @@ pub fn ___syscall12(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
ret
}
-pub fn ___syscall10(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall10(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall10");
-1
}
-pub fn ___syscall14(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall14(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall14");
-1
}
-pub fn ___syscall15(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall15(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall15");
-1
}
// getpid
-pub fn ___syscall20(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall20(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall20 (getpid)");
unsafe { getpid() }
}
-pub fn ___syscall21(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall21(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall21");
-1
}
-pub fn ___syscall25(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall25(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall25");
-1
}
-pub fn ___syscall29(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall29(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall29");
-1
}
-pub fn ___syscall32(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall32(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall32");
-1
}
-pub fn ___syscall33(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall33(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall33");
-1
}
-pub fn ___syscall36(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall36(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall36");
-1
}
// rename
-pub fn ___syscall38(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall38(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall38 (rename)");
let old_path = varargs.get_str(ctx);
let new_path = varargs.get_str(ctx);
@@ -191,7 +191,7 @@ pub fn ___syscall38(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32
}
// rmdir
-pub fn ___syscall40(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall40(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall40 (rmdir)");
let pathname_addr = varargs.get_str(ctx);
let real_path_owned = get_cstr_path(ctx, pathname_addr as *const _);
@@ -204,7 +204,7 @@ pub fn ___syscall40(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
// pipe
-pub fn ___syscall42(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall42(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall42 (pipe)");
// offset to a file descriptor, which contains a read end and write end, 2 integers
let fd_offset: u32 = varargs.get(ctx);
@@ -232,28 +232,28 @@ pub fn ___syscall42(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
result
}
-pub fn ___syscall51(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall51(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall51");
-1
}
-pub fn ___syscall52(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall52(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall52");
-1
}
-pub fn ___syscall53(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall53(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall53");
-1
}
-pub fn ___syscall60(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall60(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall60");
-1
}
// dup2
-pub fn ___syscall63(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall63(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall63 (dup2) {}", _which);
let src: i32 = varargs.get(ctx);
@@ -263,93 +263,93 @@ pub fn ___syscall63(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
// getppid
-pub fn ___syscall64(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall64(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall64 (getppid)");
unsafe { getpid() }
}
-pub fn ___syscall66(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall66(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall66");
-1
}
-pub fn ___syscall75(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall75(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall75");
-1
}
-pub fn ___syscall91(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall91(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall91 - stub");
0
}
-pub fn ___syscall96(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall96(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall96");
-1
}
-pub fn ___syscall97(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall97(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall97");
-1
}
-pub fn ___syscall110(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall110(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall110");
-1
}
-pub fn ___syscall121(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall121(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall121");
-1
}
-pub fn ___syscall125(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall125(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall125");
-1
}
-pub fn ___syscall133(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall133(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall133");
-1
}
-pub fn ___syscall144(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall144(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall144");
-1
}
-pub fn ___syscall147(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall147(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall147");
-1
}
-pub fn ___syscall150(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall150(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall150");
-1
}
-pub fn ___syscall151(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall151(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall151");
-1
}
-pub fn ___syscall152(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall152(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall152");
-1
}
-pub fn ___syscall153(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall153(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall153");
-1
}
-pub fn ___syscall163(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall163(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall163");
-1
}
// getcwd
-pub fn ___syscall183(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall183(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall183");
let buf_offset: WasmPtr = varargs.get(ctx);
let _size: c_int = varargs.get(ctx);
@@ -366,7 +366,7 @@ pub fn ___syscall183(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i3
}
// mmap2
-pub fn ___syscall192(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall192(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall192 (mmap2) {}", _which);
let _addr: i32 = varargs.get(ctx);
let len: u32 = varargs.get(ctx);
@@ -401,7 +401,7 @@ pub fn ___syscall192(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// lseek
-pub fn ___syscall140(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall140(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
// -> c_int
debug!("emscripten::___syscall140 (lseek) {}", _which);
let fd: i32 = varargs.get(ctx);
@@ -429,7 +429,7 @@ pub fn ___syscall140(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
/// readv
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall145(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall145(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
// -> ssize_t
debug!("emscripten::___syscall145 (readv) {}", _which);
@@ -466,7 +466,7 @@ pub fn ___syscall145(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i3
// writev
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall146(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall146(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
// -> ssize_t
debug!("emscripten::___syscall146 (writev) {}", _which);
let fd: i32 = varargs.get(ctx);
@@ -507,7 +507,7 @@ pub fn ___syscall146(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
ret as _
}
-pub fn ___syscall191(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall191(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
let _resource: i32 = varargs.get(ctx);
debug!(
"emscripten::___syscall191 - mostly stub, resource: {}",
@@ -524,13 +524,13 @@ pub fn ___syscall191(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
0
}
-pub fn ___syscall193(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall193(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall193");
-1
}
// stat64
-pub fn ___syscall195(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall195(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall195 (stat64) {}", _which);
let pathname_addr = varargs.get_str(ctx);
let buf: u32 = varargs.get(ctx);
@@ -561,7 +561,7 @@ pub fn ___syscall195(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
// fstat64
-pub fn ___syscall197(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall197(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall197 (fstat64) {}", _which);
let fd: c_int = varargs.get(ctx);
@@ -580,129 +580,129 @@ pub fn ___syscall197(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
0
}
-pub fn ___syscall209(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall209(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall209");
-1
}
-pub fn ___syscall211(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall211(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall211");
-1
}
-pub fn ___syscall218(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall218(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall218");
-1
}
-pub fn ___syscall268(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall268(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall268");
-1
}
-pub fn ___syscall269(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall269(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall269");
-1
}
-pub fn ___syscall272(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall272(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall272");
-1
}
-pub fn ___syscall295(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall295(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall295");
-1
}
-pub fn ___syscall296(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall296(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall296");
-1
}
-pub fn ___syscall297(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall297(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall297");
-1
}
-pub fn ___syscall298(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall298(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall298");
-1
}
-pub fn ___syscall300(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall300(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall300");
-1
}
-pub fn ___syscall301(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall301(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall301");
-1
}
-pub fn ___syscall302(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall302(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall302");
-1
}
-pub fn ___syscall303(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall303(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall303");
-1
}
-pub fn ___syscall304(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall304(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall304");
-1
}
-pub fn ___syscall305(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall305(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall305");
-1
}
-pub fn ___syscall306(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall306(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall306");
-1
}
-pub fn ___syscall307(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall307(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall307");
-1
}
-pub fn ___syscall308(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall308(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall308");
-1
}
// utimensat
-pub fn ___syscall320(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall320(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall320 (utimensat), {}", _which);
0
}
-pub fn ___syscall331(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall331(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall331");
-1
}
-pub fn ___syscall333(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall333(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall333");
-1
}
-pub fn ___syscall334(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall334(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall334");
-1
}
-pub fn ___syscall337(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall337(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall337");
-1
}
// prlimit64
-pub fn ___syscall340(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall340(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall340 (prlimit64), {}", _which);
// NOTE: Doesn't really matter. Wasm modules cannot exceed WASM_PAGE_SIZE anyway.
let _pid: i32 = varargs.get(ctx);
@@ -728,7 +728,7 @@ pub fn ___syscall340(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
0
}
-pub fn ___syscall345(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall345(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall345");
-1
}
diff --git a/lib/emscripten/src/syscalls/unix.rs b/lib/emscripten/src/syscalls/unix.rs
index fac1cb30a..10fa10ec9 100644
--- a/lib/emscripten/src/syscalls/unix.rs
+++ b/lib/emscripten/src/syscalls/unix.rs
@@ -156,7 +156,7 @@ use libc::SO_NOSIGPIPE;
const SO_NOSIGPIPE: c_int = 0;
/// open
-pub fn ___syscall5(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall5(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall5 (open) {}", _which);
let pathname_addr = varargs.get_str(ctx);
let flags: i32 = varargs.get(ctx);
@@ -180,7 +180,7 @@ pub fn ___syscall5(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_in
}
/// link
-pub fn ___syscall9(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall9(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall9 (link) {}", _which);
let oldname_ptr = varargs.get_str(ctx);
@@ -196,7 +196,7 @@ pub fn ___syscall9(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_in
}
/// getrusage
-pub fn ___syscall77(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall77(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall77 (getrusage) {}", _which);
let resource: c_int = varargs.get(ctx);
@@ -208,7 +208,7 @@ pub fn ___syscall77(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
/// symlink
-pub fn ___syscall83(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall83(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall83 (symlink) {}", _which);
let path1 = varargs.get_str(ctx);
@@ -236,7 +236,7 @@ pub fn ___syscall83(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
/// readlink
-pub fn ___syscall85(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall85(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall85 (readlink)");
let pathname_addr = varargs.get_str(ctx);
let buf = varargs.get_str(ctx);
@@ -265,7 +265,7 @@ pub fn ___syscall85(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> i32
}
/// ftruncate64
-pub fn ___syscall194(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall194(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall194 (ftruncate64) {}", _which);
let _fd: c_int = varargs.get(ctx);
let _length: i64 = varargs.get(ctx);
@@ -282,7 +282,7 @@ pub fn ___syscall194(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// lchown
-pub fn ___syscall198(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall198(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall198 (lchown) {}", _which);
let path_ptr = varargs.get_str(ctx);
let real_path_owned = utils::get_cstr_path(ctx, path_ptr as *const _);
@@ -305,7 +305,7 @@ pub fn ___syscall198(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// getgroups
-pub fn ___syscall205(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall205(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall205 (getgroups) {}", _which);
let ngroups_max: c_int = varargs.get(ctx);
let groups: c_int = varargs.get(ctx);
@@ -322,7 +322,7 @@ pub fn ___syscall205(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
// chown
-pub fn ___syscall212(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall212(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall212 (chown) {}", _which);
let pathname_addr = varargs.get_str(ctx);
@@ -339,7 +339,7 @@ pub fn ___syscall212(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// madvise
-pub fn ___syscall219(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall219(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall212 (chown) {}", _which);
let addr_ptr: c_int = varargs.get(ctx);
@@ -352,7 +352,7 @@ pub fn ___syscall219(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// access
-pub fn ___syscall33(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall33(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall33 (access) {}", _which);
let path = varargs.get_str(ctx);
let real_path_owned = utils::get_cstr_path(ctx, path as *const _);
@@ -373,14 +373,14 @@ pub fn ___syscall33(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
/// nice
-pub fn ___syscall34(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall34(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall34 (nice) {}", _which);
let inc_r: c_int = varargs.get(ctx);
unsafe { nice(inc_r) }
}
// mkdir
-pub fn ___syscall39(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall39(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall39 (mkdir) {}", _which);
let pathname_addr = varargs.get_str(ctx);
let real_path_owned = utils::get_cstr_path(ctx, pathname_addr as *const _);
@@ -394,20 +394,20 @@ pub fn ___syscall39(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
}
/// dup
-pub fn ___syscall41(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall41(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall41 (dup) {}", _which);
let fd: c_int = varargs.get(ctx);
unsafe { dup(fd) }
}
/// getgid32
-pub fn ___syscall200(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall200(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall200 (getgid32)");
unsafe { getgid() as i32 }
}
// geteuid32
-pub fn ___syscall201(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall201(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall201 (geteuid32)");
unsafe {
// Maybe fix: Emscripten returns 0 always
@@ -416,7 +416,7 @@ pub fn ___syscall201(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
}
// getegid32
-pub fn ___syscall202(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall202(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
// gid_t
debug!("emscripten::___syscall202 (getegid32)");
unsafe {
@@ -426,7 +426,7 @@ pub fn ___syscall202(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
}
/// fchown
-pub fn ___syscall207(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall207(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall207 (fchown) {}", _which);
let fd: c_int = varargs.get(ctx);
let owner: uid_t = varargs.get(ctx);
@@ -435,7 +435,7 @@ pub fn ___syscall207(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// dup3
-pub fn ___syscall330(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> pid_t {
+pub fn ___syscall330(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> pid_t {
// Implementation based on description at https://linux.die.net/man/2/dup3
debug!("emscripten::___syscall330 (dup3)");
let oldfd: c_int = varargs.get(ctx);
@@ -469,7 +469,7 @@ pub fn ___syscall330(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> pi
}
/// ioctl
-pub fn ___syscall54(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall54(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall54 (ioctl) {}", _which);
let fd: i32 = varargs.get(ctx);
@@ -511,7 +511,7 @@ const SOCK_CLOEXC: i32 = 0x80000;
// socketcall
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall102(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall102(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall102 (socketcall) {}", _which);
let call: u32 = varargs.get(ctx);
let mut socket_varargs: VarArgs = varargs.get(ctx);
@@ -829,7 +829,7 @@ fn translate_socket_name_flag(name: i32) -> i32 {
}
/// getpgid
-pub fn ___syscall132(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall132(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall132 (getpgid)");
let pid: pid_t = varargs.get(ctx);
@@ -853,7 +853,7 @@ pub struct EmPollFd {
unsafe impl wasmer::ValueType for EmPollFd {}
/// poll
-pub fn ___syscall168(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall168(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall168(poll)");
let fds: WasmPtr = varargs.get(ctx);
let nfds: u32 = varargs.get(ctx);
@@ -873,7 +873,7 @@ pub fn ___syscall168(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
}
// pread
-pub fn ___syscall180(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall180(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall180 (pread) {}", _which);
let fd: i32 = varargs.get(ctx);
let buf: u32 = varargs.get(ctx);
@@ -890,7 +890,7 @@ pub fn ___syscall180(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
// pwrite
-pub fn ___syscall181(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall181(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall181 (pwrite) {}", _which);
let fd: i32 = varargs.get(ctx);
let buf: u32 = varargs.get(ctx);
@@ -911,7 +911,7 @@ pub fn ___syscall181(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// fchmod
-pub fn ___syscall94(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall94(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fchmod) {}", _which);
let fd: c_int = varargs.get(ctx);
let mode: mode_t = varargs.get(ctx);
@@ -920,7 +920,7 @@ pub fn ___syscall94(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
/// wait4
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall114(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> pid_t {
+pub fn ___syscall114(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> pid_t {
debug!("emscripten::___syscall114 (wait4)");
let pid: pid_t = varargs.get(ctx);
let status: u32 = varargs.get(ctx);
@@ -938,7 +938,7 @@ pub fn ___syscall114(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> pi
}
/// fsync
-pub fn ___syscall118(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall118(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fsync) {}", _which);
let fd: c_int = varargs.get(ctx);
unsafe { fsync(fd) }
@@ -946,7 +946,7 @@ pub fn ___syscall118(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
// select
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall142(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall142(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall142 (newselect) {}", _which);
let nfds: i32 = varargs.get(ctx);
@@ -968,7 +968,7 @@ pub fn ___syscall142(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// fdatasync
-pub fn ___syscall148(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall148(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall148 (fdatasync) {}", _which);
let fd: i32 = varargs.get(ctx);
@@ -977,7 +977,7 @@ pub fn ___syscall148(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
// setpgid
-pub fn ___syscall57(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall57(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall57 (setpgid) {}", _which);
let pid: i32 = varargs.get(ctx);
@@ -993,7 +993,7 @@ pub fn ___syscall57(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_i
/// uname
// NOTE: Wondering if we should return custom utsname, like Emscripten.
-pub fn ___syscall122(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall122(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall122 (uname) {}", _which);
let buf: u32 = varargs.get(ctx);
debug!("=> buf: {}", buf);
@@ -1002,7 +1002,7 @@ pub fn ___syscall122(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// lstat64
-pub fn ___syscall196(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall196(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall196 (lstat64) {}", _which);
let path = varargs.get_str(ctx);
let real_path_owned = utils::get_cstr_path(ctx, path as *const _);
@@ -1035,7 +1035,7 @@ pub fn ___syscall196(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
}
// getuid
-pub fn ___syscall199(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall199(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall199 (getuid)");
let uid = unsafe { getuid() as _ };
debug!(" => {}", uid);
@@ -1045,7 +1045,7 @@ pub fn ___syscall199(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
// getdents
// dirent structure is
// i64, i64, u16 (280), i8, [i8; 256]
-pub fn ___syscall220(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
+pub fn ___syscall220(ctx: &EmEnv, _which: i32, mut varargs: VarArgs) -> i32 {
use super::super::env::get_emscripten_data;
let fd: i32 = varargs.get(ctx);
@@ -1109,7 +1109,7 @@ pub fn ___syscall220(ctx: &mut EmEnv, _which: i32, mut varargs: VarArgs) -> i32
}
// fcntl64
-pub fn ___syscall221(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall221(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall221 (fcntl64) {}", _which);
let fd: i32 = varargs.get(ctx);
let cmd: i32 = varargs.get(ctx);
@@ -1127,7 +1127,7 @@ pub fn ___syscall221(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_
}
/// fallocate
-pub fn ___syscall324(ctx: &mut EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall324(ctx: &EmEnv, _which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall324 (fallocate) {}", _which);
let _fd: c_int = varargs.get(ctx);
let _mode: c_int = varargs.get(ctx);
diff --git a/lib/emscripten/src/syscalls/windows.rs b/lib/emscripten/src/syscalls/windows.rs
index ca1acb4f3..abd2ad94a 100644
--- a/lib/emscripten/src/syscalls/windows.rs
+++ b/lib/emscripten/src/syscalls/windows.rs
@@ -13,7 +13,7 @@ use std::os::raw::c_int;
type pid_t = c_int;
/// open
-pub fn ___syscall5(ctx: &mut EmEnv, which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall5(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall5 (open) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -64,19 +64,19 @@ pub fn ___syscall5(ctx: &mut EmEnv, which: c_int, mut varargs: VarArgs) -> c_int
}
/// link
-pub fn ___syscall9(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall9(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall9 (link) {}", _which);
unimplemented!("emscripten::___syscall9 (link) {}", _which);
}
/// ftruncate64
-pub fn ___syscall194(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall194(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall194 - stub");
unimplemented!("emscripten::___syscall194 - stub")
}
// chown
-pub fn ___syscall212(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall212(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall212 (chown) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -84,19 +84,19 @@ pub fn ___syscall212(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
}
/// access
-pub fn ___syscall33(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall33(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall33 (access) {}", _which);
unimplemented!("emscripten::___syscall33 (access) {}", _which);
}
/// nice
-pub fn ___syscall34(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall34(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall34 (nice) {}", _which);
unimplemented!("emscripten::___syscall34 (nice) {}", _which);
}
// mkdir
-pub fn ___syscall39(ctx: &mut EmEnv, which: c_int, mut varargs: VarArgs) -> c_int {
+pub fn ___syscall39(ctx: &EmEnv, which: c_int, mut varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall39 (mkdir) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -111,80 +111,80 @@ pub fn ___syscall39(ctx: &mut EmEnv, which: c_int, mut varargs: VarArgs) -> c_in
}
/// dup
-pub fn ___syscall41(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall41(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall41 (dup) {}", _which);
unimplemented!("emscripten::___syscall41 (dup) {}", _which);
}
/// getrusage
-pub fn ___syscall77(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall77(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall77 (getrusage) {}", _which);
unimplemented!("emscripten::___syscall77 (getrusage) {}", _which);
}
/// symlink
-pub fn ___syscall83(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall83(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall83 (symlink) {}", _which);
unimplemented!("emscripten::___syscall83 (symlink) {}", _which);
}
/// readlink
-pub fn ___syscall85(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall85(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall85 (readlink) {}", _which);
-1
}
/// getpgid
-pub fn ___syscall132(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall132(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall132 (getpgid)");
-1
}
/// lchown
-pub fn ___syscall198(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall198(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall198 (lchown) {}", _which);
unimplemented!("emscripten::___syscall198 (lchown) {}", _which);
}
/// getgid32
-pub fn ___syscall200(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall200(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall200 (getgid32)");
unimplemented!("emscripten::___syscall200 (getgid32)");
}
// geteuid32
-pub fn ___syscall201(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall201(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall201 (geteuid32)");
unimplemented!("emscripten::___syscall201 (geteuid32)");
}
// getegid32
-pub fn ___syscall202(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall202(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
// gid_t
debug!("emscripten::___syscall202 (getegid32)");
unimplemented!("emscripten::___syscall202 (getegid32)");
}
/// getgroups
-pub fn ___syscall205(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall205(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall205 (getgroups) {}", _which);
unimplemented!("emscripten::___syscall205 (getgroups) {}", _which);
}
/// madvise
-pub fn ___syscall219(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall219(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall212 (chown) {}", _which);
unimplemented!("emscripten::___syscall212 (chown) {}", _which);
}
/// dup3
-pub fn ___syscall330(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t {
+pub fn ___syscall330(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t {
debug!("emscripten::___syscall330 (dup3)");
-1
}
/// ioctl
-pub fn ___syscall54(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall54(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall54 (ioctl) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -192,14 +192,14 @@ pub fn ___syscall54(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_
}
/// fchmod
-pub fn ___syscall94(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall94(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fchmod) {}", _which);
unimplemented!("emscripten::___syscall118 (fchmod) {}", _which);
}
// socketcall
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall102(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall102(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall102 (socketcall) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -207,13 +207,13 @@ pub fn ___syscall102(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
}
/// fsync
-pub fn ___syscall118(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall118(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall118 (fsync) {}", _which);
unimplemented!("emscripten::___syscall118 (fsync) {}", _which);
}
// pread
-pub fn ___syscall180(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall180(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall180 (pread) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -221,7 +221,7 @@ pub fn ___syscall180(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
}
// pwrite
-pub fn ___syscall181(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall181(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall181 (pwrite) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -230,14 +230,14 @@ pub fn ___syscall181(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
/// wait4
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall114(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t {
+pub fn ___syscall114(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> pid_t {
debug!("emscripten::___syscall114 (wait4)");
-1
}
// select
#[allow(clippy::cast_ptr_alignment)]
-pub fn ___syscall142(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall142(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall142 (newselect) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -245,13 +245,13 @@ pub fn ___syscall142(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
}
/// fdatasync
-pub fn ___syscall148(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall148(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall148 (fdatasync) {}", _which);
unimplemented!("emscripten::___syscall148 (fdatasync) {}", _which);
}
// setpgid
-pub fn ___syscall57(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall57(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall57 (setpgid) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -260,7 +260,7 @@ pub fn ___syscall57(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_
/// uname
// NOTE: Wondering if we should return custom utsname, like Emscripten.
-pub fn ___syscall122(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall122(_ctx: &EmEnv, which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall122 (uname) {}", which);
#[cfg(not(feature = "debug"))]
let _ = which;
@@ -268,43 +268,43 @@ pub fn ___syscall122(_ctx: &mut EmEnv, which: c_int, mut _varargs: VarArgs) -> c
}
/// poll
-pub fn ___syscall168(_ctx: &mut EmEnv, _which: i32, _varargs: VarArgs) -> i32 {
+pub fn ___syscall168(_ctx: &EmEnv, _which: i32, _varargs: VarArgs) -> i32 {
debug!("emscripten::___syscall168(poll) - stub");
-1
}
/// lstat64
-pub fn ___syscall196(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall196(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall196 (lstat64) - stub");
-1
}
// getuid
-pub fn ___syscall199(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall199(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall199 (getuid)");
-1
}
// getdents
-pub fn ___syscall220(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn ___syscall220(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::___syscall220");
-1
}
// fcntl64
-pub fn ___syscall221(_ctx: &mut EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
+pub fn ___syscall221(_ctx: &EmEnv, _which: c_int, mut _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall221 (fcntl64) {}", _which);
-1
}
/// fchown
-pub fn ___syscall207(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall207(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall207 (fchown) {}", _which);
unimplemented!("emscripten::___syscall207 (fchown) {}", _which)
}
/// fallocate
-pub fn ___syscall324(_ctx: &mut EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
+pub fn ___syscall324(_ctx: &EmEnv, _which: c_int, _varargs: VarArgs) -> c_int {
debug!("emscripten::___syscall324 (fallocate) {}", _which);
unimplemented!("emscripten::___syscall324 (fallocate) {}", _which)
}
diff --git a/lib/emscripten/src/time.rs b/lib/emscripten/src/time.rs
index 50b1091df..1827b89b1 100644
--- a/lib/emscripten/src/time.rs
+++ b/lib/emscripten/src/time.rs
@@ -52,7 +52,7 @@ const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
/// emscripten: _gettimeofday
#[allow(clippy::cast_ptr_alignment)]
-pub fn _gettimeofday(ctx: &mut EmEnv, tp: c_int, tz: c_int) -> c_int {
+pub fn _gettimeofday(ctx: &EmEnv, tp: c_int, tz: c_int) -> c_int {
debug!("emscripten::_gettimeofday {} {}", tp, tz);
#[repr(C)]
struct GuestTimeVal {
@@ -75,7 +75,7 @@ pub fn _gettimeofday(ctx: &mut EmEnv, tp: c_int, tz: c_int) -> c_int {
0
}
-pub fn _clock_getres(_ctx: &mut EmEnv, _clk_id: i32, _tp: i32) -> i32 {
+pub fn _clock_getres(_ctx: &EmEnv, _clk_id: i32, _tp: i32) -> i32 {
debug!("emscripten::_clock_getres");
// clock_getres(clk_id, tp)
0
@@ -83,7 +83,7 @@ pub fn _clock_getres(_ctx: &mut EmEnv, _clk_id: i32, _tp: i32) -> i32 {
/// emscripten: _clock_gettime
#[allow(clippy::cast_ptr_alignment)]
-pub fn _clock_gettime(ctx: &mut EmEnv, clk_id: clockid_t, tp: c_int) -> c_int {
+pub fn _clock_gettime(ctx: &EmEnv, clk_id: clockid_t, tp: c_int) -> c_int {
debug!("emscripten::_clock_gettime {} {}", clk_id, tp);
// debug!("Memory {:?}", ctx.memory(0)[..]);
#[repr(C)]
@@ -115,41 +115,41 @@ pub fn _clock_gettime(ctx: &mut EmEnv, clk_id: clockid_t, tp: c_int) -> c_int {
0
}
-pub fn _clock_settime(_ctx: &mut EmEnv, _clk_id: i32, _tp: i32) -> i32 {
+pub fn _clock_settime(_ctx: &EmEnv, _clk_id: i32, _tp: i32) -> i32 {
debug!("emscripten::_clock_settime");
// clock_settime(clk_id, tp)
0
}
/// emscripten: ___clock_gettime
-pub fn ___clock_gettime(ctx: &mut EmEnv, clk_id: clockid_t, tp: c_int) -> c_int {
+pub fn ___clock_gettime(ctx: &EmEnv, clk_id: clockid_t, tp: c_int) -> c_int {
debug!("emscripten::___clock_gettime {} {}", clk_id, tp);
_clock_gettime(ctx, clk_id, tp)
}
/// emscripten: _clock
-pub fn _clock(_ctx: &mut EmEnv) -> c_int {
+pub fn _clock(_ctx: &EmEnv) -> c_int {
debug!("emscripten::_clock");
0 // TODO: unimplemented
}
/// emscripten: _difftime
-pub fn _difftime(_ctx: &mut EmEnv, t0: u32, t1: u32) -> f64 {
+pub fn _difftime(_ctx: &EmEnv, t0: u32, t1: u32) -> f64 {
debug!("emscripten::_difftime");
(t0 - t1) as _
}
-pub fn _gmtime_r(_ctx: &mut EmEnv, _one: i32, _two: i32) -> i32 {
+pub fn _gmtime_r(_ctx: &EmEnv, _one: i32, _two: i32) -> i32 {
debug!("emscripten::_gmtime_r");
-1
}
-pub fn _mktime(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _mktime(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_mktime");
-1
}
-pub fn _gmtime(_ctx: &mut EmEnv, _one: i32) -> i32 {
+pub fn _gmtime(_ctx: &EmEnv, _one: i32) -> i32 {
debug!("emscripten::_gmtime");
-1
}
@@ -170,13 +170,13 @@ struct guest_tm {
}
/// emscripten: _tvset
-pub fn _tvset(_ctx: &mut EmEnv) {
+pub fn _tvset(_ctx: &EmEnv) {
debug!("emscripten::_tvset UNIMPLEMENTED");
}
/// formats time as a C string
#[allow(clippy::cast_ptr_alignment)]
-unsafe fn fmt_time(ctx: &mut EmEnv, time: u32) -> *const c_char {
+unsafe fn fmt_time(ctx: &EmEnv, time: u32) -> *const c_char {
let date = &*(emscripten_memory_pointer!(ctx.memory(0), time) as *mut guest_tm);
let days = vec!["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
@@ -201,7 +201,7 @@ unsafe fn fmt_time(ctx: &mut EmEnv, time: u32) -> *const c_char {
}
/// emscripten: _asctime
-pub fn _asctime(ctx: &mut EmEnv, time: u32) -> u32 {
+pub fn _asctime(ctx: &EmEnv, time: u32) -> u32 {
debug!("emscripten::_asctime {}", time);
unsafe {
@@ -215,7 +215,7 @@ pub fn _asctime(ctx: &mut EmEnv, time: u32) -> u32 {
}
/// emscripten: _asctime_r
-pub fn _asctime_r(ctx: &mut EmEnv, time: u32, buf: u32) -> u32 {
+pub fn _asctime_r(ctx: &EmEnv, time: u32, buf: u32) -> u32 {
debug!("emscripten::_asctime_r {}, {}", time, buf);
unsafe {
@@ -234,7 +234,7 @@ pub fn _asctime_r(ctx: &mut EmEnv, time: u32, buf: u32) -> u32 {
/// emscripten: _localtime
#[allow(clippy::cast_ptr_alignment)]
-pub fn _localtime(ctx: &mut EmEnv, time_p: u32) -> c_int {
+pub fn _localtime(ctx: &EmEnv, time_p: u32) -> c_int {
debug!("emscripten::_localtime {}", time_p);
// NOTE: emscripten seems to want tzset() called in this function
// https://stackoverflow.com/questions/19170721/real-time-awareness-of-timezone-change-in-localtime-vs-localtime-r
@@ -272,7 +272,7 @@ pub fn _localtime(ctx: &mut EmEnv, time_p: u32) -> c_int {
}
/// emscripten: _localtime_r
#[allow(clippy::cast_ptr_alignment)]
-pub fn _localtime_r(ctx: &mut EmEnv, time_p: u32, result: u32) -> c_int {
+pub fn _localtime_r(ctx: &EmEnv, time_p: u32, result: u32) -> c_int {
debug!("emscripten::_localtime_r {}", time_p);
// NOTE: emscripten seems to want tzset() called in this function
@@ -309,7 +309,7 @@ pub fn _localtime_r(ctx: &mut EmEnv, time_p: u32, result: u32) -> c_int {
/// emscripten: _time
#[allow(clippy::cast_ptr_alignment)]
-pub fn _time(ctx: &mut EmEnv, time_p: u32) -> i32 {
+pub fn _time(ctx: &EmEnv, time_p: u32) -> i32 {
debug!("emscripten::_time {}", time_p);
unsafe {
@@ -318,7 +318,7 @@ pub fn _time(ctx: &mut EmEnv, time_p: u32) -> i32 {
}
}
-pub fn _ctime_r(ctx: &mut EmEnv, time_p: u32, buf: u32) -> u32 {
+pub fn _ctime_r(ctx: &EmEnv, time_p: u32, buf: u32) -> u32 {
debug!("emscripten::_ctime_r {} {}", time_p, buf);
// var stack = stackSave();
@@ -329,7 +329,7 @@ pub fn _ctime_r(ctx: &mut EmEnv, time_p: u32, buf: u32) -> u32 {
rv
}
-pub fn _ctime(ctx: &mut EmEnv, time_p: u32) -> u32 {
+pub fn _ctime(ctx: &EmEnv, time_p: u32) -> u32 {
debug!("emscripten::_ctime {}", time_p);
let tm_current = 2414544;
_ctime_r(ctx, time_p, tm_current)
@@ -338,7 +338,7 @@ pub fn _ctime(ctx: &mut EmEnv, time_p: u32) -> u32 {
/// emscripten: _timegm
#[cfg(not(target_os = "windows"))]
#[allow(clippy::cast_ptr_alignment)]
-pub fn _timegm(ctx: &mut EmEnv, time_ptr: u32) -> i32 {
+pub fn _timegm(ctx: &EmEnv, time_ptr: u32) -> i32 {
debug!("emscripten::_timegm {}", time_ptr);
unsafe {
@@ -378,7 +378,7 @@ pub fn _timegm(ctx: &mut EmEnv, time_ptr: u32) -> i32 {
}
#[cfg(target_os = "windows")]
-pub fn _timegm(_ctx: &mut EmEnv, _time_ptr: c_int) -> i32 {
+pub fn _timegm(_ctx: &EmEnv, _time_ptr: c_int) -> i32 {
debug!(
"emscripten::_timegm - UNIMPLEMENTED IN WINDOWS {}",
_time_ptr
@@ -387,13 +387,7 @@ pub fn _timegm(_ctx: &mut EmEnv, _time_ptr: c_int) -> i32 {
}
/// emscripten: _strftime
-pub fn _strftime(
- ctx: &mut EmEnv,
- s_ptr: c_int,
- maxsize: u32,
- format_ptr: c_int,
- tm_ptr: c_int,
-) -> i32 {
+pub fn _strftime(ctx: &EmEnv, s_ptr: c_int, maxsize: u32, format_ptr: c_int, tm_ptr: c_int) -> i32 {
debug!(
"emscripten::_strftime {} {} {} {}",
s_ptr, maxsize, format_ptr, tm_ptr
@@ -448,7 +442,7 @@ pub fn _strftime(
/// emscripten: _strftime_l
pub fn _strftime_l(
- ctx: &mut EmEnv,
+ ctx: &EmEnv,
s_ptr: c_int,
maxsize: u32,
format_ptr: c_int,
diff --git a/lib/emscripten/src/ucontext.rs b/lib/emscripten/src/ucontext.rs
index fcb11d25a..7fda8656e 100644
--- a/lib/emscripten/src/ucontext.rs
+++ b/lib/emscripten/src/ucontext.rs
@@ -1,20 +1,20 @@
use crate::EmEnv;
-pub fn _getcontext(_ctx: &mut EmEnv, _ucp: i32) -> i32 {
+pub fn _getcontext(_ctx: &EmEnv, _ucp: i32) -> i32 {
debug!("emscripten::_getcontext({})", _ucp);
0
}
-pub fn _makecontext(_ctx: &mut EmEnv, _ucp: i32, _func: i32, _argc: i32, _argv: i32) {
+pub fn _makecontext(_ctx: &EmEnv, _ucp: i32, _func: i32, _argc: i32, _argv: i32) {
debug!(
"emscripten::_makecontext({}, {}, {}, {})",
_ucp, _func, _argc, _argv
);
}
-pub fn _setcontext(_ctx: &mut EmEnv, _ucp: i32) -> i32 {
+pub fn _setcontext(_ctx: &EmEnv, _ucp: i32) -> i32 {
debug!("emscripten::_setcontext({})", _ucp);
0
}
-pub fn _swapcontext(_ctx: &mut EmEnv, _oucp: i32, _ucp: i32) -> i32 {
+pub fn _swapcontext(_ctx: &EmEnv, _oucp: i32, _ucp: i32) -> i32 {
debug!("emscripten::_swapcontext({}, {})", _oucp, _ucp);
0
}
diff --git a/lib/emscripten/src/unistd.rs b/lib/emscripten/src/unistd.rs
index b0439fb1e..ecb08a371 100644
--- a/lib/emscripten/src/unistd.rs
+++ b/lib/emscripten/src/unistd.rs
@@ -1,6 +1,6 @@
use crate::EmEnv;
-pub fn confstr(_ctx: &mut EmEnv, _name: i32, _buf_pointer: i32, _len: i32) -> i32 {
+pub fn confstr(_ctx: &EmEnv, _name: i32, _buf_pointer: i32, _len: i32) -> i32 {
debug!("unistd::confstr({}, {}, {})", _name, _buf_pointer, _len);
0
}
diff --git a/lib/emscripten/src/utils.rs b/lib/emscripten/src/utils.rs
index c3d24f039..a8d3efef7 100644
--- a/lib/emscripten/src/utils.rs
+++ b/lib/emscripten/src/utils.rs
@@ -93,7 +93,7 @@ pub fn get_emscripten_metadata(module: &Module) -> Result