Wang, KunshanBlackburn, StephenHosking, TonyNorrish, Michael2023-03-1425 March 2978-1-4503-5579-7http://hdl.handle.net/1885/287027On-stack replacement (OSR) is a performance-critical technology for many languages, especially dynamic languages. Conventional wisdom, apparent in JavaScript engines such as V8 and SpiderMonkey, is that OSR must be implemented in a low-level (i.e., in assembly) and language-specific way. This paper presents an OSR abstraction based on Swapstack, materialized as the API for a low-level virtual machine, and shows how the abstraction of resumption protocols facilitates an elegant implementation of this API on real hardware. Using an experimental JavaScript implementation, we demonstrate that this API enables the language implementation to perform OSR without the need to deal with machine-level details. We also show that the API itself is implementable on concrete hardware. This work helps crystallize OSR abstractions and, by providing a reusable implementation, brings OSR within reach for more language implementers.This research was supported (partially or fully) by the Australian Government through the Australian Research Council’s Discovery Projects funding scheme (project DP140103878).application/pdfen-AU© 2018 Copyright held by the owner/author(s)on-stack replacementSwapstacklanguage implementationfeedback-directed optimizationHop, Skip, & Jump: Practical On-Stack Replacement for a Cross-Platform Language-Neutral VM201810.1145/3186411.31864122022-01-09