Author: Ronan Lamy <[email protected]>
Branch: kill-ootype
Changeset: r65275:7ae668fca267
Date: 2013-07-07 20:03 +0200
http://bitbucket.org/pypy/pypy/changeset/7ae668fca267/
Log: Remove OOJitMixin
diff --git a/rpython/jit/metainterp/test/support.py
b/rpython/jit/metainterp/test/support.py
--- a/rpython/jit/metainterp/test/support.py
+++ b/rpython/jit/metainterp/test/support.py
@@ -263,39 +263,6 @@
NODE.become(lltype.GcStruct('NODE', ('value', lltype.Signed),
('next', lltype.Ptr(NODE))))
return NODE
-
-class OOJitMixin(JitMixin):
- type_system = 'ootype'
- #CPUClass = runner.OOtypeCPU
-
- def setup_class(cls):
- py.test.skip("ootype tests skipped for now")
-
- @staticmethod
- def Ptr(T):
- return T
-
- @staticmethod
- def GcStruct(name, *fields, **kwds):
- if 'hints' in kwds:
- kwds['_hints'] = kwds['hints']
- del kwds['hints']
- I = ootype.Instance(name, ootype.ROOT, dict(fields), **kwds)
- return I
-
- malloc = staticmethod(ootype.new)
- nullptr = staticmethod(ootype.null)
-
- @staticmethod
- def malloc_immortal(T):
- return ootype.new(T)
-
- def _get_NODE(self):
- NODE = ootype.Instance('NODE', ootype.ROOT, {})
- NODE._add_fields({'value': ootype.Signed,
- 'next': NODE})
- return NODE
-
# ____________________________________________________________
class _Foo:
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
@@ -4,7 +4,7 @@
from rpython.jit.codewriter.policy import StopAtXPolicy
from rpython.jit.metainterp import history
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin, noConst
+from rpython.jit.metainterp.test.support import LLJitMixin, noConst
from rpython.jit.metainterp.warmspot import get_stats
from rpython.rlib import rerased
from rpython.rlib.jit import (JitDriver, we_are_jitted, hint, dont_look_inside,
@@ -3045,86 +3045,6 @@
i += 1
res = self.meta_interp(f, [32])
assert res == f(32)
-
-class XXXDisabledTestOOtype(BasicTests, OOJitMixin):
-
- def test_oohash(self):
- def f(n):
- s = ootype.oostring(n, -1)
- return s.ll_hash()
- res = self.interp_operations(f, [5])
- assert res == ootype.oostring(5, -1).ll_hash()
-
- def test_identityhash(self):
- A = ootype.Instance("A", ootype.ROOT)
- def f():
- obj1 = ootype.new(A)
- obj2 = ootype.new(A)
- return ootype.identityhash(obj1) == ootype.identityhash(obj2)
- assert not f()
- res = self.interp_operations(f, [])
- assert not res
-
- def test_oois(self):
- A = ootype.Instance("A", ootype.ROOT)
- def f(n):
- obj1 = ootype.new(A)
- if n:
- obj2 = obj1
- else:
- obj2 = ootype.new(A)
- return obj1 is obj2
- res = self.interp_operations(f, [0])
- assert not res
- res = self.interp_operations(f, [1])
- assert res
-
- def test_oostring_instance(self):
- A = ootype.Instance("A", ootype.ROOT)
- B = ootype.Instance("B", ootype.ROOT)
- def f(n):
- obj1 = ootype.new(A)
- obj2 = ootype.new(B)
- s1 = ootype.oostring(obj1, -1)
- s2 = ootype.oostring(obj2, -1)
- ch1 = s1.ll_stritem_nonneg(1)
- ch2 = s2.ll_stritem_nonneg(1)
- return ord(ch1) + ord(ch2)
- res = self.interp_operations(f, [0])
- assert res == ord('A') + ord('B')
-
- def test_subclassof(self):
- A = ootype.Instance("A", ootype.ROOT)
- B = ootype.Instance("B", A)
- clsA = ootype.runtimeClass(A)
- clsB = ootype.runtimeClass(B)
- myjitdriver = JitDriver(greens = [], reds = ['n', 'flag', 'res'])
-
- def getcls(flag):
- if flag:
- return clsA
- else:
- return clsB
-
- def f(flag, n):
- res = True
- while n > -100:
- myjitdriver.can_enter_jit(n=n, flag=flag, res=res)
- myjitdriver.jit_merge_point(n=n, flag=flag, res=res)
- cls = getcls(flag)
- n -= 1
- res = ootype.subclassof(cls, clsB)
- return res
-
- res = self.meta_interp(f, [1, 100],
- policy=StopAtXPolicy(getcls),
- enable_opts='')
- assert not res
-
- res = self.meta_interp(f, [0, 100],
- policy=StopAtXPolicy(getcls),
- enable_opts='')
- assert res
class BaseLLtypeTests(BasicTests):
@@ -3959,7 +3879,7 @@
def test_weakref(self):
import weakref
-
+
class A(object):
def __init__(self, x):
self.x = x
@@ -3982,7 +3902,7 @@
def test_external_call(self):
from rpython.rlib.objectmodel import invoke_around_extcall
-
+
T = rffi.CArrayPtr(rffi.TIME_T)
external = rffi.llexternal("time", [T], rffi.TIME_T)
diff --git a/rpython/jit/metainterp/test/test_blackhole.py
b/rpython/jit/metainterp/test/test_blackhole.py
--- a/rpython/jit/metainterp/test/test_blackhole.py
+++ b/rpython/jit/metainterp/test/test_blackhole.py
@@ -1,6 +1,6 @@
import py
from rpython.rlib.jit import JitDriver
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.blackhole import BlackholeInterpBuilder
from rpython.jit.metainterp.blackhole import BlackholeInterpreter
from rpython.jit.metainterp.blackhole import convert_and_run_from_pyjitpl
diff --git a/rpython/jit/metainterp/test/test_del.py
b/rpython/jit/metainterp/test/test_del.py
--- a/rpython/jit/metainterp/test/test_del.py
+++ b/rpython/jit/metainterp/test/test_del.py
@@ -2,7 +2,7 @@
from rpython.rlib.jit import JitDriver, dont_look_inside
from rpython.rlib.objectmodel import keepalive_until_here
from rpython.rlib import rgc
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
class DelTests:
@@ -125,8 +125,3 @@
class TestLLtype(DelTests, LLJitMixin):
pass
-
-class TestOOtype(DelTests, OOJitMixin):
- def setup_class(cls):
- py.test.skip("XXX dels are not implemented in the"
- " static CLI or JVM backend")
diff --git a/rpython/jit/metainterp/test/test_dict.py
b/rpython/jit/metainterp/test/test_dict.py
--- a/rpython/jit/metainterp/test/test_dict.py
+++ b/rpython/jit/metainterp/test/test_dict.py
@@ -1,5 +1,5 @@
import py
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.jit import JitDriver
from rpython.rlib import objectmodel
@@ -163,7 +163,7 @@
def test_unrolling_of_dict_iter(self):
driver = JitDriver(greens = [], reds = ['n'])
-
+
def f(n):
while n > 0:
driver.jit_merge_point(n=n)
@@ -178,8 +178,5 @@
'jump': 1})
-class TestOOtype(DictTests, OOJitMixin):
- pass
-
class TestLLtype(DictTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_exception.py
b/rpython/jit/metainterp/test/test_exception.py
--- a/rpython/jit/metainterp/test/test_exception.py
+++ b/rpython/jit/metainterp/test/test_exception.py
@@ -1,5 +1,5 @@
import py, sys
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.jit import JitDriver, dont_look_inside
from rpython.rlib.rarithmetic import ovfcheck, LONG_BIT, intmask
from rpython.jit.codewriter.policy import StopAtXPolicy
@@ -43,7 +43,7 @@
def check(n):
if n % 2:
raise ValueError
-
+
def f(n):
while n > 0:
myjitdriver.can_enter_jit(n=n)
@@ -65,7 +65,7 @@
def check(n):
if n % 2 == 0:
raise ValueError
-
+
def f(n):
while n > 0:
myjitdriver.can_enter_jit(n=n)
@@ -116,7 +116,7 @@
return e.n
def f(n):
return a(n)
-
+
res = self.interp_operations(f, [-4])
assert res == -40
@@ -476,7 +476,7 @@
class SomeException(Exception):
pass
-
+
def portal(n):
while n > 0:
jitdriver.can_enter_jit(n=n)
@@ -525,7 +525,7 @@
def x(n):
if n == 1:
raise MyError(n)
-
+
def f(n):
try:
while n > 0:
@@ -535,7 +535,7 @@
n -= 1
except MyError:
z()
-
+
def z():
raise ValueError
@@ -617,8 +617,5 @@
self.n = n
-class TestOOtype(ExceptionTests, OOJitMixin):
- pass
-
class TestLLtype(ExceptionTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_float.py
b/rpython/jit/metainterp/test/test_float.py
--- a/rpython/jit/metainterp/test/test_float.py
+++ b/rpython/jit/metainterp/test/test_float.py
@@ -1,5 +1,5 @@
import math, sys
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.rarithmetic import intmask, r_uint
@@ -75,8 +75,5 @@
assert type(res) is float and res == float(long(r_uint(-12345)))
-class TestOOtype(FloatTests, OOJitMixin):
- pass
-
class TestLLtype(FloatTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_greenfield.py
b/rpython/jit/metainterp/test/test_greenfield.py
--- a/rpython/jit/metainterp/test/test_greenfield.py
+++ b/rpython/jit/metainterp/test/test_greenfield.py
@@ -1,4 +1,4 @@
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.jit import JitDriver
@@ -55,6 +55,3 @@
class TestLLtypeGreenFieldsTests(GreenFieldsTests, LLJitMixin):
pass
-
-class TestOOtypeGreenFieldsTests(GreenFieldsTests, OOJitMixin):
- pass
diff --git a/rpython/jit/metainterp/test/test_immutable.py
b/rpython/jit/metainterp/test/test_immutable.py
--- a/rpython/jit/metainterp/test/test_immutable.py
+++ b/rpython/jit/metainterp/test/test_immutable.py
@@ -1,5 +1,5 @@
from rpython.rlib import jit
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
@jit.dont_look_inside
def escape(x):
@@ -177,6 +177,3 @@
class TestLLtypeImmutableFieldsTests(ImmutableFieldsTests, LLJitMixin):
pass
-
-class TestOOtypeImmutableFieldsTests(ImmutableFieldsTests, OOJitMixin):
- pass
diff --git a/rpython/jit/metainterp/test/test_jitdriver.py
b/rpython/jit/metainterp/test/test_jitdriver.py
--- a/rpython/jit/metainterp/test/test_jitdriver.py
+++ b/rpython/jit/metainterp/test/test_jitdriver.py
@@ -1,6 +1,6 @@
"""Tests for multiple JitDrivers."""
from rpython.rlib.jit import JitDriver, unroll_safe, set_param
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.warmspot import get_stats
@@ -145,6 +145,3 @@
class TestLLtype(MultipleJitDriversTests, LLJitMixin):
pass
-
-class TestOOtype(MultipleJitDriversTests, OOJitMixin):
- pass
diff --git a/rpython/jit/metainterp/test/test_list.py
b/rpython/jit/metainterp/test/test_list.py
--- a/rpython/jit/metainterp/test/test_list.py
+++ b/rpython/jit/metainterp/test/test_list.py
@@ -1,7 +1,7 @@
import py
from rpython.rlib.objectmodel import newlist_hint
from rpython.rlib.jit import JitDriver, promote
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
class ListTests:
@@ -288,9 +288,6 @@
self.check_resops(call=0)
-class TestOOtype(ListTests, OOJitMixin):
- pass
-
class TestLLtype(ListTests, LLJitMixin):
def test_listops_dont_invalidate_caches(self):
class A(object):
diff --git a/rpython/jit/metainterp/test/test_loop.py
b/rpython/jit/metainterp/test/test_loop.py
--- a/rpython/jit/metainterp/test/test_loop.py
+++ b/rpython/jit/metainterp/test/test_loop.py
@@ -2,16 +2,16 @@
from rpython.rlib.jit import JitDriver, hint, set_param
from rpython.rlib.objectmodel import compute_hash
from rpython.jit.metainterp.warmspot import ll_meta_interp, get_stats
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.codewriter.policy import StopAtXPolicy
from rpython.jit.metainterp.resoperation import rop
from rpython.jit.metainterp import history
class LoopTest(object):
enable_opts = ''
-
+
automatic_promotion_result = {
- 'int_add' : 6, 'int_gt' : 1, 'guard_false' : 1, 'jump' : 1,
+ 'int_add' : 6, 'int_gt' : 1, 'guard_false' : 1, 'jump' : 1,
'guard_value' : 3
}
@@ -43,7 +43,7 @@
class A(object):
def __init__(self):
self.x = 3
-
+
def f(x, y):
res = 0
a = A()
@@ -70,7 +70,7 @@
def l(y, x, t):
llop.debug_print(lltype.Void, y, x, t)
-
+
def g(y, x, r):
if y <= 12:
res = x - 2
@@ -241,7 +241,7 @@
def can_enter_jit(i, x, node):
myjitdriver.can_enter_jit(i=i, x=x, node=node)
-
+
def f(node):
x = 0
i = 0
@@ -362,16 +362,16 @@
#
# i = j = x = 0
# while i < n:
- # j = 0
+ # j = 0
# while j <= i:
# j = j + 1
# x = x + (i&j)
# i = i + 1
-
+
myjitdriver = JitDriver(greens = ['pos'], reds = ['i', 'j', 'n', 'x'])
bytecode = "IzJxji"
def f(n, threshold):
- set_param(myjitdriver, 'threshold', threshold)
+ set_param(myjitdriver, 'threshold', threshold)
i = j = x = 0
pos = 0
op = '-'
@@ -418,7 +418,7 @@
myjitdriver = JitDriver(greens = ['pos'], reds = ['i', 'j', 'n', 'x'])
bytecode = "IzJxji"
def f(nval, threshold):
- set_param(myjitdriver, 'threshold', threshold)
+ set_param(myjitdriver, 'threshold', threshold)
i, j, x = A(0), A(0), A(0)
n = A(nval)
pos = 0
@@ -477,30 +477,30 @@
if not (i < n):
pos += 2
elif op == '7':
- if s==1:
+ if s==1:
x = x + 7
else:
x = x + 2
elif op == '8':
- if s==1:
+ if s==1:
x = x + 8
else:
x = x + 3
pos += 1
return x
-
+
def g(n, s):
sa = 0
for i in range(7):
sa += f(n, s)
return sa
- assert self.meta_interp(g, [25, 1]) == 7 * 25 * (7 + 8)
+ assert self.meta_interp(g, [25, 1]) == 7 * 25 * (7 + 8)
def h(n):
return g(n, 1) + g(n, 2)
- assert self.meta_interp(h, [25]) == 7 * 25 * (7 + 8 + 2 + 3)
-
+ assert self.meta_interp(h, [25]) == 7 * 25 * (7 + 8 + 2 + 3)
+
def test_three_nested_loops(self):
myjitdriver = JitDriver(greens = ['i'], reds = ['x'])
bytecode = ".+357"
@@ -599,7 +599,7 @@
z = Z(z.elem + 1)
x -= 1
return z.elem
-
+
expected = f(100, 5)
res = self.meta_interp(f, [100, 5], policy=StopAtXPolicy(externfn))
assert res == expected
@@ -617,16 +617,16 @@
CO_INCREASE = 0
CO_JUMP_BACK_3 = 1
CO_DECREASE = 2
-
+
code = [CO_INCREASE, CO_INCREASE, CO_INCREASE,
CO_JUMP_BACK_3, CO_INCREASE, CO_DECREASE]
-
+
def add(res, a):
return res + a
def sub(res, a):
return res - a
-
+
def main_interpreter_loop(a):
i = 0
res = 0
@@ -663,16 +663,16 @@
reds = ['res', 'a'])
CO_INCREASE = 0
CO_JUMP_BACK_3 = 1
-
+
code = [CO_INCREASE, CO_INCREASE, CO_INCREASE,
CO_JUMP_BACK_3, CO_INCREASE]
-
+
def add(res, a):
return res + a
def sub(res, a):
return res - a
-
+
def main_interpreter_loop(a):
i = 0
res = 0
@@ -729,7 +729,7 @@
def __init__(self, lst):
self.lst = lst
codes = [Code([]), Code([0, 0, 1, 1])]
-
+
def interpret(num):
code = codes[num]
p = 0
@@ -810,7 +810,7 @@
some_fn(Stuff(n), k, z)
return 0
- res = self.meta_interp(f, [200])
+ res = self.meta_interp(f, [200])
def test_regular_pointers_in_short_preamble(self):
from rpython.rtyper.lltypesystem import lltype
@@ -908,8 +908,5 @@
res = self.meta_interp(f, [20, 10])
assert res == f(20, 10)
-class TestOOtype(LoopTest, OOJitMixin):
- pass
-
class TestLLtype(LoopTest, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_loop_unroll.py
b/rpython/jit/metainterp/test/test_loop_unroll.py
--- a/rpython/jit/metainterp/test/test_loop_unroll.py
+++ b/rpython/jit/metainterp/test/test_loop_unroll.py
@@ -1,22 +1,18 @@
import py
from rpython.rlib.jit import JitDriver
from rpython.jit.metainterp.test import test_loop
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.optimizeopt import ALL_OPTS_NAMES
class LoopUnrollTest(test_loop.LoopTest):
enable_opts = ALL_OPTS_NAMES
-
+
automatic_promotion_result = {
'int_gt': 2, 'guard_false': 2, 'jump': 1, 'int_add': 6,
- 'guard_value': 1
+ 'guard_value': 1
}
# ====> test_loop.py
class TestLLtype(LoopUnrollTest, LLJitMixin):
pass
-
-class TestOOtype(LoopUnrollTest, OOJitMixin):
- pass
-
diff --git a/rpython/jit/metainterp/test/test_loop_unroll_disopt.py
b/rpython/jit/metainterp/test/test_loop_unroll_disopt.py
--- a/rpython/jit/metainterp/test/test_loop_unroll_disopt.py
+++ b/rpython/jit/metainterp/test/test_loop_unroll_disopt.py
@@ -1,7 +1,7 @@
import py
from rpython.rlib.jit import JitDriver
from rpython.jit.metainterp.test import test_loop
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.optimizeopt import ALL_OPTS_NAMES
allopts = ALL_OPTS_NAMES.split(':')
@@ -22,4 +22,4 @@
del TestLLtype # No need to run the last set twice
del TestLoopNoUnrollLLtype # This case is take care of by test_loop
-
+
diff --git a/rpython/jit/metainterp/test/test_math.py
b/rpython/jit/metainterp/test/test_math.py
--- a/rpython/jit/metainterp/test/test_math.py
+++ b/rpython/jit/metainterp/test/test_math.py
@@ -1,16 +1,16 @@
import math
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.rfloat import isinf, isnan, INFINITY, NAN
class MathTests:
-
+
def test_math_sqrt(self):
def f(x):
try:
return math.sqrt(x)
except ValueError:
return -INFINITY
-
+
res = self.interp_operations(f, [0.0])
assert res == 0.0
self.check_operations_history(call_pure=1)
@@ -40,8 +40,5 @@
self.check_operations_history(call_pure=0)
-class TestOOtype(MathTests, OOJitMixin):
- pass
-
class TestLLtype(MathTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_recursive.py
b/rpython/jit/metainterp/test/test_recursive.py
--- a/rpython/jit/metainterp/test/test_recursive.py
+++ b/rpython/jit/metainterp/test/test_recursive.py
@@ -3,7 +3,7 @@
from rpython.rlib.jit import unroll_safe, dont_look_inside, promote
from rpython.rlib.objectmodel import we_are_translated
from rpython.rlib.debug import fatalerror
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.codewriter.policy import StopAtXPolicy
from rpython.rtyper.annlowlevel import hlstr
from rpython.jit.metainterp.warmspot import get_stats
@@ -33,7 +33,7 @@
myjitdriver = JitDriver(greens=[], reds=['n', 'm'])
class Error(Exception):
pass
-
+
def f(n):
m = n - 2
while True:
@@ -246,7 +246,7 @@
class Exc(Exception):
pass
-
+
def f(code, n):
pc = 0
while pc < len(code):
@@ -286,7 +286,7 @@
return "%s %d %s" % (code, pc, code[pc])
myjitdriver = JitDriver(greens=['pc', 'code'], reds=['n'],
get_printable_location=p)
-
+
def f(code, n):
pc = 0
while pc < len(code):
@@ -309,7 +309,7 @@
return n
def main(n):
set_param(None, 'threshold', 3)
- set_param(None, 'trace_eagerness', 5)
+ set_param(None, 'trace_eagerness', 5)
return f("c-l", n)
expected = main(100)
res = self.meta_interp(main, [100], enable_opts='', inline=True)
@@ -328,7 +328,7 @@
if n > 0:
return recursive(n - 1) + 1
return 0
- def loop(n):
+ def loop(n):
set_param(myjitdriver, "threshold", 10)
pc = 0
while n:
@@ -411,8 +411,8 @@
self.i7 = i7
self.i8 = i8
self.i9 = i9
-
-
+
+
def loop(n):
i = 0
o = A(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
@@ -444,8 +444,8 @@
self.i7 = i7
self.i8 = i8
self.i9 = i9
-
-
+
+
def loop(n):
i = 0
o = A(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
@@ -467,7 +467,7 @@
res = self.meta_interp(main, [20], failargs_limit=FAILARGS_LIMIT,
listops=True)
assert not res
- self.check_aborted_count(5)
+ self.check_aborted_count(5)
def test_set_param_inlining(self):
myjitdriver = JitDriver(greens=[], reds=['n', 'recurse'])
@@ -480,7 +480,7 @@
myjitdriver.can_enter_jit(n=n, recurse=recurse)
return n
TRACE_LIMIT = 66
-
+
def main(inline):
set_param(None, "threshold", 10)
set_param(None, 'function_threshold', 60)
@@ -502,7 +502,7 @@
return "'%s' at %d: %s" % (code, pc, code[pc])
myjitdriver = JitDriver(greens=['pc', 'code'], reds=['n'],
get_printable_location=p)
-
+
def f(code, n):
pc = 0
while pc < len(code):
@@ -543,7 +543,7 @@
return "%s %d %s" % (code, pc, code[pc])
myjitdriver = JitDriver(greens=['pc', 'code'], reds=['n'],
get_printable_location=p)
-
+
def f(code, n):
pc = 0
while pc < len(code):
@@ -576,7 +576,7 @@
result += f('-c-----------l-', i+100)
self.meta_interp(g, [10], backendopt=True)
self.check_aborted_count(1)
- self.check_resops(call=0, call_assembler=2)
+ self.check_resops(call=0, call_assembler=2)
self.check_jitcell_token_count(2)
def test_directly_call_assembler(self):
@@ -717,7 +717,7 @@
class MyException(Exception):
def __init__(self, x):
self.x = x
-
+
driver = JitDriver(greens = ['codeno'], reds = ['i'],
get_printable_location = lambda codeno :
str(codeno))
@@ -736,7 +736,7 @@
raise MyException(1)
self.meta_interp(portal, [2], inline=True)
- self.check_history(call_assembler=1)
+ self.check_history(call_assembler=1)
def test_directly_call_assembler_fail_guard(self):
driver = JitDriver(greens = ['codeno'], reds = ['i', 'k'],
@@ -765,10 +765,10 @@
class Thing(object):
def __init__(self, val):
self.val = val
-
+
class Frame(object):
_virtualizable2_ = ['thing']
-
+
driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
virtualizables = ['frame'],
get_printable_location = lambda codeno :
str(codeno))
@@ -803,10 +803,10 @@
class Thing(object):
def __init__(self, val):
self.val = val
-
+
class Frame(object):
_virtualizable2_ = ['thing']
-
+
driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
virtualizables = ['frame'],
get_printable_location = lambda codeno :
str(codeno))
@@ -854,10 +854,10 @@
class Thing(object):
def __init__(self, val):
self.val = val
-
+
class Frame(object):
_virtualizable2_ = ['thing']
-
+
driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
virtualizables = ['frame'],
get_printable_location = lambda codeno :
str(codeno))
@@ -918,7 +918,7 @@
def main(codeno, n, a):
frame = Frame([a, a+1, a+2, a+3], 0)
return f(codeno, n, a, frame)
-
+
def f(codeno, n, a, frame):
x = 0
while n > 0:
@@ -948,10 +948,10 @@
class Thing(object):
def __init__(self, val):
self.val = val
-
+
class Frame(object):
_virtualizable2_ = ['thing']
-
+
driver = JitDriver(greens = ['codeno'], reds = ['i', 'frame'],
virtualizables = ['frame'],
get_printable_location = lambda codeno :
str(codeno))
@@ -1195,7 +1195,7 @@
def test_trace_from_start_always(self):
from rpython.rlib.nonconst import NonConstant
-
+
driver = JitDriver(greens = ['c'], reds = ['i', 'v'])
def portal(c, i, v):
@@ -1220,7 +1220,7 @@
def test_trace_from_start_does_not_prevent_inlining(self):
driver = JitDriver(greens = ['c', 'bc'], reds = ['i'])
-
+
def portal(bc, c, i):
while True:
driver.jit_merge_point(c=c, bc=bc, i=i)
@@ -1229,7 +1229,7 @@
c += 1
else:
return
- if c == 10: # bc == 0
+ if c == 10: # bc == 0
c = 0
if i >= 100:
return
@@ -1266,6 +1266,3 @@
class TestLLtype(RecursiveTests, LLJitMixin):
pass
-
-class TestOOtype(RecursiveTests, OOJitMixin):
- pass
diff --git a/rpython/jit/metainterp/test/test_send.py
b/rpython/jit/metainterp/test/test_send.py
--- a/rpython/jit/metainterp/test/test_send.py
+++ b/rpython/jit/metainterp/test/test_send.py
@@ -1,10 +1,10 @@
import py
from rpython.rlib.jit import JitDriver, promote, elidable, set_param
from rpython.jit.codewriter.policy import StopAtXPolicy
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
class SendTests(object):
-
+
def test_green_send(self):
myjitdriver = JitDriver(greens = ['i'], reds = ['counter'])
lst = ["123", "45"]
@@ -149,7 +149,7 @@
def f(y):
while y > 0:
myjitdriver.can_enter_jit(y=y)
- myjitdriver.jit_merge_point(y=y)
+ myjitdriver.jit_merge_point(y=y)
w = externfn(y)
w.foo()
y -= 1
@@ -343,8 +343,8 @@
policy=StopAtXPolicy(State.externfn.im_func))
assert res == f(198)
# we get two TargetTokens, one for the loop and one for the preamble
- self.check_jitcell_token_count(1)
- self.check_target_token_count(2)
+ self.check_jitcell_token_count(1)
+ self.check_target_token_count(2)
def test_indirect_call_unknown_object_3(self):
myjitdriver = JitDriver(greens = [], reds = ['x', 'y', 'z', 'state'])
@@ -436,7 +436,7 @@
# and 1 bridge going from the
# loop back to the loop
self.check_trace_count(2) # preamble/loop and 1 bridge
- self.check_jitcell_token_count(1)
+ self.check_jitcell_token_count(1)
self.check_target_token_count(3) # preamble, Int1, Int2
self.check_aborted_count(0)
@@ -521,7 +521,7 @@
def test_recursive_call_to_portal_from_blackhole(self):
from rpython.rtyper.annlowlevel import hlstr
-
+
myjitdriver = JitDriver(greens = ['k'], reds = ['n'])
def f(n, k):
while n >= 0:
@@ -634,9 +634,5 @@
res = self.meta_interp(fn, [20], policy=StopAtXPolicy(extern))
assert res == 21
-
-class TestOOtype(SendTests, OOJitMixin):
- pass
-
class TestLLtype(SendTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_slist.py
b/rpython/jit/metainterp/test/test_slist.py
--- a/rpython/jit/metainterp/test/test_slist.py
+++ b/rpython/jit/metainterp/test/test_slist.py
@@ -1,5 +1,5 @@
import py
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rlib.jit import JitDriver
class ListTests(object):
@@ -94,9 +94,6 @@
assert res == 41
self.check_resops(call=0, guard_value=0)
-# we don't support resizable lists on ootype
-#class TestOOtype(ListTests, OOJitMixin):
-# pass
class TestLLtype(ListTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_string.py
b/rpython/jit/metainterp/test/test_string.py
--- a/rpython/jit/metainterp/test/test_string.py
+++ b/rpython/jit/metainterp/test/test_string.py
@@ -603,9 +603,6 @@
})
-#class TestOOtype(StringTests, OOJitMixin):
-# CALL = "oosend"
-# CALL_PURE = "oosend_pure"
class TestLLtype(StringTests, LLJitMixin):
CALL = "call"
diff --git a/rpython/jit/metainterp/test/test_tl.py
b/rpython/jit/metainterp/test/test_tl.py
--- a/rpython/jit/metainterp/test/test_tl.py
+++ b/rpython/jit/metainterp/test/test_tl.py
@@ -1,6 +1,6 @@
import py
from rpython.jit.codewriter.policy import StopAtXPolicy
-from rpython.jit.metainterp.test.support import OOJitMixin, LLJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
class ToyLanguageTests:
@@ -141,8 +141,5 @@
meth_func = meth.im_func
del meth_func._jit_look_inside_
-class TestOOtype(ToyLanguageTests, OOJitMixin):
- pass
-
class TestLLtype(ToyLanguageTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_tlc.py
b/rpython/jit/metainterp/test/test_tlc.py
--- a/rpython/jit/metainterp/test/test_tlc.py
+++ b/rpython/jit/metainterp/test/test_tlc.py
@@ -3,7 +3,7 @@
from rpython.jit.tl import tlc
-from rpython.jit.metainterp.test.support import OOJitMixin, LLJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
class TLCTests:
diff --git a/rpython/jit/metainterp/test/test_virtual.py
b/rpython/jit/metainterp/test/test_virtual.py
--- a/rpython/jit/metainterp/test/test_virtual.py
+++ b/rpython/jit/metainterp/test/test_virtual.py
@@ -2,7 +2,7 @@
from rpython.rlib.jit import JitDriver, promote, dont_look_inside
from rpython.rlib.objectmodel import compute_unique_id
from rpython.jit.codewriter.policy import StopAtXPolicy
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.rtyper.lltypesystem import lltype, rclass, rffi
from rpython.rtyper.lltypesystem.lloperation import llop
from rpython.rtyper.ootypesystem import ootype
@@ -189,7 +189,7 @@
self.check_resops(new_with_vtable=0, setfield_gc=0,
getfield_gc=2, new=0)
-
+
def test_two_loops_with_escaping_virtual(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'node'])
def externfn(node):
@@ -296,7 +296,7 @@
class StuffList(object):
_immutable_ = True
-
+
def f(n, a, i):
stufflist = StuffList()
stufflist.lst = [Stuff(a), Stuff(3)]
@@ -339,7 +339,7 @@
res = self.meta_interp(f, [10], policy=StopAtXPolicy(g))
assert res == 3
- self.check_resops(**{self._new_op: 1})
+ self.check_resops(**{self._new_op: 1})
def test_virtual_on_virtual(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'parent'])
@@ -351,7 +351,7 @@
class SubNode(object):
def __init__(self, f):
self.f = f
-
+
def f(n):
subnode = self._new()
subnode.value = 3
@@ -439,7 +439,7 @@
n -= 1
return sa
assert self.meta_interp(f, [30]) == f(30)
-
+
def test_constant_virtual2(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'sa', 'node'])
def f(n):
@@ -461,7 +461,7 @@
n -= 1
return sa
assert self.meta_interp(f, [31]) == f(31)
-
+
def test_stored_reference_with_bridge1(self):
class RefNode(object):
def __init__(self, ref):
@@ -711,7 +711,7 @@
assert self.meta_interp(f, [40]) == f(40)
def FIXME_why_does_this_force(self):
- mydriver = JitDriver(reds = ['i', 'j'], greens = [])
+ mydriver = JitDriver(reds = ['i', 'j'], greens = [])
def f():
i = self._new()
i.value = 0
@@ -727,7 +727,7 @@
assert self.meta_interp(f, []) == 20
def FIXME_why_does_this_force2(self):
- mydriver = JitDriver(reds = ['i', 'j'], greens = [])
+ mydriver = JitDriver(reds = ['i', 'j'], greens = [])
def f():
i = self._new()
i.value = 0
@@ -745,7 +745,7 @@
i = j
return i.value + j.value
assert self.meta_interp(f, []) == 20
-
+
def test_virtual_skipped_by_bridge(self):
myjitdriver = JitDriver(greens = [], reds = ['n', 'm', 'i', 'x'])
def f(n, m):
@@ -778,12 +778,12 @@
node1 = next
node2 = next
n -= 1
- return node1.value
+ return node1.value
res = self.meta_interp(f, [10])
assert res == f(10)
self.check_resops(new_with_vtable=0, new=0)
-
+
def test_retrace_not_matching_bridge(self):
@dont_look_inside
@@ -817,7 +817,7 @@
node2 = node2.new()
i += 1
- return node.value
+ return node.value
res = self.meta_interp(f, [10], repeat=10)
assert res == f(10)
self.check_resops(jump=2)
@@ -855,7 +855,7 @@
node2 = node2.new()
node.value += len(s)
i += 1
- return node.value
+ return node.value
res = self.meta_interp(f, [10], repeat=10)
assert res == f(10)
self.check_resops(jump=2)
@@ -1018,12 +1018,12 @@
assert r == expected
def test_arraycopy_disappears(self):
- mydriver = JitDriver(reds = ['i'], greens = [])
+ mydriver = JitDriver(reds = ['i'], greens = [])
def f():
i = 0
while i < 10:
mydriver.can_enter_jit(i=i)
- mydriver.jit_merge_point(i=i)
+ mydriver.jit_merge_point(i=i)
t = (1, 2, 3, i + 1)
t2 = t[:]
del t
@@ -1039,7 +1039,7 @@
class A(object):
def __init__(self, state):
self.state = state
-
+
def f():
i = 0
s = 10000
@@ -1227,7 +1227,7 @@
class TestLLtype_Instance(VirtualTests, LLJitMixin):
_new_op = 'new_with_vtable'
_field_prefix = 'inst_'
-
+
@staticmethod
def _new():
return MyClass()
@@ -1261,16 +1261,6 @@
self.check_resops(new_with_vtable=0, setfield_gc=0, getfield_gc=0,
new=0)
-class TestOOtype_Instance(VirtualTests, OOJitMixin):
- _new_op = 'new_with_vtable'
- _field_prefix = 'o'
-
- @staticmethod
- def _new():
- return MyClass()
-
- test_class_with_default_fields =
TestLLtype_Instance.test_class_with_default_fields.im_func
-
# ____________________________________________________________
# Run 2: all the tests use lltype.malloc to make a NODE
@@ -1281,7 +1271,7 @@
class TestLLtype_NotObject(VirtualTests, LLJitMixin):
_new_op = 'new'
_field_prefix = ''
-
+
@staticmethod
def _new():
return lltype.malloc(NODE)
@@ -1294,14 +1284,6 @@
'floatval' : ootype.Float,
'extra': ootype.Signed})
-class TestOOtype_NotObject(VirtualTests, OOJitMixin):
- _new_op = 'new_with_vtable'
- _field_prefix = ''
-
- @staticmethod
- def _new():
- return ootype.new(OONODE)
-
# ____________________________________________________________
# Run 3: all the tests use lltype.malloc to make a NODE2
# (same as Run 2 but it is part of the OBJECT hierarchy)
@@ -1317,7 +1299,7 @@
class TestLLtype_Object(VirtualTests, LLJitMixin):
_new_op = 'new_with_vtable'
_field_prefix = ''
-
+
@staticmethod
def _new():
p = lltype.malloc(NODE2)
@@ -1326,8 +1308,5 @@
# misc
-class TestOOTypeMisc(VirtualMiscTests, OOJitMixin):
- pass
-
class TestLLTypeMisc(VirtualMiscTests, LLJitMixin):
pass
diff --git a/rpython/jit/metainterp/test/test_virtualizable.py
b/rpython/jit/metainterp/test/test_virtualizable.py
--- a/rpython/jit/metainterp/test/test_virtualizable.py
+++ b/rpython/jit/metainterp/test/test_virtualizable.py
@@ -3,7 +3,7 @@
from rpython.jit.codewriter import heaptracker
from rpython.jit.codewriter.policy import StopAtXPolicy
from rpython.jit.metainterp.optimizeopt.test.test_util import LLtypeMixin
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.warmspot import get_translator
from rpython.rlib.jit import JitDriver, hint, dont_look_inside, promote,
virtual_ref
from rpython.rlib.rarithmetic import intmask
@@ -1470,12 +1470,6 @@
})
-class TestOOtype(#ExplicitVirtualizableTests,
- ImplicitVirtualizableTests,
- OOJitMixin):
- pass
-
-
class TestLLtype(ExplicitVirtualizableTests,
ImplicitVirtualizableTests,
LLJitMixin):
diff --git a/rpython/jit/metainterp/test/test_warmspot.py
b/rpython/jit/metainterp/test/test_warmspot.py
--- a/rpython/jit/metainterp/test/test_warmspot.py
+++ b/rpython/jit/metainterp/test/test_warmspot.py
@@ -4,7 +4,7 @@
from rpython.rlib.jit import JitDriver, set_param, unroll_safe, jit_callback
from rpython.jit.backend.llgraph import runner
-from rpython.jit.metainterp.test.support import LLJitMixin, OOJitMixin
+from rpython.jit.metainterp.test.support import LLJitMixin
from rpython.jit.metainterp.optimizeopt import ALL_OPTS_NAMES
@@ -502,13 +502,13 @@
# of W_InterpIterable), but we need to put it in a try/except block.
# With the first "inline_in_portal" approach, this case crashed
myjitdriver = JitDriver(greens = [], reds = 'auto')
-
+
def inc(x, n):
if x == n:
raise OverflowError
return x+1
inc._dont_inline_ = True
-
+
class MyRange(object):
def __init__(self, n):
self.cur = 0
@@ -563,10 +563,6 @@
CPUClass = runner.LLGraphCPU
type_system = 'lltype'
-class TestOOWarmspot(WarmspotTests, OOJitMixin):
- ##CPUClass = runner.OOtypeCPU
- type_system = 'ootype'
-
class TestWarmspotDirect(object):
def setup_class(cls):
from rpython.jit.metainterp.typesystem import llhelper
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit