Update to cranelift 0.20.0.
The biggest change is the split from FunctionIndex to DefinedFuncIndex to FuncIndex. Take better advantage of this by converting several Vecs to PrimaryMaps. Also, table_addr can now handle indices of the table index type, so we don't need to explicitly uextend them anymore.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use cranelift_codegen::settings;
|
||||
use cranelift_codegen::settings::Configurable;
|
||||
use cranelift_entity::EntityRef;
|
||||
use faerie::Artifact;
|
||||
use wasmtime_environ::{Compilation, Module, Relocations};
|
||||
|
||||
@@ -12,7 +13,8 @@ pub fn emit_module(
|
||||
relocations: &Relocations,
|
||||
) -> Result<(), String> {
|
||||
debug_assert!(
|
||||
module.start_func.is_none() || module.start_func.unwrap() >= module.imported_funcs.len(),
|
||||
module.start_func.is_none()
|
||||
|| module.start_func.unwrap().index() >= module.imported_funcs.len(),
|
||||
"imported start functions not supported yet"
|
||||
);
|
||||
|
||||
@@ -21,11 +23,11 @@ pub fn emit_module(
|
||||
.enable("enable_verifier")
|
||||
.expect("Missing enable_verifier setting");
|
||||
|
||||
for (i, function_relocs) in relocations.iter().enumerate() {
|
||||
for (i, function_relocs) in relocations.iter() {
|
||||
assert!(function_relocs.is_empty(), "relocations not supported yet");
|
||||
let body = &compilation.functions[i];
|
||||
let func_index = module.imported_funcs.len() + i;
|
||||
let string_name = format!("wasm_function[{}]", func_index);
|
||||
let func_index = module.func_index(i);
|
||||
let string_name = format!("wasm_function[{}]", func_index.index());
|
||||
|
||||
obj.define(string_name, body.clone())
|
||||
.map_err(|err| format!("{}", err))?;
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
)]
|
||||
|
||||
extern crate cranelift_codegen;
|
||||
extern crate cranelift_entity;
|
||||
extern crate faerie;
|
||||
extern crate wasmtime_environ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user