Re: Disable Web Assembly Memory Checks

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: Disable Web Assembly Memory Checks

sadashiv8605950412
On Tuesday, January 9, 2018 at 2:12:34 AM UTC+5:30, Abhinav Jangda wrote:

> Hello Everyone,
>
> I am looking for an option in SpiderMonkey to turn off the bounds check
> emitted by JIT compiler while compiling Web Assembly code, something like
> "wasm_no_bounds_check" and "wasm_no_stack_checks" in Google V8.
> Unfortunately, I couldn't find any such options either using "js --help"
> for SpiderMonkey JS Shell version JavaScript-C59.0a1 or "about:config"
> options in Mozilla Firefox 57.0.4. Can anyone please help with turning the
> checks off, this is required for a research project.
>
> Thank You,
>
> Abhinav Jangda

_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Disable Web Assembly Memory Checks

sadashiv8605950412
On Tuesday, January 9, 2018 at 2:12:34 AM UTC+5:30, Abhinav Jangda wrote:

> Hello Everyone,
>
> I am looking for an option in SpiderMonkey to turn off the bounds check
> emitted by JIT compiler while compiling Web Assembly code, something like
> "wasm_no_bounds_check" and "wasm_no_stack_checks" in Google V8.
> Unfortunately, I couldn't find any such options either using "js --help"
> for SpiderMonkey JS Shell version JavaScript-C59.0a1 or "about:config"
> options in Mozilla Firefox 57.0.4. Can anyone please help with turning the
> checks off, this is required for a research project.
>
> Thank You,
>
> Abhinav Jangda

see this
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine
Reply | Threaded
Open this post in threaded view
|

Re: Disable Web Assembly Memory Checks

Benjamin Bouvier-2
We don't have shell flags to do this at the moment.

Regarding memory accesses checks:
- on x64 (and probably on ARM64 when we get to implement it, aka
WASM_HUGE_MEMORY platforms), we use mprotect and signal handling to catch
memory accesses that are out of bounds, so no bounds checks are generated
for those.
- other platforms get explicit bounds checks. You can disable them for Ion
with an early return in CodeGenerator::visitWasmBoundsCheck:
https://searchfox.org/mozilla-central/source/js/src/jit/
CodeGenerator.cpp#12685
And for the wasm baseline compiler (tier 1) in
https://searchfox.org/mozilla-central/source/js/src/wasm/WasmBaselineCompile.cpp#3990

Regarding calls to function table checks: (i.e. checking that we're using a
function index that's in bound of the function table)
There's no way to disable those either. They're generated in
MacroAssembler::wasmCallIndirect, so you can either pass `boundsCheck` =
false to all callers of this function, or just tweak the behavior there:
https://searchfox.org/mozilla-central/source/js/src/jit/
MacroAssembler.cpp#3245

The v8 flag wasm_no_stack_checks lets me guess this also includes stack
limit checks, those would be disabled there:
- for Ion/Baseline, the checks in this block:
https://searchfox.org/mozilla-central/source/js/src/wasm/WasmFrameIter.cpp#520
- for Baseline: by returning early in
https://searchfox.org/mozilla-central/source/js/src/wasm/WasmBaselineCompile.cpp#1208

Good luck! Out of curiosity, if you can disclose this information, I'd be
curious to know what your research project is about. Feel free to follow up
in private if you prefer.

Cheers,
Benjamin

On Wed, Feb 21, 2018 at 4:43 PM, <[hidden email]> wrote:

> On Tuesday, January 9, 2018 at 2:12:34 AM UTC+5:30, Abhinav Jangda wrote:
> > Hello Everyone,
> >
> > I am looking for an option in SpiderMonkey to turn off the bounds check
> > emitted by JIT compiler while compiling Web Assembly code, something like
> > "wasm_no_bounds_check" and "wasm_no_stack_checks" in Google V8.
> > Unfortunately, I couldn't find any such options either using "js --help"
> > for SpiderMonkey JS Shell version JavaScript-C59.0a1 or "about:config"
> > options in Mozilla Firefox 57.0.4. Can anyone please help with turning
> the
> > checks off, this is required for a research project.
> >
> > Thank You,
> >
> > Abhinav Jangda
>
> see this
> _______________________________________________
> dev-tech-js-engine mailing list
> [hidden email]
> https://lists.mozilla.org/listinfo/dev-tech-js-engine
>
_______________________________________________
dev-tech-js-engine mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-js-engine