esm and qjs rewrite
Closed this issue · 6 comments
Some months ago i rewrote r2dec to use ESM and few other basic es6 features. The plan was to make r2dec run on top of quickjs instead of duktape. and also be loaded as a native javascript plugin for radare2, now that we ship qjs by default.
The result is 2-3 faster execution, cleaner code and it does not depend on a C compiler anymore and also works in the webassembly builds (duktape depends on globals and setjmp which is bad). But the amount of changes in the import/require statements makes it not possible to work side by side (some stuff is not ported because that was just a PoC), so a fork is required because duktape will never support es6 or esm. And that's a language change not an API one. I just have the WIP rewrite in a branch of my fork just in case someone wants to try:
But i'm opening this issue here just to discuss about options and plans for the main r2dec in order to move to this new paradigm before doing more work. I have been rebasing it without much difficulty, but supporting both engines is imho not an option.
Thoughs?
could be a good transition. i would just use es6 tho.
So how would you like to proceed?
probably i need to integrate quickjs in r2dec and remove the dukjs dependency code.
If r2dec is only suposed to run in r2 you can just relay on r2's qjs and theres no need to port the c logic to use qjs instead of duktape.
Check my pr, the js code is compiled with frida-compile (or r2frida-compile) into a single .js file that can be loaded by r2 as a plugin directly.
i haven't had chance yet to do anything, but i will
i think we can close this ticket now