Author: Armin Rigo <[email protected]>
Branch: 
Changeset: r64844:123cde0fe60f
Date: 2013-06-10 19:16 +0200
http://bitbucket.org/pypy/pypy/changeset/123cde0fe60f/

Log:    Kill this hack. It's a Very Bad idea to do it this way: it means
        translation will fail on any user-provided example too :-((

diff --git a/rpython/jit/backend/llsupport/test/zrpy_gc_boehm_test.py 
b/rpython/jit/backend/llsupport/test/zrpy_gc_boehm_test.py
--- a/rpython/jit/backend/llsupport/test/zrpy_gc_boehm_test.py
+++ b/rpython/jit/backend/llsupport/test/zrpy_gc_boehm_test.py
@@ -2,7 +2,6 @@
 import weakref
 from rpython.rlib.jit import JitDriver, dont_look_inside
 from rpython.jit.backend.llsupport.test.zrpy_gc_test import run, get_entry, 
compile
-from rpython.jit.backend.llsupport.test.ztranslation_test import 
fix_annotator_for_vrawbuffer
 
 class X(object):
     def __init__(self, x=0):
@@ -32,8 +31,7 @@
     g._dont_inline_ = True
     return g
 
-def compile_boehm_test(monkeypatch):
-    fix_annotator_for_vrawbuffer(monkeypatch)
+def compile_boehm_test():
     myjitdriver = JitDriver(greens = [], reds = ['n', 'x'])
     @dont_look_inside
     def see(lst, n):
diff --git a/rpython/jit/backend/llsupport/test/ztranslation_test.py 
b/rpython/jit/backend/llsupport/test/ztranslation_test.py
--- a/rpython/jit/backend/llsupport/test/ztranslation_test.py
+++ b/rpython/jit/backend/llsupport/test/ztranslation_test.py
@@ -9,23 +9,10 @@
 from rpython.jit.codewriter.policy import StopAtXPolicy
 
 
-def fix_annotator_for_vrawbuffer(monkeypatch):
-    from rpython.rlib.nonconst import NonConstant
-    from rpython.jit.metainterp.optimizeopt.virtualize import VRawBufferValue
-    from rpython.jit.metainterp import warmspot
-
-    def my_hook_for_tests(cpu):
-        # this is needed so that the annotator can see it
-        if NonConstant(False):
-            v = VRawBufferValue(cpu, None, -1, None, None)
-    monkeypatch.setattr(warmspot, 'hook_for_tests', my_hook_for_tests)
-
-
 class TranslationTest(CCompiledMixin):
     CPUClass = getcpuclass()
 
-    def test_stuff_translates(self, monkeypatch):
-        fix_annotator_for_vrawbuffer(monkeypatch)
+    def test_stuff_translates(self):
         # this is a basic test that tries to hit a number of features and their
         # translation:
         # - jitting of loops and bridges
@@ -102,10 +89,9 @@
 class TranslationTestCallAssembler(CCompiledMixin):
     CPUClass = getcpuclass()
 
-    def test_direct_assembler_call_translates(self, monkeypatch):
+    def test_direct_assembler_call_translates(self):
         """Test CALL_ASSEMBLER and the recursion limit"""
         from rpython.rlib.rstackovf import StackOverflow
-        fix_annotator_for_vrawbuffer(monkeypatch)
 
         class Thing(object):
             def __init__(self, val):
@@ -183,8 +169,7 @@
 class TranslationTestJITStats(CCompiledMixin):
     CPUClass = getcpuclass()
 
-    def test_jit_get_stats(self, monkeypatch):
-        fix_annotator_for_vrawbuffer(monkeypatch)
+    def test_jit_get_stats(self):
         driver = JitDriver(greens = [], reds = ['i'])
 
         def f():
@@ -207,8 +192,7 @@
 class TranslationRemoveTypePtrTest(CCompiledMixin):
     CPUClass = getcpuclass()
 
-    def test_external_exception_handling_translates(self, monkeypatch):
-        fix_annotator_for_vrawbuffer(monkeypatch)
+    def test_external_exception_handling_translates(self):
         jitdriver = JitDriver(greens = [], reds = ['n', 'total'])
 
         class ImDone(Exception):
diff --git a/rpython/jit/metainterp/warmspot.py 
b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -761,8 +761,6 @@
         cpu = jd.warmstate.cpu
 
         def ll_portal_runner(*args):
-            hook_for_tests(cpu) # usually it's empty, but tests can monkeypatch
-                                # it to fix the annotator
             start = True
             while 1:
                 try:
@@ -999,10 +997,3 @@
         graphs = self.translator.graphs
         for graph, block, i in find_force_quasi_immutable(graphs):
             self.replace_force_quasiimmut_with_direct_call(block.operations[i])
-
-def hook_for_tests(cpu):
-    """
-    This function is empty and does nothing. Its only role is to be
-    monkey-patched by tests to "fix" the annotator if needed (see
-    e.g. 
x86/test/test_ztranslation::test_external_exception_handling_translates
-    """
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to