Skip to content

Commit

Permalink
Merge #515
Browse files Browse the repository at this point in the history
515: Improved emscripten dyncalls r=syrusakbary a=syrusakbary

Improved emscripten dyncalls

Co-authored-by: Syrus <[email protected]>
  • Loading branch information
bors[bot] and syrusakbary committed Jun 30, 2019
2 parents 9f333bd + a2b723d commit f760424
Show file tree
Hide file tree
Showing 3 changed files with 18 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
9 changes: 9 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 Expand Up @@ -853,6 +858,10 @@ pub fn invoke_vijj(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: i32, a4: i32
panic!("dyn_call_vijj is set to None");
}
}
pub fn invoke_vidd(ctx: &mut Ctx, index: i32, a1: i32, a2: f64, a3: f64) {
debug!("emscripten::invoke_viid");
invoke_no_return!(ctx, dyn_call_vidd, index, a1, a2, a3);
}
pub fn invoke_viid(ctx: &mut Ctx, index: i32, a1: i32, a2: i32, a3: f64) {
debug!("emscripten::invoke_viid");
invoke_no_return!(ctx, dyn_call_viid, index, a1, a2, a3);
Expand Down
8 changes: 8 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 All @@ -146,6 +147,7 @@ pub struct EmscriptenData<'a> {
pub dyn_call_vijiii: Option<Func<'a, (i32, i32, i32, i32, i32, i32, i32)>>,
pub dyn_call_vijj: Option<Func<'a, (i32, i32, i32, i32, i32, i32)>>,
pub dyn_call_viid: Option<Func<'a, (i32, i32, i32, f64)>>,
pub dyn_call_vidd: Option<Func<'a, (i32, i32, f64, f64)>>,
pub dyn_call_viidii: Option<Func<'a, (i32, i32, i32, f64, i32, i32)>>,
pub dyn_call_viidddddddd:
Option<Func<'a, (i32, i32, i32, f64, f64, f64, f64, f64, f64, f64, f64)>>,
Expand Down Expand Up @@ -197,6 +199,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 All @@ -218,6 +221,7 @@ impl<'a> EmscriptenData<'a> {
let dyn_call_vijiii = instance.func("dynCall_vijiii").ok();
let dyn_call_vijj = instance.func("dynCall_vijj").ok();
let dyn_call_viid = instance.func("dynCall_viid").ok();
let dyn_call_vidd = instance.func("dynCall_vidd").ok();
let dyn_call_viidii = instance.func("dynCall_viidii").ok();
let dyn_call_viidddddddd = instance.func("dynCall_viidddddddd").ok();

Expand Down Expand Up @@ -263,6 +267,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 All @@ -284,6 +289,7 @@ impl<'a> EmscriptenData<'a> {
dyn_call_vijiii,
dyn_call_vijj,
dyn_call_viid,
dyn_call_vidd,
dyn_call_viidii,
dyn_call_viidddddddd,
temp_ret_0: 0,
Expand Down Expand Up @@ -912,6 +918,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 All @@ -930,6 +937,7 @@ pub fn generate_emscripten_env(globals: &mut EmscriptenGlobals) -> ImportObject
"invoke_viji" => func!(crate::emscripten_target::invoke_viji),
"invoke_vijiii" => func!(crate::emscripten_target::invoke_vijiii),
"invoke_vijj" => func!(crate::emscripten_target::invoke_vijj),
"invoke_vidd" => func!(crate::emscripten_target::invoke_vidd),
"invoke_viid" => func!(crate::emscripten_target::invoke_viid),
"invoke_viidii" => func!(crate::emscripten_target::invoke_viidii),
"invoke_viidddddddd" => func!(crate::emscripten_target::invoke_viidddddddd),
Expand Down

0 comments on commit f760424

Please sign in to comment.