Fix emrun_file_dump() to work in multithreaded builds.#26698
Fix emrun_file_dump() to work in multithreaded builds.#26698juj wants to merge 2 commits intoemscripten-core:mainfrom
Conversation
| self.assertContained('remember to add `--` between arguments', err) | ||
|
|
||
| @also_with_threads | ||
| def test_emrun(self): |
There was a problem hiding this comment.
IIRC we are not actually running these tests in CI since they got disabled a while back.
See #26182
We should certain look into fixing that.
There was a problem hiding this comment.
Thanks. Tending to that is not urgent from my pov at least.
| http.open("POST", "stdio.html?file=" + filename, true); | ||
| http.send(data); // XXX this does not work in workers, for some odd reason (issue #2681) | ||
| if (ArrayBuffer.isView(data) && typeof SharedArrayBuffer !== "undefined" && data.buffer instanceof SharedArrayBuffer) { | ||
| http.send(new data.constructor(data)); // Make a clone of the typed array of the same type, since http.send() does not allow SharedArrayBuffer backing. |
There was a problem hiding this comment.
Maybe just always go this. Its such a rare opertaion?\
Or at least do
if (.. ) {
data = new data.constructor(data);
}
http.send(data);
There was a problem hiding this comment.
Good idea with the second part.
| out(`Dumping out file "${filename}" with ${data.length} bytes of data.`); | ||
| http.open("POST", "stdio.html?file=" + filename, true); | ||
| http.send(data); // XXX this does not work in workers, for some odd reason (issue #2681) | ||
| if (ArrayBuffer.isView(data) && typeof SharedArrayBuffer !== "undefined" && data.buffer instanceof SharedArrayBuffer) { |
There was a problem hiding this comment.
It you look at getUnsharedTextDecoderView I think we can replace this whole expression with just !(data.buffer instanceof ArrayBuffer)
There was a problem hiding this comment.
In emrun_file_dump() hypothetically, data might be a regular array. Since it is invoked from the JS realm (and not C/C++), existing users might have been calling it by feeding a regular array or a typed array, or a typed array view. The comment had
// POSTs the given binary data represented as a (typed) array
so I don't want to change that. That is why the check here is conditional.
|
Re the code size failures, here was an update that happened overnight. If you rebase that should now be fixed. |
dcc4cb0 to
504c5e8
Compare
No description provided.