[pypy-commit] pypy kill-ootype: kill rpython.jit.metainterp.typesystem.OOTypeHelper
rlamy
noreply at buildbot.pypy.org
Tue Jul 9 03:00:45 CEST 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: kill-ootype
Changeset: r65279:d00592d4942b
Date: 2013-07-08 02:26 +0200
http://bitbucket.org/pypy/pypy/changeset/d00592d4942b/
Log: kill rpython.jit.metainterp.typesystem.OOTypeHelper
diff --git a/rpython/jit/metainterp/optimizeopt/optimizer.py b/rpython/jit/metainterp/optimizeopt/optimizer.py
--- a/rpython/jit/metainterp/optimizeopt/optimizer.py
+++ b/rpython/jit/metainterp/optimizeopt/optimizer.py
@@ -6,7 +6,7 @@
IntLowerBound, MININT, MAXINT
from rpython.jit.metainterp.optimizeopt.util import make_dispatcher_method
from rpython.jit.metainterp.resoperation import rop, ResOperation, AbstractResOp
-from rpython.jit.metainterp.typesystem import llhelper, oohelper
+from rpython.jit.metainterp.typesystem import llhelper
from rpython.tool.pairtype import extendabletype
from rpython.rlib.debug import debug_print
from rpython.rlib.objectmodel import specialize
@@ -256,7 +256,6 @@
CVAL_ZERO = ConstantValue(CONST_0)
CVAL_ZERO_FLOAT = ConstantValue(Const._new(0.0))
llhelper.CVAL_NULLREF = ConstantValue(llhelper.CONST_NULL)
-oohelper.CVAL_NULLREF = ConstantValue(oohelper.CONST_NULL)
REMOVED = AbstractResOp(None)
diff --git a/rpython/jit/metainterp/test/test_typesystem.py b/rpython/jit/metainterp/test/test_typesystem.py
--- a/rpython/jit/metainterp/test/test_typesystem.py
+++ b/rpython/jit/metainterp/test/test_typesystem.py
@@ -1,6 +1,5 @@
from rpython.jit.metainterp import typesystem
from rpython.rtyper.lltypesystem import lltype, llmemory
-from rpython.rtyper.ootypesystem import ootype
class TypeSystemTests(object):
@@ -35,19 +34,3 @@
def null_ref(self):
return lltype.nullptr(llmemory.GCREF.TO)
-
-
-class TestOOtype(TypeSystemTests):
- helper = typesystem.oohelper
-
- def fresh_ref(self):
- O = ootype.StaticMethod([], ootype.Signed)
- o = O._example()
- return ootype.cast_to_object(o)
-
- def duplicate_ref(self, x):
- o = x.obj
- return ootype.cast_to_object(o)
-
- def null_ref(self):
- return ootype.NULL
diff --git a/rpython/jit/metainterp/typesystem.py b/rpython/jit/metainterp/typesystem.py
--- a/rpython/jit/metainterp/typesystem.py
+++ b/rpython/jit/metainterp/typesystem.py
@@ -132,7 +132,7 @@
def cast_to_ref(self, value):
return lltype.cast_opaque_ptr(llmemory.GCREF, value)
cast_to_ref._annspecialcase_ = 'specialize:ll'
-
+
def getaddr_for_box(self, box):
return box.getaddr()
@@ -143,104 +143,4 @@
assert ref
return lltype.identityhash(ref)
-# ____________________________________________________________
-
-class OOTypeHelper(TypeSystemHelper):
-
- name = 'ootype'
- functionptr = staticmethod(ootype.static_meth)
- nullptr = staticmethod(ootype.null)
- cast_instance_to_base_ref = staticmethod(cast_instance_to_base_obj)
- BASETYPE = ootype.Object
- BoxRef = history.BoxObj
- ConstRef = history.ConstObj
- loops_done_with_this_frame_ref = None # patched by compile.py
- NULLREF = history.ConstObj.value
- CONST_NULL = history.ConstObj(NULLREF)
- CVAL_NULLREF = None # patched by optimizeopt.py
-
- def new_ConstRef(self, x):
- obj = ootype.cast_to_object(x)
- return history.ConstObj(obj)
-
- def get_typeptr(self, obj):
- return ootype.classof(obj)
-
- def get_FuncType(self, ARGS, RESULT):
- FUNCTYPE = ootype.StaticMethod(ARGS, RESULT)
- return FUNCTYPE, FUNCTYPE
-
- def get_superclass(self, TYPE):
- return TYPE._superclass
-
- def cast_to_instance_maybe(self, TYPE, instance):
- return instance
- cast_to_instance_maybe._annspecialcase_ = 'specialize:arg(1)'
-
- def cast_fnptr_to_root(self, fnptr):
- return ootype.cast_to_object(fnptr)
-
- def cls_of_box(self, cpu, box):
- obj = box.getref(ootype.ROOT)
- oocls = ootype.classof(obj)
- return history.ConstObj(ootype.cast_to_object(oocls))
-
- def subclassOf(self, cpu, clsbox1, clsbox2):
- cls1 = clsbox1.getref(ootype.Class)
- cls2 = clsbox2.getref(ootype.Class)
- return ootype.subclassof(cls1, cls2)
-
- def get_exception_box(self, etype):
- return history.ConstObj(etype)
-
- def get_exc_value_box(self, evalue):
- return history.BoxObj(evalue)
-
- def get_exception_obj(self, evaluebox):
- # only works when translated
- obj = evaluebox.getref(ootype.ROOT)
- return cast_base_ptr_to_instance(Exception, obj)
-
- def cast_to_baseclass(self, value):
- return ootype.cast_from_object(ootype.ROOT, value)
-
- @specialize.ll()
- def getlength(self, array):
- return array.ll_length()
-
- @specialize.ll()
- def getarrayitem(self, array, i):
- return array.ll_getitem_fast(i)
-
- @specialize.ll()
- def setarrayitem(self, array, i, newvalue):
- array.ll_setitem_fast(i, newvalue)
-
- def conststr(self, str):
- oo = oostr(str)
- return history.ConstObj(ootype.cast_to_object(oo))
-
- # A dict whose keys are refs (like the .value of BoxObj).
- # It is a normal dict on ootype. Two copies, to avoid conflicts
- # with the value type.
- def new_ref_dict(self):
- return {}
- def new_ref_dict_2(self):
- return {}
-
- def cast_vtable_to_hashable(self, cpu, obj):
- return ootype.cast_to_object(obj)
-
- def cast_from_ref(self, TYPE, value):
- return ootype.cast_from_object(TYPE, value)
- cast_from_ref._annspecialcase_ = 'specialize:arg(1)'
-
- def cast_to_ref(self, value):
- return ootype.cast_to_object(value)
- cast_to_ref._annspecialcase_ = 'specialize:ll'
-
- def getaddr_for_box(self, box):
- return box.getref_base()
-
llhelper = LLTypeHelper()
-oohelper = OOTypeHelper()
More information about the pypy-commit
mailing list