Skip to content

Commit

Permalink
Improved emscripten dyncalls
Browse files Browse the repository at this point in the history
  • Loading branch information
syrusakbary committed Jun 30, 2019
1 parent 9f333bd commit 299d41c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All PRs to the Wasmer repository must add to this file.
Blocks of changes will separated by version increments.

## **[Unreleased]**
- [#515](https://github.com/wasmerio/wasmer/pull/510) Improved Emscripten dyncalls
- [#513](https://github.com/wasmerio/wasmer/pull/510) Fix emscripten lseek implementation.
- [#510](https://github.com/wasmerio/wasmer/pull/510) Simplify construction of floating point constants in LLVM backend. Fix LLVM assertion failure due to definition of %ctx.

Expand Down
5 changes: 5 additions & 0 deletions lib/emscripten/src/emscripten_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,11 @@ pub fn invoke_iij(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
invoke!(ctx, dyn_call_iij, index, a1, a2, a3)
}

pub fn invoke_iji(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: i32) -> i32 {
debug!("emscripten::invoke_iji");
invoke!(ctx, dyn_call_iji, index, a1, a2, a3)
}

pub fn invoke_iiji(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: i32, a4: i32) -> i32 {
debug!("emscripten::invoke_iiji");
invoke!(ctx, dyn_call_iiji, index, a1, a2, a3, a4)
Expand Down
4 changes: 4 additions & 0 deletions lib/emscripten/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ pub struct EmscriptenData<'a> {
pub dyn_call_viiiiiiiiii:
Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32)>>,
pub dyn_call_iij: Option<Func<'a, (i32, i32, i32, i32), i32>>,
pub dyn_call_iji: Option<Func<'a, (i32, i32, i32, i32), i32>>,
pub dyn_call_iiji: Option<Func<'a, (i32, i32, i32, i32, i32), i32>>,
pub dyn_call_iiijj: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32), i32>>,
pub dyn_call_j: Option<Func<'a, i32, i32>>,
Expand Down Expand Up @@ -197,6 +198,7 @@ impl<'a> EmscriptenData<'a> {
let dyn_call_viiiiiiiii = instance.func("dynCall_viiiiiiiii").ok();
let dyn_call_viiiiiiiiii = instance.func("dynCall_viiiiiiiiii").ok();
let dyn_call_iij = instance.func("dynCall_iij").ok();
let dyn_call_iji = instance.func("dynCall_iji").ok();
let dyn_call_iiji = instance.func("dynCall_iiji").ok();
let dyn_call_iiijj = instance.func("dynCall_iiijj").ok();
let dyn_call_j = instance.func("dynCall_j").ok();
Expand Down Expand Up @@ -263,6 +265,7 @@ impl<'a> EmscriptenData<'a> {
dyn_call_viiiiiiiii,
dyn_call_viiiiiiiiii,
dyn_call_iij,
dyn_call_iji,
dyn_call_iiji,
dyn_call_iiijj,
dyn_call_j,
Expand Down Expand Up @@ -912,6 +915,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"invoke_viiiiiiiii" => func!(crate::emscripten_target::invoke_viiiiiiiii),
"invoke_viiiiiiiiii" => func!(crate::emscripten_target::invoke_viiiiiiiiii),
"invoke_iij" => func!(crate::emscripten_target::invoke_iij),
"invoke_iji" => func!(crate::emscripten_target::invoke_iji),
"invoke_iiji" => func!(crate::emscripten_target::invoke_iiji),
"invoke_iiijj" => func!(crate::emscripten_target::invoke_iiijj),
"invoke_j" => func!(crate::emscripten_target::invoke_j),
Expand Down

0 comments on commit 299d41c

Please sign in to comment.