Closed paradite closed 1 year ago
If you add the directive "show source" to a function, Hermes will preserve its source code. For example:
function foo() {
"show source";
return 1 + 1;
}
print(foo.toString());
Thank you for the help @tmikov, let me try it out.
It seems to work, but now I am running into https://github.com/facebook/hermes/issues/612
Update:
I am able to walk around #612 by triggering a hot-reload of the file that contains "show source";
.
Feel free to close this issue.
Problem
The hermes engine is incompatible with numjs, which uses cwise library for generate cache efficient map/reduce operations.
When using
numjs
, some functions are dynamically generated by the library based on the dimensions of arguments provided.For example, for the
unpack
function here reproduced below:When using
jsc
, the functions can be generated correctly:However, using
hermes
, we got an error, presumably because the function has already been compiled to bytecode, and the generated function can't make use of it:Sample error for search indexing:
Solution
Using
jsc
can be a walkaround but withhermes
going to be default, I hope this issue can be addressed withhermes
.Some ideas:
hermes
provides some ability to opt out / exclude bytecode for certain functions?numjs
andcwise
lib to make it compatible with the wayhermes
work now?Any help on this issue would be appreciated.
Additional Context
Here's the relevant code for compiling and generating dynamic function in
cwise-compiler
:https://github.com/scijs/cwise-compiler/blob/b65933f021302e15c6d4624353bb4b69168cd543/lib/compile.js#L116-L199