[pypy-commit] pypy py3k: hg merge b238b48f9138

mjacob pypy.commits at gmail.com
Sun Mar 13 18:45:51 EDT 2016


Author: Manuel Jacob <me at manueljacob.de>
Branch: py3k
Changeset: r83023:7fa0c2fa7ef4
Date: 2016-03-13 23:06 +0100
http://bitbucket.org/pypy/pypy/changeset/7fa0c2fa7ef4/

Log:	hg merge b238b48f9138

	This is the last changeset which was merged into release-5.x.

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -240,6 +240,7 @@
   Kristjan Valur Jonsson
   David Lievens
   Neil Blakey-Milner
+  Sergey Matyunin
   Lutz Paelike
   Lucio Torre
   Lars Wassermann
@@ -271,6 +272,7 @@
   Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
+  Logan Chien
   Juan Francisco Cantero Hurtado
   Ruochen Huang
   Jeong YunWon
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -123,7 +123,7 @@
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-#html_title = None
+html_title = 'PyPy documentation'
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
 #html_short_title = None
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -210,6 +210,7 @@
   Kristjan Valur Jonsson
   David Lievens
   Neil Blakey-Milner
+  Sergey Matyunin
   Lutz Paelike
   Lucio Torre
   Lars Wassermann
@@ -241,6 +242,7 @@
   Aaron Tubbs
   Ben Darnell
   Roberto De Ioris
+  Logan Chien
   Juan Francisco Cantero Hurtado
   Ruochen Huang
   Jeong YunWon
diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -265,7 +265,7 @@
         return False
 
     def evil(y):
-        d = {x(): 1}
+        d = {X(): 1}
         X.__eq__ = __evil_eq__
         d[y] # might trigger a call to __eq__?
 
diff --git a/pypy/doc/release-5.0.0.rst b/pypy/doc/release-5.0.0.rst
--- a/pypy/doc/release-5.0.0.rst
+++ b/pypy/doc/release-5.0.0.rst
@@ -1,44 +1,44 @@
-==========
-PyPy 5.0.0
-==========
+========
+PyPy 5.0
+========
 
-We have released PyPy 5.0.0, about three months after PyPy 4.0.0. 
+We have released PyPy 5.0, about three months after PyPy 4.0.1.
 We encourage all users of PyPy to update to this version. Apart from the usual
 bug fixes, there is an ongoing effort to improve the warmup time and memory
 usage of JIT-related metadata. The exact effects depend vastly on the program
 you're running and can range from insignificant to warmup being up to 30%
-faster and memory dropping by about 30%. 
+faster and memory dropping by about 30%.
 
 We also merged a major upgrade to our C-API layer (cpyext), simplifying the
 interaction between c-level objects and PyPy interpreter level objects. As a
-result, lxml  with its cython compiled component `passes all tests`_ on PyPy
+result, lxml  (prerelease) with its cython compiled component
+`passes all tests`_ on PyPy. The new cpyext is also much faster.
 
-Users who have gotten used to vmprof_ on Linux, and those on other platforms
-who have not yet tried its awesomeness, will be happy to hear that vmprof
-now just works on MacOS and Windows too, in both PyPy (built-in support) and
-CPython (as an installed module).
+vmprof_ has been a go-to profiler for PyPy on linux for a few releases
+and we're happy to announce that thanks to the cooperation with jetbrains,
+vmprof now works on Linux, OS X and Windows on both PyPy and CPython.
 
-You can download the PyPy 5.0.0 release here:
+You can download the PyPy 5.0 release here:
 
     http://pypy.org/download.html
 
 We would like to thank our donors for the continued support of the PyPy
 project.
 
-We would also like to thank our contributors and 
+We would also like to thank our contributors and
 encourage new people to join the project. PyPy has many
 layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
-improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ 
-with making RPython's JIT even better. 
+improvements, tweaking popular `modules`_ to run on pypy, or general `help`_
+with making RPython's JIT even better.
 
 CFFI
 ====
 
 While not applicable only to PyPy, `cffi`_ is arguably our most significant
-contribution to the python ecosystem. PyPy 5.0.0 ships with 
-`cffi-1.5.2`_ which now allows embedding PyPy (or cpython) in a c program.
+contribution to the python ecosystem. PyPy 5.0 ships with
+`cffi-1.5.2`_ which now allows embedding PyPy (or cpython) in a C program.
 
-.. _`PyPy`: http://doc.pypy.org 
+.. _`PyPy`: http://doc.pypy.org
 .. _`RPython`: https://rpython.readthedocs.org
 .. _`cffi`: https://cffi.readthedocs.org
 .. _`cffi-1.5.2`: http://cffi.readthedocs.org/en/latest/whatsnew.html#v1-5-2
@@ -52,18 +52,18 @@
 =============
 
 PyPy is a very compliant Python interpreter, almost a drop-in replacement for
-CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison)
+CPython 2.7. It's fast (`PyPy and CPython 2.7.x`_ performance comparison)
 due to its integrated tracing JIT compiler.
 
 We also welcome developers of other
 `dynamic languages`_ to see what RPython can do for them.
 
 This release supports **x86** machines on most common operating systems
-(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, freebsd),
+(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, FreeBSD),
 newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, and the
-big- and little-endian variants of **ppc64** running Linux.
+big- and little-endian variants of **PPC64** running Linux.
 
-.. _`pypy and cpython 2.7.x`: http://speed.pypy.org
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
 .. _`dynamic languages`: http://pypyjs.org
 
 Other Highlights (since 4.0.1 released in November 2015)
@@ -103,7 +103,7 @@
 
   * More completely support datetime, optimize timedelta creation
 
-  * Fix for issue 2185 which caused an inconsistent list of operations to be
+  * Fix for issue #2185 which caused an inconsistent list of operations to be
     generated by the unroller, appeared in a complicated DJango app
 
   * Fix an elusive issue with stacklets on shadowstack which showed up when
@@ -128,9 +128,6 @@
   * Fix for corner case (likely shown by Krakatau) for consecutive guards with
     interdependencies
 
-  * Fix applevel bare class method comparisons which should fix pretty printing
-    in IPython
-
   * Issues reported with our previous release were resolved_ after reports from users on
     our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at
     #pypy
@@ -150,49 +147,60 @@
   * Support partition() as an app-level function, together with a cffi wrapper
     in pypy/numpy, this now provides partial support for partition()
 
-* Performance improvements and refactorings:
+* Performance improvements:
 
-  * Refactor and improve exception analysis in the annotator
-
-  * Remove unnecessary special handling of space.wrap().
+  * Optimize global lookups
 
   * Improve the memory signature of numbering instances in the JIT. This should
     massively decrease the amount of memory consumed by the JIT, which is
     significant for most programs. Also compress the numberings using variable-
     size encoding
 
+  * Optimize string concatenation
+
+  * Use INT_LSHIFT instead of INT_MUL when possible
+
+  * Improve struct.unpack by casting directly from the underlying buffer.
+    Unpacking floats and doubles is about 15 times faster, and integer types
+    about 50% faster (on 64 bit integers). This was then subsequently
+    improved further in optimizeopt.py.
+
+  * Optimize two-tuple lookups in mapdict, which improves warmup of instance
+    variable access somewhat
+
+  * Reduce all guards from int_floordiv_ovf if one of the arguments is constant
+
+  * Identify permutations of attributes at instance creation, reducing the
+    number of bridges created
+
+  * Greatly improve re.sub() performance
+
+
+* Internal refactorings:
+
+  * Refactor and improve exception analysis in the annotator
+
+  * Remove unnecessary special handling of space.wrap().
+
   * Support list-resizing setslice operations in RPython
 
   * Tweak the trace-too-long heuristic for multiple jit drivers
 
   * Refactor bookkeeping (such a cool word - three double letters) in the
     annotater
-    
+
   * Refactor wrappers for OS functions from rtyper to rlib and simplify them
 
   * Simplify backend loading instructions to only use four variants
 
-  * Optimize string concatination
-
   * Simplify GIL handling in non-jitted code
 
-  * Use INT_LSHIFT instead of INT_MUL when possible
-
-  * Improve struct.unpack by casting directly from the underlying buffer. 
-    Unpacking floats and doubles is about 15 times faster, and integer types
-    about 50% faster (on 64 bit integers). This was then subsequently
-    improved further in optimizeopt.py.
-
   * Refactor naming in optimizeopt
 
   * Change GraphAnalyzer to use a more precise way to recognize external
     functions and fix null pointer handling, generally clean up external
     function handling
 
-  * Optimize global lookups
-
-  * Optimize two-tuple lookups in mapdict
-
   * Remove pure variants of ``getfield_gc_*`` operations from the JIT by
     determining purity while tracing
 
@@ -203,17 +211,10 @@
   * Refactor rtyper debug code into python.rtyper.debug
 
   * Seperate structmember.h from Python.h Also enhance creating api functions
-    to specify which header file they appear in (previously only pypy_decl.h) 
-
-  * Reduce all guards from int_floordiv_ovf if one of the arguments is constant
+    to specify which header file they appear in (previously only pypy_decl.h)
 
   * Fix tokenizer to enforce universal newlines, needed for Python 3 support
 
-  * Identify permutations of attributes at instance creation, reducing the
-    number of bridges created
-
-  * Greatly improve re.sub() performance
-
 .. _resolved: http://doc.pypy.org/en/latest/whatsnew-5.0.0.html
 .. _`hypothesis`: http://hypothesis.readthedocs.org
 .. _`blog post`: http://morepypy.blogspot.com/2016/02/c-api-support-update.html
diff --git a/pypy/doc/whatsnew-5.0.0.rst b/pypy/doc/whatsnew-5.0.0.rst
--- a/pypy/doc/whatsnew-5.0.0.rst
+++ b/pypy/doc/whatsnew-5.0.0.rst
@@ -1,6 +1,6 @@
-========================
-What's new in PyPy 5.0.0
-========================
+======================
+What's new in PyPy 5.0
+======================
 
 .. this is a revision shortly after release-4.0.1
 .. startrev: 4b5c840d0da2
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -2,6 +2,6 @@
 What's new in PyPy 5.0.+
 =========================
 
-.. this is a revision shortly after release-5.0.0
-.. startrev: 7bb6381d084c
+.. this is a revision shortly after release-5.0
+.. startrev: 9c4299dc2d60
 
diff --git a/pypy/module/_vmprof/interp_vmprof.py b/pypy/module/_vmprof/interp_vmprof.py
--- a/pypy/module/_vmprof/interp_vmprof.py
+++ b/pypy/module/_vmprof/interp_vmprof.py
@@ -60,10 +60,10 @@
     Must be smaller than 1.0
     """
     w_modules = space.sys.get('modules')
-    if space.contains_w(w_modules, space.wrap('_continuation')):
-        space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
-                              "with vmprof will crash"),
-                   space.w_RuntimeWarning)
+    #if space.contains_w(w_modules, space.wrap('_continuation')):
+    #    space.warn(space.wrap("Using _continuation/greenlet/stacklet together "
+    #                          "with vmprof will crash"),
+    #               space.w_RuntimeWarning)
     try:
         rvmprof.enable(fileno, period)
     except rvmprof.VMProfError, e:
diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
--- a/pypy/tool/release/repackage.sh
+++ b/pypy/tool/release/repackage.sh
@@ -1,7 +1,7 @@
 # Edit these appropriately before running this script
-maj=4
+maj=5
 min=0
-rev=1
+rev=0
 # This script will download latest builds from the buildmaster, rename the top
 # level directory, and repackage ready to be uploaded to bitbucket. It will also
 # download source, assuming a tag for the release already exists, and repackage them.
diff --git a/requirements.txt b/requirements.txt
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,3 +1,3 @@
 # hypothesis is used for test generation on untranslated jit tests
 hypothesis
-
+enum>=0.4.6 # is a dependency, but old pip does not pick it up
diff --git a/rpython/doc/conf.py b/rpython/doc/conf.py
--- a/rpython/doc/conf.py
+++ b/rpython/doc/conf.py
@@ -59,7 +59,7 @@
 
 # General information about the project.
 project = u'RPython'
-copyright = u'2015, The PyPy Project'
+copyright = u'2016, The PyPy Project'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
@@ -121,7 +121,7 @@
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
-#html_title = None
+html_title = 'RPython Documentation'
 
 # A shorter title for the navigation bar.  Default is the same as html_title.
 #html_short_title = None
diff --git a/rpython/jit/metainterp/blackhole.py b/rpython/jit/metainterp/blackhole.py
--- a/rpython/jit/metainterp/blackhole.py
+++ b/rpython/jit/metainterp/blackhole.py
@@ -1148,35 +1148,45 @@
 
     @arguments("cpu", "i", "R", "d", returns="i")
     def bhimpl_residual_call_r_i(cpu, func, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_i(func, None, args_r, None, calldescr)
     @arguments("cpu", "i", "R", "d", returns="r")
     def bhimpl_residual_call_r_r(cpu, func, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_r(func, None, args_r, None, calldescr)
     @arguments("cpu", "i", "R", "d")
     def bhimpl_residual_call_r_v(cpu, func, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_v(func, None, args_r, None, calldescr)
 
     @arguments("cpu", "i", "I", "R", "d", returns="i")
     def bhimpl_residual_call_ir_i(cpu, func, args_i, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_i(func, args_i, args_r, None, calldescr)
     @arguments("cpu", "i", "I", "R", "d", returns="r")
     def bhimpl_residual_call_ir_r(cpu, func, args_i, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_r(func, args_i, args_r, None, calldescr)
     @arguments("cpu", "i", "I", "R", "d")
     def bhimpl_residual_call_ir_v(cpu, func, args_i, args_r, calldescr):
+        workaround2200.active = True
         return cpu.bh_call_v(func, args_i, args_r, None, calldescr)
 
     @arguments("cpu", "i", "I", "R", "F", "d", returns="i")
     def bhimpl_residual_call_irf_i(cpu, func, args_i,args_r,args_f,calldescr):
+        workaround2200.active = True
         return cpu.bh_call_i(func, args_i, args_r, args_f, calldescr)
     @arguments("cpu", "i", "I", "R", "F", "d", returns="r")
     def bhimpl_residual_call_irf_r(cpu, func, args_i,args_r,args_f,calldescr):
+        workaround2200.active = True
         return cpu.bh_call_r(func, args_i, args_r, args_f, calldescr)
     @arguments("cpu", "i", "I", "R", "F", "d", returns="f")
     def bhimpl_residual_call_irf_f(cpu, func, args_i,args_r,args_f,calldescr):
+        workaround2200.active = True
         return cpu.bh_call_f(func, args_i, args_r, args_f, calldescr)
     @arguments("cpu", "i", "I", "R", "F", "d")
     def bhimpl_residual_call_irf_v(cpu, func, args_i,args_r,args_f,calldescr):
+        workaround2200.active = True
         return cpu.bh_call_v(func, args_i, args_r, args_f, calldescr)
 
     # conditional calls - note that they cannot return stuff
@@ -1204,44 +1214,54 @@
 
     @arguments("cpu", "j", "R", returns="i")
     def bhimpl_inline_call_r_i(cpu, jitcode, args_r):
+        workaround2200.active = True
         return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
                              None, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "R", returns="r")
     def bhimpl_inline_call_r_r(cpu, jitcode, args_r):
+        workaround2200.active = True
         return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
                              None, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "R")
     def bhimpl_inline_call_r_v(cpu, jitcode, args_r):
+        workaround2200.active = True
         return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
                              None, args_r, None, jitcode.calldescr)
 
     @arguments("cpu", "j", "I", "R", returns="i")
     def bhimpl_inline_call_ir_i(cpu, jitcode, args_i, args_r):
+        workaround2200.active = True
         return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", returns="r")
     def bhimpl_inline_call_ir_r(cpu, jitcode, args_i, args_r):
+        workaround2200.active = True
         return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, None, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R")
     def bhimpl_inline_call_ir_v(cpu, jitcode, args_i, args_r):
+        workaround2200.active = True
         return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, None, jitcode.calldescr)
 
     @arguments("cpu", "j", "I", "R", "F", returns="i")
     def bhimpl_inline_call_irf_i(cpu, jitcode, args_i, args_r, args_f):
+        workaround2200.active = True
         return cpu.bh_call_i(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F", returns="r")
     def bhimpl_inline_call_irf_r(cpu, jitcode, args_i, args_r, args_f):
+        workaround2200.active = True
         return cpu.bh_call_r(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F", returns="f")
     def bhimpl_inline_call_irf_f(cpu, jitcode, args_i, args_r, args_f):
+        workaround2200.active = True
         return cpu.bh_call_f(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, args_f, jitcode.calldescr)
     @arguments("cpu", "j", "I", "R", "F")
     def bhimpl_inline_call_irf_v(cpu, jitcode, args_i, args_r, args_f):
+        workaround2200.active = True
         return cpu.bh_call_v(jitcode.get_fnaddr_as_int(),
                              args_i, args_r, args_f, jitcode.calldescr)
 
@@ -1528,6 +1548,8 @@
             if not self.nextblackholeinterp:
                 self._exit_frame_with_exception(current_exc)
             return current_exc
+        finally:
+            workaround2200.active = False
         #
         # pass the frame's return value to the caller
         caller = self.nextblackholeinterp
@@ -1701,3 +1723,10 @@
     #
     _run_forever(firstbh, current_exc)
 convert_and_run_from_pyjitpl._dont_inline_ = True
+
+# ____________________________________________________________
+
+class WorkaroundIssue2200(object):
+    pass
+workaround2200 = WorkaroundIssue2200()
+workaround2200.active = False
diff --git a/rpython/jit/metainterp/test/test_ajit.py b/rpython/jit/metainterp/test/test_ajit.py
--- a/rpython/jit/metainterp/test/test_ajit.py
+++ b/rpython/jit/metainterp/test/test_ajit.py
@@ -4377,3 +4377,30 @@
             assert res == -1
         else:
             assert res == 4294967295
+
+    def test_issue2200_recursion(self):
+        # Reproduces issue #2200.  This test contains no recursion,
+        # but due to an unlikely combination of factors it ends up
+        # creating an RPython-level recursion, one per loop iteration.
+        # The recursion is: blackhole interp from the failing guard ->
+        # does the call to enter() as a normal call -> enter() runs
+        # can_enter_jit() as if we're interpreted -> we enter the JIT
+        # again from the start of the loop -> the guard fails again
+        # during the next iteration -> blackhole interp.  All arrows
+        # in the previous sentence are one or more levels of RPython
+        # function calls.
+        driver = JitDriver(greens=[], reds=["i"])
+        def enter(i):
+            driver.can_enter_jit(i=i)
+        def f():
+            set_param(None, 'trace_eagerness', 999999)
+            i = 0
+            while True:
+                driver.jit_merge_point(i=i)
+                i += 1
+                if i >= 300:
+                    return i
+                promote(i + 1)   # a failing guard
+                enter(i)
+
+        self.meta_interp(f, [])
diff --git a/rpython/jit/metainterp/warmstate.py b/rpython/jit/metainterp/warmstate.py
--- a/rpython/jit/metainterp/warmstate.py
+++ b/rpython/jit/metainterp/warmstate.py
@@ -433,6 +433,14 @@
                     bound_reached(hash, None, *args)
                 return
 
+            # Workaround for issue #2200, maybe temporary.  This is not
+            # a proper fix, but only a hack that should work well enough
+            # for PyPy's main jitdriver...  See test_issue2200_recursion
+            from rpython.jit.metainterp.blackhole import workaround2200
+            if workaround2200.active:
+                workaround2200.active = False
+                return
+
             # Here, we have found 'cell'.
             #
             if cell.flags & (JC_TRACING | JC_TEMPORARY):
diff --git a/rpython/jit/tool/traceviewer.py b/rpython/jit/tool/traceviewer.py
--- a/rpython/jit/tool/traceviewer.py
+++ b/rpython/jit/tool/traceviewer.py
@@ -103,9 +103,9 @@
             self.last_guard = -1
         else:
             # guards can be out of order nowadays
-            groups = sorted(groups)
-            self.first_guard = guard_number(groups[0])
-            self.last_guard = guard_number(groups[-1])
+            groups = sorted(map(guard_number, groups))
+            self.first_guard = groups[0]
+            self.last_guard = groups[-1]
 
     content = property(get_content, set_content)
 
diff --git a/rpython/rlib/rvmprof/src/vmprof_getpc.h b/rpython/rlib/rvmprof/src/vmprof_getpc.h
--- a/rpython/rlib/rvmprof/src/vmprof_getpc.h
+++ b/rpython/rlib/rvmprof/src/vmprof_getpc.h
@@ -54,6 +54,7 @@
 // It will cause problems for FreeBSD though!, because it turns off
 // the needed __BSD_VISIBLE.
 #ifdef __APPLE__
+#include <limits.h>
 #define _XOPEN_SOURCE 500
 #endif
 
@@ -144,7 +145,11 @@
 #else
 intptr_t GetPC(ucontext_t *signal_ucontext) {
 #ifdef __APPLE__
+#if ((ULONG_MAX) == (UINT_MAX))
+  return (signal_ucontext->uc_mcontext->__ss.__eip);
+#else
   return (signal_ucontext->uc_mcontext->__ss.__rip);
+#endif
 #else
   return signal_ucontext->PC_FROM_UCONTEXT;   // defined in config.h
 #endif
diff --git a/rpython/translator/c/genc.py b/rpython/translator/c/genc.py
--- a/rpython/translator/c/genc.py
+++ b/rpython/translator/c/genc.py
@@ -547,6 +547,11 @@
                         relpypath = localpath.relto(pypkgpath.dirname)
                         assert relpypath, ("%r should be relative to %r" %
                             (localpath, pypkgpath.dirname))
+                        if len(relpypath.split(os.path.sep)) > 2:
+                            # pypy detail to agregate the c files by directory,
+                            # since the enormous number of files was causing
+                            # memory issues linking on win32
+                            return os.path.split(relpypath)[0] + '.c'
                         return relpypath.replace('.py', '.c')
             return None
         if hasattr(node.obj, 'graph'):
diff --git a/rpython/translator/c/src/entrypoint.c b/rpython/translator/c/src/entrypoint.c
--- a/rpython/translator/c/src/entrypoint.c
+++ b/rpython/translator/c/src/entrypoint.c
@@ -37,6 +37,7 @@
 # include <src/thread.h>
 #endif
 
+RPY_EXPORTED
 void rpython_startup_code(void)
 {
 #ifdef RPY_WITH_GIL
diff --git a/rpython/translator/c/test/test_genc.py b/rpython/translator/c/test/test_genc.py
--- a/rpython/translator/c/test/test_genc.py
+++ b/rpython/translator/c/test/test_genc.py
@@ -596,7 +596,7 @@
     t.context._graphof(foobar_fn).inhibit_tail_call = True
     t.source_c()
     lines = t.driver.cbuilder.c_source_filename.join('..',
-                              'rpython_translator_c_test_test_genc.c').readlines()
+                              'rpython_translator_c_test.c').readlines()
     for i, line in enumerate(lines):
         if '= pypy_g_foobar_fn' in line:
             break
diff --git a/rpython/translator/c/test/test_standalone.py b/rpython/translator/c/test/test_standalone.py
--- a/rpython/translator/c/test/test_standalone.py
+++ b/rpython/translator/c/test/test_standalone.py
@@ -81,7 +81,7 @@
         #
         # verify that the executable re-export symbols, but not too many
         if sys.platform.startswith('linux') and not kwds.get('shared', False):
-            seen_main = False
+            seen = set()
             g = os.popen("objdump -T '%s'" % builder.executable_name, 'r')
             for line in g:
                 if not line.strip():
@@ -91,8 +91,8 @@
                 name = line.split()[-1]
                 if name.startswith('__'):
                     continue
+                seen.add(name)
                 if name == 'main':
-                    seen_main = True
                     continue
                 if name == 'pypy_debug_file':     # ok to export this one
                     continue
@@ -104,7 +104,9 @@
                         "declaration of this C function or global variable"
                         % (name,))
             g.close()
-            assert seen_main, "did not see 'main' exported"
+            # list of symbols that we *want* to be exported:
+            for name in ['main', 'pypy_debug_file', 'rpython_startup_code']:
+                assert name in seen, "did not see '%r' exported" % name
         #
         return t, builder
 
@@ -123,9 +125,9 @@
 
         # Verify that the generated C files have sane names:
         gen_c_files = [str(f) for f in cbuilder.extrafiles]
-        for expfile in ('rpython_rlib_rposix.c',
-                        'rpython_rtyper_lltypesystem_rstr.c',
-                        'rpython_translator_c_test_test_standalone.c'):
+        for expfile in ('rpython_rlib.c',
+                        'rpython_rtyper_lltypesystem.c',
+                        'rpython_translator_c_test.c'):
             assert cbuilder.targetdir.join(expfile) in gen_c_files
 
     def test_print(self):
diff --git a/rpython/translator/interactive.py b/rpython/translator/interactive.py
--- a/rpython/translator/interactive.py
+++ b/rpython/translator/interactive.py
@@ -32,12 +32,6 @@
         self.context.viewcg()
 
     def ensure_setup(self, argtypes=None, policy=None):
-        standalone = argtypes is None
-        if standalone:
-            assert argtypes is None
-        else:
-            if argtypes is None:
-                argtypes = []
         self.driver.setup(self.entry_point, argtypes, policy,
                           empty_translator=self.context)
         self.ann_argtypes = argtypes


More information about the pypy-commit mailing list