<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>编译点滴 &#187; JIT</title>
	<atom:link href="http://www.lingcc.com/tag/jit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.lingcc.com</link>
	<description>编译器、虚拟机、程序设计语言、体系结构、软件调试、操作系统等等</description>
	<lastBuildDate>Sat, 04 Feb 2012 06:56:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</title>
		<link>http://www.lingcc.com/2011/10/09/11773/</link>
		<comments>http://www.lingcc.com/2011/10/09/11773/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 08:03:53 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[编译器相关招聘信息]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[Job]]></category>
		<category><![CDATA[Qualcomm]]></category>
		<category><![CDATA[virtual mach]]></category>
		<category><![CDATA[WebKit]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11773</guid>
		<description><![CDATA[SOURCE: https://jobs.qualcomm.com/public/jobDetails.xhtml?requisitionId=1887529&#38;page=jobSearch Division Qualcomm CDMA Technology Job Area Engineering &#8211; Software Location California &#8211; San Diego Job Function The JIT compiler and Virtual Machines team in the Web Technologies group at Qualcomm Innovation Center focuses on development and optimization of software virtual machines (both interpreter and JIT compiler based), for languages like Java, JavaScript, Action <a href='http://www.lingcc.com/2011/10/09/11773/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WebKit和Firefox的JavaScript性能对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F12%2F9946%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GNOME 2.22 抢先预览</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F05%2F08%2F11580%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">JAVA虚拟机入门</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/03/04/11545/' rel='bookmark' title='AMD intern and full time compiler position based on OpenCL and LLVM'>AMD intern and full time compiler position based on OpenCL and LLVM</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11108/' rel='bookmark' title='MNC need compiler expert'>MNC need compiler expert</a></li>
<li><a href='http://www.lingcc.com/2011/09/20/11745/' rel='bookmark' title='美国国家仪器（NI）招聘信息'>美国国家仪器（NI）招聘信息</a></li>
<li><a href='http://www.lingcc.com/2011/05/23/11595/' rel='bookmark' title='能给H1B签证的编译器及模拟器职位&#8211;Compilers jobs at Tensilica'>能给H1B签证的编译器及模拟器职位&#8211;Compilers jobs at Tensilica</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11104/' rel='bookmark' title='Pathscale招聘Fortran编译器背景工程师'>Pathscale招聘Fortran编译器背景工程师</a></li>
<li><a href='http://www.lingcc.com/2011/01/14/11511/' rel='bookmark' title='AMD招聘Open64编译器开发工程师&#8211;北美'>AMD招聘Open64编译器开发工程师&#8211;北美</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>SOURCE: <a title="https://jobs.qualcomm.com/public/jobDetails.xhtml?requisitionId=1887529&amp;page=jobSearch" href="https://jobs.qualcomm.com/public/jobDetails.xhtml?requisitionId=1887529&amp;page=jobSearch">https://jobs.qualcomm.com/public/jobDetails.xhtml?requisitionId=1887529&amp;page=jobSearch</a></p>
<table cellspacing="0">
<tbody>
<tr>
<td width="20%">Division</td>
<td width="80%"><a href="http://www.qualcomm.com/qct/index.html">Qualcomm CDMA Technology</a></td>
</tr>
<tr>
<td width="20%">Job Area</td>
<td width="80%">Engineering &#8211; Software</td>
</tr>
<tr>
<td width="20%">Location</td>
<td width="80%">California &#8211; San Diego</td>
</tr>
<tr>
<td width="20%">Job Function</td>
<td width="80%">The JIT compiler and Virtual Machines team in the Web Technologies group at Qualcomm Innovation Center focuses on development and optimization of software virtual machines (both interpreter and JIT compiler based), for languages like Java, JavaScript, Action Script, etc, commonly used in Web Browsers, for Qualcomms various MSM platforms. This role requires the following essential duties and responsibilities:</p>
<ul>
<li>Research, design, develop, enhance, and implement the different components of the software in a virtual machine by efficiently utilizing/interfacing the HW in Qualcomms SOCs, leading to optimized performance, power, memory usage, and user experience.</li>
<li>Collaborate with chipset architecture and hardware engineers, and come up with software solutions best suited for Qualcomms SOCs.</li>
<li>Develop and execute benchmark and test scenarios for the virtual machines based on the different use-cases in a web browser.</li>
<li>Work with Product and Systems teams to understand and improve the design and working of the software involved in the virtual machines.</li>
<li>Analyze and identify system level integration issues, interface with the browser integration and test teams.</li>
<li>Follow Qualcomms open source design practices</li>
<li>Keep up with the web technology landscape (HTML5, CSS, JavaScript, etc) and help drive design aspects of Qualcomm CDMA Technology&#8217;s (QCT) chipsets necessary for supporting these technologies</li>
<li>Plan and integrate new features into the software for virtual machines based on open web standards such as W3C and the language standards (e.g. ECMA for JavaScript).</li>
</ul>
</td>
</tr>
<tr>
<td width="20%">Skills/Experience</td>
<td width="80%">
<ul>
<li>Experience in compiler development &#8211; compiler intermediate representations, machine independent and machine dependent optimizations, instruction selection, scheduling, register-allocation, back-end optimizations.</li>
<li>Working knowledge of Operating System concepts, process/thread, memory management, garbage collection algorithms, threads scheduling.</li>
<li>Working knowledge of assemblers, linkers, loaders, object file formats, instruction set simulators and experience using them.</li>
<li>Knowledge of the structure &amp; function of the virtual machine internals byte-code formats, heap, constant pool resolution, garbage collection, execution mechanisms, etc.</li>
<li>Understanding of the compilation challenges and potential solutions for languages like Java (e.g., dynamic dispatch, polymorphism, inline caching) and JavaScript (e.g., dynamic types, dynamic addition/deletion of properties/values to objects, prototype based inheritance).</li>
<li>Knowledge of computer architectures &#8211; pipeline structure &amp; hazards, cache &amp; memory organization, etc.</li>
<li>Knowledge of the software architecture and internals of a web browser, JavaScript to Webkit bindings, JavaScript engines interaction with DOM and Plugins.</li>
<li>Strong background in embedded software development, experience in assembly language programming and optimization.</li>
<li>5 to 10 years of programming experience in C/C++.</li>
<li>Should have exposure to large scale software build, integration and test environments</li>
<li>Strong communication and interpersonal skills required</li>
</ul>
</td>
</tr>
<tr>
<td width="20%">Responsibilities</td>
<td width="80%">
<ul>
<li>Knowledge and experience in Android or Chrome OS mobile platforms.</li>
<li>ARM architecture knowledge and assembly code optimization experience.</li>
<li>Experience with scripting languages used in build systems and hands-on experience on debugging embedded systems.</li>
<li>Experience with JTAG and ICE debuggers</li>
</ul>
</td>
</tr>
<tr>
<td width="20%">Education Requirements</td>
<td width="80%">Masters degree in Computer Science, Computer Engineering or related field, with experience in the technical domain. PhD degree and research work in the related technical area also encouraged. Candidates close to graduating with Masters or PhD in Computer Science/Engineering with project experience in the technical area can also apply.</td>
</tr>
</tbody>
</table>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">WebKit和Firefox的JavaScript性能对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F12%2F9946%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GNOME 2.22 抢先预览</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F05%2F08%2F11580%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">JAVA虚拟机入门</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2011/03/04/11545/' rel='bookmark' title='AMD intern and full time compiler position based on OpenCL and LLVM'>AMD intern and full time compiler position based on OpenCL and LLVM</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11108/' rel='bookmark' title='MNC need compiler expert'>MNC need compiler expert</a></li>
<li><a href='http://www.lingcc.com/2011/09/20/11745/' rel='bookmark' title='美国国家仪器（NI）招聘信息'>美国国家仪器（NI）招聘信息</a></li>
<li><a href='http://www.lingcc.com/2011/05/23/11595/' rel='bookmark' title='能给H1B签证的编译器及模拟器职位&#8211;Compilers jobs at Tensilica'>能给H1B签证的编译器及模拟器职位&#8211;Compilers jobs at Tensilica</a></li>
<li><a href='http://www.lingcc.com/2010/07/20/11104/' rel='bookmark' title='Pathscale招聘Fortran编译器背景工程师'>Pathscale招聘Fortran编译器背景工程师</a></li>
<li><a href='http://www.lingcc.com/2011/01/14/11511/' rel='bookmark' title='AMD招聘Open64编译器开发工程师&#8211;北美'>AMD招聘Open64编译器开发工程师&#8211;北美</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2011/10/09/11773/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>webkit-龙小组成立</title>
		<link>http://www.lingcc.com/2010/07/10/11060/</link>
		<comments>http://www.lingcc.com/2010/07/10/11060/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 02:56:23 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[main]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[Squirrelfish]]></category>
		<category><![CDATA[webkit-龙]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=11060</guid>
		<description><![CDATA[自从龙芯N32系统上的Squirrelfish性能发布后，得到了很多朋友的支持，汇报最新进展： webkit-龙移植优化小组成立，dancefish和philip兄加入。dancefish兄对webkit在嵌入式系统上的移植和裁剪经验丰富，philip兄对webkit在andorid系统下的编译调试也有丰富经验。几番邮件交流之后,根据个人的兴趣爱好和实际工作，大致分了一下，dancefish和philip侧重webkit中的webcore部分，以及浏览器的验证。我将侧重JavaScript部分的JIT。这个分工只是大致而已。大家都是凭自己的热心兴趣在做。 webkit的现状：gentoo emerge的 webkit-qt,webkit-gtk现在能编译，运行能弹出浏览器框，但经常bus error崩溃。怀疑和这个bug有关。 机器问题:dancefish有机器，philip兄的机器，下周联系一下龙梦，看能否再给邮寄一台。 感谢zsc顾问提供的建议，解决了关于date的bug，现在squirrelfish的解释器只剩下一个 bug  ecma/Math/15.8.2.17.js. 感谢lei兄的建议，但最近从webkit svn库同步代码之后，我的龙芯小本在最后ld ../lib/libQtWebKit.so.4.8.0时报错final link failed:Bad value.所以没能尝试你的建议。 而且这个ld除了报fail link外再也没有其他任何错误提示。跟踪了一下内存使用情况，物理内存耗尽了，swap分区是开着的，但ld好像并没有使用swap分区。估计是因为这个原因导致的出错。 创建了webkit-ls的git 代码库。  http://gitorious.org/webkit-ls 相关文章： 龙芯N32系统上的Squirrelfish性能 WebKit和Firefox的JavaScript性能对比 宏和内联函数 拥有Nanojit龙芯后端的firefox发布(10年1月14日更新) 使用crossdev安装龙芯的O32 gnu交叉工具链 JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/10/09/11296/' rel='bookmark' title='宏和内联函数'>宏和内联函数</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>自从<a title="Permalink to 龙芯N32系统上的Squirrelfish性能" rel="bookmark" href="http://www.lingcc.com/2010/06/28/10983/">龙芯N32系统上的Squirrelfish性能</a>发布后，得到了很多朋友的支持，汇报最新进展：</p>
<ol>
<li>webkit-龙移植优化小组成立，dancefish和philip兄加入。dancefish兄对webkit在嵌入式系统上的移植和裁剪经验丰富，philip兄对webkit在andorid系统下的编译调试也有丰富经验。几番邮件交流之后,根据个人的兴趣爱好和实际工作，大致分了一下，dancefish和philip侧重webkit中的webcore部分，以及浏览器的验证。我将侧重JavaScript部分的JIT。这个分工只是大致而已。大家都是凭自己的热心兴趣在做。<span id="more-11060"></span></li>
<li>webkit的现状：gentoo emerge的 webkit-qt,webkit-gtk现在能编译，运行能弹出浏览器框，但经常bus error崩溃。怀疑和<a href="https://bugs.webkit.org/show_bug.cgi?id=19946" target="_blank">这个bug</a>有关。</li>
<li>机器问题:dancefish有机器，philip兄的机器，下周联系一下龙梦，看能否再给邮寄一台。</li>
<li>感谢zsc顾问提供的建议，解决了关于date的bug，现在squirrelfish的解释器只剩下一个 bug  ecma/Math/15.8.2.17.js.</li>
<li>感谢lei兄的建议，但最近从webkit svn库同步代码之后，我的龙芯小本在最后ld ../lib/libQtWebKit.so.4.8.0时报错final link failed:Bad value.所以没能尝试你的建议。 而且这个ld除了报fail link外再也没有其他任何错误提示。跟踪了一下内存使用情况，物理内存耗尽了，swap分区是开着的，但ld好像并没有使用swap分区。估计是因为这个原因导致的出错。</li>
<li>创建了webkit-ls的git 代码库。  <a href="http://gitorious.org/webkit-ls">http://gitorious.org/webkit-ls</a></li>
</ol>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F08%2F15%2F11127%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于龙芯公司的小道消息</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/10/09/11296/' rel='bookmark' title='宏和内联函数'>宏和内联函数</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/07/10/11060/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
		</item>
		<item>
		<title>龙芯N32系统上的Squirrelfish性能</title>
		<link>http://www.lingcc.com/2010/06/28/10983/</link>
		<comments>http://www.lingcc.com/2010/06/28/10983/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 08:58:37 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[IT职业和生活]]></category>
		<category><![CDATA[main]]></category>
		<category><![CDATA[chromium]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[N32]]></category>
		<category><![CDATA[Squirrelfish]]></category>
		<category><![CDATA[sunspider]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[webkit-龙]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10983</guid>
		<description><![CDATA[缘起：写这篇文章因为报名参加了龙芯开源软件大赛，项目是《Webkit-龙》,把webkit移植到龙芯N32系统上，起初是想做chromium的移植。但在起步的过程中，发现一是Google的V8引擎，对mips的支持基本处于不可用状态，而且chromium为了追求性能，使用的方式太过灵巧，如Native client(Google的野心–Native Client+LLVM),凭自己的一己之力，靠业余时间，很难完成，只好先做webkit了。 Squirrelfish 是Webkit的Javascript引擎。针对龙芯平台(MIPS)已经有了JIT支持，但仅仅对O32系统才有，本博曾经介绍过相关内容（WebKit和Firefox的JavaScript性能对比）。 切入正题，N32系统下，龙芯平台上，Sunspider性能测试结果如下： ============================================ RESULTS (means and 95% confidence intervals) -------------------------------------------- Total: 9125.6ms +/- 0.1% -------------------------------------------- 3d: 1058.6ms +/- 0.2% cube: 326.9ms +/- 0.1% morph: 380.9ms +/- 0.6% raytrace: 350.8ms +/- 0.1% access: 1441.2ms +/- 0.1% binary-trees: 108.4ms +/- 0.3% fannkuch: 829.2ms +/- 0.2% nbody: 249.0ms +/- 0.0% nsieve: 254.6ms +/- 0.4% <a href='http://www.lingcc.com/2010/06/28/10983/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/07/10/11060/' rel='bookmark' title='webkit-龙小组成立'>webkit-龙小组成立</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/09/03/11176/' rel='bookmark' title='移植软件到64位系统'>移植软件到64位系统</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>缘起：写这篇文章因为报名参加了龙芯开源软件大赛，项目是《Webkit-龙》,把webkit移植到龙芯N32系统上，起初是想做chromium的移植。但在起步的过程中，发现一是Google的V8引擎，对mips的支持基本处于不可用状态，而且chromium为了追求性能，使用的方式太过灵巧，如Native client(<a title="Permalink to  Google的野心–Native Client+LLVM" rel="bookmark" href="http://www.lingcc.com/2010/06/02/10955/">Google的野心–Native  Client+LLVM</a>),凭自己的一己之力，靠业余时间，很难完成，只好先做webkit了。</p>
<p><a href="http://trac.webkit.org/wiki/SquirrelFish" target="_blank">Squirrelfish</a> 是Webkit的Javascript引擎。针对龙芯平台(MIPS)已经有了JIT支持，但仅仅对O32系统才有，本博曾经介绍过相关内容（<a href="http://www.lingcc.com/2010/01/22/10668/" target="_blank">WebKit和Firefox的JavaScript性能对比</a>）。<span id="more-10983"></span></p>
<p>切入正题，N32系统下，龙芯平台上，Sunspider性能测试结果如下：<br />
<code><br />
============================================<br />
RESULTS (means and 95% confidence intervals)<br />
--------------------------------------------<br />
Total:                  9125.6ms +/- 0.1%<br />
--------------------------------------------<br />
3d:                   1058.6ms +/- 0.2%<br />
cube:                326.9ms +/- 0.1%<br />
morph:               380.9ms +/- 0.6%<br />
raytrace:            350.8ms +/- 0.1%<br />
access:               1441.2ms +/- 0.1%<br />
binary-trees:        108.4ms +/- 0.3%<br />
fannkuch:            829.2ms +/- 0.2%<br />
nbody:               249.0ms +/- 0.0%<br />
nsieve:              254.6ms +/- 0.4%<br />
bitops:               1088.6ms +/- 0.2%<br />
3bit-bits-in-byte:   196.2ms +/- 0.3%<br />
bits-in-byte:        250.1ms +/- 0.2%<br />
bitwise-and:         224.9ms +/- 0.3%<br />
nsieve-bits:         417.4ms +/- 0.3%<br />
controlflow:           138.2ms +/- 0.2%<br />
recursive:           138.2ms +/- 0.2%<br />
crypto:                621.5ms +/- 0.1%<br />
aes:                 323.0ms +/- 0.1%<br />
md5:                 145.3ms +/- 0.2%<br />
sha1:                153.2ms +/- 0.3%<br />
date:                  523.6ms +/- 0.6%<br />
format-tofte:        302.4ms +/- 0.6%<br />
format-xparb:        221.2ms +/- 1.3%<br />
math:                  931.3ms +/- 0.1%<br />
cordic:              356.0ms +/- 0.2%<br />
partial-sums:        324.5ms +/- 0.1%<br />
spectral-norm:       250.8ms +/- 0.2%<br />
regexp:               1681.6ms +/- 0.1%<br />
dna:                1681.6ms +/- 0.1%<br />
string:               1641.0ms +/- 0.2%<br />
base64:              232.9ms +/- 0.2%<br />
fasta:               261.9ms +/- 0.2%<br />
tagcloud:            394.9ms +/- 0.2%<br />
unpack-code:         525.2ms +/- 0.2%<br />
validate-input:      226.1ms +/- 0.7%</code></p>
<p>与O32系统的性能相比：9125ms vs 6355ms，慢了一半。一个原因是N32现在没有JIT支持。</p>
<p>正确性方面，使用webkit的 Javascript测试集测试。有7个例子出错：<br />
<code><br />
ecma/Date/15.9.5.14.js<br />
ecma/Date/15.9.5.28-1.js<br />
ecma/Date/15.9.5.29-1.js<br />
ecma/Date/15.9.5.31-1.js<br />
ecma/Date/15.9.5.34-1.js<br />
ecma/Date/15.9.5.35-1.js<br />
ecma/Math/15.8.2.17.js</code></p>
<p>WebKit-龙项目方面：</p>
<ul>
<li>主要优化JavaScript引擎，</li>
<li>现在WebKit虽然能编译，但运行还会报错：</li>
</ul>
<p><code>Can't find built framework at "/root/WebKit/WebKitBuild/Release/lib/libQtWebKit.so".</code></p>
<ul>
<li>这个项目刚刚启动，欢迎加入</li>
</ul>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">webkit-龙小组成立</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F09%2F11055%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">龙芯中科公司招聘JAVA虚拟机开发工程师</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F01%2F23%2F9890%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">zzzz龙芯之火，可以燎原（下）</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F02%2F25%2F10698%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">好大一筐梅普斯(MIPS)</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F09%2F19%2F11208%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">GCC即将支持龙芯3A</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/01/22/10668/' rel='bookmark' title='WebKit和Firefox的JavaScript性能对比'>WebKit和Firefox的JavaScript性能对比</a></li>
<li><a href='http://www.lingcc.com/2010/07/10/11060/' rel='bookmark' title='webkit-龙小组成立'>webkit-龙小组成立</a></li>
<li><a href='http://www.lingcc.com/2011/10/09/11773/' rel='bookmark' title='JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm'>JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2010/09/03/11176/' rel='bookmark' title='移植软件到64位系统'>移植软件到64位系统</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/06/28/10983/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Google的野心&#8211;Native Client+LLVM</title>
		<link>http://www.lingcc.com/2010/06/02/10955/</link>
		<comments>http://www.lingcc.com/2010/06/02/10955/#comments</comments>
		<pubDate>Wed, 02 Jun 2010 12:27:35 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[Backend 编译器后端]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[LLVM]]></category>
		<category><![CDATA[Nacl]]></category>
		<category><![CDATA[Native Client]]></category>
		<category><![CDATA[pnacl]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[计算技术未来]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10955</guid>
		<description><![CDATA[认识Native Client Native Client (Nacl) 是Google提出的一种让浏览器直接运行机器码的技术，让Web应用可以从客户机上获得更多的性能，同时又不会引起安全问题。这个技术类似于微软的ActiveX。程序员可以使用C++或者其他语言编写web应用程序，再通过Nacl发布。程序中可以调用一些系统服务中安全的API，如声卡或者图形显示等。Nacl能使用的本地系统调用都是已经规定好的，所以安全性有保证。这篇文章介绍如何使用Native Client。 图中，灰色部分是不安全的模块。其中IMC，即Inter-Module Communications，模块间通信.  SRPC，即Simple RPC， 简单的远程过程调用机制。 NPAPI，即Netscape Plugin Application Programming Interface，Netscape插件应用编程接口。 因为安全问题，所以Nacl的运行时环境必须禁止很多有安全隐患的系统调用，因此NaCl更加适用于纯计算，或者计算密集的应用，对于需要创建进程，访问文件系统的，通通都要毙掉。不过像cache一样，可信的存储应该可以进行。Nacl会首先做静态分析，在机器码中，找出不安全的系统调用和不安全的指令，这些都能通过反汇编搞定。但还得有运行时环境来保证模块间的通信，让Nacl模块可以和其他Nacl模块和浏览器交互。还有一个问题，硬件例外的处理。比如算数值时溢出了，段错误了，或者被外部中断，因为Nacl的运行时环境将Nacl模块的运行完全屏蔽，所以没辙，遇到终端会直接终止。 PNaCl-兼容可移植性和性能 有了C++之类的语言保证，NaCl的应用的运行效率就有了保证。但还需要开发者预先跟据指令集的不同，编译得到不同的机器码，再根据访问者的CPU分发相应的机器码。问题可想而知：兼容性，可移植性不好。于是Google 想到了热火朝天的LLVM(关于LLVM：《前瞻-全时优化和LLVM-1》《前瞻-全时优化和LLVM-2》《前瞻-LLVM大事记(2004-2010)》).PNaCl就诞生了。 使用LLVM，将C/C++代码转换成LLVM中间表示。然后再将中间表示分发给访问者。避免了针对ISA的编译，又能提升性能。LLVM静态编译和动态执行的透明性又使得PNacl的代码更容易调试。LLVM的前端有可以增加诸如Fortran和Objectiv C之类的语言。有个问题，就是PNaCL得以单文件形式分发，不过幸好LLVM工具链提供了在做过程间优化时生成一个bitcode文件的功能。 上图是PNacl的执行模型，Bitcode下载到客户机后，通过llc或者ld转换执行，在Nacl的运行时环境中执行。 PNaCl的未来 Google现在基于LLVM的有两个，unladen-swallow和Nacl。JavaScript会被Nacl替代吗？以后Google会用PNacl的后端来替代JavaScript的解释器V8吗？Python如果能用LLVM做后端，C/C++也能扩展到LLVM，那以后会是怎样？ 或许有点多虑，就好像每一种语言刚刚出现的时候，都有人认为它会替代所有现有语言。但发展到今天，还没有哪种语言能一统江湖，安全、性能和可移植性本身就是矛盾的，不能兼顾，只有根据应用的取舍。 PNacl的问题 本来的用意是加快执行速度，现在先做一遍翻译，变成bitcode，再做一遍翻译，编程机器码。性能还有保证吗？这个项目2010年二月才开始。还有很长的路要走。 参考： http://code.google.com/p/unladen-swallow/ http://en.wikipedia.org/wiki/JavaScript http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/documentation/getting_started.html http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/documentation/nacl_paper.pdf http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/README.html http://nativeclient.googlecode.com/svn/data/site/pnacl.pdf http://googlecode.blogspot.com/2008/12/native-client-technology-for-running.html 相关文章： 前瞻-LLVM大事记(2004-2010) LLVM 2.7 发布 期待未来-一张趣图 通用微处理中的SIMD指令扩展 多面体模型是编译器循环优化的未来吗？ 前瞻-全时优化和LLVM-2<table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F03%2F10960%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM之爷谈下一代编译器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F17%2F10657%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">前瞻- 编译器的bug就不能少点？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F22%2F10404%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">有写编译器的冲动？来看看这些网站</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F27%2F10782%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于《编译点滴》的定位和未来</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/04/28/10807/' rel='bookmark' title='LLVM 2.7 发布'>LLVM 2.7 发布</a></li>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2010/07/16/11081/' rel='bookmark' title='多面体模型是编译器循环优化的未来吗？'>多面体模型是编译器循环优化的未来吗？</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<h4>认识Native Client</h4>
<p><a href="http://code.google.com/p/nativeclient/">Native Client</a> (Nacl) 是Google提出的一种让浏览器直接运行机器码的技术，让Web应用可以从客户机上获得更多的性能，同时又不会引起安全问题。这个技术类似于微软的ActiveX。程序员可以使用C++或者其他语言编写web应用程序，再通过Nacl发布。程序中可以调用一些系统服务中安全的API，如声卡或者图形显示等。Nacl能使用的本地系统调用都是已经规定好的，所以安全性有保证。<a href="http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/documentation/getting_started.html" target="_blank">这篇文章</a>介绍如何使用Native Client。<span id="more-10955"></span></p>
<div id="attachment_10956" class="wp-caption alignnone" style="width: 734px"><a href="http://www.lingcc.com/wp-content/uploads/2010/06/nacl.jpg"><img class="size-full wp-image-10956" title="nacl" src="http://www.lingcc.com/wp-content/uploads/2010/06/nacl.jpg" alt="" width="724" height="267" /></a><p class="wp-caption-text">使用Nacal实现图片编辑和分享的应用</p></div>
<p>图中，灰色部分是不安全的模块。其中IMC，即Inter-Module Communications，模块间通信.  SRPC，即Simple RPC， 简单的远程过程调用机制。 NPAPI，即Netscape Plugin Application Programming Interface，Netscape插件应用编程接口。</p>
<p>因为安全问题，所以Nacl的运行时环境必须禁止很多有安全隐患的系统调用，因此NaCl更加适用于纯计算，或者计算密集的应用，对于需要创建进程，访问文件系统的，通通都要毙掉。不过像cache一样，可信的存储应该可以进行。Nacl会首先做静态分析，在机器码中，找出不安全的系统调用和不安全的指令，这些都能通过反汇编搞定。但还得有运行时环境来保证模块间的通信，让Nacl模块可以和其他Nacl模块和浏览器交互。还有一个问题，硬件例外的处理。比如算数值时溢出了，段错误了，或者被外部中断，因为Nacl的运行时环境将Nacl模块的运行完全屏蔽，所以没辙，遇到终端会直接终止。</p>
<h4>PNaCl-兼容可移植性和性能</h4>
<p>有了C++之类的语言保证，NaCl的应用的运行效率就有了保证。但还需要开发者预先跟据指令集的不同，编译得到不同的机器码，再根据访问者的CPU分发相应的机器码。问题可想而知：兼容性，可移植性不好。于是Google 想到了热火朝天的LLVM(关于LLVM：《<a title="Permanent Link to 前瞻-全时优化和LLVM-1" rel="bookmark" href="http://www.lingcc.com/2010/04/07/10721/">前瞻-全时优化和LLVM-1</a>》《<a title="Permanent Link to 前瞻-全时优化和LLVM-2" rel="bookmark" href="http://www.lingcc.com/2010/04/29/10728/">前瞻-全时优化和LLVM-2</a>》《<a title="Permanent Link to 前瞻-LLVM大事记(2004-2010)" rel="bookmark" href="http://www.lingcc.com/2010/04/30/10822/">前瞻-LLVM大事记(2004-2010)</a>》).PNaCl就诞生了。</p>
<div id="attachment_10957" class="wp-caption alignnone" style="width: 810px"><a href="http://www.lingcc.com/wp-content/uploads/2010/06/llvm-pass.jpg"><img class="size-full wp-image-10957" title="llvm-pass" src="http://www.lingcc.com/wp-content/uploads/2010/06/llvm-pass.jpg" alt="" width="800" height="444" /></a><p class="wp-caption-text">使用LLVM开发Nacl应用流程</p></div>
<p>使用LLVM，将C/C++代码转换成LLVM中间表示。然后再将中间表示分发给访问者。避免了针对ISA的编译，又能提升性能。LLVM静态编译和动态执行的透明性又使得PNacl的代码更容易调试。LLVM的前端有可以增加诸如Fortran和Objectiv C之类的语言。有个问题，就是PNaCL得以单文件形式分发，不过幸好LLVM工具链提供了在做过程间优化时生成一个bitcode文件的功能。</p>
<div id="attachment_10958" class="wp-caption alignnone" style="width: 460px"><a href="http://www.lingcc.com/wp-content/uploads/2010/06/llvm-nacl-run.jpg"><img class="size-medium wp-image-10958" title="llvm-nacl-run" src="http://www.lingcc.com/wp-content/uploads/2010/06/llvm-nacl-run-300x210.jpg" alt="" width="450" height="315" /></a><p class="wp-caption-text">PNaCl的执行模型</p></div>
<p>上图是PNacl的执行模型，Bitcode下载到客户机后，通过llc或者ld转换执行，在Nacl的运行时环境中执行。</p>
<h4>PNaCl的未来</h4>
<p>Google现在基于LLVM的有两个，<a href="http://code.google.com/p/unladen-swallow/" target="_blank">unladen-swallow</a>和Nacl。JavaScript会被Nacl替代吗？以后Google会用PNacl的后端来替代JavaScript的解释器V8吗？Python如果能用LLVM做后端，C/C++也能扩展到LLVM，那以后会是怎样？</p>
<p>或许有点多虑，就好像每一种语言刚刚出现的时候，都有人认为它会替代所有现有语言。但发展到今天，还没有哪种语言能一统江湖，安全、性能和可移植性本身就是矛盾的，不能兼顾，只有根据应用的取舍。</p>
<h4>PNacl的问题</h4>
<h4><span style="font-weight: normal;">本来的用意是加快执行速度，现在先做一遍翻译，变成bitcode，再做一遍翻译，编程机器码。性能还有保证吗？这个项目2010年二月才开始。还有很长的路要走。</span></h4>
<p>参考：</p>
<ol>
<li>http://code.google.com/p/unladen-swallow/</li>
<li>http://en.wikipedia.org/wiki/JavaScript</li>
<li>http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/documentation/getting_started.html</li>
<li>http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/documentation/nacl_paper.pdf</li>
<li>http://nativeclient.googlecode.com/svn/data/docs_tarball/nacl/googleclient/native_client/README.html</li>
<li><cite>http://nativeclient.googlecode.com/svn/data/site/<strong>pnacl</strong>.pdf</cite></li>
<li><cite>http://googlecode.blogspot.com/2008/12/native-client-technology-for-running.html</cite></li>
</ol>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F03%2F10960%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM之爷谈下一代编译器</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F17%2F10657%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">前瞻- 编译器的bug就不能少点？</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2009%2F12%2F22%2F10404%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">有写编译器的冲动？来看看这些网站</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F27%2F10782%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">关于《编译点滴》的定位和未来</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F02%2F10955%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2010/04/28/10807/' rel='bookmark' title='LLVM 2.7 发布'>LLVM 2.7 发布</a></li>
<li><a href='http://www.lingcc.com/2010/05/07/10916/' rel='bookmark' title='期待未来-一张趣图'>期待未来-一张趣图</a></li>
<li><a href='http://www.lingcc.com/2011/06/01/11600/' rel='bookmark' title='通用微处理中的SIMD指令扩展'>通用微处理中的SIMD指令扩展</a></li>
<li><a href='http://www.lingcc.com/2010/07/16/11081/' rel='bookmark' title='多面体模型是编译器循环优化的未来吗？'>多面体模型是编译器循环优化的未来吗？</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/06/02/10955/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>前瞻-LLVM大事记(2004-2010)</title>
		<link>http://www.lingcc.com/2010/04/30/10822/</link>
		<comments>http://www.lingcc.com/2010/04/30/10822/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 12:04:03 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Chris Lattener]]></category>
		<category><![CDATA[clang]]></category>
		<category><![CDATA[compiler infrastructure]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[ld]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[mount]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[openmp]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[SPEC2000]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[后端]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[整点]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器开发]]></category>
		<category><![CDATA[编译器性能]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[过程间分析和优化 Inter procedural Analysis]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10822</guid>
		<description><![CDATA[因为之前的两篇博文前瞻-全时优化和LLVM-1和前瞻-全时优化和LLVM-2都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。 从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从这里找到。 1.2增加了调试信息支持， 1.3增加精确垃圾收集功能， 1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器； 1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制； 1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器； 1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持； 1.8DWARF调试支持,循环优化改进； 1.9新的X86-64后端，连接时优化能和本机连接器交互； 2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进； 2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持； 2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构； 2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写 2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持 2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持 2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持 2.7，启动LLVM新logo，MicroBlaze后端支持。 以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。 LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。 Chris Lattener最近几年发表的文章： “Making Context-sensitive Points-to Analysis with Heap Cloning Practical For The Real World” PLDI 2007, San Diego, CA, June 2007。 “Macroscopic Data <a href='http://www.lingcc.com/2010/04/30/10822/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>因为之前的两篇博文<a title="Permanent Link: 前瞻-全时优化和LLVM-1" rel="bookmark" href="http://www.lingcc.com/2010/04/07/10721/">前瞻-全时优化和LLVM-1<abbr title="YARPP  中的 5.867000 是指当前文章和关联文章之间的匹配程度。当您以管理员的身份登录时才能查阅，游客等其他权限是不能查阅的。"></abbr></a>和<a href="http://www.lingcc.com/2010/04/29/10728/" target="_blank">前瞻-全时优化和LLVM-2</a>都是基于Chris Lattner 2004年发表在CGO的文章写的。所以需要介绍一下LLVM从2004到2010这六年的变化，LLVM的开发社区很活跃。</p>
<p>从2004年三月到2010年4月，LLVM共发布了1.2-1.9，2.0-2.7，16个版本，至少每年发布两个版本。详细的历史发布版本和release都能从<a href="http://llvm.org/releases/" target="_blank">这里</a>找到。</p>
<p><span id="more-10822"></span></p>
<ul>
<li>1.2增加了调试信息支持，</li>
<li>1.3增加精确垃圾收集功能，</li>
<li>1.4增加PowerPC JIT支持，增加通用的编译驱动器和连接器；</li>
<li>1.5增加针对Alpha,IA-64和SPARC-V8的代码生成器，新的指令选择机制；</li>
<li>1.6指令选择能从机器模型中生成，指令调度支持，支持子目标机代码生成器；</li>
<li>1.7向量支持，新的GCC4.0 C/C++前端，Objective C/C++支持，汇编内联支持；</li>
<li>1.8DWARF调试支持,循环优化改进；</li>
<li>1.9新的X86-64后端，连接时优化能和本机连接器交互；</li>
<li>2.0中间表示更新(整型完全无符号化，任意长度位的整型支持),代码生成器更新(软浮点支持),X86,ARM,PowerPC代码生成改进；</li>
<li>2.1.gcc-4.2前端，Fortran，Ada和OpenMP支持，MIPS后端支持；</li>
<li>2.2 Clang启动，CellSPU后端支持，精确垃圾收集代码重构；</li>
<li>2.3, 不再支持gcc4.0前端，vmkit启动(用LLVM实现JVM和CLI)，多返回值支持，llvmc重构，连接时优化起结构重写</li>
<li>2.4，增加优化，并缩短O0编译时间，PIC16微处理器支持</li>
<li>2.5，启动Pure,LLVM D Compiler,Roadsend PHP;XCore后端支持</li>
<li>2.6，启动compiler-rt,KLEE,machine code toolkit,开优化时调试信息行号支持，新MSP430，SystemZ和Blackin后端支持，Gold连接器插件支持</li>
<li>2.7，启动LLVM新logo，MicroBlaze后端支持。</li>
</ul>
<p>以上就是从04年到10年LLVM每次发行新版本中给出的最要新特性.可以看出，几乎和普通的编译器没有什么两样。所做的无非在增加新前端，编译更多的语言，支持新后端，可以在更多的处理器上运行。增加中间优化，调bug。</p>
<p>LLVM近几年的发展路线已经越来越像一个标准的，前端+后端+优化的编译器。运行时的优化也大部分集中在JIT上，反馈制导优化也没有涉及。</p>
<p>Chris Lattener最近几年发表的文章：</p>
<ol>
<li>“<strong><a href="http://llvm.org/pubs/2007-06-10-PLDI-DSA.html">Making  Context-sensitive  Points-to Analysis with Heap Cloning Practical For The Real World</a></strong>”<br />
<a href="http://ties.ucsd.edu/PLDI/">PLDI 2007</a>, San Diego, CA, June  2007。</li>
<li>“<a href="http://llvm.org/pubs/2005-05-04-LattnerPHDThesis.html"><strong>Macroscopic  Data Structure Analysis and Optimization</strong></a>”<br />
<em>Ph.D. Thesis</em>, <a href="http://www.cs.uiuc.edu/">Computer Science  Dept.</a>, University of Illinois at Urbana-Champaign, May 2005.</li>
<li>“<a href="http://llvm.org/pubs/2005-05-21-PLDI-PoolAlloc.html"><strong>Automatic  Pool  Allocation: Improving Performance by Controlling Data  Structure Layout in the Heap</strong></a>”<br />
<a href="http://research.ihost.com/pldi2005/">PLDI 2005</a>, Chicago, IL, June 2005.<br />
<strong>PLDI&#8217;05 Best paper award.</strong></li>
<li>“<a href="http://llvm.org/pubs/2005-06-12-MSP-PointerComp.html"><strong>Transparent   Pointer Compression for Linked Data Structures</strong></a>”<br />
MSP  2005,  Chicago, IL, June 2005.</li>
</ol>
<p>基本也没有太多触及LLVM整体架构的。</p>
<p>另外，Chris Lattener在近几年的几个邀请报告上也简明扼要的讲解了LLVM的架构。</p>
<ol>
<li>“<a href="http://llvm.org/devmtg/2009-10/">State of Clang</a>”  (shared     talk) and several other pieces of the meeting, such as the  introduction,      open discussion forum, etc.<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, Oct 2009.</li>
<li>“<a href="http://llvm.org/pubs/2008-10-04-ACAT-LLVM-Intro.html">Introduction  	to the LLVM Compiler System</a>”<br />
Plenary Talk, <em><a href="http://acat2008.cern.ch/">ACAT 2008</a>:  Advanced 	Computing and Analysis Techniques in Physics Research</em>, Erice, Sicily, Italy, November 2008.</li>
<li>“<a href="http://llvm.org/pubs/2008-05-17-BSDCan-LLVMIntro.html">LLVM  and 	Clang: Next Generation Compiler Technology</a>”<br />
<em><a href="http://www.bsdcan.org/2008/">BSDCan 2008</a></em>, Ottawa,  Canada, May 16-17, 2008.</li>
<li>“<a href="http://conferences.oreillynet.com/cs/os2007/view/e_sess/12824">The 		LLVM Compiler System</a>”<br />
<em>2007 O&#8217;Reilly Open Source Convention</em>, Portland, OR, July 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-07-25-LLVM-2.0-and-Beyond.html">LLVM  	2.0 and Beyond!</a>”<br />
<em>Google Tech Talk</em>, Mountain View, CA, July 25, 2007.</li>
<li>“<a href="http://llvm.org/devmtg/2007-05/">LLVM in OpenGL and for  Dynamic  	Languages</a>” (and several others)<br />
<em>LLVM Developer Meeting</em>, Cupertino, CA, May 2007.</li>
<li>“<a href="http://llvm.org/pubs/2007-03-12-BossaLLVMIntro.html">The  LLVM 	Compiler System</a>”<br />
<em>2007 Bossa Conference on Open Source, Mobile Internet and Multimedia</em>, 	Recife, Brazil, March 2007.</li>
<li>“<a href="http://llvm.org/pubs/2006-04-25-GelatoLLVMIntro.html">Introduction  	to the LLVM Compiler Infrastructure</a>”<br />
<em>2006 Itanium Conference and Expo</em>, San Jose, California, April  2006.</li>
</ol>
<p>对比一下Chris最近几年在不同的文献中，对LLVM的架构描述也是很有意思的。</p>
<div id="attachment_10826" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02.jpg"><img class="size-medium wp-image-10826" title="LLVM from Chris M.S. Thesis  2002" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-02-300x66.jpg" alt="" width="300" height="66" /></a><p class="wp-caption-text">llvm-02 from Chris M.S. Thesis  2002</p></div>
<div id="attachment_10731" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1.jpg"><img class="size-medium wp-image-10731" title="llvm-arch" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch1-300x65.jpg" alt="" width="300" height="65" /></a><p class="wp-caption-text">LLVM CGO2004</p></div>
<div id="attachment_10828" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1.jpg"><img class="size-medium wp-image-10828" title="llvm-06-1" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-1-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 06 Link-Time Optimization</p></div>
<div id="attachment_10829" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2.jpg"><img class="size-medium wp-image-10829" title="llvm-06-2" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-06-2-300x123.jpg" alt="" width="300" height="123" /></a><p class="wp-caption-text">LLVM 06 Code Generator</p></div>
<div id="attachment_10830" class="wp-caption alignnone" style="width: 310px"><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08.jpg"><img class="size-medium wp-image-10830" title="llvm-08" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-08-300x118.jpg" alt="" width="300" height="118" /></a><p class="wp-caption-text">LLVM 08</p></div>
<p>LLVM始终坚持的是LLVM代码在代码生成器，解释执行之间的透明性。重点突破的一直是过程间优化。但架构却基本上摒弃了全时优化，开始走经典的静态分析路线。和GCC、Open64相比，在目的上也没有差别了。<br />
LLVM的性能方面，相比于GCC还逊色不少，和Open64就更没法比了.很遗憾，我没有找到将这三个编译器作性能对比的文章.已有的Open64的数据都是非常老的，没什么可比性。而且编译优化这个东西，差距很大。关键是看有没有人做，投入多大经历做，太老的数据没有什么对比意义。</p>
<p>但LLVM和GCC最新版的对比有， LLVM2.7和GCC 4.5的性能对比(图来自<a href="http://vmakarov.fedorapeople.org/spec/" target="_blank">http://vmakarov.fedorapeople.org/spec/</a>）：</p>
<ul>
<li>SPEC 2000 整点(-O2)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32.png"><img class="alignnone size-medium wp-image-10859" title="GLI2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC2000浮点(-O2）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32.png"><img class="alignnone size-medium wp-image-10861" title="GLF2Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF2Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 整点（-O3）</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32.png"><img class="alignnone size-medium wp-image-10860" title="GLI3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLI3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<ul>
<li>SPEC 2000 浮点(-O3)</li>
</ul>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32.png"><img class="alignnone size-medium wp-image-10862" title="GLF3Score32" src="http://www.lingcc.com/wp-content/uploads/2010/04/GLF3Score32-300x154.png" alt="" width="300" height="154" /></a></p>
<p>O2和O3优化下，GCC的性能平均都比LLVM 2.7要好大概2%-3%左右。浮点GCC的优势比整点要大.上面数据仅供参考：）</p>
<p>此外上面的网页中也对编译时间做了对比。LLVM比GCC要快30%左右。</p>
<p>以上数据测试平台：2.93Ghz Intel Core I7 with 8GB memory under Fedora Core10. X86 32位系统.</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F30%2F10822%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/14/10736/' rel='bookmark' title='探秘CPU性能测试：Spec CPU2000之整点篇'>探秘CPU性能测试：Spec CPU2000之整点篇</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/30/10822/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>前瞻-全时优化和LLVM-2</title>
		<link>http://www.lingcc.com/2010/04/29/10728/</link>
		<comments>http://www.lingcc.com/2010/04/29/10728/#comments</comments>
		<pubDate>Thu, 29 Apr 2010 04:14:19 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[编译理论实践和应用]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[空闲时优化]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器架构]]></category>
		<category><![CDATA[编译器设计]]></category>
		<category><![CDATA[虚拟机]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10728</guid>
		<description><![CDATA[上篇文章，以论文为主要依据，介绍了LLVM的概况和中间表示，本篇关注论文的后半部分内容&#8211;架构设计和LLVM的整体评测： LLVM的架构设计： 总览 LLVM的架构设计以让传统的链接时，安装时，运行时和空闲时代码转换都能透明地在LLVM中间表示上展开为目的。上图就是LLVM的高层设计架构。包括静态的编译器前端用于生成LLVM中间表示；连接器用于做连接时优化，尤其是过程间优化。连接器的输出被JIT或者机器代码生成器生成机器代码。在机器代码生成时，可以通过插入低代价的抽样指令来测量运行时的profile，检测热代码，并将空闲时进行优化。 作者认为LLVM的这种架构具有五个优点，这些优点现阶段的编译器或虚拟机等都无法完全具备，它们是： 提供程序的高层信息 离线代码生成器 用户级的profiling和优化 透明的运行时模型 统一的全程序编译 作者比较了如今存在的一些系统，分析它们是否具备以上5点： 传统的源码级编译器：能提供2和4，但很难提供1，3，5.虽然也能提供过程间优化，但需要修改Makefile 一些商用编译器能够在链接时部分支持1和5，这也是用过将它们的中间表示信息输出到目标文件中。但无法在空闲时使用这些信息 高层虚拟机，如JVM和CLI能提供3，部分支持1. CLI部分支持5，因为它支持多语言代码，但很多底层系统代码只能作为不可控代码直接运行。 透明的二进制运行时优化系统，如Dynamo和Transmeta能提供2，4，5，但不能提供1，而且对3的支持只在运行时。 静态profile制导优化（PGO），能提供3代价是不再对其他阶段透明。另外PGO也有缺点：应用开发者很少用它；使用PGO意味着训练用的输入需要严格和用户行为一致；profiling信息是完全静态的。 当然LLVM也有自己的缺点，作者在文中提到两点：1，源程序语言相关优化需要在前端生成LLVM中间表示之前完成；2，编程语言需不需要一个庞大的运行时系统还有争议。 编译时：外部前端和静态优化 外部静态LLVM编译器(即前端)将源语言程序转换为LLVM虚拟指令集。每种静态编译器都要完成三个关键任务：进行语言相关优化，如使用高层函数优化闭包(closures); 将源程序转换为LLVM代码，并综合尽量多的LLVM类型信息，如指针、结构体和数组信息；启动LLVM的全局或过程间优化。其中第二个任务是外部编译器必须要完成的。LLVM的优化都被写成库的形式，方便前端使用。前端无需构建SSA，可以使用一个栈存放变量，于是就能用栈来实现SSA的构建了。对于所谓的高层语言相关优化，LLVM的观点是：将LLVM优化扩展到特定的转换要好过在编码时为特定语言投入大量的精力。 连接时和过程间优化 LLVM中，连接时是绝大部分分析和转换可以实现的首个编译阶段。LLVM现在包含一些过程间优化，包括：内容相关指针分析；调用图构建；定义-引用分析和过程间转换(内联，死全局变量删除、死参数删除、死类型删除、常数传播、数据越界检查删除、简单结构体域重排、自动存储分配等).LLVM中提供的编译和运行时优化器能加快过程间分析速度。编译时，汇总每个函数的过程间信息，并附在LLVM 代码中。链接时，过程间优化器以这些信息作为输入，而非重新从源码中得到信息。这种技术有效的缩短了编译实践，而且在链接时之前，并未破坏源码的结构。 离线和实时代码生成器 代码生成器用于运行代码前将LLVM中间表示转换为目标平台的机器语言(目前LLVM支持X86和Sparc V9平台).有两种方式实现这种转换，一是在链接时或安装时代码生成器静态地生成高效本地码，这时可以使用代价高的代码生成技术。如果用户打算使用运行时和离线优化器，LLVM中间表示将会附在可执行文件中，并且代码生成器会插入低代价的指令来识别常被执行到的代码区间。另外，LLVM还有一个实时执行引擎，直接在运行时启动代码转换器。 运行时程序行为采集和重优化 LLVM设计的目标之一是开发一种全新的普通应用运行时优化架构。程序执行中，识别最常被执行的路径，通常是热循环。识别出热循环后，复制热区域代码，并使用LLVM代码生成器，优化并生成机器码，并在原始代码和新机器码之间插入一个分支指令。这种机制很强大，理由有三：本地代码生成恩公使用经典算法来产生高性能代码；因为本地代码生成器和运行时优化器都是LLVM的一部分，因此能很好的协同工作，让运行时优化起从代码生成器中得到很好支持；运行时优化起能从LLVM的中间表示中得到高层信息以便实施高度优化。 用户行为信息制导的离线重优化 因为LLVM中间表示能保存，使得应用程序的空闲时离线优化能透明地在用户系统上进行。该优化器可以简单修改连接时过程间优化器来得到，只需要把重点放在目标机相关和反馈信息指导优化即可。 LLVM的评测和应用 评测LLVM 作者评测了LLVM的四个方面：语言无关类型系统的完备性；高级语言特性到LLVM中间表示转换如何实现；LLVM中间表示的复杂度；LLVM的编译速度。 类型系统完备性方面，LLVM使用流敏感，域敏感和内容敏感的指针分析算法来保证LLVM类型系统的可靠性。 高级语言特性方面，作者给出了C++中的隐式调用、模板、基类、虚函数表、例外如何使用LLVM中间表示表达。 LLVM中间表示的复杂度方面，作者对比了GCC3.3 O3下生成X86，Sparc可执行文件和LLVM中间表示文件的大小，结果显示LLVM中间表示大小和X86可执行文件大小相当，明显小于Sparc的可执行文件，作者相信这是LLVM的优势，因为LLVM中间表示使用无限多的寄存器，丰富的类型信息，控制流信息和数据流信息(SSA),而可执行代码没有这些信息。 LLVM的编译速度方面，作者给出了LLVM上几个过程间优化：DGE(aggressive Dead Global variable and function Elimination),DAE(aggressive Dead Argument and return value Elimination),inline转换时间并和GCC O3的编译时间对比，结果显示LLVM做以上三个过程间优化的编译时间要大大短于GCC O3的编译时间，而且GCC O3还没有过程间优化，作者也给出了LLVM的优化效果。 LLVM的应用 <a href='http://www.lingcc.com/2010/04/29/10728/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>上篇文章，以论文为主要依据，介绍了LLVM的概况和中间表示，本篇关注论文的后半部分内容&#8211;架构设计和LLVM的整体评测：</p>
<h3>LLVM的架构设计：</h3>
<h4>总览</h4>
<p><a href="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch.jpg"><img class="alignnone size-medium wp-image-10729" title="llvm-arch" src="http://www.lingcc.com/wp-content/uploads/2010/04/llvm-arch-300x65.jpg" alt="" width="300" height="65" /></a></p>
<p>LLVM的架构设计以让传统的链接时，安装时，运行时和空闲时代码转换都能透明地在LLVM中间表示上展开为目的。上图就是LLVM的高层设计架构。包括静态的编译器前端用于生成LLVM中间表示；连接器用于做连接时优化，尤其是过程间优化。连接器的输出被JIT或者机器代码生成器生成机器代码。在机器代码生成时，可以通过插入低代价的抽样指令来测量运行时的profile，检测热代码，并将空闲时进行优化。</p>
<p><span id="more-10728"></span></p>
<p>作者认为LLVM的这种架构具有五个优点，这些优点现阶段的编译器或虚拟机等都无法完全具备，它们是：</p>
<ol>
<li>提供程序的高层信息</li>
<li>离线代码生成器</li>
<li>用户级的profiling和优化</li>
<li>透明的运行时模型</li>
<li>统一的全程序编译</li>
</ol>
<p>作者比较了如今存在的一些系统，分析它们是否具备以上5点：</p>
<ul>
<li>传统的源码级编译器：能提供2和4，但很难提供1，3，5.虽然也能提供过程间优化，但需要修改Makefile</li>
<li>一些商用编译器能够在链接时部分支持1和5，这也是用过将它们的中间表示信息输出到目标文件中。但无法在空闲时使用这些信息</li>
<li>高层虚拟机，如JVM和CLI能提供3，部分支持1. CLI部分支持5，因为它支持多语言代码，但很多底层系统代码只能作为不可控代码直接运行。</li>
<li>透明的二进制运行时优化系统，如Dynamo和Transmeta能提供2，4，5，但不能提供1，而且对3的支持只在运行时。</li>
<li>静态profile制导优化（PGO），能提供3代价是不再对其他阶段透明。另外PGO也有缺点：应用开发者很少用它；使用PGO意味着训练用的输入需要严格和用户行为一致；profiling信息是完全静态的。</li>
</ul>
<p>当然LLVM也有自己的缺点，作者在文中提到两点：1，源程序语言相关优化需要在前端生成LLVM中间表示之前完成；2，编程语言需不需要一个庞大的运行时系统还有争议。</p>
<h4>编译时：外部前端和静态优化</h4>
<p>外部静态LLVM编译器(即前端)将源语言程序转换为LLVM虚拟指令集。每种静态编译器都要完成三个关键任务：进行语言相关优化，如使用高层函数优化闭包(closures); 将源程序转换为LLVM代码，并综合尽量多的LLVM类型信息，如指针、结构体和数组信息；启动LLVM的全局或过程间优化。其中第二个任务是外部编译器必须要完成的。LLVM的优化都被写成库的形式，方便前端使用。前端无需构建SSA，可以使用一个栈存放变量，于是就能用栈来实现SSA的构建了。对于所谓的高层语言相关优化，LLVM的观点是：将LLVM优化扩展到特定的转换要好过在编码时为特定语言投入大量的精力。</p>
<h4>连接时和过程间优化</h4>
<p>LLVM中，连接时是绝大部分分析和转换可以实现的首个编译阶段。LLVM现在包含一些过程间优化，包括：内容相关指针分析；调用图构建；定义-引用分析和过程间转换(内联，死全局变量删除、死参数删除、死类型删除、常数传播、数据越界检查删除、简单结构体域重排、自动存储分配等).LLVM中提供的编译和运行时优化器能加快过程间分析速度。编译时，汇总每个函数的过程间信息，并附在LLVM 代码中。链接时，过程间优化器以这些信息作为输入，而非重新从源码中得到信息。这种技术有效的缩短了编译实践，而且在链接时之前，并未破坏源码的结构。</p>
<h4>离线和实时代码生成器</h4>
<p>代码生成器用于运行代码前将LLVM中间表示转换为目标平台的机器语言(目前LLVM支持X86和Sparc V9平台).有两种方式实现这种转换，一是在链接时或安装时代码生成器静态地生成高效本地码，这时可以使用代价高的代码生成技术。如果用户打算使用运行时和离线优化器，LLVM中间表示将会附在可执行文件中，并且代码生成器会插入低代价的指令来识别常被执行到的代码区间。另外，LLVM还有一个实时执行引擎，直接在运行时启动代码转换器。</p>
<h4>运行时程序行为采集和重优化</h4>
<p>LLVM设计的目标之一是开发一种全新的普通应用运行时优化架构。程序执行中，识别最常被执行的路径，通常是热循环。识别出热循环后，复制热区域代码，并使用LLVM代码生成器，优化并生成机器码，并在原始代码和新机器码之间插入一个分支指令。这种机制很强大，理由有三：本地代码生成恩公使用经典算法来产生高性能代码；因为本地代码生成器和运行时优化器都是LLVM的一部分，因此能很好的协同工作，让运行时优化起从代码生成器中得到很好支持；运行时优化起能从LLVM的中间表示中得到高层信息以便实施高度优化。</p>
<h4>用户行为信息制导的离线重优化</h4>
<p>因为LLVM中间表示能保存，使得应用程序的空闲时离线优化能透明地在用户系统上进行。该优化器可以简单修改连接时过程间优化器来得到，只需要把重点放在目标机相关和反馈信息指导优化即可。</p>
<h3>LLVM的评测和应用</h3>
<h4>评测LLVM</h4>
<p>作者评测了LLVM的四个方面：语言无关类型系统的完备性；高级语言特性到LLVM中间表示转换如何实现；LLVM中间表示的复杂度；LLVM的编译速度。</p>
<p>类型系统完备性方面，LLVM使用流敏感，域敏感和内容敏感的指针分析算法来保证LLVM类型系统的可靠性。</p>
<p>高级语言特性方面，作者给出了C++中的隐式调用、模板、基类、虚函数表、例外如何使用LLVM中间表示表达。</p>
<p>LLVM中间表示的复杂度方面，作者对比了GCC3.3 O3下生成X86，Sparc可执行文件和LLVM中间表示文件的大小，结果显示LLVM中间表示大小和X86可执行文件大小相当，明显小于Sparc的可执行文件，作者相信这是LLVM的优势，因为LLVM中间表示使用无限多的寄存器，丰富的类型信息，控制流信息和数据流信息(SSA),而可执行代码没有这些信息。</p>
<p>LLVM的编译速度方面，作者给出了LLVM上几个过程间优化：DGE(aggressive Dead Global variable and function Elimination),DAE(aggressive Dead Argument and return value Elimination),inline转换时间并和GCC O3的编译时间对比，结果显示LLVM做以上三个过程间优化的编译时间要大大短于GCC O3的编译时间，而且GCC O3还没有过程间优化，作者也给出了LLVM的优化效果。</p>
<h4>LLVM的应用</h4>
<p>LLVM中已经实现的几种技术：如数据结构体分析(Data Structure Analysis)和自动查询分配(Automatic Poll Allocation)都得益于LLVM的架构。</p>
<p>SAFECode:一个安全的低级中间表示和运行环境。该中间表示基于LLVM中间表示，目的是增强程序的存储安全。除了运行时优化外，SAFECode几乎使用了LLVM架构中的所有结构。</p>
<p>虚拟指令集计算机的外部指令系统设计：虚拟指令集处理器可以使用两个完全不同指令集。外在的虚拟指令级和隐藏的内部实现指令集。LLVM的中间表示就能作为一种外部虚拟指令集。</p>
<h3>与LLVM相关的工作:</h3>
<p>高层语言虚拟机，如SmallTalk，Self，JVM和CLI，需要特定的对象模型和运行时系统支持，但因为太高层，其他语言(如C++)可能很难在该虚拟机上运行。为了可移植性，中间表示需要严格的类型安全，这也限制了对多语言的支持。类型安全的检测也使得很多优化无法进行。</p>
<p>虽然微软的CLI有些支持不同语言的特性。但CLI支持多语言的unmanaged方式使得，部分语言不能用CLI的中间表示完整表达，优化机会也就随之丧失。</p>
<p>Omniware虚拟机和LLVM比较像，因为都实现抽象的低层RISC指令级。但Omniware缺乏高层的类型信息。</p>
<p>Kistler和Franz给出了一个编译器架构，初始代码生成很简单，依靠程序运行行为指导接下来的优化。但不能支持任意语言，而且也没有透明的运行时系统。</p>
<p>类型化的中间表示方面，也有很多相关工作。但多数都为了类型安全，提取高层语言信息。LLVM则重点放在在静态编译优化之外使得经典的程序分析和优化算法能够实现。</p>
<p>统一、通用的中间表示方面也有了不少研究。但几乎都失败了。这些中间表示大多从AST级抽取信息并尽量支持所有源语言特性。LLVM的中间表示更像汇编，使用很小的类型集和低层操作。</p>
<p>过程间优化方面，有的为给定处理器做基于汇编的优化；有些从静态编译器中得到附加信息。但这些都没有考虑运行时和离线优化支持。</p>
<p>也有一些系统提供透明的运行时优化。但这些系统都只是努力的优化机器码。LLVM则是以提供类型，数据流和精确控制流图为目标。</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F05%2F03%2F10884%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">安装LLVM2.7 step by step</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F15%2F10978%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F29%2F10728%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64业内外人士对LLVM和Open64的观点</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/07/10721/' rel='bookmark' title='前瞻-全时优化和LLVM-1'>前瞻-全时优化和LLVM-1</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/12/28/10469/' rel='bookmark' title='Open64课程-结语'>Open64课程-结语</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/29/10728/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>前瞻-全时优化和LLVM-1</title>
		<link>http://www.lingcc.com/2010/04/07/10721/</link>
		<comments>http://www.lingcc.com/2010/04/07/10721/#comments</comments>
		<pubDate>Wed, 07 Apr 2010 14:30:56 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[LLVM]]></category>
		<category><![CDATA[编译前沿]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[编译理论实践和应用]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[N64]]></category>
		<category><![CDATA[Open64]]></category>
		<category><![CDATA[SSA]]></category>
		<category><![CDATA[中间表示]]></category>
		<category><![CDATA[全时优化]]></category>
		<category><![CDATA[工具链]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[空闲时优化]]></category>
		<category><![CDATA[编程技术]]></category>
		<category><![CDATA[编译器]]></category>
		<category><![CDATA[编译器设计]]></category>
		<category><![CDATA[虚拟机]]></category>
		<category><![CDATA[过程间优化]]></category>
		<category><![CDATA[运行时技术]]></category>
		<category><![CDATA[链接]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10721</guid>
		<description><![CDATA[读论文&#60;LLVM: A Compilation Framework for Lifelong Program Analysis &#38; Transformation&#62; CGO 04 1，写在前面的话 全时优化(LifeLong Optimization)对于每个编译爱好者来说，太有魅力了。我在起初也是被这个题目所吸引打算一探究竟。本文是04年LLVM的最早两位开发者Chris Lattner和Vikram Adve所写，发表在04年的CGO上， 先来说说LLVM的历史。2000年LLVM开始开发，2005年Apple雇了Chris Lattner，LLVM也相当于成了Apple的官方支持的编译器。Apple已经将它用在OpenCL的流水线优化，Xcode已经能使用llvm-gcc编译代码。可以说05年之前LLVM一直都是学术界的东西，05年之后用于工业界.而这篇文章写在04年.本博最近听过一个关于LLVM的讨论会，会中有资深人士提到LLVM现在越来越像一个普通的编译器。说这番话的意思是，我们可以从这篇文章里找到LLVM的架构设计和早期的一些实现思想，但请不要迷信LLVM现在有多么神奇，每个架构都会有它的优缺点。 这篇文章，我现在已经读完了理论和介绍部分，性能评测部分还没有读。所以标题里面加了个1，因为接下来，还想作几件事，一是读完文章，二是跟踪一下Chris Lattner最近几年的文章，三是尝试将Open64和LLVM做个对比，最后看看代码。所以敬请期待之后的系列文章。 2.总览 先来解释Lifetime:文中分为编译时，链接时，安装时，运行时，空闲时五个阶段。这五个阶段都存在着优化机会：编译时的普通静态优化；链接时的过程间优化；安装时的目标机相关优化；运行时的动态优化和空闲时的profile制导优化。LLVM最早的设计就是针对以上几种优化进行的。 既然需要运行时和空闲时优化，就必须有必要的运行时环境和profile插装方式。因此注定LLVM的中间表示将占据非常重要的位置。编译和链接是为了生成中间表示，运行和空闲时则需要对中间表示的解释和执行。因此LLVM用上了目前编译所开发的所有技术:静态编译优化，JIT，虚拟机，解释器，运行时技术等等。也注定了LLVM要有一整套的工具链和环境来完成上述工作。 作者给出了LLVM架构设计中由于支持全时优化的五个特性，并支持现阶段，并无任何一种系统能同时具备这五个特性，不管是编译器，虚拟机还是其他系统。这五个特性是： 保持程序信息不变 离线本地代码生成 基于用户的profile和优化 透明的运行时模型 统一的全程序编译。 作者从两个角度来论述LLVM对全时优化的支持，一是LLVM的中间表示设计；二是LLVM的整体架构设计。 3.中间表示 LLVM的中间表示采取类RISC指令集，但包含关键的高层类型信息，精确控制流图和数据流图。LLVM的中间表示的几个特性：低层，语言无关的类型系 统；提供保存类型信息又能做类型转换和底层地址运算的指令；两个底层例外处理指令。LLVM中间表示之所以能做到与源程序独立，是因为它使用了比汇编稍大 的底层指令级及存储模型但并不暴露任何实际运行时需求和源程序语义需求。这种中间表示也决定了LLVM的局限性，对于源源转换之类的优化，LLVM就无法 直接在中间表示发力。 作者主要从五个方面介绍了LLVM中间表示的特点：指令集、语言无关的类型信息、存储模型、例外处理截止和三种中间表示形式相互透明(普通文本，二进制和内存中) 指令集： LLVM的中间表示采用原始处理器中的关键操作，回避物理寄存器、流水线、底层调用转换等细节，但为虚拟寄存器提供了集中类型(布尔型、整型、浮点型、指针),这些虚拟寄存器都采用SSA的形式。LLVM中有31个指令，多数采用了类型重载，且多为三地址形式.LLVM的每个虚拟寄存器都使用SSA的形式，而存储位置则不是SSA，这是因为存储可能存在别名。虚拟寄存器采用SSA能带来精确的定义-使用关系。另外LLVM也简化了控制流图，每个函数都转化为基本块的集合。每个基本块都有LLVM指令序列组成，结束基本块都有一个退出指令，如return，unwind，invoke。 语言无关的类型信息： LLVM中每个SSA 虚拟寄存器和存储对象都有和其关联的类型，所有的操作也都有严格的类型规则。LLVM的类型系统包括了如下类型:void,bool, signed/unsigned int(8bit to 64bit),single float,double float和四种衍生类型：pointer,array,structure和function。作者认为很多高层的类型都能使用这些类型表示。如C++中的类继承就能使用structure,function和function pointer array 来表示；而且作者也认为以上这些类型基本胜任经典的语言无关的程序分析和优化。因为LLVM的中间表示层次低，就需要支持弱类型语言，因此为提高在LLVM程序中声明类型的可靠性，LLVM使用一些指针分析算法来来判断所访问的内存与指针的类型是否可以可靠的相互转换。LLVM的类型转换仅能通过cast指令从一种类型转换为另一种类型。LLVM的指针算术运算通过getelementptr来实现，该指令力保在做地址运算时指令安全。load和store指令则只负责取和存。 精确存储分配和统一存储模型： LLVM通过三个指令实现存储操作：malloc，free和alloca。malloc负责在堆上分配带类型的存储位置；free负责释放malloc分配的存储空间；alloca和malloc相似，它分配的是在当前栈帧內分配存储而非堆，该内存将在函数返回时自动收回。LLVM中所有地址对象都被精确分配地址。全局变量和函数定义都被分配一个对象地址。这使得一个 统一的存储模型被建立。 函数调用和例外处理： <a href='http://www.lingcc.com/2010/04/07/10721/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F04%2F11545%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AMD intern and full time compiler position based on OpenCL and LLVM</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">你好，LLVM 3.0</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
<li><a href='http://www.lingcc.com/2009/12/14/10295/' rel='bookmark' title='open64课程&#8211;过程间分析优化(IPA)'>open64课程&#8211;过程间分析优化(IPA)</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>读论文&lt;<a href="http://llvm.org/pubs/2004-01-30-CGO-LLVM.html" target="_blank">LLVM: A Compilation Framework for Lifelong Program Analysis &amp; Transformation</a>&gt; CGO 04</p>
<h3>1，写在前面的话</h3>
<p>全时优化(LifeLong Optimization)对于每个编译爱好者来说，太有魅力了。我在起初也是被这个题目所吸引打算一探究竟。本文是04年LLVM的最早两位开发者Chris Lattner和Vikram Adve所写，发表在04年的CGO上，</p>
<p>先来说说LLVM的历史。2000年LLVM开始开发，2005年Apple雇了Chris Lattner，LLVM也相当于成了Apple的官方支持的编译器。Apple已经将它用在OpenCL的流水线优化，Xcode已经能使用llvm-gcc编译代码。可以说05年之前LLVM一直都是学术界的东西，05年之后用于工业界.而这篇文章写在04年.本博最近听过一个关于LLVM的讨论会，会中有资深人士提到LLVM现在越来越像一个普通的编译器。说这番话的意思是，我们可以从这篇文章里找到LLVM的架构设计和早期的一些实现思想，但请不要迷信LLVM现在有多么神奇，每个架构都会有它的优缺点。</p>
<p>这篇文章，我现在已经读完了理论和介绍部分，性能评测部分还没有读。所以标题里面加了个1，因为接下来，还想作几件事，一是读完文章，二是跟踪一下Chris Lattner最近几年的文章，三是尝试将Open64和LLVM做个对比，最后看看代码。所以敬请期待之后的系列文章。<br />
<span id="more-10721"></span></p>
<h3>2.总览</h3>
<p>先来解释Lifetime:文中分为编译时，链接时，安装时，运行时，空闲时五个阶段。这五个阶段都存在着优化机会：编译时的普通静态优化；链接时的过程间优化；安装时的目标机相关优化；运行时的动态优化和空闲时的profile制导优化。LLVM最早的设计就是针对以上几种优化进行的。</p>
<p>既然需要运行时和空闲时优化，就必须有必要的运行时环境和profile插装方式。因此注定LLVM的中间表示将占据非常重要的位置。编译和链接是为了生成中间表示，运行和空闲时则需要对中间表示的解释和执行。因此LLVM用上了目前编译所开发的所有技术:静态编译优化，JIT，虚拟机，解释器，运行时技术等等。也注定了LLVM要有一整套的工具链和环境来完成上述工作。</p>
<p>作者给出了LLVM架构设计中由于支持全时优化的五个特性，并支持现阶段，并无任何一种系统能同时具备这五个特性，不管是编译器，虚拟机还是其他系统。这五个特性是：</p>
<ol>
<li>保持程序信息不变</li>
<li>离线本地代码生成</li>
<li>基于用户的profile和优化</li>
<li>透明的运行时模型</li>
<li>统一的全程序编译。</li>
</ol>
<p>作者从两个角度来论述LLVM对全时优化的支持，一是LLVM的中间表示设计；二是LLVM的整体架构设计。</p>
<h3>3.中间表示</h3>
<p>LLVM的中间表示采取类RISC指令集，但包含关键的高层类型信息，精确控制流图和数据流图。LLVM的中间表示的几个特性：低层，语言无关的类型系 统；提供保存类型信息又能做类型转换和底层地址运算的指令；两个底层例外处理指令。LLVM中间表示之所以能做到与源程序独立，是因为它使用了比汇编稍大 的底层指令级及存储模型但并不暴露任何实际运行时需求和源程序语义需求。这种中间表示也决定了LLVM的局限性，对于源源转换之类的优化，LLVM就无法 直接在中间表示发力。</p>
<p>作者主要从五个方面介绍了LLVM中间表示的特点：指令集、语言无关的类型信息、存储模型、例外处理截止和三种中间表示形式相互透明(普通文本，二进制和内存中)</p>
<h4>指令集：</h4>
<p>LLVM的中间表示采用原始处理器中的关键操作，回避物理寄存器、流水线、底层调用转换等细节，但为虚拟寄存器提供了集中类型(布尔型、整型、浮点型、指针),这些虚拟寄存器都采用SSA的形式。LLVM中有31个指令，多数采用了类型重载，且多为三地址形式.LLVM的每个虚拟寄存器都使用SSA的形式，而存储位置则不是SSA，这是因为存储可能存在别名。虚拟寄存器采用SSA能带来精确的定义-使用关系。另外LLVM也简化了控制流图，每个函数都转化为基本块的集合。每个基本块都有LLVM指令序列组成，结束基本块都有一个退出指令，如return，unwind，invoke。</p>
<h4>语言无关的类型信息：</h4>
<p>LLVM中每个SSA 虚拟寄存器和存储对象都有和其关联的类型，所有的操作也都有严格的类型规则。LLVM的类型系统包括了如下类型:void,bool, signed/unsigned int(8bit to 64bit),single float,double float和四种衍生类型：pointer,array,structure和function。作者认为很多高层的类型都能使用这些类型表示。如C++中的类继承就能使用structure,function和function pointer array 来表示；而且作者也认为以上这些类型基本胜任经典的语言无关的程序分析和优化。因为LLVM的中间表示层次低，就需要支持弱类型语言，因此为提高在LLVM程序中声明类型的可靠性，LLVM使用一些指针分析算法来来判断所访问的内存与指针的类型是否可以可靠的相互转换。LLVM的类型转换仅能通过cast指令从一种类型转换为另一种类型。LLVM的指针算术运算通过getelementptr来实现，该指令力保在做地址运算时指令安全。load和store指令则只负责取和存。</p>
<h4>精确存储分配和统一存储模型：</h4>
<p>LLVM通过三个指令实现存储操作：malloc，free和alloca。malloc负责在堆上分配带类型的存储位置；free负责释放malloc分配的存储空间；alloca和malloc相似，它分配的是在当前栈帧內分配存储而非堆，该内存将在函数返回时自动收回。LLVM中所有地址对象都被精确分配地址。全局变量和函数定义都被分配一个对象地址。这使得一个 统一的存储模型被建立。</p>
<h4>函数调用和例外处理：</h4>
<p>对于普通的函数调用，LLVM提供了一个带类型的call指令。LLVM有个与众不同的特性使得低级中间表示能处理高级程序例外，这种特性基于invoke和unwind两个指令实现。这两个指令共同支持了基于栈弹出的抽象例外处理模型。详细的机制论述请参考论文，作者用了将近一页的篇幅来论述。</p>
<h4>普通文本、二进制和内存中的表示形式：</h4>
<p>LLVM的中间表示是首个能同时等价的在二进制，普通文本和内存中(如编译器内部)表示的。指令集最初的设计就考虑到要能高效的即可作为一个中间表示，又能作为离线代码表示和编译器内部表示，并且在三者之间转换时无需任何语义变化。这三者之间的等价转换使得LLVM调试很方便。</p>
<p><em><span style="color: #000000;"><strong>正所谓，中间表示很重要，编译架构也得牛，眼高手低要不得，关键还得看评测。敬请关注下文 LLVM的架构介绍及整体评测。</strong></span></em></p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="2" border="0" width="100%" style="clear: both;">
    
    <tr>
        <td ><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F10%2F20%2F11361%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM居然开始做广告了！</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2012%2F01%2F15%2F11963%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">Open64、LLVM、GCC源代码行数对比</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F03%2F04%2F11545%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">AMD intern and full time compiler position based on OpenCL and LLVM</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F28%2F10807%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">LLVM 2.7 发布</font>
                    </a>
                </td>
            </tr>
            <tr>
                <td style="margin: 0 !important; padding: 0 !important; line-height: 20px !important;">
                    <img border="0" src="http://static.wumii.com/images/widget/widget_solidPoint.gif">
                    <a target="_blank" style="text-decoration: none !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F12%2F08%2F11882%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F04%2F07%2F10721%2F">
                        <font size="-1" color="#333333" style="line-height: 1.65em; font-size: 12px !important;">你好，LLVM 3.0</font>
                    </a>
                </td>
            </tr>
    
    <tr>
        <td  align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2010/04/29/10728/' rel='bookmark' title='前瞻-全时优化和LLVM-2'>前瞻-全时优化和LLVM-2</a></li>
<li><a href='http://www.lingcc.com/2010/04/30/10822/' rel='bookmark' title='前瞻-LLVM大事记(2004-2010)'>前瞻-LLVM大事记(2004-2010)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2009/11/18/10000/' rel='bookmark' title='Open64课程-简介，概述和中间表示'>Open64课程-简介，概述和中间表示</a></li>
<li><a href='http://www.lingcc.com/2009/11/19/10024/' rel='bookmark' title='Open64课程-编译过程'>Open64课程-编译过程</a></li>
<li><a href='http://www.lingcc.com/2009/12/14/10295/' rel='bookmark' title='open64课程&#8211;过程间分析优化(IPA)'>open64课程&#8211;过程间分析优化(IPA)</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/04/07/10721/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WebKit和Firefox的JavaScript性能对比</title>
		<link>http://www.lingcc.com/2010/01/22/10668/</link>
		<comments>http://www.lingcc.com/2010/01/22/10668/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 14:37:22 +0000</pubDate>
		<dc:creator>erlv</dc:creator>
				<category><![CDATA[Linux系统]]></category>
		<category><![CDATA[编译技术]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[elf]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[glibc]]></category>
		<category><![CDATA[intel]]></category>
		<category><![CDATA[JIT]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[MIPS]]></category>
		<category><![CDATA[nanojit]]></category>
		<category><![CDATA[spec]]></category>
		<category><![CDATA[TraceMonkey]]></category>
		<category><![CDATA[WebKit]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[x86]]></category>
		<category><![CDATA[开源]]></category>
		<category><![CDATA[性能]]></category>
		<category><![CDATA[运行时技术]]></category>
		<category><![CDATA[链接]]></category>
		<category><![CDATA[龙芯]]></category>

		<guid isPermaLink="false">http://www.lingcc.com/?p=10668</guid>
		<description><![CDATA[严格的说WebKit仅仅是个浏览器核心，采用该核心的浏览器很多，如国内的搜狗浏览器，遨游浏览器。其他的如google的chrome(Windows平台，linux平台下为chromium),epiphany(linux平台下，gnome2.28版本之后),苹果的Safari 都采用了webkit的内核。Firefox则是采用Gecko的内核，这是NetScape公司开发的内核，后来开源，mozilla继续开发。另外，现在还有另外两种常见的浏览器内核，Trident主要用在IE系列上，Presto主要用在Opera上。 这篇文章仅仅针对浏览器处理JavaScript的性能作比较，主要在X86平台和龙芯平台。先来解释一下JavaScript，JavaScript是互联网内较为常用的脚本语言，面向对象，主要在浏览器内解释执行，用于生成动态网页，因为很多语言特性受Java影响，所以叫JavaScript。通过JavaScript，浏览器可以运行服务器想要在访问者终端上运行的一些计算程序，以达到更好的浏览体验。 再说说浏览器内核和JavaScript的关系，其实JavaScrip脚本的执行仅仅是浏览器内核的一部分，其他的还有Html语言的解释执行，网页的呈现等等也是内核要做的。之所以这么关心浏览器核心对JavaScript脚本的处理情况，是因为现在的很多应用不再是简单的网页浏览，如gmail，google reader，gooe wave还有一些网页3D特效等等都需要在客户机上作计算，这就需要JavaScript大显身手了。而且越来越多的应用依赖JavaScript，所以现在浏览器对JavaScript的处理速度直接影响着用户体验。目前WebKit的JavaScript引擎SquirrelFish，JavaScript的引擎是SpiderMonkey 目前JavaScript在大多数平台上的处理是靠解释执行的，又因为是动态类型，面向对象。。。，决定了JavaScript执行效率低，所以就诞生了各种针对JavaScript的优化，也有了测试JavaScipt解释器性能的BenchMark，目前常用的是Sunspider和google V8，这篇文章中的对比针对Sunspider测试集。 另外还要说说JIT，Just In time，转换，将部分程序代码直接转换成机器码执行，这种技术在运行时优化中比较常用，JavaScript是解释器，所以JIT在解释器中也是很重要的优化手段。目前X86的webkit和Firefox默认就有JIT支持，但龙芯平台上还没有，本博也是最早对龙芯2F平台有JIT支持的Webkit和firefox  JavaScript引擎作对比的，目前这两个JIT都还没有进入官方的代码库中，感兴趣的朋友可以在下面的前两个链接中找到相关源码。其中webkit的补丁还要做些宏的修改，改动不大。这两个都是从官方源码库checkout出来并修改之后的。其中firefox的JIT部分是由ZSC大牛写出来的，详细的讨论贴和测试结果可以在龙芯论坛看到，见下面的第三个链接。 x86下epiphany(webkit内核)和firefox开了jit之后的性能，如下 webkit Total: 833.6ms +/- 2.1% firefox Total: 1774.4ms +/- 2.7% （测试环境是我的笔记本 intel Pentium t2390,开了频率调节，所以波动较大)、两个差距： TEST COMPARISON FROM TO DETAILS ============================================================================= ** TOTAL **: 2.13x as fast 1774.4ms +/- 2.7% 833.6ms +/- 2.1% significant ============================================================================= 3d: 2.96x as fast 257.2ms +/- 2.1% 87.0ms <a href='http://www.lingcc.com/2010/01/22/10668/'>[...]</a><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="webkit-龙小组成立" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">webkit-龙小组成立</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="zzMozilla的疯狂构想 Firefox 4将开拓浏览器新疆界" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F31%2F9966%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/05/11067795.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zzMozilla的疯狂构想 Firefox 4将开拓浏览器新疆界</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="龙芯N32系统上的Squirrelfish性能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="擦亮眼睛 “百度Hi”用户协议有猫腻" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F06%2F9928%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115378.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">擦亮眼睛 “百度Hi”用户协议有猫腻</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table>
<h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>严格的说WebKit仅仅是个浏览器核心，采用该核心的浏览器很多，如国内的搜狗浏览器，遨游浏览器。其他的如google的chrome(Windows平台，linux平台下为chromium),epiphany(linux平台下，gnome2.28版本之后),苹果的Safari 都采用了webkit的内核。Firefox则是采用Gecko的内核，这是NetScape公司开发的内核，后来开源，mozilla继续开发。另外，现在还有另外两种常见的浏览器内核，Trident主要用在IE系列上，Presto主要用在Opera上。</p>
<p>这篇文章仅仅针对浏览器处理JavaScript的性能作比较，主要在X86平台和龙芯平台。先来解释一下JavaScript，JavaScript是互联网内较为常用的脚本语言，面向对象，主要在浏览器内解释执行，用于生成动态网页，因为很多语言特性受Java影响，所以叫JavaScript。通过JavaScript，浏览器可以运行服务器想要在访问者终端上运行的一些计算程序，以达到更好的浏览体验。<span id="more-10668"></span></p>
<p>再说说浏览器内核和JavaScript的关系，其实JavaScrip脚本的执行仅仅是浏览器内核的一部分，其他的还有Html语言的解释执行，网页的呈现等等也是内核要做的。之所以这么关心浏览器核心对JavaScript脚本的处理情况，是因为现在的很多应用不再是简单的网页浏览，如gmail，google reader，gooe wave还有一些网页3D特效等等都需要在客户机上作计算，这就需要JavaScript大显身手了。而且越来越多的应用依赖JavaScript，所以现在浏览器对JavaScript的处理速度直接影响着用户体验。目前WebKit的JavaScript引擎SquirrelFish，JavaScript的引擎是SpiderMonkey</p>
<p>目前JavaScript在大多数平台上的处理是靠解释执行的，又因为是动态类型，面向对象。。。，决定了JavaScript执行效率低，所以就诞生了各种针对JavaScript的优化，也有了测试JavaScipt解释器性能的BenchMark，目前常用的是Sunspider和google V8，这篇文章中的对比针对Sunspider测试集。</p>
<p>另外还要说说JIT，Just In time，转换，将部分程序代码直接转换成机器码执行，这种技术在运行时优化中比较常用，JavaScript是解释器，所以JIT在解释器中也是很重要的优化手段。目前X86的webkit和Firefox默认就有JIT支持，但龙芯平台上还没有，本博也是最早对龙芯2F平台有JIT支持的Webkit和firefox  JavaScript引擎作对比的，目前这两个JIT都还没有进入官方的代码库中，感兴趣的朋友可以在下面的前两个链接中找到相关源码。其中webkit的补丁还要做些宏的修改，改动不大。这两个都是从官方源码库checkout出来并修改之后的。其中firefox的JIT部分是由ZSC大牛写出来的，详细的讨论贴和测试结果可以在龙芯论坛看到，见下面的第三个链接。<br />
x86下epiphany(webkit内核)和firefox开了jit之后的性能，如下</p>
<pre id="comment_text_6">
webkit Total:                  833.6ms +/- 2.1%
firefox Total:                 1774.4ms +/- 2.7%</pre>
<p>（测试环境是我的笔记本 intel Pentium t2390,开了频率调节，所以波动较大)、两个差距：</p>
<pre id="console">TEST                   COMPARISON            FROM                 TO             DETAILS

=============================================================================

** TOTAL **:           2.13x as fast     1774.4ms +/- 2.7%   833.6ms +/- 2.1%     significant

=============================================================================

  3d:                  2.96x as fast      257.2ms +/- 2.1%    87.0ms +/- 1.0%     significant
    cube:              3.36x as fast       79.2ms +/- 1.7%    23.6ms +/- 2.9%     significant
    morph:             1.52x as fast       50.4ms +/- 1.4%    33.2ms +/- 3.1%     significant
    raytrace:          4.23x as fast      127.6ms +/- 3.0%    30.2ms +/- 3.4%     significant

  access:              3.26x as fast      237.0ms +/- 4.7%    72.8ms +/- 2.8%     significant
    binary-trees:      8.82x as fast       67.0ms +/- 4.4%     7.6ms +/- 9.0%     significant
    fannkuch:          3.48x as fast       98.2ms +/- 0.6%    28.2ms +/- 3.7%     significant
    nbody:             2.50x as fast       51.4ms +/- 10.3%    20.6ms +/- 3.3%     significant
    nsieve:            -                   20.4ms +/- 56.6%    16.4ms +/- 4.2% 

  bitops:              1.42x as fast       53.8ms +/- 1.9%    38.0ms +/- 0.0%     significant
    3bit-bits-in-byte: *3.10x as slow*      2.0ms +/- 0.0%     6.2ms +/- 9.0%     significant
    bits-in-byte:      -                   11.0ms +/- 8.0%    10.4ms +/- 6.5%
    bitwise-and:       *2.33x as slow*      3.0ms +/- 0.0%     7.0ms +/- 0.0%     significant
    nsieve-bits:       2.62x as fast       37.8ms +/- 1.5%    14.4ms +/- 4.7%     significant

  controlflow:         8.76x as fast       50.8ms +/- 2.0%     5.8ms +/- 9.6%     significant
    recursive:         8.76x as fast       50.8ms +/- 2.0%     5.8ms +/- 9.6%     significant

  crypto:              2.34x as fast       93.8ms +/- 1.7%    40.0ms +/- 2.2%     significant
    aes:               2.57x as fast       54.0ms +/- 3.6%    21.0ms +/- 4.2%     significant
    md5:               2.62x as fast       26.2ms +/- 2.1%    10.0ms +/- 0.0%     significant
    sha1:              1.51x as fast       13.6ms +/- 5.0%     9.0ms +/- 0.0%     significant

  date:                1.87x as fast      275.2ms +/- 2.0%   147.0ms +/- 1.0%     significant
    format-tofte:      2.75x as fast      149.0ms +/- 1.0%    54.2ms +/- 1.0%     significant
    format-xparb:      1.36x as fast      126.2ms +/- 4.0%    92.8ms +/- 1.7%     significant

  math:                1.12x as fast       89.8ms +/- 1.8%    80.2ms +/- 21.7%     significant
    cordic:            2.13x as fast       43.4ms +/- 3.3%    20.4ms +/- 9.2%     significant
    partial-sums:      *1.41x as slow*     34.4ms +/- 2.0%    48.6ms +/- 38.2%     significant
    spectral-norm:     1.07x as fast       12.0ms +/- 0.0%    11.2ms +/- 12.2%     significant

  regexp:              3.73x as fast      125.4ms +/- 15.5%    33.6ms +/- 2.0%     significant
    dna:               3.73x as fast      125.4ms +/- 15.5%    33.6ms +/- 2.0%     significant

  string:              1.80x as fast      591.4ms +/- 3.3%   329.2ms +/- 1.6%     significant
    base64:            *1.24x as slow*     28.4ms +/- 2.4%    35.2ms +/- 1.6%     significant
    fasta:             1.71x as fast      133.0ms +/- 2.3%    78.0ms +/- 4.6%     significant
    tagcloud:          2.81x as fast      169.4ms +/- 3.8%    60.2ms +/- 8.2%     significant
    unpack-code:       1.91x as fast      193.8ms +/- 4.4%   101.6ms +/- 2.7%     significant
    validate-input:    1.23x as fast       66.8ms +/- 5.8%    54.2ms +/- 6.4%     significant</pre>
<p>龙芯上的JIT具体对比数据不便透漏，可以从下面第三个链接中找到第一版发布时的测试数据。这里仅仅给出一个对比。webkit之所以with GUI是使用编译出的迷你小浏览器中测试结果，no GUI是使用测试脚本跑出来的结果。</p>
<pre id="comment_text_4"> Webkit with GUI Total:                  6723.4ms +/- 0.5%
        no GUI   Total:                  6355.8ms +/- 0.5%
 Firfox Total 7000 ms 左右。</pre>
<p>注： 龙芯中的JIT现在还不够成熟，其中Webkit的JIT仅是针对MIPS III做的，没有针对龙芯的特殊优化。</p>
<p>另外，X86中firefox的版本是3.5.7，龙芯中firefox的版本是3.7pre1.WebKit在X86中版本是epiphany的2.28中的版本，龙芯中为SVN中的2010-01-12 r53114。X86运行环境为Gentoo，Gcc4.4.2,Glibc2.11,龙芯运行环境是玲珑一体机，GCC4.3(龙梦修改版）,Glibc2.10。</p>
<p>对比结果可见：X86中WebKit浏览器的性能要明显优于Firefox，达到两倍之多。龙芯相比起来还有些差距，不过相信优化后龙芯的性能会更好。</p>
<p><strong>参考</strong></p>
<p>https://bugs.webkit.org/show_bug.cgi?id=30144</p>
<p>http://dev.lemote.com/code/firefox-3.7-loongson-jit</p>
<p>http://lemote.com/bbs/viewthread.php?tid=26687&#038;extra=page%3D1</p>
<p>http://en.wikipedia.org/wiki/Google_Chrome</p>
<p>http://ineolee.com/pc/several-browser-core-introduction/</p>
<div style=float:left><!-- JiaThis Button BEGIN -->
<div id="jiathis_style_32x32">
	<a class="jiathis_button_qzone"></a>
	<a class="jiathis_button_tsina"></a>
	<a class="jiathis_button_tqq"></a>
	<a class="jiathis_button_renren"></a>
	<a class="jiathis_button_kaixin001"></a>
	<a href="http://www.jiathis.com/share/" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
	<a class="jiathis_counter_style"></a>
</div>
<script type="text/javascript" src="http://v2.jiathis.com/code/jia.js" charset="utf-8"></script>
<!-- JiaThis Button END --></div><table class="wumii-related-items" cellspacing="0" cellpadding="3" border="0"  style="clear: both;">
    
    <tr>
        <td colspan="5"><b><font size="-1"  style="display: block !important; padding: 20px 0 5px !important;">您可能也喜欢：</font></b></td>
    </tr>
    
        <tr>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important;">
                    <a target="_blank" title="webkit-龙小组成立" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F07%2F10%2F11060%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">webkit-龙小组成立</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="zzMozilla的疯狂构想 Firefox 4将开拓浏览器新疆界" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F31%2F9966%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/06/05/11067795.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">zzMozilla的疯狂构想 Firefox 4将开拓浏览器新疆界</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="龙芯N32系统上的Squirrelfish性能" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2010%2F06%2F28%2F10983%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">龙芯N32系统上的Squirrelfish性能</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2011%2F10%2F09%2F11773%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/images/blogWidget/wordpress_default.gif" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">JIT Compiler and Virtual Machine SW Engineer for Web Browsers in Qualcomm</font>
                    </a>
                </td>
                <td width="102" valign="top" style="padding: 5px !important; margin: 0 !important; border-left: 1px solid #DDDDDD !important;">
                    <a target="_blank" title="擦亮眼睛 “百度Hi”用户协议有猫腻" style="text-decoration: none !important; cursor: pointer !important;" href="http://app.wumii.com/ext/redirect.htm?url=http%3A%2F%2Fwww.lingcc.com%2F2008%2F03%2F06%2F9928%2F&from=http%3A%2F%2Fwww.lingcc.com%2F2010%2F01%2F22%2F10668%2F">
                        <img style="margin: 0 !important; padding: 2px !important; border: 1px solid #DDDDDD !important; width: 96px !important; height: 96px !important;" src="http://static.wumii.com/site_images/2011/04/30/7115378.jpg" width="96px" height="96px" /><br />
                        <font size="-1" color="#333333" style="display: block !important; line-height: 15px !important; width: 102px !important; font: 12px/15px arial !important; height: 60px !important; margin: 3px 0 0 0 !important; padding: 0 !important; overflow: hidden !important;">擦亮眼睛 “百度Hi”用户协议有猫腻</font>
                    </a>
                </td>
        </tr>
    
    <tr>
        <td colspan="5" align="right">
            <a style="text-decoration: none !important;" href="http://www.wumii.com/widget/relatedItems.htm" target="_blank" title="无觅相关文章插件">
                <font size="-1" color="#bbbbbb" style="display: block !important; font-family: arial !important; padding: 5px 0 !important; font-size: 12px !important; color: #bbb !important;">无觅</font>
            </a>
        </td>
    </tr>
</table><p><h3>相关文章：</h3><ul>
<li><a href='http://www.lingcc.com/2009/12/24/10451/' rel='bookmark' title='拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)'>拥有Nanojit龙芯后端的firefox发布(10年1月14日更新)</a></li>
<li><a href='http://www.lingcc.com/2009/12/29/10503/' rel='bookmark' title='GCC初窥'>GCC初窥</a></li>
<li><a href='http://www.lingcc.com/2010/01/05/10588/' rel='bookmark' title='用crossdev装龙芯的n32 gnu交叉工具链'>用crossdev装龙芯的n32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2010/01/07/10594/' rel='bookmark' title='使用crossdev安装龙芯的O32 gnu交叉工具链'>使用crossdev安装龙芯的O32 gnu交叉工具链</a></li>
<li><a href='http://www.lingcc.com/2009/12/31/10534/' rel='bookmark' title='Gentoo中的交叉编译利器&#8211;crossdev'>Gentoo中的交叉编译利器&#8211;crossdev</a></li>
<li><a href='http://www.lingcc.com/2010/06/28/10983/' rel='bookmark' title='龙芯N32系统上的Squirrelfish性能'>龙芯N32系统上的Squirrelfish性能</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.lingcc.com/2010/01/22/10668/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

