mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-17 10:51:21 +00:00
Hopefully finish the memory manager implementation for llvm RuntimeDyLd
This commit is contained in:
@ -616,7 +616,7 @@ fn parse_function(
|
||||
let struct_value = basic_value.into_struct_value();
|
||||
for i in 0..(count as u32) {
|
||||
let value =
|
||||
builder.build_extract_value(struct_value, i, &state.var_name());
|
||||
builder.build_extract_value(struct_value, i, &state.var_name()).unwrap();
|
||||
state.push1(value);
|
||||
}
|
||||
}
|
||||
|
8
lib/llvm-backend/src/platform/mod.rs
Normal file
8
lib/llvm-backend/src/platform/mod.rs
Normal file
@ -0,0 +1,8 @@
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
mod unix;
|
||||
#[cfg(target_family = "unix")]
|
||||
pub use self::unix::*;
|
||||
|
||||
#[cfg(target_family = "windows")]
|
||||
compile_error!("windows not yet supported for the llvm-based compiler backend");
|
40
lib/llvm-backend/src/platform/unix/mod.rs
Normal file
40
lib/llvm-backend/src/platform/unix/mod.rs
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
extern "C" {
|
||||
fn __register_frame(frame: *const u8);
|
||||
fn __deregister_frame(frame: *const u8);
|
||||
}
|
||||
|
||||
pub unsafe fn register_eh_frames(eh_frames: *const u8, num_bytes: usize) {
|
||||
visit_frame_desc_entries(eh_frames, num_bytes, |frame| __register_frame(frame));
|
||||
}
|
||||
|
||||
unsafe fn visit_frame_desc_entries<F>(eh_frames: *const u8, num_bytes: usize, visitor: F)
|
||||
where
|
||||
F: Fn(*const u8),
|
||||
{
|
||||
let mut next = eh_frames;
|
||||
let mut end = eh_frames.add(num_bytes);
|
||||
|
||||
loop {
|
||||
if next >= end {
|
||||
break;
|
||||
}
|
||||
|
||||
let cfi = next;
|
||||
let mut cfi_num_bytes = (next as *const u32).read_unaligned() as u64;
|
||||
assert!(cfi_num_bytes != 0);
|
||||
|
||||
next = next.add(4);
|
||||
if num_bytes == 0xffffffff {
|
||||
let cfi_num_bytes64 = (next as *const u64).read_unaligned();
|
||||
cfi_num_bytes = cfi_num_bytes64;
|
||||
next = next.add(8);
|
||||
}
|
||||
|
||||
let cie_offset = (next as *const u32).read_unaligned();
|
||||
if cie_offset != 0 {
|
||||
visitor(cfi);
|
||||
}
|
||||
next = next.add(cfi_num_bytes as usize);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user