JDK-8029373 : Move PropertyListener functionality out of PropertyMap
  • Type: Task
  • Component: core-libs
  • Sub-Component: jdk.nashorn
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2013-12-02
  • Updated: 2014-02-27
  • Resolved: 2014-02-27
Related Reports
Relates :  
Currently PropertyMap acts as PropertyListener, maintaining a collection of SwitchPoints to invalidate callsites for properties in the prototype chain. This prevents PropertyMaps to be sharable between globals/threads because proto switch points may leak memory.

After trying many different approaches it has become apparent that moving listeners out of property maps does not lead towards sharable script classes. In fact if we want to share classes in a performant way (avoiding megamorphism if possible) we have to share property maps as much as possible, and if listeners are to serve the purpose of invalidating inherited properties in such a world they have to be attached to the shared property maps, not the per-global ScriptObjects using them. To avoid memory leaks (which was one concern that lead to the creation of this bug) we'll need to make use of weak or soft references. Closing this bug as won't-fix.