Armin Rigo  committed b90ea3b

Trying out some more _immutable_ hints, some using
quasi-immutable fields.

  • Participants
  • Parent commits b4acd9a
  • Branches out-of-line-guards-2

Comments (0)

Files changed (4)

File pypy/interpreter/

     and an arbitrary 'closure' passed to the code object."""
     can_change_code = True
-    _immutable_fields_ = ['defs?[*]']
+    _immutable_fields_ = ['code?',
+                          'w_func_globals?',
+                          'closure?',
+                          'defs?[*]']
     def __init__(self, space, code, w_globals=None, defs_w=[], closure=None,
 class Method(Wrappable):
     """A method is a function bound to a specific instance or class."""
+    _immutable_fields_ = ['w_function', 'w_instance', 'w_class']
     def __init__(self, space, w_function, w_instance, w_class): = space

File pypy/interpreter/

 class GeneratorIterator(Wrappable):
     "An iterator created by a generator."
+    _immutable_fields_ = ['pycode']
     def __init__(self, frame): =

File pypy/interpreter/

                 WHY_CONTINUE,   SContinueLoop
                 WHY_YIELD       not needed
+    _immutable_ = True
     def nomoreblocks(self):
         raise BytecodeCorruption("misplaced bytecode - should not return")
 class SReturnValue(SuspendedUnroller):
     """Signals a 'return' statement.
     Argument is the wrapped object to return."""
+    _immutable_ = True
     kind = 0x01
     def __init__(self, w_returnvalue):
         self.w_returnvalue = w_returnvalue
 class SApplicationException(SuspendedUnroller):
     """Signals an application-level exception
     (i.e. an OperationException)."""
+    _immutable_ = True
     kind = 0x02
     def __init__(self, operr):
         self.operr = operr
 class SBreakLoop(SuspendedUnroller):
     """Signals a 'break' statement."""
+    _immutable_ = True
     kind = 0x04
     def state_unpack_variables(self, space):
 class SContinueLoop(SuspendedUnroller):
     """Signals a 'continue' statement.
     Argument is the bytecode position of the beginning of the loop."""
+    _immutable_ = True
     kind = 0x08
     def __init__(self, jump_to):
         self.jump_to = jump_to

File pypy/interpreter/

 from pypy.interpreter.baseobjspace import Wrappable
 class Ellipsis(Wrappable):
+    _immutable_ = True
     def __init__(self, space): = space 
     def descr__repr__(self):
 class NotImplemented(Wrappable): 
+    _immutable_ = True
     def __init__(self, space): = space 
     def descr__repr__(self):