mirror of
https://github.com/fluencelabs/wasm-utils
synced 2025-04-02 03:01:04 +00:00
some fixes
This commit is contained in:
parent
f7e6631c83
commit
f9540c5423
@ -8,7 +8,7 @@ use clap::{App, Arg};
|
|||||||
fn main() {
|
fn main() {
|
||||||
logger::init_log();
|
logger::init_log();
|
||||||
|
|
||||||
let matches = App::new("wasm-opt")
|
let matches = App::new("wasm-prune")
|
||||||
.arg(Arg::with_name("input")
|
.arg(Arg::with_name("input")
|
||||||
.index(1)
|
.index(1)
|
||||||
.required(true)
|
.required(true)
|
||||||
@ -39,7 +39,7 @@ fn main() {
|
|||||||
// Invoke optimizer
|
// Invoke optimizer
|
||||||
// Contract is supposed to have only these functions as public api
|
// Contract is supposed to have only these functions as public api
|
||||||
// All other symbols not usable by this list is optimized away
|
// All other symbols not usable by this list is optimized away
|
||||||
utils::optimize(&mut module, exports).expect("Optimizer to finish without errors");
|
utils::optimize(&mut module, exports).expect("Optimizer failed");
|
||||||
|
|
||||||
parity_wasm::serialize_to_file(&output, module).unwrap();
|
parity_wasm::serialize_to_file(&output, module).expect("Serialization failed");
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ pub fn pack_instance(raw_module: Vec<u8>, mut ctor_module: elements::Module) ->
|
|||||||
// Calculates a function index within module's function section
|
// Calculates a function index within module's function section
|
||||||
let function_internal_index = function_index - ctor_import_functions;
|
let function_internal_index = function_index - ctor_import_functions;
|
||||||
|
|
||||||
// Constructor should be of signature `func(i32)` (void), fail otherwise
|
// Constructor should be of signature `func()` (void), fail otherwise
|
||||||
let type_id = ctor_module.function_section().ok_or(Error::NoCodeSection)?
|
let type_id = ctor_module.function_section().ok_or(Error::NoCodeSection)?
|
||||||
.entries().get(function_index - ctor_import_functions).ok_or(Error::MalformedModule)?
|
.entries().get(function_index - ctor_import_functions).ok_or(Error::MalformedModule)?
|
||||||
.type_ref();
|
.type_ref();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user