~ubuntu-branches/ubuntu/karmic/pypy/karmic

« back to all changes in this revision

Viewing changes to pypy/doc/config/translation.backendopt.mallocs.html

  • Committer: Bazaar Package Importer
  • Author(s): Alexandre Fayolle
  • Date: 2007-04-13 09:33:09 UTC
  • Revision ID: james.westby@ubuntu.com-20070413093309-yoojh4jcoocu2krz
Tags: upstream-1.0.0
ImportĀ upstreamĀ versionĀ 1.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
2
<html>
 
3
  <head>
 
4
    <title>PyPy Configuration[translation.backendopt.mallocs] </title>
 
5
    <meta content="text/html;charset=ISO-8859-1" name="Content-Type"/>
 
6
    <link href="../style.css" media="screen" rel="stylesheet" type="text/css"/></head>
 
7
  <body>
 
8
    <div><a><img alt="PyPy" height="110" id="pyimg" src="http://codespeak.net/pypy/img/py-web1.png" width="149"/></a></div>
 
9
    <div id="metaspace">
 
10
      <div class="project_title">PyPy Configuration[translation.backendopt.mallocs] </div>
 
11
      <div id="menubar"><a class="menu" href="../index.html">general documentation</a> <a class="menu" href="index.html">config index</a> <a class="menu" href="commandline.html">command-line overview</a>  </div></div>
 
12
    <div id="contentspace">
 
13
      <div id="docinfoline">
 
14
        <div style="float: right; font-style: italic;"> </div></div>
 
15
<div class="document" id="translation-backendopt-mallocs">
 
16
<h1 class="title">translation.backendopt.mallocs</h1>
 
17
 
 
18
<div class="contents topic">
 
19
<p class="topic-title first"><a id="contents" name="contents">Contents</a></p>
 
20
<ul class="simple">
 
21
<li><a class="reference" href="#basic-option-information" id="id1" name="id1">Basic Option Information</a></li>
 
22
<li><a class="reference" href="#description" id="id2" name="id2">Description</a></li>
 
23
</ul>
 
24
</div>
 
25
<p><a class="reference" href="translation.backendopt.html">back to parent</a></p>
 
26
<div class="section">
 
27
<h1><a class="toc-backref" href="#id1" id="basic-option-information" name="basic-option-information">Basic Option Information</a></h1>
 
28
<ul class="simple">
 
29
<li><strong>name:</strong> mallocs</li>
 
30
<li><strong>description:</strong> Remove mallocs</li>
 
31
<li><strong>command-line:</strong> --translation-backendopt-mallocs</li>
 
32
<li><strong>command-line for negation:</strong> --no-translation-backendopt-mallocs</li>
 
33
<li><strong>option type:</strong> boolean option</li>
 
34
<li><strong>default:</strong> True</li>
 
35
</ul>
 
36
</div>
 
37
<div class="section">
 
38
<h1><a class="toc-backref" href="#id2" id="description" name="description">Description</a></h1>
 
39
<p>This optimization enables &quot;malloc removal&quot;, which &quot;explodes&quot;
 
40
allocations of structures which do not escape from the function they
 
41
are allocated in into one or more additional local variables.</p>
 
42
<p>An example.  Consider this rather unlikely seeming code:</p>
 
43
<pre class="literal-block">
 
44
class C:
 
45
    pass
 
46
def f(y):
 
47
    c = C()
 
48
    c.x = y
 
49
    return c.x
 
50
</pre>
 
51
<p>Malloc removal will spot that the <tt class="docutils literal"><span class="pre">C</span></tt> object can never leave <tt class="docutils literal"><span class="pre">f</span></tt>
 
52
and replace the above with code like this:</p>
 
53
<pre class="literal-block">
 
54
def f(y):
 
55
    _c__x = y
 
56
    return _c__x
 
57
</pre>
 
58
<p>It is rare for code to be directly written in a way that allows this
 
59
optimization to be useful, but inlining often results in opportunities
 
60
for its use (and indeed, this is one of the main reasons PyPy does its
 
61
own inlining rather than relying on the C compilers).</p>
 
62
<p>For much more information about this and other optimizations you can
 
63
read section 4.1 of the technical report on &quot;Massive Parallelism and
 
64
Translation Aspects&quot; which you can find on the <a class="reference" href="../index-report.html">Technical reports page</a>.</p>
 
65
</div>
 
66
</div>
 
67
</div></body></html>
 
 
b'\\ No newline at end of file'