ecma262 icon indicating copy to clipboard operation
ecma262 copied to clipboard

Normative: Spec liveness constraint for template objects

Open syg opened this issue 2 years ago • 3 comments

The Lit framework depends on the identity of template arrays being stable (and not being recreated) so long as the site might still get evaluated in the future.

This PR removes the incorrect note about observability of template array objects and tries to spec normative liveness constraints. Firstly, the collection of template objects is most definitely now observable because of WeakRefs. The intention IIRC was that so long as the template site could still be evaluated, we can't GC the template object, but if the template site could no longer be evaluated (what I understand to be meant by "the Parse Node is unreachable), then we can GC it.

Instead of depending on this misleading note about observability, this PR specs the liveness of Parse Nodes, and directly specs the removal from the template registry if the Parse Nodes are no longer live.

cc @leszekswirski and @justinfagnani

Also see v8:13190

syg avatar Nov 12 '22 00:11 syg

Would appreciate reviews from Kevin and Waldemar, who've thought deeply about our liveness definition in the past.

syg avatar Nov 14 '22 19:11 syg

What does it mean to "observe the identity" of a Parse Node in any valid Future Execution? If this means "same Parse Node" comparisons, then GetTemplateObject always observes the identities of all Parse Nodes in a Realm, so how can any cease to be live?

waldemarhorwat avatar Nov 22 '22 00:11 waldemarhorwat

@waldemarhorwat I had intended "observe the identity" of a Parse Node to mean the "same Parse Node" comparison. But that indeed is buggy as written, because the template registry is specced as an associative list, this means GetTemplateObject observes the identity of every Parse Node in the [[TemplateMap]].

My intention here was to only count the Parse Node passed as the argument to GetTemplateObject as "observed". I am not sure what the best way to capture that intention is currently.

syg avatar Nov 22 '22 21:11 syg