arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2401.08264cs.SEcs.PL
收藏

面向 C/C++ 到更安全 Rust 的转译器

Towards a Transpiler for C/C++ to Safer Rust

Dhiren Tripuramallu, Swapnil Singh, Shrirang Deshmukh, Srinivas Pinisetty, Shinde Arjun Shivaji, Raja Balusamy, Ajaganna Bandeppa

AI总结:

本文研究将 C/C++ 代码稳健安全地转译为 Rust 的方法,通过手动转译总结对应关系并构建转译表,同时分析现有自动化转译器的不足,最终在不牺牲性能与可靠性的前提下提升内存安全性。

摘要:

Rust 是由 Mozilla 开发的一种多范式编程语言,注重性能与安全性。Rust 代码最为人所知的特点是其运行速度和内存安全性,而内存安全性在开发嵌入式系统时至关重要。因此,Rust 成为开发嵌入式设备操作系统时的替代方案之一。如何将现有 C++ 代码库转换为 Rust 也正受到越来越多的关注。在本工作中,我们重点关注以稳健且安全的方式将 C++ 代码转译为 Rust 代码库的过程。我们通过手动转译过程来理解 Rust 语言的不同构造及其与 C++ 构造的对应关系。基于手动转译的经验,我们创建了一个转译表,以辅助未来的转译工作并用于开发自动化转译器。我们还研究了现有的自动化转译器,并识别出其中存在的问题和低效之处。我们对转译过程的结果进行了密切监测和评估,结果表明在未损害生成代码库性能和可靠性的前提下,内存安全性得到了提升。本研究最后对发现进行了全面分析,评估了其对未来研究的影响,并就该领域未来的研究提出了建议。

英文摘要:

Rust is a multi-paradigm programming language developed by Mozilla that focuses on performance and safety. Rust code is arguably known best for its speed and memory safety, a property essential while developing embedded systems. Thus, it becomes one of the alternatives when developing operating systems for embedded devices. How to convert an existing C++ code base to Rust is also gaining greater attention. In this work, we focus on the process of transpiling C++ code to a Rust codebase in a robust and safe manner. The manual transpilation process is carried out to understand the different constructs of the Rust language and how they correspond to C++ constructs. Based on the learning from the manual transpilation, a transpilation table is created to aid in future transpilation efforts and to develop an automated transpiler. We also studied the existing automated transpilers and identified the problems and inefficiencies they involved. The results of the transpilation process were closely monitored and evaluated, showing improved memory safety without compromising performance and reliability of the resulting codebase. The study concludes with a comprehensive analysis of the findings, an evaluation of the implications for future research, and recommendations for the same in this area.

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

↑