Commits

Alex Gaynor  committed 8148f32

Soem cleanups.

  • Participants
  • Parent commits b4cd93e

Comments (0)

Files changed (1)

File rpython/jit/metainterp/optimizeopt/virtualstate.py

 from rpython.jit.metainterp import resume
-from rpython.jit.metainterp.optimizeopt import virtualize
-from rpython.jit.metainterp.optimizeopt.optimizer import LEVEL_CONSTANT, \
-                                                      LEVEL_KNOWNCLASS, \
-                                                      LEVEL_NONNULL, \
-                                                      LEVEL_UNKNOWN, \
-                                                      MININT, MAXINT, OptValue
 from rpython.jit.metainterp.history import BoxInt, ConstInt, BoxPtr, Const
 from rpython.jit.metainterp.optimize import InvalidLoop
-from rpython.jit.metainterp.optimizeopt.intutils import IntBound, IntUnbounded
+from rpython.jit.metainterp.optimizeopt import virtualize
+from rpython.jit.metainterp.optimizeopt.intutils import IntUnbounded
+from rpython.jit.metainterp.optimizeopt.optimizer import (LEVEL_CONSTANT,
+    LEVEL_KNOWNCLASS, LEVEL_NONNULL, LEVEL_UNKNOWN)
 from rpython.jit.metainterp.resoperation import rop, ResOperation
-from rpython.rlib.objectmodel import we_are_translated
 from rpython.rlib.debug import debug_start, debug_stop, debug_print
 from rpython.rlib.objectmodel import we_are_translated
-import os
+
 
 class BadVirtualState(Exception):
     pass
 
+
 class AbstractVirtualStateInfo(resume.AbstractVirtualInfo):
     position = -1
 
         else:
             debug_print(indent + "    ...")
 
-
     def debug_header(self, indent):
         raise NotImplementedError
 
     def debug_header(self, indent):
         debug_print(indent + 'VirtualStateInfo(%d):' % self.position)
 
+
 class VStructStateInfo(AbstractVirtualStructStateInfo):
     def __init__(self, typedescr, fielddescrs):
         AbstractVirtualStructStateInfo.__init__(self, fielddescrs)
         debug_print(indent + 'VArrayStateInfo(%d):' % self.position)
 
 
-
 class VArrayStructStateInfo(AbstractVirtualStateInfo):
     def __init__(self, arraydescr, fielddescrs):
         self.arraydescr = arraydescr
         debug_print(indent + 'VArrayStructStateInfo(%d):' % self.position)
 
 
-
 class NotVirtualStateInfo(AbstractVirtualStateInfo):
     def __init__(self, value, is_opaque=False):
         self.is_opaque = is_opaque
             extra_guards.append(op)
             return
 
-        if self.level == LEVEL_NONNULL and \
-               other.level == LEVEL_UNKNOWN and \
-               isinstance(box, BoxPtr) and \
-               box.nonnull():
+        if (self.level == LEVEL_NONNULL and
+               other.level == LEVEL_UNKNOWN and
+               isinstance(box, BoxPtr) and
+               box.nonnull()):
             op = ResOperation(rop.GUARD_NONNULL, [box], None)
             extra_guards.append(op)
             return
 
-        if self.level == LEVEL_UNKNOWN and \
-               other.level == LEVEL_UNKNOWN and \
-               isinstance(box, BoxInt) and \
-               self.intbound.contains(box.getint()):
+        if (self.level == LEVEL_UNKNOWN and
+               other.level == LEVEL_UNKNOWN and
+               isinstance(box, BoxInt) and
+               self.intbound.contains(box.getint())):
             if self.intbound.has_lower:
                 bound = self.intbound.lower
-                if not (other.intbound.has_lower and \
+                if not (other.intbound.has_lower and
                         other.intbound.lower >= bound):
                     res = BoxInt()
                     op = ResOperation(rop.INT_GE, [box, ConstInt(bound)], res)
                     extra_guards.append(op)
             if self.intbound.has_upper:
                 bound = self.intbound.upper
-                if not (other.intbound.has_upper and \
+                if not (other.intbound.has_upper and
                         other.intbound.upper <= bound):
                     res = BoxInt()
                     op = ResOperation(rop.INT_LE, [box, ConstInt(bound)], res)
         # Remaining cases are probably not interesting
         raise InvalidLoop('Generating guards for making the VirtualStates ' +
                           'at hand match have not been implemented')
-        if self.level == LEVEL_CONSTANT:
-            import pdb; pdb.set_trace()
-            raise NotImplementedError
 
     def enum_forced_boxes(self, boxes, value, optimizer):
         if self.level == LEVEL_CONSTANT:
         debug_print(indent + mark + 'NotVirtualInfo(%d' % self.position +
                     ', ' + l + ', ' + self.intbound.__repr__() + lb + ')')
 
+
 class VirtualState(object):
     def __init__(self, state):
         self.state = state
         for s in self.state:
             s.debug_print("    ", seen, bad)
 
+
 class VirtualStateAdder(resume.ResumeDataVirtualAdder):
     def __init__(self, optimizer):
         self.fieldboxes = {}
     def make_vrawbuffer(self, size, offsets, descrs):
         raise NotImplementedError
 
+
 class BoxNotProducable(Exception):
     pass
 
+
 class ShortBoxes(object):
     def __init__(self, optimizer, surviving_boxes, availible_boxes=None):
         self.potential_ops = {}
         if self.availible_boxes is not None and box not in self.availible_boxes:
             raise BoxNotProducable
         self.short_boxes_in_production[box] = None
-        
+
         if box in self.potential_ops:
             ops = self.prioritized_alternatives(box)
             produced_one = False