Author: Maciej Fijalkowski <[email protected]>
Branch: optresult-unroll
Changeset: r79431:3c1f7d42f12b
Date: 2015-09-04 17:09 +0200
http://bitbucket.org/pypy/pypy/changeset/3c1f7d42f12b/
Log: let's just use one exception instead of two that have to be caught a
bit everywhere'
diff --git a/rpython/jit/metainterp/optimizeopt/virtualstate.py
b/rpython/jit/metainterp/optimizeopt/virtualstate.py
--- a/rpython/jit/metainterp/optimizeopt/virtualstate.py
+++ b/rpython/jit/metainterp/optimizeopt/virtualstate.py
@@ -13,9 +13,6 @@
LEVEL_KNOWNCLASS = '\x02'
LEVEL_CONSTANT = '\x03'
-class BadVirtualState(Exception):
- pass
-
class VirtualStatesCantMatch(Exception):
def __init__(self, msg='?', state=None):
self.msg = msg
@@ -179,7 +176,7 @@
box = optimizer.get_box_replacement(box)
info = optimizer.getptrinfo(box)
if info is None or not info.is_virtual():
- raise BadVirtualState()
+ raise VirtualStatesCantMatch()
else:
assert isinstance(info, AbstractStructPtrInfo)
for i in range(len(self.fielddescrs)):
@@ -254,9 +251,9 @@
box = optimizer.get_box_replacement(box)
info = optimizer.getptrinfo(box)
if info is None or not info.is_virtual():
- raise BadVirtualState()
+ raise VirtualStatesCantMatch()
if len(self.fieldstate) > info.getlength():
- raise BadVirtualState
+ raise VirtualStatesCantMatch
for i in range(len(self.fieldstate)):
fieldbox = info.getitem(self.arraydescr, i)
s = self.fieldstate[i]
@@ -321,11 +318,11 @@
def enum_forced_boxes(self, boxes, box, optimizer, force_boxes=False):
opinfo = optimizer.getptrinfo(box)
if not isinstance(opinfo, ArrayStructInfo):
- raise BadVirtualState
+ raise VirtualStatesCantMatch
if not opinfo.is_virtual():
- raise BadVirtualState
+ raise VirtualStatesCantMatch
#if len(self.fielddescrs) > len(value._items):
- # raise BadVirtualState
+ # raise VirtualStatesCantMatch
for i in range(self.length):
for descr in self.fielddescrs:
index = i * len(self.fielddescrs) + descr.get_index()
@@ -334,7 +331,7 @@
descr.get_index()]
if fieldstate is None:
if itembox is not None:
- raise BadVirtualState
+ raise VirtualStatesCantMatch
continue
# I think itembox must be present here
if fieldstate.position > self.position:
@@ -501,7 +498,7 @@
if force_boxes:
info.force_box(box, optimizer)
else:
- raise BadVirtualState
+ raise VirtualStatesCantMatch
boxes[self.position_in_notvirtuals] = box
def _enum(self, virtual_state):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit