Issue with cached/compiled function signatures

Jesse Schulman jesse at dreamtsoft.com
Mon Jun 26 22:23:56 UTC 2017


In our application we expose some of our java classes to javascript via the
JSObject interface, one of which provides a commons-js type require
function.  We also use Class from prototypejs and most of the javascript
that is returned from require calls is returning a "Class" that is created
by Class.create() from prototypejs.

We recently started having an issue when a certain code pattern is hit
where it seems that an incorrect signature is cached for the klass function
that is part of the constructor functionality of Class.create, we found
that accessing arguments within the klass function seems to prevent that
caching, but this seems to be a workaround for what feels like a bigger
issue.

We have reproduced this outside our application and pushed to a github repo
https://github.com/jesseschulman/nashorn_issue, along with some debugging
notes in the readme.

Note that this repo represents our code path that caused the issue, but it
seems the same issue happens with other code paths, such as not involving
SubClass.js and only calling SuperClass.js (as noted in comments).

In Class.js there are two fixes commented out starting at line 33, they
both workaround/resolve our issue but seem to produce slightly different
invoker signatures for the MethodHandle as noted in the comments.

Please let me know if there are any questions or if there is more
information that we can provide to help with this.

Thanks!
Jesse


More information about the nashorn-dev mailing list