-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JS_FFI option to disable JS FFI mangling. (#5168)
* LEGALIZE_JS_FFI option to disable JS FFI mangling. For JS/Web platform, calls to JS imports are normally wrapped to convert i64 to i32 and f32 to f64. Likewise calls from JS into exports do the inverse wrapping. This change provides an option to disable that wrapping and use the original types for the call. This is useful for non-web embeddings. The following fastcomp options get enabled by this option: -emscripten-legalize-javascript-ffi=0 -emscripten-only-wasm The following binaryen options get enabled by this option: --no-legalize-javascript-ffi --wasm-only * Add test for LEGALIZE_JS_FFI. The test other.test_legalize_js_ffi compiles tests/core/ffi.c several different ways: LEGALIZE_JS_FFI={0,1}, SIDE_MODULE={0,1}, -O{2,0}. After each build the test scans the results a.out.wast file to make sure that type wrapping/conversions happen (LEGALIZE_JS_FFI=1) or don't happen (LEGALIZE_JS_FFI=0).
- Loading branch information
Showing
6 changed files
with
87 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include <stdio.h> | ||
#include <math.h> | ||
|
||
float add_f (float a, float b) { | ||
return a + b; | ||
} | ||
|
||
long long add_ll (long long a, long long b) { | ||
return a + b; | ||
} | ||
|
||
extern float import_f(float x); | ||
|
||
extern long long import_ll(long long x); | ||
|
||
int main () { | ||
float a = 1.2, | ||
b = import_f((float)3.4), | ||
c; | ||
c = add_f(a, b); | ||
|
||
long long d = 1, | ||
e = import_ll((long long)2), | ||
f; | ||
f = add_ll(d, e); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters