Hi, sorry, I missed your original e-mail. Well, we can take a look when we get a bit of time to do so. In general, I’m not surprised to see that self-hosted JsJs is faster than Nashorn-bootstrapped JsJs (with current Nashorn) since you made some strong reductions in semantics of what JsJs can handle (strict + single assignment).
Stack traces showing frames named “Recompilation”-something aren’t anomalous. We simply add “$Recompilation$<nnnn>” to the class names whenever we do compilation on-demand, so it would be more precise to use “$OnDemand$<nnnn>” maybe. As it happens, Nashorn defaults to lazy compilation (we compile every function when it is first invoked), so you’ll probably see that in most Nashorn-generated class names. It doesn’t mean there’s constant recompilation going on. You could catch recompilations with “--log=recompile” command line option, but those aren’t happening unless you’re also using optimistic typing, which, again, is off by default. If having “Recompilation” in class names is confusing, we might consider changing it. It used to help us to debug codegen bugs (especially since the class name also carries an ordinal number of the compilation job too so we can distinguish them and find the right one among potentially hundreds in a code dump), but is not essential; we load every compilation’s results in a separate class loader, so even <nnnn> for making it unique is not necessary. Attila. > On May 2, 2015, at 6:47 PM, Remi Forax <fo...@univ-mlv.fr> wrote: > > ping ? > > Rémi > > On 04/13/2015 09:08 AM, Remi Forax wrote: >> Hi guys, >> I've written a simple AOT compiler [1] that takes a javascript file and >> transform it to a .class file that can run with a very small runtime. It >> uses the Nashorn Parser API and also Nashorn to bootstrap itself (the AOT is >> written in JavaScript). >> >> While the runtime is fairly naive, everything is considered as an >> java.lang.Object and JS Objects are hash maps (each field is accessed >> through a double indirection), I've found that Nashorn was really slow to >> run the AOT script (jsjs.js) compared to using jsjs to compile itself, given >> that some Nashorn stacktraces seems to show recompilation on top of >> recompilation on ... etc, I think there is a bug that lies somewhere in the >> runtime of Nashorn. >> >> You can run Nashorn on jsjs.js that way: >> jjs -J-Xbootclasspath/p:lib/nashorn.jar -cp >> classes:lib/asm-debug-all-5.0.3.jar jsjs.js -- jsjs.js >> >> and jsjs on jsjs.js that way: >> java -Xbootclasspath/p:lib/nashorn.jar -cp >> .:classes:lib/asm-debug-all-5.0.3.jar jsjs jsjs.js >> >> cheers, >> Rémi >> >> [1] https://github.com/forax/jsjs >