Updated compatibility with latest emscripten

This commit is contained in:
Syrus
2019-07-06 17:15:35 -07:00
parent 336b5459bd
commit 24e7c1b263
3 changed files with 39 additions and 16 deletions

View File

@ -24,7 +24,7 @@ pub fn is_emscripten_module(module: &Module) -> bool {
.namespace_table
.get(import_name.namespace_index);
let field = module.info().name_table.get(import_name.name_index);
if field == "_emscripten_memcpy_big" && namespace == "env" {
if (field == "_emscripten_memcpy_big" || field=="emscripten_memcpy_big") && namespace == "env" {
return true;
}
}
@ -110,6 +110,8 @@ pub unsafe fn copy_cstr_into_wasm(ctx: &mut Ctx, cstr: *const c_char) -> u32 {
pub unsafe fn allocate_on_stack<'a, T: Copy>(ctx: &'a mut Ctx, count: u32) -> (u32, &'a mut [T]) {
let offset = get_emscripten_data(ctx)
.stack_alloc
.as_ref()
.unwrap()
.call(count * (size_of::<T>() as u32))
.unwrap();
let addr = emscripten_memory_pointer!(ctx.memory(0), offset) as *mut T;