Author: Tim Felgentreff <[email protected]>
Branch: 
Changeset: r45:420d5621ee9e
Date: 2013-02-18 16:56 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/420d5621ee9e/

Log:    (timfel, cfbolz) immutability and promotes for method shadows

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -451,6 +451,7 @@
         bytecodes  (variable)
     """
 
+    _immutable_fields_ = ["_shadow?"]
 ### Extension from Squeak 3.9 doc, which we do not implement:
 ###        trailer (variable)
 ###    The trailer has two variant formats.  In the first variant, the last
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -445,9 +445,10 @@
         return self.s_home().w_method()
 
     def method(self):
-        methodshadow = self.w_method().as_compiledmethod_get_shadow(self.space)
-        jit.promote(methodshadow)
-        return methodshadow
+        w_method = jit.promote(self.w_method())
+        return jit.promote(
+            w_method.as_compiledmethod_get_shadow(self.space)
+        )
 
     def getbytecode(self):
         jit.promote(self._pc)
@@ -714,8 +715,9 @@
 
 
 class CompiledMethodShadow(object):
+    _immutable_fields_ = ["bytecode", "literals[*]", "bytecodeoffset", 
"literalsize", "tempsize"]
+
     def __init__(self, w_compiledmethod):
-        self.w_compiledmethod = w_compiledmethod
         self.bytecode = "".join(w_compiledmethod.bytes)
         self.literals = w_compiledmethod.literals
         self.bytecodeoffset = w_compiledmethod.bytecodeoffset()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to