Review request for JDK-8007273
Hannes Wallnoefer
hannes.wallnoefer at oracle.com
Mon Feb 4 01:14:12 PST 2013
Please review webrev for JDK-8007273 (Creation of ScriptFunctions can be
refactored):
http://cr.openjdk.java.net/~hannesw/8007273/
This introduces a ScriptFunctionData class that stores everything needed
to instantiate functions and is stored in a script class's constants array.
It also adds a dedicated ScriptFunction constructors for functions from
compiled code as opposed to other types of functions such as built-ins.
This makes code simpler since different types of functions have
different properties (e.g. built-ins don't have source or token,
compiled functions don't have to compute arity from signature...).
I also tried various forms of optimization and found the one thing that
helps is to not adapt method handle signatures into something that can
be used by used by ScriptFunction.invoke()/.construct() (which mainly
means boxing the return value to Object) right away in the constructor.
Instead the method handle is now left unchanged in ScriptFunction and
only adapted lazily for invoke()/construct(). This seems to improve
performance in earley-boyer and gbemu by something like 10-20%.
Hannes
More information about the nashorn-dev
mailing list