王俊吉-RustConf2023-RustBelt.pptx

編號:132055 PPTX 21頁 2.63MB 下載積分:VIP專享
下載報告請您先登錄!

王俊吉-RustConf2023-RustBelt.pptx

1、第三屆中國第三屆中國Rust開發者大會開發者大會王俊吉RustBelt-Rust的形式化語義模型的形式化語義模型OutlineBackground RustBelt Project Rust Types OverviewRust SemanticsType SystemThe own PredictExclusive Ownership&Mutable BorrowExamplesRcLogics Hoare Logic Separation LogicBackgroundERC Project RustBelt2015-2021Unlike C/C+,Rust is a safe langu

2、ageBut,like C/C+,Rust is also an unsafe languageThere are guaranteed memory safety,thread safety,.There are plenty of unsafe codes in Rusts standard library.use after freedata racearray-index overflowuse after freedata racearray-index overflow?.RustBelt ProjectBackgroundRalf Jung,et.al.RustBelt:Secu

3、ring the Foundations of the Rust Programming Language.In POPL 2018:ACM SIGPLAN Symposium on Principles of Programming LanguagesRalf Jung.Understanding and Evolving the Rust Programming Language.PhD dissertation,Saarland University,August 2020Recipient of the 2020 ACM Doctoral Dissertation Award Hono

4、rable MentionRecipient of the 2021 ACM SIGPLAN John C.Reynolds Doctoral Dissertation AwardRecipient of the 2021 ETAPS Doctoral Dissertation AwardRecipient of the 2021 Otto Hahn MedalRalf JungAssistant professor,Institute for Programming Languages and Systems,ETH ZrichRustBelt ProjectBackgroundIris:A

5、 Higher-Order Concurrent Separation Logic FrameworkRustBelt:Securing the Foundations of the Rust Programming LanguageCoq Proof Assistant:A Formal Proof Management Systembuilt on top ofbuilt on top ofRust Types OverviewBackgroundT&mut mut T&Tmutable borrowimmutable borrowcoercionmovemutablereborrowre

6、borrow()dropnewexclusivesharedownsborrowsHoare LogicLogicsCPreconditionPostconditionProgramGiven the precondition“P”,if we execute the program“C”and it terminates,it will hold the postcondition“Q”.PQLogicsTrue let x=10 x=10 x=3 x+=1 x=4True loop FalseHoare LogicLogicsP:x vOwnershipWe own“x”,and“x”po

7、ints to“v”.DisjointnessGiven“(x v)(y w)”,we know that“x y”,i.e.,they do not alias.P Q Separation Logic(Iris)PQvxyP Q Magic wandConsuming resource“P”,we can reach resource“Q”.QPwhat we acually ownLogics(x v)(x w)False(x v)(x w)v=wSeparation Logic(Iris)(x=1)(y=2)(x=1)(y=2)Resources,uniqueResources,not

8、 duplicableNon-resourcesLogicsTrue let x=Box:new(1)x 1(x 1)(y 1)*x+=*y (x 2)(y 1)x drop(x)TrueSeparation Logic(Iris)Type System of Rust(selective)Rust SemanticsRust TypeRust Typeboolbool|intintboolbool|BigIntBox&a mut mut T|&a T(T1,T2)|()enum enum Type A(T1),B(T2)|enumenum Type or !|OptionAbstract m

9、achine!The own own PredictRust Semantics boolbool.own(v):=v =truetrue v =falsefalse .own(v)-A relation between a type and a list of values:=.own(v).own(v).own(v):CopyList concatentation intint.own(v)1 2.own(v):=z .v =z:=v1,v2.(v =v1+v2)1.own(v1)2.own(v2)Exclusive Ownership&Mutable BorrowsRust Semant

10、icsIt owns a location value“”;(under full borrow of lifetime“”)In Rust,T,Box can be borrowed as&a mutmut T ownown .own(v)“”points to a value of type“”;We can deallocate“”;It owns a location value“”;“”points to a value of type“”;.own .ownRc(simplified model,without weak references)ExamplesIt owns a l

11、ocation value“”;rcrc .own(v)“”points to a tuple of a counter“c”and data“w”cntdataRcAnother RcHowever,multiple Rcs can point to the same value,which breaks the uniqueness of“”.Rc:The shared_ownshared_own PredictExamples“shared_own”ties up the counter“c”and the proportion“q”of the partial tdataRcRc ca

12、n be cloned,with its cnt increased 1.Cloned Rccnt+1data rcrc .own(v)When Rc:cnt is 1,it owns the dataRc:cloneExamples rcrc .own(x)let y=x.clone()rcrc .own(x)rc rc .own(y)t+=1;let y=ptr:read(x)GoalProofsketchRc:cloneExamplesGoalRc:cloneExamplesGoalRc:cloneExamplesGoalProofsketch rcrc .own(x)rcrc .own(y)Q.E.D.let y=ptr:read(x)Thank you!

友情提示

1、下載報告失敗解決辦法
2、PDF文件下載后,可能會被瀏覽器默認打開,此種情況可以點擊瀏覽器菜單,保存網頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站報告下載后的文檔和圖紙-無水印,預覽文檔經過壓縮,下載后原文更清晰。

本文(王俊吉-RustConf2023-RustBelt.pptx)為本站 (2200) 主動上傳,三個皮匠報告文庫僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對上載內容本身不做任何修改或編輯。 若此文所含內容侵犯了您的版權或隱私,請立即通知三個皮匠報告文庫(點擊聯系客服),我們立即給予刪除!

溫馨提示:如果因為網速或其他原因下載失敗請重新下載,重復下載不扣分。
客服
商務合作
小程序
服務號
折疊
午夜网日韩中文字幕,日韩Av中文字幕久久,亚洲中文字幕在线一区二区,最新中文字幕在线视频网站