Author: Tim Felgentreff <[email protected]>
Branch:
Changeset: r49:15f6ac6c1189
Date: 2013-02-18 16:28 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/15f6ac6c1189/
Log: (timfel, cfbolz) add literalsize and tempsize shadowing, those are
needed in contexts as well
diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -539,6 +539,9 @@
def size(self):
return self.headersize() + self.getliteralsize() + len(self.bytes)
+ def gettempsize(self):
+ return self.tempsize
+
def getliteralsize(self):
return self.literalsize * constants.BYTES_PER_WORD
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -714,3 +714,5 @@
self.bytecode = "".join(w_compiledmethod.bytes)
self.literals = w_compiledmethod.literals
self.bytecodeoffset = w_compiledmethod.bytecodeoffset()
+ self.literalsize = w_compiledmethod.getliteralsize()
+ self.tempsize = w_compiledmethod.gettempsize()
diff --git a/spyvm/test/test_shadow.py b/spyvm/test/test_shadow.py
--- a/spyvm/test/test_shadow.py
+++ b/spyvm/test/test_shadow.py
@@ -184,13 +184,15 @@
def test_compiledmethodshadow():
from test_model import joinbits
- header = joinbits([0,2,0,0,0,0],[9,8,1,6,4,1])
+ header = joinbits([0,2,0,1,0,0],[9,8,1,6,4,1])
w_compiledmethod = model.W_CompiledMethod(3, header)
w_compiledmethod.setbytes(list("abc"))
shadow = w_compiledmethod.as_compiledmethod_get_shadow(space)
assert shadow.bytecode == "abc"
assert shadow.bytecodeoffset == 12
+ assert shadow.literalsize == 8 # 12 - 4byte header
+ assert shadow.tempsize == 1
w_compiledmethod.literalatput0(space, 1, 17)
w_compiledmethod.literalatput0(space, 2, 41)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit