-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demangle symbols when reading them out of the symbol table. #1203
Conversation
cd0e158
to
1655f39
Compare
This breaks the production build due to NekR/offline-plugin#408. |
274144a
to
1e68fd6
Compare
Codecov Report
@@ Coverage Diff @@
## master #1203 +/- ##
==========================================
+ Coverage 77.82% 77.82% +<.01%
==========================================
Files 151 151
Lines 10023 10025 +2
Branches 2449 2449
==========================================
+ Hits 7800 7802 +2
Misses 2003 2003
Partials 220 220
Continue to review full report at Codecov.
|
IT'S GREEEN!!!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this works for me! I left some comments that I feel should be addressed before landing, but I don't think they need a re-review.
I also looked at the gecko-profiler-demangle
code which looked decently straightforward for the needs here.
// wasm-bindgen), when targeting the browser + webpack, generates an ES6 module | ||
// that node cannot deal with. Most importantly, it uses the syntax | ||
// "import * as wasm from './gecko_profiler_demangle_bg';" in order to load | ||
// the wasm module, which is currently only supported by webpack. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a bug somewhere to track this feature? If so it would be nice to link it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added:
// The long-term path to make this work correctly is to wait for node to
// support ES6 modules (and WASM as ES6 modules) natively [1]. It's possible
// that in the medium term, wasm-bindgen will get support for outputting JS
// files which work in both webpack and in node natively [2].
// [1] https://medium.com/@giltayar/native-es-modules-in-nodejs-status-and-future-directions-part-i-ee5ea3001f71
// [2] https://github.com/rustwasm/wasm-bindgen/issues/233
This also adds our first wasm module and updates the configuration so that that's possible. I've used wasm-pack to publish a gecko-profiler-demangle module to npm instead of copying the generated code into this repository. I'm not sure if that was a good or a bad idea; I mostly did it so that our Flow and ESLint rules wouldn't be applied to the wasm-bindgen generated code. I've also needed to autogenerate a flow libdef for this module. wasm-bindgen doesn't create those automatically yet: rustwasm/wasm-bindgen#180 I could have created one manually and included it in the published package, but I don't know if wasm-pack would have included my additional files in the published package (via `wasm-pack publish`).
Doing demangling in perf.html has the following advantages:
This also adds our first wasm module and updates the configuration so
that that's possible.
I've used wasm-pack to publish a gecko-profiler-demangle module to npm
instead of copying the generated code into this repository. I'm not sure
if that was a good or a bad idea; I mostly did it so that our Flow and
ESLint rules wouldn't be applied to the wasm-bindgen generated code.
I've also needed to autogenerate a flow libdef for this module.
wasm-bindgen doesn't create those automatically yet:
rustwasm/wasm-bindgen#180
I could have created one manually and included it in the published
package, but I don't know if wasm-pack would have included my additional
files in the published package (via
wasm-pack publish
).Todo:
import()
, Our test infrastructure can't deal with asyncimport()
#1204[ ] add tests that verify that things get demangled(impossible because we don't have the demangler in the test suite. We could mock some fake demangling and test that it happens when getting symbols out of symbol tables, but it would be silly.)