Author: Matti Picus <[email protected]>
Branch: cpyext-int
Changeset: r67838:cc3307a7b330
Date: 2013-10-22 21:48 +0300
http://bitbucket.org/pypy/pypy/changeset/cc3307a7b330/

Log:    merge default into branch

diff --git a/pypy/tool/pypyjit.py b/pypy/tool/pypyjit.py
--- a/pypy/tool/pypyjit.py
+++ b/pypy/tool/pypyjit.py
@@ -28,15 +28,16 @@
 config.translation.backendopt.inline_threshold = 0.1
 config.translation.gc = 'boehm'
 config.translating = True
+config.translation.rweakref = False
 set_opt_level(config, level='jit')
 config.objspace.allworkingmodules = False
 config.objspace.usemodules.pypyjit = True
 config.objspace.usemodules.array = False
-config.objspace.usemodules._weakref = True
+config.objspace.usemodules._weakref = False
 config.objspace.usemodules._sre = False
 config.objspace.usemodules._lsprof = False
 #
-config.objspace.usemodules._ffi = True
+config.objspace.usemodules._ffi = False
 config.objspace.usemodules.micronumpy = False
 #
 set_pypy_opt_level(config, level='jit')
@@ -101,7 +102,7 @@
 
     from rpython.jit.codewriter.codewriter import CodeWriter
     CodeWriter.debug = True
-    from rpython.jit.tl.pypyjit_child import run_child
+    from pypy.tool.pypyjit_child import run_child
     run_child(globals(), locals())
 
 
diff --git a/pypy/tool/pypyjit_demo.py b/pypy/tool/pypyjit_demo.py
--- a/pypy/tool/pypyjit_demo.py
+++ b/pypy/tool/pypyjit_demo.py
@@ -1,27 +1,20 @@
-import pypyjit
-pypyjit.set_param(threshold=200)
 
-kwargs = {"z": 1}
+def g(i):
+    k = 0
+    while k < 3:
+        k += 1
+    return i + 1
 
-def f(*args, **kwargs):
-    result = g(1, *args, **kwargs)
-    return result + 2
+def f(x):
+    for i in range(10000):
+        t = (1, 2, i)
+        i = g(i)
+        x == t
 
-def g(x, y, z=2):
-    return x - y + z
-
-def main():
-    res = 0
-    i = 0
-    while i < 10000:
-        res = f(res, z=i)
-        g(1, res, **kwargs)
-        i += 1
-    return res
 
 
 try:
-    print main()
+    f((1, 2, 3))
 
 except Exception, e:
     print "Exception: ", type(e)
diff --git a/rpython/jit/metainterp/heapcache.py 
b/rpython/jit/metainterp/heapcache.py
--- a/rpython/jit/metainterp/heapcache.py
+++ b/rpython/jit/metainterp/heapcache.py
@@ -6,7 +6,7 @@
     def __init__(self):
         self.reset()
 
-    def reset(self):
+    def reset(self, reset_virtuals=True):
         # contains boxes where the class is already known
         self.known_class_boxes = {}
         # store the boxes that contain newly allocated objects, this maps the
@@ -14,7 +14,8 @@
         # escaped the trace or not (True means the box never escaped, False
         # means it did escape), its presences in the mapping shows that it was
         # allocated inside the trace
-        self.new_boxes = {}
+        if reset_virtuals:
+            self.new_boxes = {}
         # Tracks which boxes should be marked as escaped when the key box
         # escapes.
         self.dependencies = {}
diff --git a/rpython/jit/metainterp/pyjitpl.py 
b/rpython/jit/metainterp/pyjitpl.py
--- a/rpython/jit/metainterp/pyjitpl.py
+++ b/rpython/jit/metainterp/pyjitpl.py
@@ -2058,7 +2058,7 @@
                 duplicates[box] = None
 
     def reached_loop_header(self, greenboxes, redboxes, resumedescr):
-        self.heapcache.reset()
+        self.heapcache.reset(reset_virtuals=False)
 
         duplicates = {}
         self.remove_consts_and_duplicates(redboxes, len(redboxes),
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
@@ -3359,6 +3359,26 @@
         assert res == main(1)
         self.check_resops(call=0, getfield_gc=0)
 
+    def test_isvirtual_call_assembler(self):
+        driver = JitDriver(greens = ['code'], reds = ['n'])
+
+        @look_inside_iff(lambda t1, t2: isvirtual(t1))
+        def g(t1, t2):
+            return t1[0] == t2[0]
+
+        def f(code, n):
+            while n > 0:
+                driver.can_enter_jit(code=code, n=n)
+                driver.jit_merge_point(code=code, n=n)
+                t = (1, 2, n)
+                if code:
+                    f(0, 3)
+                g(t, (1, 2, n))
+                n -= 1
+
+        self.meta_interp(f, [1, 10], inline=True)
+        self.check_resops(call=0, call_may_force=0, call_assembler=2)
+
     def test_reuse_elidable_result(self):
         driver = JitDriver(reds=['n', 's'], greens = [])
         def main(n):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to