Commits

Armin Rigo committed e4d4c3e

More @jit.elidable. The new test in test_misc is still not passing.

Comments (0)

Files changed (3)

pypy/module/pypyjit/test_pypy_c/test_misc.py

 
         log = self.run(main, [300])
         loop, = log.loops_by_id("long_op")
-        assert log.match("""
+        assert loop.match("""
         """)

rpython/rlib/jit.py

     func._jit_look_inside_ = False
     return func
 
+def look_inside(func):
+    """ Make sure the JIT traces inside decorated function, even
+    if the rest of the module is not visible to the JIT
+    """
+    func._jit_look_inside_ = True
+    return func
+
 def unroll_safe(func):
     """ JIT can safely unroll loops in this function and this will
     not lead to code explosion

rpython/rlib/rbigint.py

             
         
     @staticmethod
+    @jit.elidable
     def frombool(b):
-        # This function is marked as pure, so you must not call it and
-        # then modify the result.
+        # You must not call this function and then modify the result.
         if b:
             return ONERBIGINT
         return NULLRBIGINT
         return _decimalstr_to_bigint(s)
 
     @staticmethod
+    @jit.elidable
     def frombytes(s, byteorder, signed):
         if byteorder not in ('big', 'little'):
             raise InvalidEndiannessError()
     def tolonglong(self):
         return _AsLongLong(self)
 
+    @jit.look_inside
     def tobool(self):
         return self.sign != 0
 
+    @jit.elidable
     def touint(self):
         if self.sign == -1:
             raise ValueError("cannot convert negative integer to unsigned int")
             raise ValueError("cannot convert negative integer to unsigned int")
         return _AsULonglong_ignore_sign(self)
 
+    @jit.elidable
     def uintmask(self):
         return _AsUInt_mask(self)
 
+    @jit.elidable
     def ulonglongmask(self):
         """Return r_ulonglong(self), truncating."""
         return _AsULonglong_mask(self)
 
+    @jit.elidable
     def tofloat(self):
         return _AsDouble(self)
 
             i += 1
         return True
 
-    @jit.elidable
+    @jit.look_inside
     def ne(self, other):
         return not self.eq(other)
 
             i -= 1
         return False
 
-    @jit.elidable
+    @jit.look_inside
     def le(self, other):
         return not other.lt(self)
 
-    @jit.elidable
+    @jit.look_inside
     def gt(self, other):
         return other.lt(self)
 
-    @jit.elidable
+    @jit.look_inside
     def ge(self, other):
         return not self.lt(other)
 
             
         return div
 
+    @jit.look_inside
     def div(self, other):
         return self.floordiv(other)
 
             z = z.sub(c)
         return z
 
+    @jit.elidable
     def neg(self):
         return rbigint(self._digits, -self.sign, self.size)
 
+    @jit.elidable
     def abs(self):
         if self.sign != -1:
             return self
         return rbigint(self._digits, 1, self.size)
 
+    @jit.elidable
     def invert(self): #Implement ~x as -(x + 1)
         if self.sign == 0:
             return ONENEGATIVERBIGINT
     def or_(self, other):
         return _bitwise(self, '|', other)
 
+    @jit.elidable
     def oct(self):
         if self.sign == 0:
             return '0L'
         else:
             return _format(self, BASE8, '0', 'L')
 
+    @jit.elidable
     def hex(self):
         return _format(self, BASE16, '0x', 'L')