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

Add a compilation section to disable address maps #3598

Merged

Conversation

alexcrichton
Copy link
Member

This commit adds a new Config::generate_address_map compilation
setting which is used to disable emission of the .wasmtime.addrmap
section of compiled artifacts. This section is currently around the size
of the entire .text section itself unfortunately and for size reasons
may wish to be omitted. Functionality-wise all that is lost is knowing
the precise wasm module offset address of a faulting instruction or in a
backtrace of instructions. This also means that if the module has DWARF
debugging information available with it Wasmtime isn't able to produce a
filename and line number in the backtrace.

This option remains enabled by default. This option may not be needed in
the future with #3547 perhaps, but in the meantime it seems reasonable
enough to support a configuration mode where the section is entirely
omitted if the smallest module possible is desired.

This commit adds a new `Config::generate_address_map` compilation
setting which is used to disable emission of the `.wasmtime.addrmap`
section of compiled artifacts. This section is currently around the size
of the entire `.text` section itself unfortunately and for size reasons
may wish to be omitted. Functionality-wise all that is lost is knowing
the precise wasm module offset address of a faulting instruction or in a
backtrace of instructions. This also means that if the module has DWARF
debugging information available with it Wasmtime isn't able to produce a
filename and line number in the backtrace.

This option remains enabled by default. This option may not be needed in
the future with bytecodealliance#3547 perhaps, but in the meantime it seems reasonable
enough to support a configuration mode where the section is entirely
omitted if the smallest module possible is desired.
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 13, 2021
tests/all/traps.rs Outdated Show resolved Hide resolved
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

alexcrichton and others added 2 commits December 13, 2021 09:36
Co-authored-by: Nick Fitzgerald <fitzgen@gmail.com>
@github-actions github-actions bot added the wasmtime:c-api Issues pertaining to the C API. label Dec 13, 2021
@github-actions
Copy link

Subscribe to Label Action

cc @peterhuene

This issue or pull request has been labeled: "wasmtime:c-api"

Thus the following users have been cc'd because of the following labels:

  • peterhuene: wasmtime:c-api

To subscribe or unsubscribe from this label, edit the .github/subscribe-to-label.json configuration file.

Learn more.

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Could we put a guard around addrs.push(range.clone(), &func.address_map.instructions); so we don't even allocate the memory for the address map when we aren't going to omit it?

@pchickey
Copy link
Contributor

Also, should this imply WasmBacktraceDetails::Disable? What backtrace details will actually be emitted if the addr map isnt present?

@alexcrichton
Copy link
Member Author

Could we put a guard around ...

Ah yes indeed!

Also, should this imply WasmBacktraceDetails::Disable?

While we won't get precise locations within functions (which also means no filenames/line numbers) we do still get the function names in the backtrace due to the .eh_frame section. I think because of that we probably don't want to forcibly disable backtraces for now, although in the future we could probably drop the .eh_frame section as well (at least on Unix) if it's a size concern.

Copy link
Contributor

@pchickey pchickey left a comment

Choose a reason for hiding this comment

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

Thanks!

@alexcrichton alexcrichton merged commit f1225df into bytecodealliance:main Dec 13, 2021
@alexcrichton alexcrichton deleted the smaller-compiled-modules branch December 13, 2021 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants