arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2303.10515cs.PLcs.SE
收藏

所有权引导的C到Rust转换

Ownership guided C to Rust translation

Hanliang Zhang, Cristina David, Yijun Yu, Meng Wang

摘要:

Rust被称为更安全的C,是一种现代程序设计语言,它结合了内存安全和低级控制。这种有趣的组合使得Rust在开发人员中非常受欢迎,并且将遗留代码库(通常在C中)迁移到Rust的趋势越来越明显。在本文中,我们提出了一种以静态所有权分析为中心的C到Rust转换方法。我们设计了一套分析,推断C指针的所有权模型,并自动将指针转换为安全的Rust等价物。由此产生的工具Crown可扩展到真实世界的代码库(不到10秒即可完成50万行代码),并实现了高转换率。

英文摘要:

Dubbed a safer C, Rust is a modern programming language that combines memory safety and low-level control. This interesting combination has made Rust very popular among developers and there is a growing trend of migrating legacy codebases (very often in C) to Rust. In this paper, we present a C to Rust translation approach centred around static ownership analysis. We design a suite of analyses that infer ownership models of C pointers and automatically translate the pointers into safe Rust equivalents. The resulting tool, Crown, scales to real-world codebases (half a million lines of code in less than 10 seconds) and achieves a high conversion rate.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑