Author: Ronan Lamy <[email protected]>
Branch: type_system-cleanup
Changeset: r80069:37e366591ab1
Date: 2015-10-09 00:07 +0100
http://bitbucket.org/pypy/pypy/changeset/37e366591ab1/
Log: Kill LowLevelTypeSystem.generic_is
diff --git a/rpython/rtyper/rmodel.py b/rpython/rtyper/rmodel.py
--- a/rpython/rtyper/rmodel.py
+++ b/rpython/rtyper/rmodel.py
@@ -2,7 +2,7 @@
from rpython.flowspace.model import Constant
from rpython.rtyper.error import TyperError, MissingRTypeOperation
from rpython.rtyper.lltypesystem import lltype
-from rpython.rtyper.lltypesystem.lltype import Void, Bool, LowLevelType
+from rpython.rtyper.lltypesystem.lltype import Void, Bool, LowLevelType, Ptr
from rpython.tool.pairtype import pairtype, extendabletype, pair
@@ -283,7 +283,23 @@
def rtype_is_((robj1, robj2), hop):
if hop.s_result.is_constant():
return inputconst(Bool, hop.s_result.const)
- return hop.rtyper.type_system.generic_is(robj1, robj2, hop)
+ roriginal1 = robj1
+ roriginal2 = robj2
+ if robj1.lowleveltype is Void:
+ robj1 = robj2
+ elif robj2.lowleveltype is Void:
+ robj2 = robj1
+ if (not isinstance(robj1.lowleveltype, Ptr) or
+ not isinstance(robj2.lowleveltype, Ptr)):
+ raise TyperError('is of instances of the non-pointers: %r, %r' % (
+ roriginal1, roriginal2))
+ if robj1.lowleveltype != robj2.lowleveltype:
+ raise TyperError('is of instances of different pointer types: %r,
%r' % (
+ roriginal1, roriginal2))
+
+ v_list = hop.inputargs(robj1, robj2)
+ return hop.genop('ptr_eq', v_list, resulttype=Bool)
+
# default implementation for checked getitems
diff --git a/rpython/rtyper/typesystem.py b/rpython/rtyper/typesystem.py
--- a/rpython/rtyper/typesystem.py
+++ b/rpython/rtyper/typesystem.py
@@ -8,25 +8,6 @@
class LowLevelTypeSystem(object):
name = "lltypesystem"
- def generic_is(self, robj1, robj2, hop):
- roriginal1 = robj1
- roriginal2 = robj2
- if robj1.lowleveltype is lltype.Void:
- robj1 = robj2
- elif robj2.lowleveltype is lltype.Void:
- robj2 = robj1
- if (not isinstance(robj1.lowleveltype, lltype.Ptr) or
- not isinstance(robj2.lowleveltype, lltype.Ptr)):
- raise TyperError('is of instances of the non-pointers: %r, %r' % (
- roriginal1, roriginal2))
- if robj1.lowleveltype != robj2.lowleveltype:
- raise TyperError('is of instances of different pointer types: %r,
%r' % (
- roriginal1, roriginal2))
-
- v_list = hop.inputargs(robj1, robj2)
- return hop.genop('ptr_eq', v_list, resulttype=lltype.Bool)
-
-
def _getconcretetype(v):
return v.concretetype
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit