[pypy-commit] pypy online-transforms: hg merge default
rlamy
noreply at buildbot.pypy.org
Thu Oct 16 17:47:03 CEST 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: online-transforms
Changeset: r73978:1bdebe826b62
Date: 2014-10-16 16:46 +0100
http://bitbucket.org/pypy/pypy/changeset/1bdebe826b62/
Log: hg merge default
diff --git a/rpython/annotator/annrpython.py b/rpython/annotator/annrpython.py
--- a/rpython/annotator/annrpython.py
+++ b/rpython/annotator/annrpython.py
@@ -249,10 +249,6 @@
assert s_value.contains(s_old)
arg.annotation = s_value
- def transfer_binding(self, v_target, v_source):
- assert v_source.annotation is not None
- v_target.annotation = v_source.annotation
-
def warning(self, msg, pos=None):
if pos is None:
try:
diff --git a/rpython/annotator/bookkeeper.py b/rpython/annotator/bookkeeper.py
--- a/rpython/annotator/bookkeeper.py
+++ b/rpython/annotator/bookkeeper.py
@@ -559,10 +559,6 @@
assert self.annotator.binding(op.args[pos]) == s_type
return op
- def ondegenerated(self, what, s_value, where=None, called_from_graph=None):
- self.annotator.ondegenerated(what, s_value, where=where,
- called_from_graph=called_from_graph)
-
def whereami(self):
return self.annotator.whereami(self.position_key)
diff --git a/rpython/annotator/description.py b/rpython/annotator/description.py
--- a/rpython/annotator/description.py
+++ b/rpython/annotator/description.py
@@ -14,7 +14,6 @@
objects, where the equivalence relation is the transitive closure of
'd1~d2 if d1 and d2 might be called at the same call site'.
"""
- overridden = False
normalized = False
modified = True
@@ -175,7 +174,6 @@
class FunctionDesc(Desc):
knowntype = types.FunctionType
- overridden = False
def __init__(self, bookkeeper, pyobj=None,
name=None, signature=None, defaults=None,
diff --git a/rpython/rlib/rbigint.py b/rpython/rlib/rbigint.py
--- a/rpython/rlib/rbigint.py
+++ b/rpython/rlib/rbigint.py
@@ -71,7 +71,6 @@
FIVEARY_CUTOFF = 8
-
def _mask_digit(x):
return UDIGIT_MASK(x & MASK)
_mask_digit._annspecialcase_ = 'specialize:argtype(0)'
@@ -384,12 +383,17 @@
digits = ''.join([digits[i] for i in range(length-1, -1, -1)])
return digits
- @jit.elidable
def toint(self):
"""
Get an integer from a bigint object.
Raises OverflowError if overflow occurs.
"""
+ if self.numdigits() > MAX_DIGITS_THAT_CAN_FIT_IN_INT:
+ raise OverflowError
+ return self._toint_helper()
+
+ @jit.elidable
+ def _toint_helper(self):
x = self._touint_helper()
# Haven't lost any bits, but if the sign bit is set we're in
# trouble *unless* this is the min negative number. So,
@@ -422,8 +426,7 @@
prev = x
x = (x << SHIFT) + self.udigit(i)
if (x >> SHIFT) != prev:
- raise OverflowError(
- "long int too large to convert to unsigned int (%d, %d)" % (x >> SHIFT, prev))
+ raise OverflowError("long int too large to convert to unsigned int")
i -= 1
return x
@@ -1084,6 +1087,11 @@
(2 * SHIFT) % 5,
(1 * SHIFT) % 5]
+
+# if the bigint has more digits than this, it cannot fit into an int
+MAX_DIGITS_THAT_CAN_FIT_IN_INT = rbigint.fromint(-sys.maxint - 1).numdigits()
+
+
#_________________________________________________________________
# Helper Functions
diff --git a/rpython/rtyper/normalizecalls.py b/rpython/rtyper/normalizecalls.py
--- a/rpython/rtyper/normalizecalls.py
+++ b/rpython/rtyper/normalizecalls.py
@@ -19,15 +19,6 @@
def normalize_calltable(annotator, callfamily):
"""Try to normalize all rows of a table."""
- overridden = False
- for desc in callfamily.descs:
- if getattr(desc, 'overridden', False):
- overridden = True
- if overridden:
- if len(callfamily.descs) > 1:
- raise Exception("non-static call to overridden function")
- callfamily.overridden = True
- return
nshapes = len(callfamily.calltables)
for shape, table in callfamily.calltables.items():
for row in table:
diff --git a/rpython/rtyper/rpbc.py b/rpython/rtyper/rpbc.py
--- a/rpython/rtyper/rpbc.py
+++ b/rpython/rtyper/rpbc.py
@@ -29,12 +29,9 @@
sample = self.any_description()
callfamily = sample.querycallfamily()
if callfamily and callfamily.total_calltable_size > 0:
- if sample.overridden:
- getRepr = OverriddenFunctionPBCRepr
- else:
- getRepr = FunctionsPBCRepr
- if small_cand(rtyper, self):
- getRepr = SmallFunctionSetPBCRepr
+ getRepr = FunctionsPBCRepr
+ if small_cand(rtyper, self):
+ getRepr = SmallFunctionSetPBCRepr
else:
getRepr = getFrozenPBCRepr
elif issubclass(kind, description.ClassDesc):
@@ -338,16 +335,6 @@
return inputconst(lltype.Void, None)
return NotImplemented
-class OverriddenFunctionPBCRepr(Repr):
- def __init__(self, rtyper, s_pbc):
- self.rtyper = rtyper
- self.s_pbc = s_pbc
- assert len(s_pbc.descriptions) == 1
- self.lowleveltype = lltype.Void
-
- def rtype_simple_call(self, hop):
- from rpython.rtyper.rspecialcase import rtype_call_specialcase
- return rtype_call_specialcase(hop)
def getFrozenPBCRepr(rtyper, s_pbc):
from rpython.rtyper.lltypesystem.rpbc import (
@@ -863,7 +850,6 @@
r_class = self.r_im_self.rclass
mangled_name, r_func = r_class.clsfields[self.methodname]
assert isinstance(r_func, (FunctionsPBCRepr,
- OverriddenFunctionPBCRepr,
SmallFunctionSetPBCRepr))
# s_func = r_func.s_pbc -- not precise enough, see
# test_precise_method_call_1. Build a more precise one...
More information about the pypy-commit
mailing list