Remove unneded prefix argument from instantiate_wasi. (#584)

* Remove unneded prefix argument from `instantiate_wasi`.

This was an artifact of an earlier backwards-compatibility mechanism
which is no longer needed.

* Remove unneeded prefix arg from remaning uses
This commit is contained in:
Dan Gohman
2019-11-16 11:40:14 -08:00
committed by GitHub
parent 0753b1206b
commit 7d47a04277
3 changed files with 6 additions and 10 deletions

View File

@@ -21,14 +21,13 @@ pub fn create_wasi_instance(
environ: &[(String, String)],
) -> Result<api::Instance, InstantiationError> {
let global_exports = store.borrow().global_exports().clone();
let wasi = instantiate_wasi("", global_exports, preopened_dirs, argv, environ)?;
let wasi = instantiate_wasi(global_exports, preopened_dirs, argv, environ)?;
let instance = api::Instance::from_handle(&store, wasi);
Ok(instance)
}
/// Return an instance implementing the "wasi" interface.
pub fn instantiate_wasi(
prefix: &str,
global_exports: Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>>,
preopened_dirs: &[(String, File)],
argv: &[String],
@@ -54,14 +53,13 @@ pub fn instantiate_wasi(
let wasi_ctx = wasi_ctx_builder.build().map_err(|err| {
InstantiationError::Resource(format!("couldn't assemble WASI context object: {}", err))
})?;
instantiate_wasi_with_context(prefix, global_exports, wasi_ctx)
instantiate_wasi_with_context(global_exports, wasi_ctx)
}
/// Return an instance implementing the "wasi" interface.
///
/// The wasi context is configured by
pub fn instantiate_wasi_with_context(
prefix: &str,
global_exports: Rc<RefCell<HashMap<String, Option<wasmtime_runtime::Export>>>>,
wasi_ctx: WasiCtx,
) -> Result<InstanceHandle, InstantiationError> {
@@ -88,10 +86,9 @@ pub fn instantiate_wasi_with_context(
pointer_type,
));
let func = module.functions.push(sig);
module.exports.insert(
prefix.to_owned() + stringify!($name),
Export::Function(func),
);
module
.exports
.insert(stringify!($name).to_owned(), Export::Function(func));
finished_functions.push(syscalls::$name::SHIM as *const VMFunctionBody);
}};
}