Asynchronous programming is widely adopted for building responsive and efficient software, and modern languages such as C# provide async/await primitives to simplify the use of asynchrony. In this paper, we propose an approach for refactoring a sequential program into an asynchronous program that uses async/await, called asynchronization. The refactoring process is parametrized by a set of methods to replace with asynchronous versions, and it is constrained to avoid introducing data races. We investigate the delay complexity of enumerating all data race free asynchronizations, which quantifies the delay between outputting two consecutive solutions. We show that this is polynomial time modulo an oracle for solving reachability in sequential programs. We also describe a pragmatic approach based on an interprocedural data-flow analysis with polynomial-time delay complexity. The latter approach has been implemented and evaluated on a number of non-trivial C# programs extracted from open-source repositories
翻译:用于建设反应灵敏、高效的软件而广泛采用非同步编程,而诸如C#等现代语言提供合成/等待原始原始语言以简化对非同步的用途。在本文中,我们提出一种方法,将一个连续程序重新纳入一个使用合成/等待的非同步程序,称为“同步”程序。重新构件过程被一套用非同步版本取代的一套方法来平衡,而且它受限制以避免引入数据竞赛。我们调查了将所有数据竞速自由同步化数据列在一起的延迟复杂性,这量化了连续两个解决方案的输出之间的延迟。我们表明,这是多元时间模版,是解决连续方案中可达性的一个标志。我们还描述了一种务实的方法,其基础是具有多时间复杂性的跨进程数据流分析。后一种方法已经实施,并评价了从开放源库提取的若干非三维的C#程序。