Moved ctx to be the first argument in emscripten

This commit is contained in:
Syrus
2019-02-09 13:58:05 -08:00
parent 393b7dbdf3
commit 6c7fd55b87
22 changed files with 209 additions and 209 deletions

View File

@ -4,7 +4,7 @@ use std::cell::UnsafeCell;
use wasmer_runtime_core::vm::Ctx;
/// setjmp
pub fn __setjmp(env_addr: u32, ctx: &mut Ctx) -> c_int {
pub fn __setjmp(ctx: &mut Ctx, env_addr: u32) -> c_int {
debug!("emscripten::__setjmp (setjmp)");
unsafe {
// Rather than using the env as the holder of the jump buffer pointer,
@ -15,7 +15,7 @@ pub fn __setjmp(env_addr: u32, ctx: &mut Ctx) -> c_int {
let jump_buf: UnsafeCell<[u32; 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
// We set the jump index to be the last 3value of jumps
*jump_index = jumps.len() as _;
// We hold the reference of the jump buffer
jumps.push(jump_buf);
@ -25,7 +25,7 @@ pub fn __setjmp(env_addr: u32, ctx: &mut Ctx) -> c_int {
/// longjmp
#[allow(unreachable_code)]
pub fn __longjmp(env_addr: u32, val: c_int, ctx: &mut Ctx) {
pub fn __longjmp(ctx: &mut Ctx, env_addr: u32, val: c_int) {
debug!("emscripten::__longjmp (longmp)");
unsafe {
// We retrieve the jump index from the env address