http:^^www.cs.washington.edu^research^projects^unisw^dyncomp^www^prototype^

来自「This data set contains WWW-pages collect」· EDU^RESEARCH^PROJECTS^UNISW^DYNCOMP^WWW^PROTOTYPE^ 代码 · 共 141 行

EDU^RESEARCH^PROJECTS^UNISW^DYNCOMP^WWW^PROTOTYPE^
141
字号
Date: Tue, 10 Dec 1996 03:35:22 GMTServer: NCSA/1.4.2Content-type: text/html<html><HEAD><TITLE>The UW DC Prototype</TITLE></HEAD><body bgcolor="#FFFFFF" TEXT="#11381A" LINK="#EE0000" VLINK="#952045" ALINK="#000000"><H1>Our Dynamic Compilation Prototype</H1><p>Phased compilation is a compilation strategy in which the codecompilation process is completed in stages: at traditional, static,compile-time, at link-time, at load-time, and (on demand) at run-time.By delaying some portion of the compilation process, we can takeadvantage of information available only at the later stages.  So, theprimary goal of phased compilation is to generate better code,thereby improving performation.  This is in contrast to incrementalcompilation, the primary goal of which is to reduce compilation time,especially recompilation time.<p>The portion of compilation postponed until run-time is called<em>dynamic compilation</em>.  Profs. <!WA0><!WA0><!WA0><!WA0><AHREF="http://www.cs.washington.edu/homes/eggers">Susan Eggers</a> and<!WA1><!WA1><!WA1><!WA1><ahref="http://www.cs.washington.edu/people/faculty/chambers.html">CraigChambers</a> and <!WA2><!WA2><!WA2><!WA2><a href="http://www.cs.washington.edu/research/projects/unisw/DynComp/www/Prototype/people.html">several students</a> make upthe University of Washington Dynamic Compilation Group.  We arefocusing on optimizing code performance at run-time using informationavailable only at run-time.  In particular, we are currentlyconsidering <!WA3><!WA3><!WA3><!WA3><ahref="http://www.cs.washington.edu/homes/pardo/papers.d/eval-vso.html">value-basedspecialization</a>.<p>Two separate compilers are involved in our model of dynamiccompilation: a static compiler and a dynamic compiler.  The staticcompiler compiles code outside of regions of code to be dynamicallycompiled, called <em>dynamic regions</em>, and partially compiles andotherwise prepares dynamic regions to be compiled at run-time.  Thedynamic compiler uses the partially compiled dynamic regions and otherinformation generated by the static compiler to generate executablecode for the dynamic regions.<p>For our prototype dynamic compilation system, designed and built by<!WA4><!WA4><!WA4><!WA4><a href="http://www.cs.washington.edu/homes/ausland">JoelAuslander</a> and <!WA5><!WA5><!WA5><!WA5><ahref="http://www.cs.washington.edu/homes/matthai">MatthaiPhilipose</a>, we have enhanced the Multiflow compiler to act as thestatic compiler, and built a dynamic compiler that is automaticallyinvoked at run-time.  Dynamic regions are identified by the programmerthrough a set of source-code annotations.  For each dynamic region,the programmer also specifies on which variables the region should bespecialized.  A new version of the region is compiled at run-time foreach set of values these variables have at the beginning of thedynamic region.  Furthermore, these annotated variables must beinvariant throughout the dynamic region, and are called <em>run-timeconstants</em>.<p>The static compiler automatically identifies all values in theregion that are derived from this programmer-specified set of run-timeconstants, which can then be considered run-time constants (and can beused as the basis for specialization) as well.  In particular, if thearguments to an arithmetic operation, a comparison, or even a memoryload are compile-time and run-time constants, then the result isassumed to be a run-time constant.<p><center><!WA6><!WA6><!WA6><!WA6><img width=100% align=middle src="http://www.cs.washington.edu/research/projects/unisw/DynComp/www/Prototype/prototype.gif"></center><p>The static compiler then splits each dynamic region into two piecesof code, <em>set-up code</em> and machine-code <em>templates</em>.Set-up code includes all computations in the region that depend,directly or indirectly, solely on compile-time and run-timeconstants. Machine-code templates include all computations in theregion that depend at least in part on run-time varyingdata. References in the machine-code templates to run-time constantscannot be resolved at static compile time, since their values are notdetermined until run time; therefore the machine-code templatescontain holes in place of these values. The static compiler alsooutputs a series of directives to the dynamic compiler that indicatehow to turn the machine-code templates into correct executable code,given the static values computed by the set-up code.<p>At run time, when a dynamic region is first entered, the dynamiccompiler is invoked. The dynamic compiler first executes the region'sset-up code to calculate the values of the run-time constants. It thenexecutes the directives, selecting and copying the desiredmachine-code templates and filling in the holes based on the valuescomputed by the set-up code, to produce the final optimized machinecode for the dynamic region.  This machine code is then run tocontinue the program's execution. For all future executions of thedynamic region with the same run-time-constant values, the generatedmachine code is executed directly without invoking the dynamiccompiler or the set-up code.<p>Generally, the more time spent optimizing code at run-time, the higherthe quality of code generated.  However, the time spent optimizingcode at run-time must be recovered through the speedups gained throughthe optimizations.  So, it is desirable to make the dynamic compileras fast as possible while still achieving significant benefits fromthe optimizations.<p>Our dynamic compiler only manipulates "nearly compiled" templates,and so is designed to be very fast.  Even so, it can perform a numberof optimizations, thus producing fast code.  The dynamic compiler cancomplete the constant propagation and folding planned by the staticcompiler, eliminate memory loads of the run-time constants, performpeephole optimizations based on their values, remove branches theydetermine, and fully unroll loops they bound.  Full unrolling of aloop causes the loop-induction variables to become run-time constantswithin each iteration, creating more opportunities for optimization.<p>However, even if the dynamic compiler is very fast and the codegenerated is very efficient, the code that is dynamically compiledwill generally have to be executed many times in order to recoup thecost of dynamic compilation through enhanced performance.  For thisreason, the regions of code to be specialized at run-time and thevariables on which the dynamic compiler is to specializemust be carefully selected.  If not much improvement can be achievedby dynamically compiling an annotated region, or if the annotatedrun-time constants take on new values too frequently, then performancewill be worse than purely statically compiled code.  So, selectingdynamic regions and run-time constants is a delicate task, which iswhy we elected to use annotations with our prototype, rather thanselecting regions and run-time constants automatically.<p>For more detailed information about our prototype, please see our<!WA7><!WA7><!WA7><!WA7><a href="http://www.cs.washington.edu/research/projects/unisw/DynComp/www/Prototype/Papers/pldi96.ps.Z">PLDI paper</a>.<h5><!WA8><!WA8><!WA8><!WA8><img width=100% height=5 border=0 src="http://www.cs.washington.edu/research/projects/unisw/DynComp/www/dot-green.gif"><br><a target="_top" href="../"><!WA9><!WA9><!WA9><!WA9><img align=right src="http://www.cs.washington.edu/research/projects/unisw/DynComp/www/back-arrow.gif" border=0></a>Last updated August 8, 1996.<br><!WA10><!WA10><!WA10><!WA10><a href="mailto:grant@cs.washington.edu">Brian Grant (<em>grant@cs.washington.edu</em>)</a></h5></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?