{"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).