TY - GEN
T1 - Dynamic property caches
T2 - 29th ACM SIGPLAN International Conference on Compiler Construction, CC 2020
AU - Serrano, Manuel
AU - Findler, Robert Bruce
N1 - Publisher Copyright:
© 2020 Association for Computing Machinery.
PY - 2020/2/22
Y1 - 2020/2/22
N2 - Inline caches and hidden classes are two essential components for closing the performance gap between static languages such as Java, Scheme, or ML and dynamic languages such as JavaScript or Python. They rely on the observation that for a particular object access located at a particular point of the program, the shapes, usually referred to as the hidden classes, of accessed objects are likely to be the same. Taking benefit of that invariant, they replace the expensive lookup the semantics of these languages normally demand with one test, the inline cache, and a memory read indexed by an offset computed during the last cache miss. These optimizations are essential but they are not general enough to cope with JavaScript's proxies. In particular, when the property name is itself unknown statically, inline cache-based optimizations always take a slow path. In this paper, we show how to generalize inline caches to cope with an unknown property name. The paper first discusses the general principle of the extension and then presents the experimental results we collected using a modified version of the Hop JavaScript compiler, demonstrating how the optimization is crucial for improving the performance of proxy objects (as they naturally use dynamic property names extensively). The evaluation report shows that the modified Hop outperforms all other implementations of the language, including the most efficient commercial ones, by a factor ranging from 2× to 100×. Even better, our optimizations are applicable to existing compilers as they require only straightforward changes to runtime data structures; no complex analyses are required.
AB - Inline caches and hidden classes are two essential components for closing the performance gap between static languages such as Java, Scheme, or ML and dynamic languages such as JavaScript or Python. They rely on the observation that for a particular object access located at a particular point of the program, the shapes, usually referred to as the hidden classes, of accessed objects are likely to be the same. Taking benefit of that invariant, they replace the expensive lookup the semantics of these languages normally demand with one test, the inline cache, and a memory read indexed by an offset computed during the last cache miss. These optimizations are essential but they are not general enough to cope with JavaScript's proxies. In particular, when the property name is itself unknown statically, inline cache-based optimizations always take a slow path. In this paper, we show how to generalize inline caches to cope with an unknown property name. The paper first discusses the general principle of the extension and then presents the experimental results we collected using a modified version of the Hop JavaScript compiler, demonstrating how the optimization is crucial for improving the performance of proxy objects (as they naturally use dynamic property names extensively). The evaluation report shows that the modified Hop outperforms all other implementations of the language, including the most efficient commercial ones, by a factor ranging from 2× to 100×. Even better, our optimizations are applicable to existing compilers as they require only straightforward changes to runtime data structures; no complex analyses are required.
KW - Hidden Classes
KW - Inline Caches
KW - JavaScript
UR - http://www.scopus.com/inward/record.url?scp=85082075001&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=85082075001&partnerID=8YFLogxK
U2 - 10.1145/3377555.3377888
DO - 10.1145/3377555.3377888
M3 - Conference contribution
AN - SCOPUS:85082075001
T3 - CC 2020 - Proceedings of the 29th International Conference on Compiler Construction
SP - 108
EP - 118
BT - CC 2020 - Proceedings of the 29th International Conference on Compiler Construction
A2 - Pouchet, Louis-Noel
A2 - Jimborean, Alexandra
PB - Association for Computing Machinery, Inc
Y2 - 22 February 2020 through 23 February 2020
ER -