A relational approach to interprocedural shape ana

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

ARelationalApproachtoInterproceduralShapeAnalysisBertrandJeannet,AlexeyLoginov,ThomasReps,andMoolySagivIRISA;Bertrand.Jeannet@irisa.frComp.Sci.Dept.,Univ.ofWisconsin;alexey,reps@cs.wisc.eduSchoolofComp.Sci.,Tel-AvivUniv.;msagiv@post.tau.ac.ilAbstract.Thispaperaddressestheverificationofpropertiesofimperativeprogramswithrecursiveprocedurecalls,heap-allocatedstorage,anddestructiveupdatingofpointer-valuedfields—i.e.,interproceduralshapeanalysis.Itpresentsawaytoapplysomepreviouslyknownapproachestointerproceduraldataflowanalysis—whichinpastworkhavebeenap-pliedonlytoamuchlessrichsetting—sothattheycanbeappliedtoprogramsthatuseheap-allocatedstorageandperformdestructiveupdating.1IntroductionThispaperconcernstechniquesforstaticanalysisofrecursiveprogramsthatmanipulateheap-allocatedstorageandperformdestructiveupdatingofpointer-valuedfields.Thegoalistorecovershapedescriptorsthatprovideinformationaboutthecharacteristicsofthedatastructuresthataprogram’spointervariablescanpointto.Suchinformationcanbeusedtohelpprogrammersunderstandcertainaspectsoftheprogram’sbehavior,toverifypropertiesoftheprogram,andtooptimizeorparallelizetheprogram.Theworkreportedinthepaperbuildsonpastworkbyseveraloftheauthorsonstaticanalysisbasedon-valuedlogic[20,12,16].Inthissetting,tworelatedlogicscomeintoplay:anordinary-valuedlogic,aswellasarelated-valuedlogic.Amemoryconfiguration,orstore,ismodeledbywhatlogicianscallalogicalstructure,whichconsistsofapredicate(i.e.,arelationofappropriatearity)foreachpredicatesymbolofavocabulary.Astoreismodeledbya-valuedlogicalstructure;asetofstoresisabstractedbya(finite)setofbounded-size-valuedlogicalstructures.Anindividualofa-valuedstructure’suniverseeithermodelsasinglememorycellor,inthecaseofasummaryindividual,acollectionofmemorycells.Theconstraintofworkingwithlimited-sizedescriptorsentailsalossofinformationaboutthestore.Certainpropertiesofconcreteindividualsarelostduetoabstraction,whichgroupstogethermultipleindividualsintosummaryindividuals:apropertycanbetrueforsomeconcreteindividualsofthegroupbutfalseforotherindividuals.Itisforthisreasonthat-valuedlogicisused;uncertaintyaboutaproperty’svalueiscapturedbymeansofthethirdtruthvalue,.Oneoftheopportunitiesforscalingupthisapproachistoexploitthecompositionalstructureofprograms.Ininterproceduraldataflowanalysis,oneavenueforaccomplish-ingthisistocreateasummarytransformerforeachprocedure,andusethesummarytransformerateachcallsiteatwhichiscalled.Eachsummarytransformermustcapture(anover-approximationof)theneteffectofacallon.Tobeabletocreatesummarytransformers,theabstracttransformersforindividualtransitionsmusthavea“composablerepresentation”;thatis,giventherepresentationsoftwoabstracttrans-formers,itmustbepossibletorepresenttheircompositionasanobjectofroughlythesamesize.Onethencarriesoutafixed-point-findingprocedureonacollectionofequa-tionsinwhicheachvariableintheequationsethasatransformer-valuedvalue—i.e.,avaluedrawnfromthedomainoftransformers—ratherthanadataflowvalueproper.Anumberofapproachestointerproceduraldataflowanalysisbasedonsummarytransformersareknown[4,21,11,15,19,17].However,notallprogram-analysisprob-lemshaveabstracttransformersthathaveacomposablerepresentation.Forsomeproblems,itispossibletoaddressthisissuebyworkingpointwise,tabulat-ingcomposedtransformersassetsofpairsofinput/outputvalues[15,19,2].However,forinterproceduralshapeanalysis,thisapproachfailstoproduceusefulinformation.The-valued-logicapproachtoshapeanalysisisastorelessone:individuals,whichmodelmemorycells,donothavefixedidentities;theyareidentifiedonlyuptotheir“distinguishingcharacteristics”,namely,theirvaluesforaspecificsetofunarypredi-cates.Becausethese“distinguishingcharacteristics”canchangeduringthecourseofaprocedurecall,thereisnowaytoidentifyindividualsinaninputabstractstructurewiththeircorrespondingindividualsintheoutputabstractstructure.Inessence,apairofinput/output-valuedstructureslosestrackofthecorrelationsbetweentheinputandoutputvaluesofanindividual’sunarypredicates.Consequently,anapproachbasedontabulatingcomposedtransformersassetsofpairsof-valuedstructuresisnotpromis-ing:therepresentationprovidesonlyaweakcharacterizationofaprocedure’sneteffect.Allisnotlost,however:insteadof“abstractingandthenpairing”(asdiscussedabove),thesolutionisto“pairandthenabstract”.Observation1.Byusing-valuedstructuresoveradoubledvocabulary,whereanddenotesdisjointunion,oneobtainsafiniteabstractionthatrelatesthepredicatevaluesforanindividualatthebeginningofatransitiontothepredicatevaluesfortheindividualattheendofthetransition.Thisabstractionprovidesawaytocreatemuchmoreaccuratecomposablerepresen-tationsoftransformers,andhencemuchmoreaccuratesummarytransformers,forabroadclassofproblems.Moreover,byextendingtheabstractdomainof-valuedlog-icalstructures[20]withsomenewoperations,itispossibletoperformabstractinter-pretationofcallandreturnstatementswithoutlosingtoomuchprecision(see4).Wehaveusedtheseideastocreateacontext-sensitiveshape-analysisalgorithmforrecur-siveprogramsthatmanipulateheap-

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功