<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html xmlns:erl="http://erlang.org" xmlns:fn="http://www.w3.org/2005/02/xpath-functions"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="../../../../doc/otp_doc.css" type="text/css"> <title>Erlang -- HiPE</title> </head> <body> <div id="container"> <script id="js" type="text/javascript" language="JavaScript" src="../../../../doc/js/flipmenu/flipmenu.js"></script><script id="js2" type="text/javascript" src="../../../../doc/js/erlresolvelinks.js"></script><script language="JavaScript" type="text/javascript"> <!-- function getWinHeight() { var myHeight = 0; if( typeof( window.innerHeight ) == 'number' ) { //Non-IE myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myHeight = document.body.clientHeight; } return myHeight; } function setscrollpos() { var objf=document.getElementById('loadscrollpos'); document.getElementById("leftnav").scrollTop = objf.offsetTop - getWinHeight()/2; } function addEvent(obj, evType, fn){ if (obj.addEventListener){ obj.addEventListener(evType, fn, true); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { return false; } } addEvent(window, 'load', setscrollpos); //--></script><div id="leftnav"><div class="innertube"> <div class="erlang-logo-wrapper"><a href="../../../../doc/index.html"><img alt="Erlang Logo" src="../../../../doc/erlang-logo.png" class="erlang-logo"></a></div> <p class="section-title">HiPE</p> <p class="section-subtitle">Reference Manual</p> <p class="section-version">Version 3.18.2</p> <ul class="panel-sections"> <li><a href="index.html">Reference Manual</a></li> <li><a href="release_notes.html">Release Notes</a></li> <li><a href="../pdf/hipe-3.18.2.pdf">PDF</a></li> <li><a href="../../../../doc/index.html">Top</a></li> </ul> <ul class="expand-collapse-items"> <li><a href="javascript:openAllFlips()">Expand All</a></li> <li><a href="javascript:closeAllFlips()">Contract All</a></li> </ul> <h3>Table of Contents</h3> <ul class="flipMenu"><li title="HiPE (App)"><a href="HiPE_app.html">HiPE (App) </a></li></ul> </div></div> <div id="content"> <div class="innertube"> <!-- refpage --><center><h1>HiPE</h1></center> <h3><span onMouseOver="document.getElementById('ghlink-application-idm281473053362760').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-application-idm281473053362760').style.visibility = 'hidden';"><span id="ghlink-application-idm281473053362760"></span><a class="title_link" name="application" href="#application">Application</a></span></h3> <div class="REFBODY application-body">HiPE</div> <h3><span onMouseOver="document.getElementById('ghlink-application-summary-idm281473053362296').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-application-summary-idm281473053362296').style.visibility = 'hidden';"><span id="ghlink-application-summary-idm281473053362296"></span><a class="title_link" name="application-summary" href="#application-summary">Application Summary</a></span></h3> <div class="REFBODY application-summary-body">The HiPE Application</div> <h3><span onMouseOver="document.getElementById('ghlink-description-idm281473053362936').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-description-idm281473053362936').style.visibility = 'hidden';"><span id="ghlink-description-idm281473053362936" class="ghlink"><a href="https://github.com/erlang/otp/edit/maint/lib/hipe/doc/src/hipe_app.xml#L37" title="Found an issue with the documentation? Fix it by clicking here!"><span class="pencil"></span></a></span><a class="title_link" name="description" href="#description">Description</a></span></h3> <div class="REFBODY description-body"><p> <div class="note"> <div class="label">Note</div> <div class="content"><p> <p> HiPE and execution of HiPE compiled code only have limited support by the OTP team at Ericsson. The OTP team only does limited maintenance of HiPE and does not actively develop HiPE. HiPE is mainly supported by the HiPE team at Uppsala University. </p> </p></div> </div> <p> The normal way to native-compile an Erlang module using HiPE is to include the atom native in the Erlang compiler options, as in:</p> <div class="example"><pre> 1> <span class="bold_code bc-12">c(my_module, [native]).</span></pre></div> <p>Options to the HiPE compiler are then passed as follows:</p> <div class="example"><pre> 1> <span class="bold_code bc-12">c(my_module, [native,{hipe,Options}]).</span></pre></div> <p>For on-line help in the Erlang shell, call <span class="code">hipe:help()</span>. Details on HiPE compiler options are given by <span class="code">hipe:help_options()</span>.</p> </p></div> <h3><span onMouseOver="document.getElementById('ghlink-feature-limitations-idm281473053151160').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-feature-limitations-idm281473053151160').style.visibility = 'hidden';"><span id="ghlink-feature-limitations-idm281473053151160" class="ghlink"><a href="https://github.com/erlang/otp/edit/maint/lib/hipe/doc/src/hipe_app.xml#L57" title="Found an issue with the documentation? Fix it by clicking here!"><span class="pencil"></span></a></span><a class="title_link" name="feature-limitations" href="#feature-limitations">Feature Limitations</a></span></h3> <div class="REFBODY rb-3"> <p> The HiPE compiler is in general compliant with the normal BEAM compiler, with respect to semantic behavior. There are however features in the BEAM compiler and the runtime system that have limited or no support for HiPE compiled modules. </p> <dl> <dt><strong>Stack traces</strong></dt> <dd> <p>Stack traces returned from <span class="bold_code bc-13"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#get_stacktrace-0');"><span class="code">erlang:get_stacktrace/0</span></a></span> or as part of <span class="code">'EXIT'</span> terms can look incomplete if HiPE compiled functions are involved. Typically a stack trace will contain only BEAM compiled functions or only HiPE compiled functions, depending on where the exception was raised.</p> <p>Source code line numbers in stack traces are also not supported by HiPE compiled functions.</p> </dd> <dt><strong>Tracing</strong></dt> <dd> <p>Erlang call trace is not supported by HiPE. Calling <span class="bold_code bc-13"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#trace_pattern-3');"><span class="code">erlang:trace_pattern({M,F,A}, ...)</span></a></span> does not have any effect on HiPE compiled modules.</p> </dd> <dt><strong>NIFs</strong></dt> <dd> <p>Modules compiled with HiPE can not call <span class="bold_code bc-13"><a href="javascript:erlhref('../../../../doc/../','erts','erlang.html#load_nif-2');"><span class="code">erlang:load_nif/2</span></a></span> to load NIFs.</p> </dd> <dt><strong>-on_load</strong></dt> <dd> <p>Modules compiled with HiPE can not use <span class="bold_code bc-13"><a href="javascript:erlhref('../../../../doc/../','doc/reference_manual','code_loading.html#on_load');"><span class="code">-on_load()</span></a></span> directives.</p> </dd> </dl> </div> <h3><span onMouseOver="document.getElementById('ghlink-performance-limitations-idm281473053161112').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-performance-limitations-idm281473053161112').style.visibility = 'hidden';"><span id="ghlink-performance-limitations-idm281473053161112" class="ghlink"><a href="https://github.com/erlang/otp/edit/maint/lib/hipe/doc/src/hipe_app.xml#L93" title="Found an issue with the documentation? Fix it by clicking here!"><span class="pencil"></span></a></span><a class="title_link" name="performance-limitations" href="#performance-limitations">Performance Limitations</a></span></h3> <div class="REFBODY rb-3"> <p> The HiPE compiler does in general produce faster code than the BEAM compiler. There are however some situation when HiPE compiled code will perform worse than BEAM code. </p> <dl> <dt><strong>Mode switches</strong></dt> <dd> <p>Every time a process changes from executing code in a HiPE compiled module to a BEAM compiled module (or vice versa), it will do a mode switch. This involves a certain amount of CPU overhead which can have a negative net impact if the process is switching back and forth without getting enough done in each mode.</p> </dd> <dt><strong>Optimization for <span class="code">receive</span> with unique references</strong></dt> <dd> <p> The BEAM compiler can do an optimization when a receive statement is only waiting for messages containing a reference created before the receive. All messages that existed in the queue when the reference was created will be bypassed, as they cannot possibly contain the reference. HiPE currently has an optimization similar this, but it is not guaranteed to bypass all messages. In the worst case scenario, it cannot bypass any messages at all. </p> <p> An example of this is when <span class="code">gen_server:call()</span> waits for the reply message. </p> </dd> <dt><strong>Garbage collection after BIFs</strong></dt> <dd> <p> The condition for determining whether a garbage collection is needed or not has changed in later releases. HiPE has not been updated regarding this which may cause premature garbage collections after BIF calls. </p> </dd> </dl> </div> <h3><span onMouseOver="document.getElementById('ghlink-stability-issues-idm281473053538856').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-stability-issues-idm281473053538856').style.visibility = 'hidden';"><span id="ghlink-stability-issues-idm281473053538856" class="ghlink"><a href="https://github.com/erlang/otp/edit/maint/lib/hipe/doc/src/hipe_app.xml#L140" title="Found an issue with the documentation? Fix it by clicking here!"><span class="pencil"></span></a></span><a class="title_link" name="stability-issues" href="#stability-issues">Stability Issues</a></span></h3> <div class="REFBODY rb-3"> <dl> <dt><strong>Not checking reduction count on function returns</strong></dt> <dd> <p> BEAM checks the reduction count and schedules out the executing process if needed both when calling a function and when returning from a function call that was not called using a tail call. HiPE only checks the reduction count when calling a function. </p> <p> The runtime system might need to schedule out a process in order to reclaim memory. If the process isn't scheduled out soon after the process has entered this state, memory consumption will quickly grow. Maintaining this state is also quite expensive performance wise. </p> <p> Processes executing code that performs large recursions and produce data after returning from recursive calls may have to be scheduled out when returning from a function call. Since HiPE does not check reductions on returns, processes executing such HiPE compiled code may cause huge peeks in memory consumption as well as severe performance degradation. </p> </dd> <dt><strong>Not bumping appropriate amount of reductions in <span class="code">receive</span> statements</strong></dt> <dd> <p> The process signaling improvements made in ERTS version 10.0 moved potentially significant amounts of work into the receive statement from other places. In order to account for this work, the reduction count should be bumped on the executing process. Reductions are not bumped when entering the <span class="code">receive</span> statement from HiPE compiled code. </p> </dd> </dl> </div> <h3><span onMouseOver="document.getElementById('ghlink-see-also-idm281473053110872').style.visibility = 'visible';" onMouseOut="document.getElementById('ghlink-see-also-idm281473053110872').style.visibility = 'hidden';"><span id="ghlink-see-also-idm281473053110872" class="ghlink"><a href="https://github.com/erlang/otp/edit/maint/lib/hipe/doc/src/hipe_app.xml#L181" title="Found an issue with the documentation? Fix it by clicking here!"><span class="pencil"></span></a></span><a class="title_link" name="see-also" href="#see-also">SEE ALSO</a></span></h3> <div class="REFBODY rb-3"> <p> <span class="bold_code bc-18"><a href="javascript:erlhref('../../../../doc/../','stdlib','c.html');">c(3)</a></span>, <span class="bold_code bc-18"><a href="javascript:erlhref('../../../../doc/../','compiler','compile.html');">compile(3)</a></span> </p> </div> </div> <div class="footer"> <hr> <p>Copyright © 2006-2019 Ericsson AB. All Rights Reserved.</p> </div> </div> </div> <script type="text/javascript">window.__otpTopDocDir = '../../../../doc/js/';</script><script type="text/javascript" src="../../../../doc/js/highlight.js"></script> </body> </html>