RFR 8160034: The `this` value in the `with` is broken by the repetition of a function call

Hannes Wallnöfer hannes.wallnoefer at oracle.com
Tue Jul 19 16:20:38 UTC 2016


Please review:

Webrev: http://cr.openjdk.java.net/~hannesw/8160034/webrev.00/
Bug: https://bugs.openjdk.java.net/browse/JDK-8160034

The change in ScriptObject.megamorphicGet actually fixes the bug. It took me quite some time that it could be fixed so elegantly at this level. Before that, I tried to fix it on the Method handle level in WithObject. 

The cleanup in WithObject.lookup is a leftover from that. I noticed that it implements code paths for both named and unnamed operations, but WithObjects are always in scope, and scope operations are always named, so I added an assertion for that and removed the code handling unnamed operations.

Finally, the change in NashornGuards is to exclude properties from WithObject expressions from the special scope guards, using the ordinary map guard instead. Previously, these guards caused properties in with statements to relink even if with objects had the same map.

Thanks,
Hannes


More information about the nashorn-dev mailing list