Fix dependency paths. wasmstandalone no longer depends on out-of-tree patches.
This commit is contained in:
@@ -68,7 +68,7 @@ pub fn compile_module(
|
||||
) -> Result<ExecutableCode, String> {
|
||||
debug_assert!(
|
||||
trans_result.start_index.is_none() ||
|
||||
trans_result.start_index.unwrap() >= trans_result.function_imports_count,
|
||||
trans_result.start_index.unwrap() >= runtime.imported_funcs.len(),
|
||||
"imported start functions not supported yet"
|
||||
);
|
||||
|
||||
@@ -101,12 +101,7 @@ pub fn compile_module(
|
||||
});
|
||||
functions_code.push(code_buf);
|
||||
}
|
||||
relocate(
|
||||
trans_result.function_imports_count,
|
||||
&functions_metatada,
|
||||
&mut functions_code,
|
||||
runtime,
|
||||
);
|
||||
relocate(&functions_metatada, &mut functions_code, runtime);
|
||||
// After having emmitted the code to memory, we deal with relocations
|
||||
match trans_result.start_index {
|
||||
None => Err(String::from(
|
||||
@@ -152,7 +147,6 @@ pub fn execute(exec: &ExecutableCode) -> Result<(), String> {
|
||||
|
||||
/// Performs the relocations inside the function bytecode, provided the necessary metadata
|
||||
fn relocate(
|
||||
function_imports_count: usize,
|
||||
functions_metatada: &[FunctionMetaData],
|
||||
functions_code: &mut Vec<Vec<u8>>,
|
||||
runtime: &StandaloneRuntime,
|
||||
@@ -164,7 +158,7 @@ fn relocate(
|
||||
ref il_func,
|
||||
} = *function_in_memory;
|
||||
for &(func_ref, offset) in relocs.funcs.values() {
|
||||
let target_func_index = runtime.func_indices[func_ref] - function_imports_count;
|
||||
let target_func_index = runtime.func_indices[func_ref] - runtime.imported_funcs.len();
|
||||
let target_func_address: isize = functions_code[target_func_index].as_ptr() as isize;
|
||||
unsafe {
|
||||
let reloc_address: isize = functions_code[func_index].as_mut_ptr().offset(
|
||||
|
||||
@@ -23,7 +23,7 @@ struct GlobalInfo {
|
||||
offset: usize,
|
||||
}
|
||||
|
||||
struct GlobalsData {
|
||||
pub struct GlobalsData {
|
||||
data: Vec<u8>,
|
||||
info: Vec<GlobalInfo>,
|
||||
}
|
||||
@@ -51,17 +51,18 @@ const PAGE_SIZE: usize = 65536;
|
||||
/// Object containing the standalone runtime information. To be passed after creation as argument
|
||||
/// to `cton_wasm::translatemodule`.
|
||||
pub struct StandaloneRuntime {
|
||||
// Compilation setting flags.
|
||||
/// Compilation setting flags.
|
||||
flags: settings::Flags,
|
||||
|
||||
// Unprocessed signatures exactly as provided by `declare_signature()`.
|
||||
/// Unprocessed signatures exactly as provided by `declare_signature()`.
|
||||
signatures: Vec<ir::Signature>,
|
||||
// Types of functions, imported and local.
|
||||
/// Types of functions, imported and local.
|
||||
func_types: Vec<SignatureIndex>,
|
||||
// Names of imported functions.
|
||||
imported_funcs: Vec<ir::FunctionName>,
|
||||
/// Names of imported functions.
|
||||
pub imported_funcs: Vec<ir::FunctionName>,
|
||||
|
||||
globals: GlobalsData,
|
||||
/// WebAssembly global variables.
|
||||
pub globals: GlobalsData,
|
||||
/// WebAssembly tables.
|
||||
pub tables: Vec<TableData>,
|
||||
/// WebAssembly linear memories.
|
||||
|
||||
Reference in New Issue
Block a user