[pypy-commit] pypy kill-ootype: clean up in rpython/rlib/
rlamy
noreply at buildbot.pypy.org
Tue Jul 23 19:15:36 CEST 2013
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: kill-ootype
Changeset: r65563:8f69c5c10b48
Date: 2013-07-23 19:13 +0200
http://bitbucket.org/pypy/pypy/changeset/8f69c5c10b48/
Log: clean up in rpython/rlib/
diff --git a/rpython/rlib/_jit_vref.py b/rpython/rlib/_jit_vref.py
--- a/rpython/rlib/_jit_vref.py
+++ b/rpython/rlib/_jit_vref.py
@@ -6,8 +6,6 @@
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.error import TyperError
-from rpython.rtyper.ootypesystem import ootype
-
class SomeVRef(annmodel.SomeObject):
@@ -28,10 +26,7 @@
return annmodel.s_Bool
def rtyper_makerepr(self, rtyper):
- if rtyper.type_system.name == 'lltypesystem':
- return vrefrepr
- elif rtyper.type_system.name == 'ootypesystem':
- return oovrefrepr
+ return vrefrepr
def rtyper_makekey(self):
return self.__class__,
@@ -70,21 +65,4 @@
hop.exception_cannot_occur()
return hop.genop('jit_is_virtual', [v], resulttype = lltype.Bool)
-from rpython.rtyper.ootypesystem.rclass import OBJECT
-
-class OOVRefRepr(VRefRepr):
- lowleveltype = OBJECT
- def rtype_simple_call(self, hop):
- [v] = hop.inputargs(self)
- hop.exception_is_here()
- v = hop.genop('jit_force_virtual', [v], resulttype = OBJECT)
- return hop.genop('oodowncast', [v], resulttype = hop.r_result)
-
- def convert_const(self, value):
- if value() is not None:
- raise TypeError("only supports virtual_ref_None as a"
- " prebuilt virtual_ref")
- return ootype.ROOT._null
-
vrefrepr = VRefRepr()
-oovrefrepr = OOVRefRepr()
diff --git a/rpython/rlib/jit.py b/rpython/rlib/jit.py
--- a/rpython/rlib/jit.py
+++ b/rpython/rlib/jit.py
@@ -758,12 +758,6 @@
args_s.append(s_arg)
bk.emulate_pbc_call(uniquekey, s_func, args_s)
- def get_getfield_op(self, rtyper):
- if rtyper.type_system.name == 'ootypesystem':
- return 'oogetfield'
- else:
- return 'getfield'
-
def specialize_call(self, hop, **kwds_i):
# XXX to be complete, this could also check that the concretetype
# of the variables are the same for each of the calls.
@@ -792,10 +786,7 @@
"field %r not found in %r" % (name,
r_red.lowleveltype.TO))
r_red = r_red.rbase
- if hop.rtyper.type_system.name == 'ootypesystem':
- GTYPE = r_red.lowleveltype
- else:
- GTYPE = r_red.lowleveltype.TO
+ GTYPE = r_red.lowleveltype.TO
assert GTYPE._immutable_field(mangled_name), (
"field %r must be declared as immutable" % name)
if not hasattr(driver, 'll_greenfields'):
@@ -804,8 +795,7 @@
#
v_red = hop.inputarg(r_red, arg=i)
c_llname = hop.inputconst(lltype.Void, mangled_name)
- getfield_op = self.get_getfield_op(hop.rtyper)
- v_green = hop.genop(getfield_op, [v_red, c_llname],
+ v_green = hop.genop('getfield', [v_red, c_llname],
resulttype=r_field)
s_green = s_red.classdef.about_attribute(fieldname)
assert s_green is not None
diff --git a/rpython/rlib/rerased.py b/rpython/rlib/rerased.py
--- a/rpython/rlib/rerased.py
+++ b/rpython/rlib/rerased.py
@@ -181,10 +181,7 @@
return False # cannot be None, but can contain a None
def rtyper_makerepr(self, rtyper):
- if rtyper.type_system.name == 'lltypesystem':
- return ErasedRepr(rtyper)
- elif rtyper.type_system.name == 'ootypesystem':
- return OOErasedRepr(rtyper)
+ return ErasedRepr(rtyper)
def rtyper_makekey(self):
return self.__class__,
@@ -242,51 +239,3 @@
return lltype.nullptr(self.lowleveltype.TO)
v = r_obj.convert_const(value._x)
return lltype.cast_opaque_ptr(self.lowleveltype, v)
-
-from rpython.rtyper.ootypesystem import ootype
-
-class OOErasedRepr(Repr):
- lowleveltype = ootype.Object
- def __init__(self, rtyper):
- self.rtyper = rtyper
-
- def rtype_erase(self, hop, s_obj):
- hop.exception_cannot_occur()
- r_obj = self.rtyper.getrepr(s_obj)
- if r_obj.lowleveltype is lltype.Void:
- return hop.inputconst(self.lowleveltype,
- ootype.NULL)
- [v_obj] = hop.inputargs(r_obj)
- return hop.genop('cast_to_object', [v_obj],
- resulttype=self.lowleveltype)
-
- def rtype_unerase(self, hop, s_obj):
- [v] = hop.inputargs(hop.args_r[0])
- return hop.genop('cast_from_object', [v], resulttype=hop.r_result)
-
- def rtype_unerase_int(self, hop, v):
- c_one = hop.inputconst(lltype.Signed, 1)
- hop.exception_cannot_occur()
- v2 = hop.genop('oounbox_int', [v], resulttype=hop.r_result)
- return hop.genop('int_rshift', [v2, c_one], resulttype=lltype.Signed)
-
- def rtype_erase_int(self, hop):
- [v_value] = hop.inputargs(lltype.Signed)
- c_one = hop.inputconst(lltype.Signed, 1)
- hop.exception_is_here()
- v2 = hop.genop('int_add_ovf', [v_value, v_value],
- resulttype = lltype.Signed)
- v2p1 = hop.genop('int_add', [v2, c_one],
- resulttype = lltype.Signed)
- return hop.genop('oobox_int', [v2p1], resulttype=hop.r_result)
-
- def convert_const(self, value):
- if value._identity is _identity_for_ints:
- return value._x # FIXME: what should we do here?
- bk = self.rtyper.annotator.bookkeeper
- s_obj = value._identity.get_input_annotation(bk)
- r_obj = self.rtyper.getrepr(s_obj)
- if r_obj.lowleveltype is lltype.Void:
- return ootype.NULL
- v = r_obj.convert_const(value._x)
- return ootype.cast_to_object(v)
diff --git a/rpython/rlib/test/test__jit_vref.py b/rpython/rlib/test/test__jit_vref.py
--- a/rpython/rlib/test/test__jit_vref.py
+++ b/rpython/rlib/test/test__jit_vref.py
@@ -4,14 +4,11 @@
from rpython.rlib._jit_vref import SomeVRef
from rpython.annotator import model as annmodel
from rpython.annotator.annrpython import RPythonAnnotator
-from rpython.rtyper.test.test_llinterp import interpret
from rpython.rtyper.lltypesystem.rclass import OBJECTPTR
-from rpython.rtyper.ootypesystem.rclass import OBJECT
from rpython.rtyper.lltypesystem import lltype
from rpython.rtyper.test.tool import BaseRtypingTest
-from rpython.rtyper.ootypesystem import ootype
class X(object):
pass
diff --git a/rpython/rlib/test/test_rerased.py b/rpython/rlib/test/test_rerased.py
--- a/rpython/rlib/test/test_rerased.py
+++ b/rpython/rlib/test/test_rerased.py
@@ -5,9 +5,7 @@
from rpython.rlib.rerased import *
from rpython.annotator import model as annmodel
from rpython.annotator.annrpython import RPythonAnnotator
-from rpython.rtyper.test.test_llinterp import interpret
from rpython.rtyper.lltypesystem.rclass import OBJECTPTR
-from rpython.rtyper.ootypesystem.rclass import OBJECT
from rpython.rtyper.lltypesystem import lltype, llmemory
from rpython.rtyper.test.tool import BaseRtypingTest
diff --git a/rpython/rlib/test/test_rstackovf.py b/rpython/rlib/test/test_rstackovf.py
--- a/rpython/rlib/test/test_rstackovf.py
+++ b/rpython/rlib/test/test_rstackovf.py
@@ -40,11 +40,6 @@
res = interpret(f, [sys.maxint])
assert res == 1
-def test_oointerp():
- from rpython.rtyper.test.test_llinterp import interpret
- res = interpret(f, [sys.maxint], type_system='ootype')
- assert res == 1
-
def test_c_translation():
from rpython.translator.c.test.test_genc import compile
fn = compile(f, [int])
More information about the pypy-commit
mailing list