Merge pull request #512 from sunfishcode/reorg

Reorganize the codebase
This commit is contained in:
Dan Gohman
2019-11-08 11:42:43 -08:00
committed by GitHub
377 changed files with 150 additions and 210 deletions

View File

@@ -46,8 +46,8 @@ jobs:
with: with:
submodules: true submodules: true
- uses: ./.github/actions/install-rust - uses: ./.github/actions/install-rust
- run: cargo doc --no-deps -p wasmtime-cli
- run: cargo doc --no-deps -p wasmtime - run: cargo doc --no-deps -p wasmtime
- run: cargo doc --no-deps -p wasmtime-api
- run: cargo doc --no-deps -p wasmtime-debug - run: cargo doc --no-deps -p wasmtime-debug
- run: cargo doc --no-deps -p wasmtime-environ - run: cargo doc --no-deps -p wasmtime-environ
- run: cargo doc --no-deps -p wasmtime-interface-types - run: cargo doc --no-deps -p wasmtime-interface-types
@@ -134,7 +134,7 @@ jobs:
with: with:
toolchain: nightly-2019-08-15 toolchain: nightly-2019-08-15
- uses: ./.github/actions/binary-compatible-builds - uses: ./.github/actions/binary-compatible-builds
- run: mkdir misc/wasmtime-py/wheelhouse - run: mkdir crates/misc/py/wheelhouse
shell: bash shell: bash
# Install Python & dependencies needed for our `setup.py` scripts # Install Python & dependencies needed for our `setup.py` scripts
@@ -145,13 +145,13 @@ jobs:
architecture: x64 architecture: x64
- run: $CENTOS pip3 install setuptools wheel==0.31.1 setuptools-rust - run: $CENTOS pip3 install setuptools wheel==0.31.1 setuptools-rust
shell: bash shell: bash
- run: (cd misc/wasmtime-py && $CENTOS $python setup.py bdist_wheel) - run: (cd crates/misc/py && $CENTOS $python setup.py bdist_wheel)
shell: bash shell: bash
# Clear the build directory between building different wheels for different # Clear the build directory between building different wheels for different
# Python versions to ensure that we don't package dynamic libraries twice by # Python versions to ensure that we don't package dynamic libraries twice by
# accident. # accident.
- run: $CENTOS rm -rf misc/wasmtime-py/build - run: $CENTOS rm -rf crates/misc/py/build
shell: bash shell: bash
# Set up Python 3.7 (and build it on Linux), reinstall dependencies, then # Set up Python 3.7 (and build it on Linux), reinstall dependencies, then
@@ -167,18 +167,18 @@ jobs:
if: matrix.os == 'ubuntu-latest' if: matrix.os == 'ubuntu-latest'
- run: $CENTOS pip3 install setuptools wheel==0.31.1 setuptools-rust auditwheel - run: $CENTOS pip3 install setuptools wheel==0.31.1 setuptools-rust auditwheel
shell: bash shell: bash
- run: (cd misc/wasmtime-py && $CENTOS $python setup.py bdist_wheel) - run: (cd crates/misc/py && $CENTOS $python setup.py bdist_wheel)
shell: bash shell: bash
# Move `dist/*.whl` into `wheelhouse/` so we can deploy them, but on Linux we # Move `dist/*.whl` into `wheelhouse/` so we can deploy them, but on Linux we
# need to run an `auditwheel` command as well to turn these into "manylinux" # need to run an `auditwheel` command as well to turn these into "manylinux"
# wheels to run across a number of distributions. # wheels to run across a number of distributions.
- run: cp misc/wasmtime-py/dist/*.whl misc/wasmtime-py/wheelhouse/ - run: cp crates/misc/py/dist/*.whl crates/misc/py/wheelhouse/
shell: bash shell: bash
if: matrix.os != 'ubuntu-latest' if: matrix.os != 'ubuntu-latest'
- run: | - run: |
set -e set -e
cd misc/wasmtime-py cd crates/misc/py
for whl in dist/*.whl; do for whl in dist/*.whl; do
$CENTOS auditwheel repair "$whl" -w wheelhouse/ $CENTOS auditwheel repair "$whl" -w wheelhouse/
done done
@@ -189,7 +189,7 @@ jobs:
- uses: actions/upload-artifact@v1 - uses: actions/upload-artifact@v1
with: with:
name: wheels-${{ matrix.os }} name: wheels-${{ matrix.os }}
path: misc/wasmtime-py/wheelhouse path: crates/misc/py/wheelhouse
# Perform release builds of `wasmtime` and `libwasmtime_api.so`. Builds on # Perform release builds of `wasmtime` and `libwasmtime_api.so`. Builds on
# Windows/Mac/Linux, and artifacts are uploaded after the build is finished. # Windows/Mac/Linux, and artifacts are uploaded after the build is finished.
@@ -216,10 +216,10 @@ jobs:
- run: $CENTOS cargo build --release --bin wasmtime --bin wasm2obj - run: $CENTOS cargo build --release --bin wasmtime --bin wasm2obj
shell: bash shell: bash
# Build `libwasmtime_api.so` # Build `libwasmtime_api.so`
- run: $CENTOS cargo build --release --manifest-path wasmtime-api/Cargo.toml - run: $CENTOS cargo build --release --manifest-path crates/api/Cargo.toml
shell: bash shell: bash
# Test what we just built # Test what we just built
- run: $CENTOS cargo test --features wasi-common/wasm_tests --release --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py --exclude wasmtime-api - run: $CENTOS cargo test --features wasi-common/wasm_tests --release --all --exclude lightbeam --exclude wasmtime-wasi-c --exclude wasmtime-py --exclude wasmtime
shell: bash shell: bash
env: env:
RUST_BACKTRACE: 1 RUST_BACKTRACE: 1

10
.gitmodules vendored
View File

@@ -1,9 +1,9 @@
[submodule "spec_testsuite"] [submodule "spec_testsuite"]
path = spec_testsuite path = tests/spec_testsuite
url = https://github.com/WebAssembly/testsuite url = https://github.com/WebAssembly/testsuite
[submodule "wasmtime-api/c-examples/wasm-c-api"] [submodule "crates/api/c-examples/wasm-c-api"]
path = wasmtime-api/c-examples/wasm-c-api path = crates/api/c-examples/wasm-c-api
url = https://github.com/WebAssembly/wasm-c-api url = https://github.com/WebAssembly/wasm-c-api
[submodule "wasi-common/WASI"] [submodule "crates/wasi-common/WASI"]
path = wasi-common/WASI path = crates/wasi-common/WASI
url = https://github.com/WebAssembly/WASI url = https://github.com/WebAssembly/WASI

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "wasmtime" name = "wasmtime-cli"
authors = ["The Wasmtime Project Developers"] authors = ["The Wasmtime Project Developers"]
version = "0.2.0" version = "0.2.0"
description = "Command-line interface for Wasmtime" description = "Command-line interface for Wasmtime"
@@ -15,17 +15,17 @@ cranelift-codegen = { version = "0.49", features = ["enable-serde"] }
cranelift-entity = { version = "0.49", features = ["enable-serde"] } cranelift-entity = { version = "0.49", features = ["enable-serde"] }
cranelift-wasm = { version = "0.49", features = ["enable-serde"] } cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
cranelift-native = { version = "0.49" } cranelift-native = { version = "0.49" }
wasmtime-api = { path = "wasmtime-api" } wasmtime = { path = "crates/api" }
wasmtime-debug = { path = "wasmtime-debug" } wasmtime-debug = { path = "crates/debug" }
wasmtime-environ = { path = "wasmtime-environ" } wasmtime-environ = { path = "crates/environ" }
wasmtime-interface-types = { path = "wasmtime-interface-types" } wasmtime-interface-types = { path = "crates/interface-types" }
wasmtime-runtime = { path = "wasmtime-runtime" } wasmtime-runtime = { path = "crates/runtime" }
wasmtime-jit = { path = "wasmtime-jit" } wasmtime-jit = { path = "crates/jit" }
wasmtime-obj = { path = "wasmtime-obj" } wasmtime-obj = { path = "crates/obj" }
wasmtime-wast = { path = "wasmtime-wast" } wasmtime-wast = { path = "crates/wast" }
wasmtime-wasi = { path = "wasmtime-wasi" } wasmtime-wasi = { path = "crates/wasi" }
wasmtime-wasi-c = { path = "wasmtime-wasi-c", optional = true } wasmtime-wasi-c = { path = "crates/wasi-c", optional = true }
wasi-common = { path = "wasi-common" } wasi-common = { path = "crates/wasi-common" }
docopt = "1.0.1" docopt = "1.0.1"
serde = { "version" = "1.0.94", features = ["derive"] } serde = { "version" = "1.0.94", features = ["derive"] }
faerie = "0.12.0" faerie = "0.12.0"
@@ -43,11 +43,11 @@ anyhow = "1.0.19"
[workspace] [workspace]
members = [ members = [
"misc/wasmtime-rust", "crates/misc/rust",
"misc/wasmtime-py", "crates/misc/py",
] ]
exclude = ["wasi-common/wasi-misc-tests"] exclude = ["crates/wasi-common/wasi-misc-tests"]
[features] [features]
# Enable all supported architectures by default. # Enable all supported architectures by default.

View File

@@ -25,8 +25,8 @@ for a tutorial on compiling and running programs using WASI and wasmtime, as
well as an overview of the filesystem sandboxing system. well as an overview of the filesystem sandboxing system.
Wasmtime passes the [WebAssembly spec testsuite]. To run it, update the Wasmtime passes the [WebAssembly spec testsuite]. To run it, update the
`spec_testsuite` submodule with `git submodule update --remote`, and it will `tests/spec_testsuite` submodule with `git submodule update --remote`, and it
be run as part of `cargo test`. will be run as part of `cargo test`.
Wasmtime does not yet implement Spectre mitigations, however this is a subject Wasmtime does not yet implement Spectre mitigations, however this is a subject
of ongoing research. of ongoing research.
@@ -50,13 +50,13 @@ Additional goals for Wasmtime include:
#### Including Wasmtime in your project #### Including Wasmtime in your project
Wasmtime exposes an API for embedding as a library through the `wasmtime-api` subcrate, Wasmtime exposes an API for embedding as a library through the `wasmtime` subcrate,
which contains both a [high-level and safe Rust API], as well as a C-compatible API which contains both a [high-level and safe Rust API], as well as a C-compatible API
compatible with the [proposed WebAssembly C API]. compatible with the [proposed WebAssembly C API].
For more information, see the [Rust API embedding chapter] of the Wasmtime documentation. For more information, see the [Rust API embedding chapter] of the Wasmtime documentation.
[high-level and safe Rust API]: https://docs.rs/wasmtime-api/ [high-level and safe Rust API]: https://docs.rs/wasmtime/
[proposed WebAssembly C API]: https://github.com/WebAssembly/wasm-c-api [proposed WebAssembly C API]: https://github.com/WebAssembly/wasm-c-api
[Rust API embedding chapter]: https://cranestation.github.io/wasmtime/embed-rust.html [Rust API embedding chapter]: https://cranestation.github.io/wasmtime/embed-rust.html

View File

@@ -25,34 +25,38 @@ fn main() -> anyhow::Result<()> {
writeln!(out, "#[allow(non_snake_case)]")?; writeln!(out, "#[allow(non_snake_case)]")?;
writeln!(out, "mod {} {{", strategy)?; writeln!(out, "mod {} {{", strategy)?;
test_directory(&mut out, "misc_testsuite", strategy)?; test_directory(&mut out, "tests/misc_testsuite", strategy)?;
let spec_tests = test_directory(&mut out, "spec_testsuite", strategy)?; let spec_tests = test_directory(&mut out, "tests/spec_testsuite", strategy)?;
// Skip running spec_testsuite tests if the submodule isn't checked // Skip running spec_testsuite tests if the submodule isn't checked
// out. // out.
if spec_tests > 0 { if spec_tests > 0 {
start_test_module(&mut out, "simd")?; start_test_module(&mut out, "simd")?;
write_testsuite_tests( write_testsuite_tests(
&mut out, &mut out,
"spec_testsuite/proposals/simd/simd_address.wast", "tests/spec_testsuite/proposals/simd/simd_address.wast",
"simd", "simd",
strategy, strategy,
)?; )?;
write_testsuite_tests( write_testsuite_tests(
&mut out, &mut out,
"spec_testsuite/proposals/simd/simd_align.wast", "tests/spec_testsuite/proposals/simd/simd_align.wast",
"simd", "simd",
strategy, strategy,
)?; )?;
write_testsuite_tests( write_testsuite_tests(
&mut out, &mut out,
"spec_testsuite/proposals/simd/simd_const.wast", "tests/spec_testsuite/proposals/simd/simd_const.wast",
"simd", "simd",
strategy, strategy,
)?; )?;
finish_test_module(&mut out)?; finish_test_module(&mut out)?;
test_directory(&mut out, "spec_testsuite/proposals/multi-value", strategy) test_directory(
.expect("generating tests"); &mut out,
"tests/spec_testsuite/proposals/multi-value",
strategy,
)
.expect("generating tests");
} else { } else {
println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`."); println!("cargo:warning=The spec testsuite is disabled. To enable, run `git submodule update --remote`.");
} }

View File

@@ -32,7 +32,7 @@ mktarball() {
# Create the main tarball of binaries # Create the main tarball of binaries
bin_pkgname=wasmtime-$TAG-$platform bin_pkgname=wasmtime-$TAG-$platform
mkdir tmp/$bin_pkgname mkdir tmp/$bin_pkgname
cp LICENSE README.md CACHE_CONFIGURATION.md tmp/$bin_pkgname cp LICENSE README.md docs/CACHE_CONFIGURATION.md tmp/$bin_pkgname
mv bins-$src/{wasmtime,wasm2obj}$exe tmp/$bin_pkgname mv bins-$src/{wasmtime,wasm2obj}$exe tmp/$bin_pkgname
chmod +x tmp/$bin_pkgname/{wasmtime,wasm2obj}$exe chmod +x tmp/$bin_pkgname/{wasmtime,wasm2obj}$exe
mktarball $bin_pkgname mktarball $bin_pkgname
@@ -48,7 +48,7 @@ mkdir tmp/$api_pkgname/lib
mkdir tmp/$api_pkgname/include mkdir tmp/$api_pkgname/include
cp LICENSE README.md tmp/$api_pkgname cp LICENSE README.md tmp/$api_pkgname
mv bins-$src/* tmp/$api_pkgname/lib mv bins-$src/* tmp/$api_pkgname/lib
cp wasmtime-api/c-examples/wasm-c-api/include/wasm.h tmp/$api_pkgname/include cp crates/api/c-examples/wasm-c-api/include/wasm.h tmp/$api_pkgname/include
mktarball $api_pkgname mktarball $api_pkgname
# Move wheels to dist folder # Move wheels to dist folder

View File

@@ -1,5 +1,5 @@
[package] [package]
name = "wasmtime-api" name = "wasmtime"
authors = ["The Wasmtime Project Developers"] authors = ["The Wasmtime Project Developers"]
version = "0.1.0" version = "0.1.0"
description = "High-level API to expose the Wasmtime runtime" description = "High-level API to expose the Wasmtime runtime"
@@ -17,9 +17,9 @@ cranelift-native = { version = "0.49" }
cranelift-entity = { version = "0.49", features = ["enable-serde"] } cranelift-entity = { version = "0.49", features = ["enable-serde"] }
cranelift-wasm = { version = "0.49", features = ["enable-serde"] } cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
cranelift-frontend = { version = "0.49" } cranelift-frontend = { version = "0.49" }
wasmtime-runtime = { path="../wasmtime-runtime" } wasmtime-runtime = { path="../runtime" }
wasmtime-environ = { path="../wasmtime-environ" } wasmtime-environ = { path="../environ" }
wasmtime-jit = { path="../wasmtime-jit" } wasmtime-jit = { path="../jit" }
wasmparser = { version = "0.39.2", default-features = false } wasmparser = { version = "0.39.2", default-features = false }
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.9.0", default-features = false }
anyhow = "1.0.19" anyhow = "1.0.19"
@@ -38,7 +38,7 @@ wasi-common = { path = "../wasi-common" }
docopt = "1.0.1" docopt = "1.0.1"
serde = { "version" = "1.0.94", features = ["derive"] } serde = { "version" = "1.0.94", features = ["derive"] }
pretty_env_logger = "0.3.0" pretty_env_logger = "0.3.0"
wasmtime-wast = { path="../wasmtime-wast" } wasmtime-wast = { path="../wast" }
wasmtime-wasi = { path="../wasmtime-wasi" } wasmtime-wasi = { path="../wasi" }
rayon = "1.1" rayon = "1.1"
file-per-thread-logger = "0.1.1" file-per-thread-logger = "0.1.1"

View File

@@ -18,7 +18,7 @@ cranelift-codegen = { version = "0.49", features = ["enable-serde"] }
cranelift-entity = { version = "0.49", features = ["enable-serde"] } cranelift-entity = { version = "0.49", features = ["enable-serde"] }
cranelift-wasm = { version = "0.49", features = ["enable-serde"] } cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
faerie = "0.12.0" faerie = "0.12.0"
wasmtime-environ = { path = "../wasmtime-environ", default-features = false } wasmtime-environ = { path = "../environ", default-features = false }
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.9.0", default-features = false }
failure = { version = "0.1.3", default-features = false } failure = { version = "0.1.3", default-features = false }
hashbrown = { version = "0.6.0", optional = true } hashbrown = { version = "0.6.0", optional = true }

View File

@@ -17,18 +17,18 @@ cranelift-entity = { version = "0.49", features = ["enable-serde"] }
cranelift-wasm = { version = "0.49", features = ["enable-serde"] } cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
lightbeam = { path = "../lightbeam", optional = true } lightbeam = { path = "../lightbeam", optional = true }
indexmap = "1.0.2" indexmap = "1.0.2"
rayon = "1.1" rayon = "1.2"
thiserror = "1.0.4" thiserror = "1.0.4"
directories = "2.0.1" directories = "2.0.1"
sha2 = "0.8.0" sha2 = "0.8.0"
base64 = "0.10.1" base64 = "0.11.0"
serde = { version = "1.0.94", features = ["derive"] } serde = { version = "1.0.94", features = ["derive"] }
bincode = "1.1.4" bincode = "1.1.4"
lazy_static = "1.3.0" lazy_static = "1.3.0"
spin = "0.5.0" spin = "0.5.0"
log = { version = "0.4.8", default-features = false } log = { version = "0.4.8", default-features = false }
zstd = "0.4" zstd = "0.5"
toml = "0.5" toml = "0.5.5"
file-per-thread-logger = "0.1.1" file-per-thread-logger = "0.1.1"
[target.'cfg(target_os = "windows")'.dependencies] [target.'cfg(target_os = "windows")'.dependencies]

View File

@@ -171,7 +171,7 @@ pub fn create_new_config<P: AsRef<Path> + Debug>(
let content = "\ let content = "\
# Comment out certain settings to use default values. # Comment out certain settings to use default values.
# For more settings, please refer to the documentation: # For more settings, please refer to the documentation:
# https://github.com/CraneStation/wasmtime/blob/master/CACHE_CONFIGURATION.md # https://github.com/CraneStation/wasmtime/blob/master/docs/CACHE_CONFIGURATION.md
[cache] [cache]
enabled = true enabled = true

View File

@@ -16,5 +16,5 @@ cranelift-codegen = { version = "0.49", default-features = false }
walrus = "0.13" walrus = "0.13"
wasmparser = { version = "0.39.2", default-features = false } wasmparser = { version = "0.39.2", default-features = false }
wasm-webidl-bindings = "0.6" wasm-webidl-bindings = "0.6"
wasmtime-jit = { path = '../wasmtime-jit', default-features = false } wasmtime-jit = { path = '../jit', default-features = false }
wasmtime-runtime = { path = '../wasmtime-runtime', default-features = false } wasmtime-runtime = { path = '../runtime', default-features = false }

View File

@@ -15,9 +15,9 @@ cranelift-codegen = { version = "0.49", features = ["enable-serde"] }
cranelift-entity = { version = "0.49", features = ["enable-serde"] } cranelift-entity = { version = "0.49", features = ["enable-serde"] }
cranelift-wasm = { version = "0.49", features = ["enable-serde"] } cranelift-wasm = { version = "0.49", features = ["enable-serde"] }
cranelift-frontend = { version = "0.49" } cranelift-frontend = { version = "0.49" }
wasmtime-environ = { path = "../wasmtime-environ", default-features = false } wasmtime-environ = { path = "../environ", default-features = false }
wasmtime-runtime = { path = "../wasmtime-runtime", default-features = false } wasmtime-runtime = { path = "../runtime", default-features = false }
wasmtime-debug = { path = "../wasmtime-debug", default-features = false } wasmtime-debug = { path = "../debug", default-features = false }
region = "2.0.0" region = "2.0.0"
failure = { version = "0.1.3", default-features = false } failure = { version = "0.1.3", default-features = false }
thiserror = "1.0.4" thiserror = "1.0.4"

Some files were not shown because too many files have changed in this diff Show More