mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-12 16:41:21 +00:00
Fixup/comment out to get things compiling
This commit is contained in:
@ -7,19 +7,20 @@ use wasmer_runtime_core::vm::Ctx;
|
||||
pub extern "C" fn __setjmp(env_addr: u32, ctx: &mut Ctx) -> c_int {
|
||||
debug!("emscripten::__setjmp (setjmp)");
|
||||
unsafe {
|
||||
// Rather than using the env as the holder of the jump buffer pointer,
|
||||
// we use the environment address to store the index relative to jumps
|
||||
// so the address of the jump it's outside the wasm memory itself.
|
||||
let jump_index = ctx.memory(0).as_ptr().add(env_addr as usize) as *mut i8;
|
||||
// We create the jump buffer outside of the wasm memory
|
||||
let jump_buf: UnsafeCell<[c_int; 27]> = UnsafeCell::new([0; 27]);
|
||||
let jumps = &mut get_emscripten_data(ctx).jumps;
|
||||
let result = setjmp(jump_buf.get() as _);
|
||||
// We set the jump index to be the last value of jumps
|
||||
*jump_index = jumps.len() as _;
|
||||
// We hold the reference of the jump buffer
|
||||
jumps.push(jump_buf);
|
||||
result
|
||||
unimplemented!()
|
||||
// // Rather than using the env as the holder of the jump buffer pointer,
|
||||
// // we use the environment address to store the index relative to jumps
|
||||
// // so the address of the jump it's outside the wasm memory itself.
|
||||
// let jump_index = ctx.memory(0).as_ptr().add(env_addr as usize) as *mut i8;
|
||||
// // We create the jump buffer outside of the wasm memory
|
||||
// let jump_buf: UnsafeCell<[c_int; 27]> = UnsafeCell::new([0; 27]);
|
||||
// let jumps = &mut get_emscripten_data(ctx).jumps;
|
||||
// let result = setjmp(jump_buf.get() as _);
|
||||
// // We set the jump index to be the last value of jumps
|
||||
// *jump_index = jumps.len() as _;
|
||||
// // We hold the reference of the jump buffer
|
||||
// jumps.push(jump_buf);
|
||||
// result
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
|
||||
macro_rules! emscripten_memory_pointer {
|
||||
($memory:expr, $pointer:expr) => {
|
||||
unsafe { $memory.as_ptr().add($pointer as usize) }
|
||||
0 as usize
|
||||
// unsafe { $memory.as_ptr().add($pointer as usize) }
|
||||
};
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ use wasmer_runtime_core::{
|
||||
module::Module,
|
||||
structures::TypedIndex,
|
||||
types::{ImportedMemoryIndex, ImportedTableIndex},
|
||||
units::Pages,
|
||||
vm::Ctx,
|
||||
};
|
||||
|
||||
@ -24,12 +25,12 @@ pub fn is_emscripten_module(module: &Module) -> bool {
|
||||
|
||||
pub fn get_emscripten_table_size(module: &Module) -> (u32, Option<u32>) {
|
||||
let (_, table) = &module.0.imported_tables[ImportedTableIndex::new(0)];
|
||||
(table.min, table.max)
|
||||
(table.minimum, table.maximum)
|
||||
}
|
||||
|
||||
pub fn get_emscripten_memory_size(module: &Module) -> (u32, Option<u32>) {
|
||||
pub fn get_emscripten_memory_size(module: &Module) -> (Pages, Option<Pages>) {
|
||||
let (_, memory) = &module.0.imported_memories[ImportedMemoryIndex::new(0)];
|
||||
(memory.min, memory.max)
|
||||
(memory.minimum, memory.maximum)
|
||||
}
|
||||
|
||||
pub unsafe fn write_to_buf(string: *const c_char, buf: u32, max: u32, ctx: &mut Ctx) -> u32 {
|
||||
|
Reference in New Issue
Block a user