[pypy-commit] pypy numpypy-nditer: merge default into branch

mattip noreply at buildbot.pypy.org
Thu Apr 17 23:51:13 CEST 2014


Author: Matti Picus <matti.picus at gmail.com>
Branch: numpypy-nditer
Changeset: r70714:7db30f61132b
Date: 2014-04-18 00:47 +0300
http://bitbucket.org/pypy/pypy/changeset/7db30f61132b/

Log:	merge default into branch

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -478,6 +478,8 @@
                 return w_mod2
             self.setitem(w_modules, w_name, w_mod)
             w_mod.init(self)
+        else:
+            self.setitem(w_modules, w_name, w_mod)
         return w_mod
 
     def get_builtinmodule_to_install(self):
diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py
--- a/rpython/jit/backend/arm/opassembler.py
+++ b/rpython/jit/backend/arm/opassembler.py
@@ -365,7 +365,7 @@
                 # we're returning with a guard_not_forced_2, and
                 # additionally we need to say that r0 contains
                 # a reference too:
-                self._finish_gcmap[0] |= r_uint(0)
+                self._finish_gcmap[0] |= r_uint(1)
                 gcmap = self._finish_gcmap
             else:
                 gcmap = self.gcmap_for_finish
diff --git a/rpython/jit/codewriter/call.py b/rpython/jit/codewriter/call.py
--- a/rpython/jit/codewriter/call.py
+++ b/rpython/jit/codewriter/call.py
@@ -220,6 +220,28 @@
                 call_release_gil_target = func._call_aroundstate_target_
                 call_release_gil_target = llmemory.cast_ptr_to_adr(
                     call_release_gil_target)
+        elif op.opname == 'indirect_call':
+            # check that we're not trying to call indirectly some
+            # function with the special flags
+            graphs = op.args[-1].value
+            for graph in (graphs or ()):
+                if not hasattr(graph, 'func'):
+                    continue
+                error = None
+                if hasattr(graph.func, '_elidable_function_'):
+                    error = '@jit.elidable'
+                if hasattr(graph.func, '_jit_loop_invariant_'):
+                    error = '@jit.loop_invariant'
+                if hasattr(graph.func, '_call_aroundstate_target_'):
+                    error = '_call_aroundstate_target_'
+                if not error:
+                    continue
+                raise Exception(
+                    "%r is an indirect call to a family of functions "
+                    "(or methods) that includes %r. However, the latter "
+                    "is marked %r. You need to use an indirection: replace "
+                    "it with a non-marked function/method which calls the "
+                    "marked function." % (op, graph, error))
         # build the extraeffect
         random_effects = self.randomeffects_analyzer.analyze(op)
         if random_effects:
diff --git a/rpython/jit/codewriter/effectinfo.py b/rpython/jit/codewriter/effectinfo.py
--- a/rpython/jit/codewriter/effectinfo.py
+++ b/rpython/jit/codewriter/effectinfo.py
@@ -167,6 +167,12 @@
     def is_call_release_gil(self):
         return bool(self.call_release_gil_target)
 
+    def __repr__(self):
+        more = ''
+        if self.oopspecindex:
+            more = ' OS=%r' % (self.oopspecindex,)
+        return '<EffectInfo 0x%x: EF=%r%s>' % (id(self), self.extraeffect, more)
+
 
 def frozenset_or_none(x):
     if x is None:
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
@@ -3418,6 +3418,26 @@
                            'int_sub': 2, 'jump': 1, 'call': 2,
                            'guard_no_exception': 2, 'int_add': 4})
 
+    def test_elidable_method(self):
+        py.test.skip("not supported so far: @elidable methods")
+        class A(object):
+            @elidable
+            def meth(self):
+                return 41
+        class B(A):
+            @elidable
+            def meth(self):
+                return 42
+        x = B()
+        def callme(x):
+            return x.meth()
+        def f():
+            callme(A())
+            return callme(x)
+        res = self.interp_operations(f, [])
+        assert res == 42
+        self.check_operations_history({'finish': 1})
+
     def test_look_inside_iff_const_getarrayitem_gc_pure(self):
         driver = JitDriver(greens=['unroll'], reds=['s', 'n'])
 
diff --git a/rpython/translator/c/src/instrument.c b/rpython/translator/c/src/instrument.c
--- a/rpython/translator/c/src/instrument.c
+++ b/rpython/translator/c/src/instrument.c
@@ -6,10 +6,10 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
+#include <stdio.h>
 #ifndef _WIN32
 #include <sys/mman.h>
-#include <stdlib.h>
-#include <stdio.h>
 #include <unistd.h>
 #else
 #include <windows.h>
diff --git a/rpython/translator/c/src/thread_nt.h b/rpython/translator/c/src/thread_nt.h
--- a/rpython/translator/c/src/thread_nt.h
+++ b/rpython/translator/c/src/thread_nt.h
@@ -1,3 +1,6 @@
+#ifndef _THREAD_NT_H
+#define _THREAD_NT_H
+#include <WinSock2.h>
 #include <windows.h>
 
 /*
@@ -19,4 +22,4 @@
 void RPyThreadReleaseLock(struct RPyOpaque_ThreadLock *lock);
 long RPyThreadGetStackSize(void);
 long RPyThreadSetStackSize(long);
-
+#endif
diff --git a/rpython/translator/c/src/threadlocal.h b/rpython/translator/c/src/threadlocal.h
--- a/rpython/translator/c/src/threadlocal.h
+++ b/rpython/translator/c/src/threadlocal.h
@@ -2,6 +2,7 @@
 
 #ifdef _WIN32
 
+#include <WinSock2.h>
 #include <windows.h>
 #define __thread __declspec(thread)
 typedef DWORD RPyThreadTLS;


More information about the pypy-commit mailing list