Author: Antonio Cuni <anto.c...@gmail.com> Branch: extradoc Changeset: r5620:e0d0635116b3 Date: 2016-04-02 15:32 +0200 http://bitbucket.org/pypy/extradoc/changeset/e0d0635116b3/
Log: more slides diff --git a/talk/bucharest2016/jit-frontend/diagrams/architecture.svg b/talk/bucharest2016/jit-frontend/diagrams/architecture.svg new file mode 100644 --- /dev/null +++ b/talk/bucharest2016/jit-frontend/diagrams/architecture.svg @@ -0,0 +1,700 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="1685.75" + height="949.56055" + id="svg3076" + version="1.1" + inkscape:version="0.48.2 r9819" + sodipodi:docname="architecture.svg"> + <defs + id="defs3078"> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend" + style="overflow:visible"> + <path + id="path4380" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Lend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Lend" + style="overflow:visible"> + <path + id="path4374" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="matrix(-1.1,0,0,-1.1,-1.1,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow1Lend" + orient="auto" + refY="0" + refX="0" + id="Arrow1Lend" + style="overflow:visible"> + <path + id="path4356" + d="M 0,0 5,-5 -12.5,0 5,5 0,0 z" + style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none" + transform="matrix(-0.8,0,0,-0.8,-10,0)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-3" + style="overflow:visible"> + <path + inkscape:connector-curvature="0" + id="path4380-3" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-4" + style="overflow:visible"> + <path + id="path4380-1" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-2" + style="overflow:visible"> + <path + id="path4380-15" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-8" + style="overflow:visible"> + <path + id="path4380-34" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" + inkscape:connector-curvature="0" /> + </marker> + <marker + inkscape:stockid="Arrow2Mend" + orient="auto" + refY="0" + refX="0" + id="Arrow2Mend-22" + style="overflow:visible"> + <path + id="path4380-2" + style="font-size:12px;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round" + d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z" + transform="scale(-0.6,-0.6)" + inkscape:connector-curvature="0" /> + </marker> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.35355339" + inkscape:cx="1138.0708" + inkscape:cy="300.08853" + inkscape:document-units="px" + inkscape:current-layer="g4325" + showgrid="false" + inkscape:window-width="1280" + inkscape:window-height="748" + inkscape:window-x="0" + inkscape:window-y="1" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + <metadata + id="metadata3081"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer4" + inkscape:label="content" + transform="translate(48.09375,-13.439453)"> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="1877.4071" + y="21.292315" + id="text5315" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5317" + x="1877.4071" + y="21.292315">rpython</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="71.292313" + id="tspan5319">+codewriter</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="121.29231" + id="tspan5321">+jitcode</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="171.29231" + id="tspan5710">+timeline</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="221.29231" + id="tspan5712">+metatracer</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="271.29233" + id="tspan5714">+optimizer</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="321.29233" + id="tspan5716">+backend</tspan><tspan + sodipodi:role="line" + x="1877.4071" + y="371.29233" + id="tspan5720">+jitted</tspan></text> + </g> + <g + inkscape:label="rpython" + inkscape:groupmode="layer" + id="layer1" + transform="translate(584.875,133.32532)"> + <g + id="g5340" + transform="translate(0,56.011525)"> + <g + id="g5323"> + <g + id="g3908" + transform="translate(-622,-168.57143)"> + <text + sodipodi:linespacing="125%" + id="text3084" + y="246.54382" + x="106.92159" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + y="246.54382" + x="106.92159" + id="tspan3086" + sodipodi:role="line">def LOAD_GLOBAL(self):</tspan><tspan + id="tspan3088" + y="276.54382" + x="106.92159" + sodipodi:role="line"> ...</tspan></text> + <rect + y="206.6479" + x="85.714287" + height="91.428574" + width="354.28571" + id="rect3138" + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" /> + </g> + <g + transform="translate(-622,-49.999979)" + id="g3908-1"> + <text + sodipodi:linespacing="125%" + id="text3084-9" + y="246.54382" + x="106.92159" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + y="246.54382" + x="106.92159" + id="tspan3086-3" + sodipodi:role="line">def STORE_FAST(self):</tspan><tspan + id="tspan3088-8" + y="276.54382" + x="106.92159" + sodipodi:role="line"> ...</tspan></text> + <rect + y="206.6479" + x="85.714287" + height="91.428574" + width="354.28571" + id="rect3138-0" + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" /> + </g> + <g + transform="translate(-622,68.571421)" + id="g3908-16"> + <text + sodipodi:linespacing="125%" + id="text3084-3" + y="246.54382" + x="106.92159" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + y="246.54382" + x="106.92159" + id="tspan3086-0" + sodipodi:role="line">def BINARY_ADD(self):</tspan><tspan + id="tspan3088-4" + y="276.54382" + x="106.92159" + sodipodi:role="line"> ...</tspan></text> + <rect + y="206.6479" + x="85.714287" + height="91.428574" + width="354.28571" + id="rect3138-8" + style="fill:none;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none" /> + </g> + </g> + </g> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="-454.88504" + y="-103.63782" + id="text5192" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5194" + x="-454.88504" + y="-103.63782">RPYTHON</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="codewriter" + transform="translate(48.09375,-13.439453)"> + <g + id="g4343" + transform="translate(550.78125,204.20488)"> + <text + sodipodi:linespacing="125%" + id="text3084-92" + y="214.0381" + x="28.557568" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + xml:space="preserve"><tspan + id="tspan3088-3" + y="214.0381" + x="28.557568" + sodipodi:role="line">CODEWRITER</tspan></text> + <rect + y="155.21931" + x="8.5714369" + height="91.428574" + width="285.97812" + id="rect3138-7" + style="fill:none;stroke:#ff0000;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:9, 3;stroke-dashoffset:0" /> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:12.49669838;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 381.19733,405.25855 130.48659,0" + id="path4348" + inkscape:connector-curvature="0" /> + </g> + <g + inkscape:groupmode="layer" + id="layer3" + inkscape:label="jitcode" + transform="translate(48.09375,-13.439453)"> + <g + id="g5358" + transform="translate(7.9254937,0)"> + <g + transform="translate(956.78125,-444.07872)" + id="g4105"> + <g + transform="translate(2.8571441,301.42856)" + id="g3908-6"> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + x="100.07337" + y="231.73483" + id="text3084-33" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="100.07337" + y="231.73483" + id="tspan3088-9">...</tspan><tspan + id="tspan4077" + sodipodi:role="line" + x="100.07337" + y="261.73483">p0 = getfield_gc(p0, 'func_globals')</tspan><tspan + id="tspan4075" + sodipodi:role="line" + x="100.07337" + y="291.73483">p2 = getfield_gc(p1, 'strval')</tspan><tspan + id="tspan4057" + sodipodi:role="line" + x="100.07337" + y="321.73483">call(dict_lookup, p0, p2)</tspan><tspan + id="tspan4059" + sodipodi:role="line" + x="100.07337" + y="351.73483">....</tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:1.67027557;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3138-85" + width="544.94354" + height="165.82893" + x="86.099648" + y="207.03326" /> + <flowRoot + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + id="flowRoot4061" + xml:space="preserve"><flowRegion + id="flowRegion4063"><rect + y="353.79074" + x="315.71429" + height="77.14286" + width="102.85714" + id="rect4065" /></flowRegion><flowPara + id="flowPara4067"></flowPara></flowRoot> </g> + </g> + <g + id="g4105-0" + transform="translate(958.20983,-261.44707)"> + <g + transform="translate(2.8571441,301.42856)" + id="g3908-6-7"> + <text + xml:space="preserve" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + x="100.07337" + y="231.73483" + id="text3084-33-8" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="100.07337" + y="231.73483" + id="tspan3088-9-8">...</tspan><tspan + id="tspan4077-6" + sodipodi:role="line" + x="100.07337" + y="261.73483">p0 = getfield_gc(p0, 'locals_w')</tspan><tspan + id="tspan4075-1" + sodipodi:role="line" + x="100.07337" + y="291.73483">setarrayitem_gc(p0, i0, p1)</tspan><tspan + id="tspan4059-8" + sodipodi:role="line" + x="100.07337" + y="321.73483">....</tspan></text> + <rect + style="fill:none;stroke:#000000;stroke-width:1.49203587;stroke-miterlimit:4;stroke-dasharray:none" + id="rect3138-85-9" + width="544.94354" + height="132.3252" + x="86.099648" + y="207.03326" /> + <flowRoot + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + id="flowRoot4061-4" + xml:space="preserve"><flowRegion + id="flowRegion4063-2"><rect + y="353.79074" + x="315.71429" + height="77.14286" + width="102.85714" + id="rect4065-2" /></flowRegion><flowPara + id="flowPara4067-6" /></flowRoot> </g> + </g> + <g + transform="matrix(1.0073841,0,0,1,716.36172,92.764781)" + id="g4325"> + <text + sodipodi:linespacing="125%" + id="text3084-33-1" + y="346.14929" + x="341.50195" + style="font-size:24px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + id="tspan3088-9-0" + y="346.14929" + x="341.50195" + sodipodi:role="line">...</tspan><tspan + y="376.14929" + x="341.50195" + sodipodi:role="line" + id="tspan6723">promote_class(p0)</tspan><tspan + y="406.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4077-62">i0 = getfield_gc(p0, 'intval')</tspan><tspan + y="436.14929" + x="341.50195" + sodipodi:role="line" + id="tspan6727">promote_class(p1)</tspan><tspan + y="466.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4075-3">i1 = getfield_gc(p1, 'intval')</tspan><tspan + y="496.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4059-7">i2 = int_add(i0, i1)</tspan><tspan + y="526.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4242">if (overflowed) goto ...</tspan><tspan + y="556.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4246">p2 = new_with_vtable('W_IntObject')</tspan><tspan + y="586.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4248">setfield_gc(p2, i2, 'intval')</tspan><tspan + y="616.14929" + x="341.50195" + sodipodi:role="line" + id="tspan4304">....</tspan></text> + <g + transform="matrix(1,0,0,1.1400311,480.57144,-267.23566)" + id="g4105-2"> + <g + id="g3908-6-5" + transform="matrix(1,0,0,1.1954725,2.8571441,206.67858)"> + <rect + y="257.17258" + x="-155.76105" + height="227.55032" + width="540.66492" + id="rect3138-85-5" + style="fill:none;stroke:#000000;stroke-width:1.94887984;stroke-miterlimit:4;stroke-dasharray:none" /> + <flowRoot + xml:space="preserve" + id="flowRoot4061-0" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion + id="flowRegion4063-6"><rect + id="rect4065-1" + width="102.85714" + height="77.14286" + x="315.71429" + y="353.79074" /></flowRegion><flowPara + id="flowPara4067-1" /></flowRoot> </g> + </g> + </g> + </g> + <path + style="fill:none;stroke:#000000;stroke-width:12.49669838;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 874.38698,405.25855 130.48662,0" + id="path4348-5" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="1240.5885" + y="43.126953" + id="text5192-9" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5194-4" + x="1240.5885" + y="43.126953">JITCODE</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer5" + inkscape:label="timeline" + transform="translate(48.09375,-13.439453)"> + <path + style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0" + d="m -48.083261,738.03442 1685.742561,0" + id="path5619" + inkscape:connector-curvature="0" /> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="506.28845" + y="697.26794" + id="text5623" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5625" + x="506.28845" + y="697.26794" + style="fill:#800000">compile-time</tspan></text> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="557.99744" + y="804.74817" + id="text5627" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5629" + x="557.99744" + y="804.74817" + style="fill:#008000">runtime</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer6" + inkscape:label="metatracer" + transform="translate(48.09375,-13.439453)"> + <text + xml:space="preserve" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + x="1331.2896" + y="928.88922" + id="text3084-92-9" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="1331.2896" + y="928.88922" + id="tspan3088-3-5">META-TRACER</tspan></text> + <rect + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:9, 3;stroke-dashoffset:0" + id="rect3138-7-6" + width="285.97812" + height="91.428574" + x="1311.3035" + y="870.07043" /> + <path + style="fill:none;stroke:#000000;stroke-width:10.14441872;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 1446.1263,750.28419 -0.6836,86.05037" + id="path4348-5-9" + inkscape:connector-curvature="0" /> + </g> + <g + inkscape:groupmode="layer" + id="layer7" + inkscape:label="optimizer" + transform="translate(48.09375,-13.439453)"> + <text + xml:space="preserve" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + x="918.10229" + y="928.88922" + id="text3084-92-9-5" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="918.10229" + y="928.88922" + id="tspan3088-3-5-2">OPTIMIZER</tspan></text> + <rect + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:9, 3;stroke-dashoffset:0" + id="rect3138-7-6-7" + width="285.97812" + height="91.428574" + x="874.03418" + y="870.07043" /> + <path + style="fill:none;stroke:#000000;stroke-width:10.88625526;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 1289.6562,915.68014 -99.0221,0" + id="path4348-5-94" + inkscape:connector-curvature="0" /> + </g> + <g + inkscape:groupmode="layer" + id="layer8" + inkscape:label="backend" + transform="translate(48.09375,-13.439453)"> + <text + xml:space="preserve" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + x="491.6084" + y="928.88922" + id="text3084-92-9-5-0" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="491.6084" + y="928.88922" + id="tspan3088-3-5-2-7">BACKEND</tspan></text> + <rect + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:9, 3;stroke-dashoffset:0" + id="rect3138-7-6-7-1" + width="285.97812" + height="91.428574" + x="436.76486" + y="870.07043" /> + <path + style="fill:none;stroke:#000000;stroke-width:10.88625526;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 852.38686,915.68014 -99.02217,0" + id="path4348-5-94-1" + inkscape:connector-curvature="0" /> + </g> + <g + inkscape:groupmode="layer" + id="layer9" + inkscape:label="jitted" + transform="translate(48.09375,-13.439453)"> + <text + xml:space="preserve" + style="font-size:36px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans;-inkscape-font-specification:Sans" + x="29.307829" + y="928.88922" + id="text3084-92-9-5-9" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="29.307829" + y="928.88922" + id="tspan3088-3-5-2-9">ASSEMBLER</tspan></text> + <rect + style="fill:none;stroke:#00ff00;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:9, 3;stroke-dashoffset:0" + id="rect3138-7-6-7-6" + width="285.97812" + height="91.428574" + x="-0.50445831" + y="870.07043" /> + <path + style="fill:none;stroke:#000000;stroke-width:10.88625526;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-end:url(#Arrow2Mend)" + d="m 415.11751,915.68014 -99.02217,0" + id="path4348-5-94-2" + inkscape:connector-curvature="0" /> + </g> +</svg> diff --git a/talk/bucharest2016/jit-frontend/diagrams/pypytrace.svg b/talk/bucharest2016/jit-frontend/diagrams/pypytrace.svg new file mode 100644 --- /dev/null +++ b/talk/bucharest2016/jit-frontend/diagrams/pypytrace.svg @@ -0,0 +1,346 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="847.5791" + height="534.64679" + id="svg5724" + version="1.1" + inkscape:version="0.48.2 r9819" + sodipodi:docname="pypytrace.svg"> + <defs + id="defs5726" /> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.7" + inkscape:cx="592.59034" + inkscape:cy="238.97744" + inkscape:document-units="px" + inkscape:current-layer="layer13" + showgrid="false" + inkscape:window-width="1280" + inkscape:window-height="748" + inkscape:window-x="0" + inkscape:window-y="1" + inkscape:window-maximized="1" + fit-margin-top="0" + fit-margin-left="0" + fit-margin-right="0" + fit-margin-bottom="0" /> + <metadata + id="metadata5729"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:groupmode="layer" + id="layer15" + inkscape:label="content" + transform="translate(37.14286,891.38847)"> + <text + xml:space="preserve" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + x="-713.01819" + y="-786.45428" + id="text6436" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan6438" + x="-713.01819" + y="-786.45428">python</tspan><tspan + sodipodi:role="line" + x="-713.01819" + y="-736.45428" + id="tspan6440">+dis</tspan><tspan + sodipodi:role="line" + x="-713.01819" + y="-686.45428" + id="tspan6442">+trace0</tspan><tspan + sodipodi:role="line" + x="-713.01819" + y="-636.45428" + id="tspan6444">+trace1</tspan><tspan + sodipodi:role="line" + x="-713.01819" + y="-586.45428" + id="tspan6446">+trace2</tspan><tspan + sodipodi:role="line" + x="-713.01819" + y="-536.45428" + id="tspan6448">+trace3</tspan></text> + </g> + <g + inkscape:label="python" + inkscape:groupmode="layer" + id="layer1" + transform="translate(37.14286,891.38847)"> + <flowRoot + transform="translate(-881.42853,413.45203)" + xml:space="preserve" + id="flowRoot4061-4-6" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion + id="flowRegion4063-2-1"><rect + id="rect4065-2-4" + width="102.85714" + height="77.14286" + x="315.71429" + y="353.79074" /></flowRegion><flowPara + id="flowPara4067-6-1" /></flowRoot> <flowRoot + transform="translate(-878.57142,-63.29983)" + xml:space="preserve" + id="flowRoot4061-9-6" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion + id="flowRegion4063-9-2"><rect + id="rect4065-9-0" + width="102.85714" + height="77.14286" + x="315.71429" + y="353.79074" /></flowRegion><flowPara + id="flowPara4067-5-0" /></flowRoot> <flowRoot + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + id="flowRoot6192" + xml:space="preserve"><flowRegion + id="flowRegion6194"><rect + y="-101.92353" + x="-842.85712" + height="940" + width="717.14288" + id="rect6196" /></flowRegion><flowPara + id="flowPara6198"></flowPara></flowRoot> <text + xml:space="preserve" + style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + x="-37.14286" + y="-765.78998" + id="text5732" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + id="tspan5734" + x="-37.14286" + y="-765.78998">def fn():</tspan><tspan + sodipodi:role="line" + x="-37.14286" + y="-725.78998" + id="tspan5736"> c = a+b</tspan><tspan + sodipodi:role="line" + x="-37.14286" + y="-685.78998" + id="tspan5770"> ...</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer10" + inkscape:label="dis" + transform="translate(37.14286,891.38847)"> + <text + xml:space="preserve" + style="font-size:32px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + x="-39.314735" + y="-619.57458" + id="text5732-8" + sodipodi:linespacing="125%" + inkscape:transform-center-x="-25.714286" + inkscape:transform-center-y="-97.142857"><tspan + sodipodi:role="line" + x="-39.314735" + y="-619.57458" + id="tspan5736-8">LOAD_GLOBAL A</tspan><tspan + sodipodi:role="line" + x="-39.314735" + y="-579.57458" + id="tspan5764">LOAD_GLOBAL B</tspan><tspan + sodipodi:role="line" + x="-39.314735" + y="-539.57458" + id="tspan5766">BINARY_ADD</tspan><tspan + sodipodi:role="line" + x="-39.314735" + y="-499.57458" + id="tspan5768">STORE_FAST C</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer11" + inkscape:label="trace0" + transform="translate(37.14286,891.38847)"> + <g + id="g4105-5" + transform="translate(321.42858,-1421.8712)"> + <text + xml:space="preserve" + style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + x="102.93052" + y="533.16339" + id="text3084-33-6" + sodipodi:linespacing="125%"><tspan + sodipodi:role="line" + x="102.93052" + y="533.16339" + id="tspan3088-9-84">...</tspan><tspan + id="tspan4077-7" + sodipodi:role="line" + x="102.93052" + y="555.66339">p0 = getfield_gc(p0, 'func_globals')</tspan><tspan + id="tspan4075-9" + sodipodi:role="line" + x="102.93052" + y="578.16339">p2 = getfield_gc(p1, 'strval')</tspan><tspan + id="tspan4057-8" + sodipodi:role="line" + x="102.93052" + y="600.66339">call(dict_lookup, p0, p2)</tspan><tspan + id="tspan4059-4" + sodipodi:role="line" + x="102.93052" + y="623.16339">...</tspan></text> + <flowRoot + transform="translate(2.8571441,301.42856)" + style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" + id="flowRoot4061-9" + xml:space="preserve"><flowRegion + id="flowRegion4063-9"><rect + y="353.79074" + x="315.71429" + height="77.14286" + width="102.85714" + id="rect4065-9" /></flowRegion><flowPara + id="flowPara4067-5" /></flowRoot> </g> + </g> + <g + inkscape:groupmode="layer" + id="layer12" + inkscape:label="trace1" + transform="translate(37.14286,891.38847)"> + <text + sodipodi:linespacing="125%" + id="text3084-33-6-5" + y="-772.99359" + x="424.3591" + style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + id="tspan3088-9-84-1" + y="-772.99359" + x="424.3591" + sodipodi:role="line">...</tspan><tspan + y="-750.49359" + x="424.3591" + sodipodi:role="line" + id="tspan4077-7-4">p0 = getfield_gc(p0, 'func_globals')</tspan><tspan + y="-727.99359" + x="424.3591" + sodipodi:role="line" + id="tspan4075-9-6">p2 = getfield_gc(p1, 'strval')</tspan><tspan + y="-705.49359" + x="424.3591" + sodipodi:role="line" + id="tspan4057-8-5">call(dict_lookup, p0, p2)</tspan><tspan + y="-682.99359" + x="424.3591" + sodipodi:role="line" + id="tspan4059-4-2">...</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer13" + inkscape:label="trace2" + transform="translate(37.14286,891.38847)"> + <text + transform="scale(1.0036853,0.99632824)" + sodipodi:linespacing="125%" + id="text3084-33-1-3" + y="-652.034" + x="423.3837" + style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + id="tspan3088-9-0-4" + y="-652.034" + x="423.3837" + sodipodi:role="line">...</tspan><tspan + y="-629.534" + x="423.3837" + sodipodi:role="line" + id="tspan4077-62-3" + style="font-weight:bold">guard_class(p0, W_IntObject)</tspan><tspan + y="-607.034" + x="423.3837" + sodipodi:role="line" + id="tspan6717">i0 = getfield_gc(p0, 'intval')</tspan><tspan + y="-584.534" + x="423.3837" + sodipodi:role="line" + id="tspan6719" + style="font-weight:bold">guard_class(p1, W_IntObject)</tspan><tspan + y="-562.034" + x="423.3837" + sodipodi:role="line" + id="tspan4075-3-2">i1 = getfield_gc(p1, 'intval')</tspan><tspan + y="-539.534" + x="423.3837" + sodipodi:role="line" + id="tspan4059-7-0">i2 = int_add(00, i1)</tspan><tspan + y="-517.034" + x="423.3837" + sodipodi:role="line" + id="tspan4246-1" + style="font-weight:bold">guard_not_overflow()</tspan><tspan + id="tspan6279" + y="-494.534" + x="423.3837" + sodipodi:role="line">p2 = new_with_vtable('W_IntObject')</tspan><tspan + y="-472.034" + x="423.3837" + sodipodi:role="line" + id="tspan4248-1">setfield_gc(p2, i2, 'intval')</tspan><tspan + y="-449.534" + x="423.3837" + sodipodi:role="line" + id="tspan4304-5">...</tspan></text> + </g> + <g + inkscape:groupmode="layer" + id="layer14" + inkscape:label="trace3" + transform="translate(37.14286,891.38847)"> + <text + sodipodi:linespacing="125%" + id="text3084-33-8-9" + y="-424.24167" + x="424.3591" + style="font-size:18px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Monospace;-inkscape-font-specification:Monospace" + xml:space="preserve"><tspan + id="tspan3088-9-8-7" + y="-424.24167" + x="424.3591" + sodipodi:role="line">...</tspan><tspan + y="-401.74167" + x="424.3591" + sodipodi:role="line" + id="tspan4077-6-9">p0 = getfield_gc(p0, 'locals_w')</tspan><tspan + y="-379.24167" + x="424.3591" + sodipodi:role="line" + id="tspan4075-1-4">setarrayitem_gc(p0, i0, p1)</tspan><tspan + y="-356.74167" + x="424.3591" + sodipodi:role="line" + id="tspan4059-8-3">....</tspan></text> + </g> +</svg> diff --git a/talk/bucharest2016/jit-frontend/talk.rst b/talk/bucharest2016/jit-frontend/talk.rst --- a/talk/bucharest2016/jit-frontend/talk.rst +++ b/talk/bucharest2016/jit-frontend/talk.rst @@ -93,7 +93,7 @@ -Part 1 +Part 2 ------ **Overview of tracing JITs** @@ -147,3 +147,320 @@ .. animage:: diagrams/tracing-phases-p*.pdf :align: center :scale: 100% + + +Trace trees +----------- + +WRITE ME + +Part 3 +------ + +**The PyPy JIT** + +General architecture +--------------------- + +.. animage:: diagrams/architecture-p*.pdf + :align: center + :scale: 24% + + +PyPy trace example +------------------- + +.. animage:: diagrams/pypytrace-p*.pdf + :align: center + :scale: 40% + + +PyPy optimizer +--------------- + +- intbounds + +- constant folding / pure operations + +- virtuals + +- string optimizations + +- heap (multiple get/setfield, etc) + +- unroll + + +Intbound optimization (1) +------------------------- + +|example<| |small| intbound.py |end_small| |>| + +.. sourcecode:: python + + def fn(): + i = 0 + while i < 5000: + i += 2 + return i + +|end_example| + +Intbound optimization (2) +-------------------------- + +|scriptsize| +|column1| +|example<| |small| unoptimized |end_small| |>| + +.. sourcecode:: python + + ... + i17 = int_lt(i15, 5000) + guard_true(i17) + i19 = int_add_ovf(i15, 2) + guard_no_overflow() + ... + +|end_example| + +|pause| + +|column2| +|example<| |small| optimized |end_small| |>| + +.. sourcecode:: python + + ... + i17 = int_lt(i15, 5000) + guard_true(i17) + i19 = int_add(i15, 2) + ... + +|end_example| +|end_columns| +|end_scriptsize| + +|pause| + +* It works **often** + +* array bound checking + +* intbound info propagates all over the trace + + +Virtuals (1) +------------- + +|example<| |small| virtuals.py |end_small| |>| + +.. sourcecode:: python + + def fn(): + i = 0 + while i < 5000: + i += 2 + return i + +|end_example| + + +Virtuals (2) +------------ + +|scriptsize| +|column1| +|example<| |small| unoptimized |end_small| |>| + +.. sourcecode:: python + + ... + guard_class(p0, W_IntObject) + i1 = getfield_pure(p0, 'intval') + i2 = int_add(i1, 2) + p3 = new(W_IntObject) + setfield_gc(p3, i2, 'intval') + ... + +|end_example| + +|pause| + +|column2| +|example<| |small| optimized |end_small| |>| + +.. sourcecode:: python + + ... + i2 = int_add(i1, 2) + ... + +|end_example| +|end_columns| +|end_scriptsize| + +|pause| + +* The most important optimization (TM) + +* It works both inside the trace and across the loop + +* It works for tons of cases + + - e.g. function frames + + +Constant folding (1) +--------------------- + +|example<| |small| constfold.py |end_small| |>| + +.. sourcecode:: python + + def fn(): + i = 0 + while i < 5000: + i += 2 + return i + +|end_example| + + +Constant folding (2) +-------------------- + +|scriptsize| +|column1| +|example<| |small| unoptimized |end_small| |>| + +.. sourcecode:: python + + ... + i1 = getfield_pure(p0, 'intval') + i2 = getfield_pure(<W_Int(2)>, + 'intval') + i3 = int_add(i1, i2) + ... + +|end_example| + +|pause| + +|column2| +|example<| |small| optimized |end_small| |>| + +.. sourcecode:: python + + ... + i1 = getfield_pure(p0, 'intval') + i3 = int_add(i1, 2) + ... + +|end_example| +|end_columns| +|end_scriptsize| + +|pause| + +* It "finishes the job" + +* Works well together with other optimizations (e.g. virtuals) + +* It also does "normal, boring, static" constant-folding + + +Out of line guards (1) +----------------------- + +|example<| |small| outoflineguards.py |end_small| |>| + +.. sourcecode:: python + + N = 2 + def fn(): + i = 0 + while i < 5000: + i += N + return i + +|end_example| + + +Out of line guards (2) +---------------------- + +|scriptsize| +|column1| +|example<| |small| unoptimized |end_small| |>| + +.. sourcecode:: python + + ... + quasiimmut_field(<Cell>, 'val') + guard_not_invalidated() + p0 = getfield_gc(<Cell>, 'val') + ... + i2 = getfield_pure(p0, 'intval') + i3 = int_add(i1, i2) + +|end_example| + +|pause| + +|column2| +|example<| |small| optimized |end_small| |>| + +.. sourcecode:: python + + ... + guard_not_invalidated() + ... + i3 = int_add(i1, 2) + ... + +|end_example| +|end_columns| +|end_scriptsize| + +|pause| + +* Python is too dynamic, but we don't care :-) + +* No overhead in assembler code + +* Used a bit "everywhere" + + +Guards +------- + +- guard_true + +- guard_false + +- guard_class + +- guard_no_overflow + +- **guard_value** + +Promotion +--------- + +- guard_value + +- specialize code + +- make sure not to **overspecialize** + +- example: type of objects + +- example: function code objects, ... + +Conclusion +----------- + +- PyPy is cool :-) + +- Any question? _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit