Improve handling of strings for backtraces (#843)

* Improve handling of strings for backtraces

Largely avoid storing strings at all in the `wasmtime-*` internal
crates, and instead only store strings in a separate global cache
specific to the `wasmtime` crate itself. This global cache is inserted
and removed from dynamically as modules are created and deallocated, and
the global cache is consulted whenever a `Trap` is created to
symbolicate any wasm frames.

This also avoids the need to thread `module_name` through the jit crates
and back, and additionally removes the need for `ModuleSyncString`.

* Run rustfmt
This commit is contained in:
Alex Crichton
2020-01-24 11:53:55 -06:00
committed by GitHub
parent 21e0a99884
commit 3db1074c15
17 changed files with 139 additions and 156 deletions

View File

@@ -3,7 +3,7 @@ use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use std::fs::File;
use std::rc::Rc;
use std::sync::Arc;
use target_lexicon::HOST;
use wasi_common::hostcalls;
use wasi_common::wasi;
@@ -79,7 +79,7 @@ pub fn instantiate_wasi_with_context(
let signatures = PrimaryMap::new();
InstanceHandle::new(
Rc::new(module),
Arc::new(module),
finished_functions.into_boxed_slice(),
imports,
&data_initializers,

View File

@@ -3,7 +3,7 @@ use cranelift_codegen::{ir, isa};
use cranelift_entity::PrimaryMap;
use cranelift_wasm::DefinedFuncIndex;
use std::fs::File;
use std::rc::Rc;
use std::sync::Arc;
use target_lexicon::HOST;
use wasi_common::old::snapshot_0::hostcalls;
use wasi_common::old::snapshot_0::{WasiCtx, WasiCtxBuilder};
@@ -79,7 +79,7 @@ pub fn instantiate_wasi_with_context(
let signatures = PrimaryMap::new();
InstanceHandle::new(
Rc::new(module),
Arc::new(module),
finished_functions.into_boxed_slice(),
imports,
&data_initializers,