Add typed functions and weird type parameter things

This commit is contained in:
Lachlan Sneff
2019-02-02 15:28:50 -08:00
parent 6c33aa5803
commit eba66f3b33
24 changed files with 706 additions and 463 deletions

View File

@@ -3,7 +3,7 @@ use libc::{c_int, c_void, memcpy, size_t};
use wasmer_runtime_core::vm::Ctx;
/// emscripten: _emscripten_memcpy_big
pub extern "C" fn _emscripten_memcpy_big(dest: u32, src: u32, len: u32, ctx: &mut Ctx) -> u32 {
pub fn _emscripten_memcpy_big(dest: u32, src: u32, len: u32, ctx: &mut Ctx) -> u32 {
debug!(
"emscripten::_emscripten_memcpy_big {}, {}, {}",
dest, src, len
@@ -17,7 +17,7 @@ pub extern "C" fn _emscripten_memcpy_big(dest: u32, src: u32, len: u32, ctx: &mu
}
/// emscripten: getTotalMemory
pub extern "C" fn get_total_memory(_ctx: &mut Ctx) -> u32 {
pub fn get_total_memory(_ctx: &mut Ctx) -> u32 {
debug!("emscripten::get_total_memory");
// instance.memories[0].current_pages()
// TODO: Fix implementation
@@ -25,7 +25,7 @@ pub extern "C" fn get_total_memory(_ctx: &mut Ctx) -> u32 {
}
/// emscripten: enlargeMemory
pub extern "C" fn enlarge_memory(_ctx: &mut Ctx) -> u32 {
pub fn enlarge_memory(_ctx: &mut Ctx) -> u32 {
debug!("emscripten::enlarge_memory");
// instance.memories[0].grow(100);
// TODO: Fix implementation
@@ -33,14 +33,14 @@ pub extern "C" fn enlarge_memory(_ctx: &mut Ctx) -> u32 {
}
/// emscripten: abortOnCannotGrowMemory
pub extern "C" fn abort_on_cannot_grow_memory(ctx: &mut Ctx) -> u32 {
pub fn abort_on_cannot_grow_memory(ctx: &mut Ctx) -> u32 {
debug!("emscripten::abort_on_cannot_grow_memory");
abort_with_message("Cannot enlarge memory arrays!", ctx);
0
}
/// emscripten: ___map_file
pub extern "C" fn ___map_file(_one: u32, _two: u32, _ctx: &mut Ctx) -> c_int {
pub fn ___map_file(_one: u32, _two: u32, _ctx: &mut Ctx) -> c_int {
debug!("emscripten::___map_file");
// NOTE: TODO: Em returns -1 here as well. May need to implement properly
-1