Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

🎬 Add explicit API to run start functions; don't run it implicitly #506

Merged
merged 7 commits into from
Apr 24, 2020
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

- Added `install_lucet_signal_handler()` and `remove_lucet_signal_handler()`, along with `Instance::ensure_signal_handler_installed()` and `Instance::ensure_sigstack_installed()` options to control the automatic installation and removal of signal handlers and alternate signal stacks. The default behaviors have not changed.

- Added `Instance::run_start()` to the public API, which runs the [Wasm start function][start-function] if it is present in that instance's Wasm module. It does nothing if there is no start function.

Creating or resetting an instance no longer implicitly runs the start function. Embedders must ensure that `run_start()` is called before calling any other exported functions. `Instance::run()` will now return `Err(Error::InstanceNeedsStart)` if the start function is present but hasn't been run since the instance was created or reset.

- Added a check that prevents [Wasm start functions][start-function] from calling imported functions. An instance that attempts to do so will fail with `Err(Error::RuntimeTerminated(TerminationDetails::StartCalledImportFunc))`.

[start-function]: https://webassembly.github.io/spec/core/syntax/modules.html#syntax-start

### 0.6.1 (2020-02-18)

- Added metadata to compiled modules that record whether instruction counting instrumentation is present.
Expand Down
140 changes: 70 additions & 70 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion benchmarks/lucet-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lucet-benchmarks"
version = "0.6.2-dev"
version = "0.7.0-dev"
description = "Benchmarks for the Lucet runtime"
homepage = "https://github.com/fastly/lucet"
repository = "https://github.com/fastly/lucet"
Expand Down
2 changes: 1 addition & 1 deletion lucet-module/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lucet-module"
version = "0.6.2-dev"
version = "0.7.0-dev"
description = "A structured interface for Lucet modules"
homepage = "https://github.com/fastly/lucet"
repository = "https://github.com/fastly/lucet"
Expand Down
6 changes: 6 additions & 0 deletions lucet-module/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,15 @@ impl OwnedFunctionMetadata {
}
}

#[derive(Clone, Copy, Debug)]
pub struct FunctionHandle {
pub ptr: FunctionPointer,
pub id: FunctionIndex,
/// This is `true` if and only if this handle was referenced through the start section.
///
/// The same function may be referenced via other contexts, and will appear with `false` in this
/// field in those cases.
pub is_start_func: bool,
Comment on lines +132 to +136
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little weird; I could be convinced this belongs in lucet-runtime-internals only, but since FunctionHandle is only used downstream of lucet-module it seemed okay.

}

// The layout of this struct is very tightly coupled to lucetc's `write_function_manifest`!
Expand Down
4 changes: 2 additions & 2 deletions lucet-objdump/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lucet-objdump"
version = "0.6.2-dev"
version = "0.7.0-dev"
description = "Analyze object files emitted by the Lucet compiler"
homepage = "https://github.com/fastly/lucet"
repository = "https://github.com/fastly/lucet"
Expand All @@ -13,7 +13,7 @@ edition = "2018"
object = "0.18"
byteorder="1.2.1"
colored="1.8.0"
lucet-module = { path = "../lucet-module", version = "=0.6.2-dev" }
lucet-module = { path = "../lucet-module", version = "=0.7.0-dev" }

[package.metadata.deb]
name = "fst-lucet-objdump"
Expand Down
Loading