Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decompose VM instantiation costs and add module cache #1359

Merged
merged 16 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@e0a440755b184aa50374330fa75cca0f84fcb59a
- uses: EmbarkStudios/cargo-deny-action@b01e7a8cfb1f496c52d77361e84c1840d8246393
with:
command: check ${{ matrix.checks }}

Expand Down
4 changes: 3 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ soroban-env-guest = { version = "=20.3.0", path = "soroban-env-guest" }
soroban-env-host = { version = "=20.3.0", path = "soroban-env-host" }
soroban-env-macros = { version = "=20.3.0", path = "soroban-env-macros" }
soroban-builtin-sdk-macros = { version = "=20.3.0", path = "soroban-builtin-sdk-macros" }
# NB: this must match the wasmparser version wasmi is using
wasmparser = "=0.116.1"

# NB: When updating, also update the version in rs-soroban-env dev-dependencies
[workspace.dependencies.stellar-xdr]
version = "=20.1.0"
git = "https://github.com/stellar/rs-stellar-xdr"
rev = "2e0f7f7d42fcd6c3c42eb0d65570fba9f5193d7e"
rev = "44b7e2d4cdf27a3611663e82828de56c5274cba0"
default-features = false

[workspace.dependencies.wasmi]
Expand Down
4 changes: 2 additions & 2 deletions soroban-bench-utils/src/tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ mod cpu {

#[cfg(not(any(target_os = "linux", target_os = "macos")))]
mod cpu {
pub struct InstructionCounter(u64);
pub struct InstructionCounter;
impl InstructionCounter {
pub fn new() -> Self {
InstructionCounter(0)
InstructionCounter
}
pub fn begin(&mut self) {}
pub fn end_and_count(&mut self) -> u64 {
Expand Down
3 changes: 2 additions & 1 deletion soroban-env-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ crate-git-revision = "=0.0.6"
soroban-env-macros = { workspace = true }
stellar-xdr = { workspace = true, default-features = false, features = [ "curr" ] }
wasmi = { workspace = true, optional = true }
wasmparser = { workspace = true, optional = true}
serde = { version = "=1.0.192", features = ["derive"], optional = true }
static_assertions = "=1.1.0"
ethnum = "=1.5.0"
Expand All @@ -34,7 +35,7 @@ num-traits = "=0.2.17"
[features]
std = ["stellar-xdr/std", "stellar-xdr/base64"]
serde = ["dep:serde", "stellar-xdr/serde"]
wasmi = ["dep:wasmi"]
wasmi = ["dep:wasmi", "dep:wasmparser"]
testutils = ["dep:arbitrary", "stellar-xdr/arbitrary"]
next = ["stellar-xdr/next", "soroban-env-macros/next"]
tracy = ["dep:tracy-client"]
Expand Down
7 changes: 7 additions & 0 deletions soroban-env-common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,13 @@ impl From<wasmi::Error> for Error {
}
}

#[cfg(feature = "wasmi")]
impl From<wasmparser::BinaryReaderError> for Error {
fn from(_: wasmparser::BinaryReaderError) -> Self {
Error::from_type_and_code(ScErrorType::WasmVm, ScErrorCode::InvalidInput)
}
}

impl Error {
// NB: we don't provide a "get_type" to avoid casting a bad bit-pattern into
// an ScErrorType. Instead we provide an "is_type" to check any specific
Expand Down
5 changes: 3 additions & 2 deletions soroban-env-host/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0"
version.workspace = true
readme = "../README.md"
edition = "2021"
rust-version.workspace = true
rust-version = "1.74"
build = "build.rs"

exclude = ["observations/"]
Expand All @@ -17,6 +17,7 @@ exclude = ["observations/"]
soroban-builtin-sdk-macros = { workspace = true }
soroban-env-common = { workspace = true, features = ["std", "wasmi", "shallow-val-hash"] }
wasmi = { workspace = true }
wasmparser = { workspace = true }
stellar-strkey = "=0.0.8"
static_assertions = "=1.1.0"
sha2 = "=0.10.8"
Expand Down Expand Up @@ -86,7 +87,7 @@ rustversion = "1.0"
[dev-dependencies.stellar-xdr]
version = "=20.1.0"
git = "https://github.com/stellar/rs-stellar-xdr"
rev = "2e0f7f7d42fcd6c3c42eb0d65570fba9f5193d7e"
rev = "44b7e2d4cdf27a3611663e82828de56c5274cba0"
default-features = false
features = ["arbitrary"]

Expand Down
Loading
Loading