Previous selective dynamic compilation systems have demonstrated that dynamic compilation can achieve performance improvements at low cost on small kernels, but they have had difficulty scaling to larger programs. To overcome this limitation, we developed
An Evaluation of Staged Run-Time Optimizations in DyC
Brian Grant, Matthai Philipose, Markus Mock, Craig Chambers, and Susan J. Eggers
Department of Computer Science and Engineering
University of Washington
Box 352350, Seattle WA 98195-2350
{grant,matthai,mock,chambers,eggers}@cs.washington.edu
Abstract
Previousthatatlargerlowdynamicselectivedynamiccompilationsystemshavedemonstratedcostoncompilationsmallkernels,canachieveperformanceimprovementsselectiveprograms.cateddynamicTocompilationovercomebutthistheyhavehaddif cultyscalingtosystemlimitation,thatwedevelopedDyC,aachieveand exibleanalysesandtransformations.includesDyCmoreissophisti-muchgoodperformanceimprovementsonprogramsthatablearetoindividuallargerandmorecomplexthanthekernels.Weanalyzethemance collectively and individually.
optimizationsofDyCandassesstheirimpactonperfor-1. Introduction
Selectivedynamiccompilationtransformsselectedpartsofprogramsatruntime,usinginformationavailableonlyatruntime,tooptimizethemmorefullythanstrictlystaticallycompiledcode.(Selectivedynamiccompilationisincontrasttocompletedynamiccompilationwhereallcompilationofaprogramisdelayeduntilrun-time;recent“justintime”compilersforJavaareexamplesofcompletedynamiccompilers.)Value-speci cselectivedynamiccompilersderivetheirbene tsbyoptimizingpartsofprogramsforparticularrun-time-computedvaluesofinvariantvariablesanddatastructures(calledrun-timeconstants),ineffectperformingakindofdynamicconstantpropagationandfolding.Proposedapplicationsforselective,value-speci cdynamiccompilationincludespecializingarchitecturalsimulatorsforthecon gurationbeingsimulated,languageinterpretersfortheprogrambeinginterpreted,renderingenginesforscene-speci cstatevariables,numericprogramsfordimensionsandvaluesoffrequentlyusedarrays,andcriticalpathsinoperatingsystemsforthetypeofdatabeingprocessedandthecurrentstateofthesystem.Trendsinsoftwareengineeringtowarddynamicrecon gurability,suchasparameterizationforreuseandportabilityacrossdifferenthardwarearchitectures, also imply a promising role for dynamic compilation.Recentresearcheffortshavemadeconsiderableprogresstowardsprovingtheviabilityofselectivedynamiccompilation.Inparticular,researchershavedemonstratedthatdynamiccompilationoverheadcanbequicklyamortizedbytheincreasedef ciencyofthedynamicallyoptimizedcode.Mostexperiments,however,werecon nedtosimplekernels,anddidnotdemonstratethatthedynamiccompilationsystemscouldcopereasonablywiththeincreasedsizeandcomplexityofapplicationsliketheinterpretersand simulators mentioned above.
Thereasonscurrentsystemshavenotmadebetterprogressonlarger,morecomplexapplicationsvary,dependingontheapproach
taken.Inimperativesystems,suchas`C[12,27,28],aprogrammerexplicitlyconstructs,composes,andcompilescodefragmentsatruntime.Imperativeapproachescanexpressawiderangeofoptimizations,butimposealargeburdenontheprogrammertomanuallyprogramtheoptimizations;theprogrammingburdenmakesitdif culttoapplyimperativeapproacheseffectivelytolargerapplications.Othersystems,suchasTempo[6,26],Fabius[21],andourprevioussystem[1],followadeclarativeapproach,wheresparseuserannotationstriggeranalysesandtransformationsoftheprogram(usingpartialevaluation-styletechniques)toexploitvalue-speci cdynamiccompilation.Tokeepdynamiccompilationcostslow,thesesystemspreplanthepossibleeffectsofdynamicoptimizationsstatically,producingaspecializeddynamiccompilertunedtotheparticularpartoftheprogrambeingdynamicallyoptimized;thissortofpreplanningwecallstagingtheoptimization.Declarativeapproachesarerelativelyeasyforprogrammerstouse,butareonlyaspowerfulastheoptimizationstheyapply.Thelimitationsofpreviousdeclarativesystemspreventedthemfromcopingeffectivelywiththemoreinvolvedpatternsofcontrolanddata owfoundinsomesmallandmostlargeapplications,causingthemtomissoptimizationopportunitiesorforcingsubstantialrewriting to t the limitations of the system.
DyC(pronounceddicey)[13,14]isaselective,value-speci cdynamiccompilationsystemthathasgoodpotentialforproducingspeedupsonlarger,morecomplexCprograms.Toreducetheprogrammingburden,DyCisadeclarative,annotation-basedsystem.Tosupporteffectiveoptimization,DyCcontainsasophisticatedformofpartial-evaluationbinding-timeanalysis,includingprogram-point-speci cpolyvariantdivisionandspecialization,1anddynamicversionsoftraditionalglobalandpeepholeoptimizations.Tokeepdynamiccompilationcostslow,nearlyallofDyC’sdynamicoptimizationsarestaged,withthebulkoftheworkoftheoptimizationoccurringatstaticcompiletimeandwithnorun-timeprogramrepresentationoriterativeanalysesrequired.DyCautomaticallycachesthedynamicallycompiledcodeandreusesitwherepossible,relievinganotherprogrammerburdenandreducingdynamiccompilationoverhead.Programmerscandeclarativelyspecifypoliciesthatgoverntheaggressivenessofspecializationandcaching,enablingprogrammerstoget nercontroloverthedynamiccompilationprocesswhilepreservingthedeclarativemodel.(Inthefuture,wehopetotreatDyCasaback-endforatoolthatautomaticallydecideswheretoapplyselective,value-speci cdynamicoptimizations,generatingannotationsthatDyC then carries out.)
Thispaperassessesthebene tsandapplicabilityofDyC’sanalysesandtransformations,bothindividuallyandwhenappliedtogether,
1
Polyvariantdivisionallowsthesamepieceofcodetobeanalyzedwithdifferentcombinationsofvariablesbeingtreatedasrun-timeconstants;eachcombinationiscalledadivision.Polyvariantspecializationallowsmultiplecompiledversionsofadivisiontobeproduced,eachspecializedfordifferentvaluesoftherun-time-constantvariables.Program-point-specificpolyvarianceenablespolyvariancetoariseatarbitrarypointsinprograms, not just at function entries.
Eggers. An evaluation of staged run-time optimizations in DyC. In Proceedings of the ACM SIGPLAN ’99 Conference on Programming Language Design and ...
Eggers. An evaluation of staged run-time optimizations in DyC. In Proceedings of the ACM SIGPLAN ’99 Conference on Programming Language Design and ...
热门文档