Cranelift: pass compilation error messages from Baldrdash to C++
Categories
(Core :: JavaScript: WebAssembly, enhancement, P5)
Tracking
()
People
(Reporter: bbouvier, Unassigned)
References
Details
Right now, the error is displayed as an error!
message onto stdout, and C++ returns a generic message "Cranelift error in clifFunc #42".
Instead, we should probably pre-reserve a buffer of text with a fixed length in C++, pass it to Rust, who'd clamp the message's size before writing it into the buffer.
An alternative is to have Rust allocate the memory for the error message, pass it to C++, and then have C++ call back into Rust to clean up the memory. Not pretty either.
Comment 1•5 years ago
|
||
We do some basic rust to c++ string marshaling in wasmTextToBinary that could be useful here. [1] [2]
[1] https://searchfox.org/mozilla-central/rev/7fd1c1c34923ece7ad8c822bee062dd0491d64dc/source/js/src/shell/WasmTesting.cpp#58
[2] https://searchfox.org/mozilla-central/rev/7fd1c1c34923ece7ad8c822bee062dd0491d64dc/source/js/src/rust/wasm.rs#36
Updated•5 years ago
|
Description
•