[pypy-svn] r47862 - pypy/dist/pypy/lang/smalltalk/tool
tverwaes at codespeak.net
tverwaes at codespeak.net
Wed Oct 24 21:16:08 CEST 2007
Author: tverwaes
Date: Wed Oct 24 21:16:07 2007
New Revision: 47862
Modified:
pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py
Log:
trying to get the right bytecode from compiledmethods. committing in
order to be able to switch machine :)
Modified: pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py (original)
+++ pypy/dist/pypy/lang/smalltalk/tool/analyseimage.py Wed Oct 24 21:16:07 2007
@@ -6,9 +6,6 @@
mini_image = py.magic.autopath().dirpath().dirpath().join('mini.image')
-def test_miniimageexists():
- assert mini_image.check(dir=False)
-
def get_miniimage():
return sq.ImageReader(sq.Stream(mini_image.open()))
@@ -26,6 +23,12 @@
if isinstance(each,sqm.W_BytesObject):
print repr(''.join(each.bytes))
+def printReadableBytecode(bytecode):
+ print "\n\nBytecode:\n---------------------"
+ print "\n".join([sqi.BYTECODE_TABLE[ord(i)].__name__ for i in bytecode])
+ print "---------------------\n"
+
+
def testCompiledMethods():
image = create_squeakimage()
amethod = None
@@ -35,7 +38,7 @@
if isinstance(each,sqm.W_CompiledMethod):
if (each.argsize == 0 and amethod == None and
each.tempsize == 0 and
- each.primitive == 1):
+ each.primitive == 0):
if len(each.bytes) == 0:
pass
@@ -56,11 +59,11 @@
w_frame = amethod.createFrame(anObject, [])
interp.activeContext = w_frame
#w_frame.push(interp.TRUE)
- w_frame.push(interp.ONE)
- w_frame.push(interp.TWO)
+ #w_frame.push(interp.ONE)
+ #w_frame.push(interp.TWO)
+
+ printReadableBytecode(amethod.bytes)
- print "Going to execute code: "
- print [ord(i) for i in amethod.bytes]
while True:
try:
interp.step()
@@ -69,10 +72,11 @@
return e.object
# apply to Xth method
-SKIPMETHODS=3 #X
+SKIPMETHODS=42 #X
def test_do():
- testCompiledMethods()
+ #testCompiledMethods()
+ printStringsInImage()
if __name__ == '__main__':
test_do()
More information about the Pypy-commit
mailing list