[pypy-svn] r76397 - in pypy/branch/fast-ctypes/pypy/rlib: . test
getxsick at codespeak.net
getxsick at codespeak.net
Thu Jul 29 23:55:23 CEST 2010
Author: getxsick
Date: Thu Jul 29 23:55:21 2010
New Revision: 76397
Modified:
pypy/branch/fast-ctypes/pypy/rlib/jit.py
pypy/branch/fast-ctypes/pypy/rlib/test/test_jit.py
Log:
new get_cpu() function to return CPU instance
Modified: pypy/branch/fast-ctypes/pypy/rlib/jit.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/jit.py (original)
+++ pypy/branch/fast-ctypes/pypy/rlib/jit.py Thu Jul 29 23:55:21 2010
@@ -4,6 +4,7 @@
from pypy.rlib.objectmodel import CDefinedIntSymbolic
from pypy.rlib.objectmodel import keepalive_until_here
from pypy.rlib.unroll import unrolling_iterable
+from pypy.jit.backend.detect_cpu import getcpuclass
def purefunction(func):
""" Decorate a function as pure. Pure means precisely that:
@@ -77,6 +78,10 @@
return result
return decorator
+def get_cpu():
+ CPUClass = getcpuclass()
+ return CPUClass(None, None)
+
class Entry(ExtRegistryEntry):
_about_ = hint
Modified: pypy/branch/fast-ctypes/pypy/rlib/test/test_jit.py
==============================================================================
--- pypy/branch/fast-ctypes/pypy/rlib/test/test_jit.py (original)
+++ pypy/branch/fast-ctypes/pypy/rlib/test/test_jit.py Thu Jul 29 23:55:21 2010
@@ -1,9 +1,10 @@
import py
from pypy.rlib.jit import hint, we_are_jitted, JitDriver, purefunction_promote
-from pypy.rlib.jit import JitHintError
+from pypy.rlib.jit import JitHintError, get_cpu
from pypy.translator.translator import TranslationContext, graphof
from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
from pypy.rpython.lltypesystem import lltype
+from pypy.jit.backend.detect_cpu import ProcessorAutodetectError
class BaseTestJIT(BaseRtypingTest):
def test_hint(self):
@@ -107,6 +108,14 @@
return n
py.test.raises(JitHintError, self.gengraph, fn, [int])
+ def test_get_cpu(self):
+ try:
+ cpu = get_cpu()
+ except ProcessorAutodetectError:
+ pass
+ else:
+ from pypy.jit.backend.model import AbstractCPU
+ assert isinstance(cpu, AbstractCPU)
class TestJITLLtype(BaseTestJIT, LLRtypeMixin):
pass
More information about the Pypy-commit
mailing list