RUSTY: Effective C to Rust Conversion via Unstructured Control Specialization

Xiangjun Han, Baojian Hua, Yang Wang, Ziyao Zhang
{"title":"RUSTY: Effective C to Rust Conversion via Unstructured Control Specialization","authors":"Xiangjun Han, Baojian Hua, Yang Wang, Ziyao Zhang","doi":"10.1109/QRS-C57518.2022.00122","DOIUrl":null,"url":null,"abstract":"Rust is an emerging programming language designed for both performance and security, and thus many research efforts have been conducted recently to migrate legacy code bases in C/C++ to Rust to exploit Rust's safety benefits. Unfortunately, prior studies on C to Rust conversion still have three limitations: 1) complex structure; 2) code explosion; and 3) poor performance. These limitations greatly affect the effectiveness and usefulness of such conversions. This paper presents Rusty, the first system for effective C to Rust code conversion via unstructured control specialization. The key technical insight of Rusty is to implement C-style syntactic sugars on top of Rust, thus eliminating the discrepancies between the two languages. We have implemented a software prototype for Rusty and conducted experiments to evaluate the effectiveness and testify the usefulness of it by applying Rusty to micro-benchmarks, as well as 3 real-world C projects: 1) Vim; 2) cURL; and 3) the silver searcher. And experimental results demonstrated that Rusty is effective in eliminating unstructured controls, reducing the code size by 16% on average with acceptable overhead (less than 61 microseconds per line of C code).","PeriodicalId":183728,"journal":{"name":"2022 IEEE 22nd International Conference on Software Quality, Reliability, and Security Companion (QRS-C)","volume":"1 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2022-12-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"2022 IEEE 22nd International Conference on Software Quality, Reliability, and Security Companion (QRS-C)","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1109/QRS-C57518.2022.00122","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0

Abstract

Rust is an emerging programming language designed for both performance and security, and thus many research efforts have been conducted recently to migrate legacy code bases in C/C++ to Rust to exploit Rust's safety benefits. Unfortunately, prior studies on C to Rust conversion still have three limitations: 1) complex structure; 2) code explosion; and 3) poor performance. These limitations greatly affect the effectiveness and usefulness of such conversions. This paper presents Rusty, the first system for effective C to Rust code conversion via unstructured control specialization. The key technical insight of Rusty is to implement C-style syntactic sugars on top of Rust, thus eliminating the discrepancies between the two languages. We have implemented a software prototype for Rusty and conducted experiments to evaluate the effectiveness and testify the usefulness of it by applying Rusty to micro-benchmarks, as well as 3 real-world C projects: 1) Vim; 2) cURL; and 3) the silver searcher. And experimental results demonstrated that Rusty is effective in eliminating unstructured controls, reducing the code size by 16% on average with acceptable overhead (less than 61 microseconds per line of C code).
通过非结构化控制专门化实现C到Rust的有效转换
Rust是一种为性能和安全性而设计的新兴编程语言,因此最近进行了许多研究工作,将C/ c++中的遗留代码库迁移到Rust中,以利用Rust的安全优势。遗憾的是,之前关于C到Rust转换的研究仍然存在三个局限性:1)结构复杂;2)代码爆炸;3)表现不佳。这些限制极大地影响了这种转换的有效性和实用性。本文介绍了Rust,第一个通过非结构化控制专门化实现C到Rust代码有效转换的系统。Rusty的关键技术见解是在Rust之上实现c风格的语法糖,从而消除两种语言之间的差异。我们已经为Rusty实现了一个软件原型,并进行了实验来评估它的有效性,并通过将Rusty应用于微基准测试以及3个真实的C项目来证明它的有用性:1)Vim;2)旋度;3)银色探索者。实验结果表明,Rusty在消除非结构化控件方面是有效的,在可接受的开销(每行C代码少于61微秒)的情况下,平均减少了16%的代码大小。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信