一句话:提出偏序与初始化时间无关性原则,用可模块化、可区域调优的静态分析保障全局对象安全初始化。
面向对象语言长期受 static 成员导致的初始化错误困扰,Scala 以全局对象替代 static,但全局对象初始化仍不安全,可能出现读取未初始化字段和死锁。论文提出偏序(partial ordering)与初始化时间无关性(initialization-time irrelevance)两条基本原则,并据此设计静态分析,在编译期消除全局对象初始化错误。该分析以对象为粒度模块化进行,避免全程序分析,同时支持全局对象初始化的静态调度,从而消除运行时开销。为增强可解释性与可调性,作者引入区域(region)概念,使上下文敏感性能被程序员理解并定制。摘要未报告具体实验评估。
Object-oriented programming has been bothered by an awkward feature for a long time: static members . Static members not only compromise the conceptual integrity of object-oriented programming, but also give rise to subtle initialization errors, such as reading non-initialized fields and deadlocks. The Scala programming language eliminated static members from the language, replacing them with global objects that present a unified object-oriented programming model. However, the problem of global object initialization remains open, and programmers still suffer from initialization errors. We propose partial ordering and initialization-time irrelevance as two fundamental principles for initializing global objects. Based on these principles, we put forward an effective static analysis to ensure safe initialization of global objects, which eliminates initialization errors at compile time. The analysis also enables static scheduling of global object initialization to avoid runtime overhead. The analysis is modular at the granularity of objects and it avoids whole-program analysis. To make the analysis explainable and tunable, we introduce the concept of regions to make context-sensitivity understandable and customizable by programmers.
@article{paperbot1896,
title = {Initializing Global Objects: Time and Order},
author = {Fengyun Liu and Ondřej Lhoták and David Hua and Enze Xing},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {OOPSLA2},
year = {2023},
doi = {10.1145/3622844}
}