Open Bug 1883881 Opened 2 years ago Updated 1 month ago

wasm32 codegen 3: introduce wasmtime driver to emulate jsshell for testing

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

ASSIGNED
Tracking Status
firefox125 --- affected

People

(Reporter: dbezhetskov, Assigned: dbezhetskov)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(1 file)

Introduce wasmtime driver to emulate jsshell to run tests.

Assignee: nobody → dbezhetskov

This is an emulator for jsshell that can be used for wasm32 target.
You can use it like jsshell, for example:

WASM32_TESTS_PATH=mozilla/js/src WASM32_MAIN_SHELL=mozilla/obj-wasm32-unknown-wasi/dist/bin/js  ./wasm32-shell --no-ion -f source.js

The wasm32-shell supports two modes - debug (cargo build) and release (cargo build --release). In debug build it dumps all jit modules to file system for debug purposes.

Severity: -- → N/A
Priority: -- → P3

I'm trying to run some tests using this patch series but I'm hitting a crash (Wasm unreachable instruction, probably from an assert failure?) right away:

cfallin@cfallin-tower:~/work/gecko-dev-2/js/src/shell/wasm32-shell% WASM32_TESTS_PATH=/home/cfallin/work/gecko-dev-2/js/src WASM32_MAIN_SHELL=../../../../obj-igalia-release/dist/bin/js target/release/wasm32-shell --no-ion -f ./concat-all-main.js
Error: error while executing at wasm backtrace:
    0: 0x59fab9 - <unknown>!js::jit::MacroAssembler::branchTestObjShape(js::jit::AssemblerWasm32::Condition, js::jit::Register, js::jit::Register, js::jit::Register, js::jit::Register, js::jit::Label*)
    1: 0x594e66 - <unknown>!js::jit::BaselineCacheIRCompiler::emitGuardShape(js::jit::ObjOperandId, unsigned int)
    2: 0x58e5f9 - <unknown>!js::jit::BaselineCacheIRCompiler::compile()
    3: 0x5a1b2d - <unknown>!js::jit::AttachBaselineCacheIRStub(JSContext*, js::jit::CacheIRWriter const&, js::jit::CacheKind, JSScript*, js::jit::ICScript*, js::jit::ICFallbackStub*, char const*)
    4: 0x5c84b5 - <unknown>!js::jit::DoSetPropFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICFallbackStub*, JS::Value*, JS::Handle<JS::Value>, JS::Handle<JS::Value>)
    5: 0x93c9 - <unknown>!<wasm function 118>
    6: 0x14a63 - <unknown>!<wasm function 297>
    7:  0x349 - <unknown>!<wasm function 0>
    8:  0xe8e - <unknown>!<wasm function 0>
    9: 0x8277d5 - <unknown>!<wasm function 18389>
   10: 0x7e8cd - <unknown>!js::Interpret(JSContext*, js::RunState&)
   11: 0x76948 - <unknown>!js::RunScript(JSContext*, js::RunState&)
   12: 0x86abf - <unknown>!js::Execute(JSContext*, JS::Handle<JSScript*>, JS::Handle<JSObject*>, JS::MutableHandle<JS::Value>)
   13: 0xfd7a0 - <unknown>!ExecuteScript(JSContext*, JS::Handle<JSObject*>, JS::Handle<JSScript*>, JS::MutableHandle<JS::Value>)
   14: 0xfd8d2 - <unknown>!JS_ExecuteScript(JSContext*, JS::Handle<JSScript*>)
   15: 0x43349 - <unknown>!RunFile(JSContext*, char const*, _IO_FILE*, CompileUtf8, bool, bool)
   16: 0x1ec96 - <unknown>!Process(JSContext*, char const*, bool, FileKind)
   17: 0x18846 - <unknown>!Shell(JSContext*, js::cli::OptionParser*)
   18: 0x10e0c - <unknown>!main
note: using the `WASMTIME_BACKTRACE_DETAILS=1` environment variable may show more debugging information

Caused by:
    wasm trap: wasm `unreachable` instruction executed

(concat-all-main.js is Octane, concatenated into one file such that it can run in the JS shell)

Dmitry, are you able to say in more detail how to run Octane benchmarks with this patchset?

For reference, I built with this mozconfig:

# Build only the SpiderMonkey JS test shell
ac_add_options --target=wasm32-wasi
ac_add_options --enable-project=js
ac_add_options --enable-application=js
ac_add_options --without-system-zlib
ac_add_options --without-intl-api
ac_add_options --disable-shared-js
ac_add_options --disable-shared-memory
ac_add_options --disable-tests
ac_add_options --disable-clang-plugin
ac_add_options --enable-jitspew
ac_add_options --enable-optimize=-O3
ac_add_options --prefix=obj-igalia-release/dist
mk_add_options MOZ_OBJDIR=obj-igalia-release

and applied this patch and its prior step (bug 1863986) on top of a clean tree from March 12.

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: dbezhetskov → nobody
Assignee: nobody → dbezhetskov
Status: NEW → ASSIGNED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: