Author: Maciej Fijalkowski <[email protected]>
Branch:
Changeset: r51213:6b798036894a
Date: 2012-01-10 21:19 +0200
http://bitbucket.org/pypy/pypy/changeset/6b798036894a/
Log: merge
diff --git a/pypy/doc/Makefile b/pypy/doc/Makefile
--- a/pypy/doc/Makefile
+++ b/pypy/doc/Makefile
@@ -12,7 +12,7 @@
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
-.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes
linkcheck doctest
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex man changes
linkcheck doctest
help:
@echo "Please use \`make <target>' where <target> is one of"
@@ -23,6 +23,7 @@
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " latex to make LaTeX files, you can set PAPER=a4 or
PAPER=letter"
+ @echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated
items"
@echo " linkcheck to check all external links for integrity"
@echo " doctest to run all doctests embedded in the documentation
(if enabled)"
@@ -79,6 +80,11 @@
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man"
+
changes:
python config/generate.py
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -197,3 +197,10 @@
# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'http://docs.python.org/': None}
+# -- Options for manpage
output-------------------------------------------------
+
+man_pages = [
+ ('man/pypy.1', 'pypy',
+ u'fast, compliant alternative implementation of the Python language',
+ u'The PyPy Project', 1)
+]
diff --git a/pypy/doc/extradoc.rst b/pypy/doc/extradoc.rst
--- a/pypy/doc/extradoc.rst
+++ b/pypy/doc/extradoc.rst
@@ -8,6 +8,9 @@
*Articles about PyPy published so far, most recent first:* (bibtex_ file)
+* `Runtime Feedback in a Meta-Tracing JIT for Efficient Dynamic Languages`_,
+ C.F. Bolz, A. Cuni, M. Fijalkowski, M. Leuschel, S. Pedroni, A. Rigo
+
* `Allocation Removal by Partial Evaluation in a Tracing JIT`_,
C.F. Bolz, A. Cuni, M. Fijalkowski, M. Leuschel, S. Pedroni, A. Rigo
@@ -50,6 +53,9 @@
*Other research using PyPy (as far as we know it):*
+* `Hardware Transactional Memory Support for Lightweight Dynamic Language
Evolution`_,
+ N. Riley and C. Zilles
+
* `PyGirl: Generating Whole-System VMs from High-Level Prototypes using PyPy`_,
C. Bruni and T. Verwaest
@@ -65,6 +71,7 @@
.. _bibtex: https://bitbucket.org/pypy/extradoc/raw/tip/talk/bibtex.bib
+.. _`Runtime Feedback in a Meta-Tracing JIT for Efficient Dynamic Languages`:
https://bitbucket.org/pypy/extradoc/raw/extradoc/talk/icooolps2011/jit-hints.pdf
.. _`Allocation Removal by Partial Evaluation in a Tracing JIT`:
http://codespeak.net/svn/pypy/extradoc/talk/pepm2011/bolz-allocation-removal.pdf
.. _`Towards a Jitting VM for Prolog Execution`:
http://www.stups.uni-duesseldorf.de/publications/bolz-prolog-jit.pdf
.. _`High performance implementation of Python for CLI/.NET with JIT compiler
generation for dynamic languages`:
http://buildbot.pypy.org/misc/antocuni-thesis.pdf
@@ -74,6 +81,7 @@
.. _`Automatic JIT Compiler Generation with Runtime Partial Evaluation`:
http://www.stups.uni-duesseldorf.de/thesis/final-master.pdf
.. _`RPython: A Step towards Reconciling Dynamically and Statically Typed OO
Languages`:
http://www.disi.unige.it/person/AnconaD/papers/Recent_abstracts.html#AACM-DLS07
.. _`EU Reports`: index-report.html
+.. _`Hardware Transactional Memory Support for Lightweight Dynamic Language
Evolution`: http://sabi.net/nriley/pubs/dls6-riley.pdf
.. _`PyGirl: Generating Whole-System VMs from High-Level Prototypes using
PyPy`: http://scg.unibe.ch/archive/papers/Brun09cPyGirl.pdf
.. _`Representation-Based Just-in-Time Specialization and the Psyco Prototype
for Python`: http://psyco.sourceforge.net/psyco-pepm-a.ps.gz
.. _`Back to the Future in One Week -- Implementing a Smalltalk VM in PyPy`:
http://dx.doi.org/10.1007/978-3-540-89275-5_7
diff --git a/pypy/doc/man/pypy.1.rst b/pypy/doc/man/pypy.1.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/man/pypy.1.rst
@@ -0,0 +1,90 @@
+======
+ pypy
+======
+
+SYNOPSIS
+========
+
+``pypy`` [*options*]
+[``-c`` *cmd*\ \|\ ``-m`` *mod*\ \|\ *file.py*\ \|\ ``-``\ ]
+[*arg*\ ...]
+
+OPTIONS
+=======
+
+-i
+ Inspect interactively after running script.
+
+-O
+ Dummy optimization flag for compatibility with C Python.
+
+-c *cmd*
+ Program passed in as CMD (terminates option list).
+
+-S
+ Do not ``import site`` on initialization.
+
+-u
+ Unbuffered binary ``stdout`` and ``stderr``.
+
+-h, --help
+ Show a help message and exit.
+
+-m *mod*
+ Library module to be run as a script (terminates option list).
+
+-W *arg*
+ Warning control (*arg* is *action*:*message*:*category*:*module*:*lineno*).
+
+-E
+ Ignore environment variables (such as ``PYTHONPATH``).
+
+--version
+ Print the PyPy version.
+
+--info
+ Print translation information about this PyPy executable.
+
+--jit *arg*
+ Low level JIT parameters. Format is
+ *arg*\ ``=``\ *value*\ [``,``\ *arg*\ ``=``\ *value*\ ...]
+
+ ``off``
+ Disable the JIT.
+
+ ``threshold=``\ *value*
+ Number of times a loop has to run for it to become hot.
+
+ ``function_threshold=``\ *value*
+ Number of times a function must run for it to become traced from
+ start.
+
+ ``inlining=``\ *value*
+ Inline python functions or not (``1``/``0``).
+
+ ``loop_longevity=``\ *value*
+ A parameter controlling how long loops will be kept before being
+ freed, an estimate.
+
+ ``max_retrace_guards=``\ *value*
+ Number of extra guards a retrace can cause.
+
+ ``retrace_limit=``\ *value*
+ How many times we can try retracing before giving up.
+
+ ``trace_eagerness=``\ *value*
+ Number of times a guard has to fail before we start compiling a
+ bridge.
+
+ ``trace_limit=``\ *value*
+ Number of recorded operations before we abort tracing with
+ ``ABORT_TRACE_TOO_LONG``.
+
+ ``enable_opts=``\ *value*
+ Optimizations to enabled or ``all``.
+ Warning, this option is dangerous, and should be avoided.
+
+SEE ALSO
+========
+
+**python**\ (1)
diff --git a/pypy/rlib/clibffi.py b/pypy/rlib/clibffi.py
--- a/pypy/rlib/clibffi.py
+++ b/pypy/rlib/clibffi.py
@@ -30,6 +30,9 @@
_MAC_OS = platform.name == "darwin"
_FREEBSD_7 = platform.name == "freebsd7"
+_LITTLE_ENDIAN = sys.byteorder == 'little'
+_BIG_ENDIAN = sys.byteorder == 'big'
+
if _WIN32:
from pypy.rlib import rwin32
@@ -360,12 +363,36 @@
cast_type_to_ffitype._annspecialcase_ = 'specialize:memo'
def push_arg_as_ffiptr(ffitp, arg, ll_buf):
- # this is for primitive types. For structures and arrays
- # would be something different (more dynamic)
+ # This is for primitive types. Note that the exact type of 'arg' may be
+ # different from the expected 'c_size'. To cope with that, we fall back
+ # to a byte-by-byte copy.
TP = lltype.typeOf(arg)
TP_P = lltype.Ptr(rffi.CArray(TP))
- buf = rffi.cast(TP_P, ll_buf)
- buf[0] = arg
+ TP_size = rffi.sizeof(TP)
+ c_size = intmask(ffitp.c_size)
+ # if both types have the same size, we can directly write the
+ # value to the buffer
+ if c_size == TP_size:
+ buf = rffi.cast(TP_P, ll_buf)
+ buf[0] = arg
+ else:
+ # needs byte-by-byte copying. Make sure 'arg' is an integer type.
+ # Note that this won't work for rffi.FLOAT/rffi.DOUBLE.
+ assert TP is not rffi.FLOAT and TP is not rffi.DOUBLE
+ if TP_size <= rffi.sizeof(lltype.Signed):
+ arg = rffi.cast(lltype.Unsigned, arg)
+ else:
+ arg = rffi.cast(lltype.UnsignedLongLong, arg)
+ if _LITTLE_ENDIAN:
+ for i in range(c_size):
+ ll_buf[i] = chr(arg & 0xFF)
+ arg >>= 8
+ elif _BIG_ENDIAN:
+ for i in range(c_size-1, -1, -1):
+ ll_buf[i] = chr(arg & 0xFF)
+ arg >>= 8
+ else:
+ raise AssertionError
push_arg_as_ffiptr._annspecialcase_ = 'specialize:argtype(1)'
diff --git a/pypy/rlib/jit.py b/pypy/rlib/jit.py
--- a/pypy/rlib/jit.py
+++ b/pypy/rlib/jit.py
@@ -390,12 +390,12 @@
'threshold': 'number of times a loop has to run for it to become hot',
'function_threshold': 'number of times a function must run for it to
become traced from start',
'trace_eagerness': 'number of times a guard has to fail before we start
compiling a bridge',
- 'trace_limit': 'number of recorded operations before we abort tracing with
ABORT_TRACE_TOO_LONG',
+ 'trace_limit': 'number of recorded operations before we abort tracing with
ABORT_TOO_LONG',
'inlining': 'inline python functions or not (1/0)',
'loop_longevity': 'a parameter controlling how long loops will be kept
before being freed, an estimate',
'retrace_limit': 'how many times we can try retracing before giving up',
'max_retrace_guards': 'number of extra guards a retrace can cause',
- 'enable_opts': 'optimizations to enabled or all, INTERNAL USE ONLY'
+ 'enable_opts': 'optimizations to enable or all, INTERNAL USE ONLY'
}
PARAMETERS = {'threshold': 1039, # just above 1024, prime
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit