Efficient and General On-Stack Replacement for Aggressive Program Specialization

Efficient invalidation and dynamic replacement of executing code - On-Stack Replacement (OSR), is necessary to facilitate effective, aggressive, specialization of object-oriented programs that are dynamically loaded, incrementally compiled, and garbage collected. Extant OSR mechanisms restrict the performance potential of program specialization since their implementations are special-purpose and restrict compiler optimization. In this paper, the authors present a novel, general-purpose OSR mechanism that is more amenable to optimization than prior approaches. In particular, they decouple the OSR implementation from the optimization process and update the program state information incrementally during optimization.