From a8b62ae8a5a0e7bca47e2d6e2ac6059ed4e465a2 Mon Sep 17 00:00:00 2001 From: Lachlan Sneff Date: Sun, 25 Nov 2018 23:56:21 -0500 Subject: [PATCH] Hack together enough emscripten stack stuff to make it happy --- src/apis/emscripten/mod.rs | 4 ---- src/apis/emscripten/storage.rs | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/src/apis/emscripten/mod.rs b/src/apis/emscripten/mod.rs index 7b660af4d..0a8c9737b 100644 --- a/src/apis/emscripten/mod.rs +++ b/src/apis/emscripten/mod.rs @@ -1,11 +1,7 @@ /// NOTE: TODO: These emscripten api implementation only support wasm32 for now because they assume offsets are u32 -<<<<<<< HEAD use crate::webassembly::{ImportObject, ImportValue, LinearMemory}; use byteorder::{ByteOrder, LittleEndian}; use std::mem; -======= -use crate::webassembly::{ImportObject, ImportValue}; ->>>>>>> Add some syscalls // EMSCRIPTEN APIS mod env; diff --git a/src/apis/emscripten/storage.rs b/src/apis/emscripten/storage.rs index 262b770da..d349e3fc0 100644 --- a/src/apis/emscripten/storage.rs +++ b/src/apis/emscripten/storage.rs @@ -1,18 +1,8 @@ use crate::webassembly::{LinearMemory, Instance}; -<<<<<<< HEAD pub fn align_memory(ptr: u32) -> u32 { (ptr + 15) & !15 -======= -pub fn align_memory(size: u32, factor: u32) -> u32 { - assert!(factor != 0, "memory cannot be aligned by 0 offset!"); - if size % factor == 1 { - (size) - (size % factor) + (factor) - } else { - size - } ->>>>>>> Add some syscalls } // pub fn static_alloc(size: u32, instance: &mut Instance) -> u32 { @@ -25,11 +15,7 @@ pub fn align_memory(size: u32, factor: u32) -> u32 { pub fn static_alloc(size: u32, static_top: &mut u32, memory: &LinearMemory) -> u32 { let old_static_top = *static_top; -<<<<<<< HEAD let total_memory = memory.maximum_size() * LinearMemory::PAGE_SIZE; -======= - let total_memory = memory.maximum.unwrap_or(LinearMemory::MAX_PAGES as u32) * LinearMemory::PAGE_SIZE; ->>>>>>> Add some syscalls // NOTE: The `4294967280` is a u32 conversion of -16 as gotten from emscripten. *static_top = (*static_top + size + 15) & 4294967280; assert!(*static_top < total_memory, "not enough memory for static allocation - increase total_memory!");