[pypy-svn] r48199 - in pypy/dist/pypy/lang/smalltalk: . test
arigo at codespeak.net
arigo at codespeak.net
Tue Oct 30 14:49:52 CET 2007
Author: arigo
Date: Tue Oct 30 14:49:52 2007
New Revision: 48199
Modified:
pypy/dist/pypy/lang/smalltalk/model.py
pypy/dist/pypy/lang/smalltalk/squeakimage.py
pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py
Log:
Remove tabs.
Modified: pypy/dist/pypy/lang/smalltalk/model.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/model.py (original)
+++ pypy/dist/pypy/lang/smalltalk/model.py Tue Oct 30 14:49:52 2007
@@ -263,20 +263,20 @@
The current format of a CompiledMethod is as follows:
- header (4 bytes)
- literals (4 bytes each)
- bytecodes (variable)
- trailer (variable)
+ header (4 bytes)
+ literals (4 bytes each)
+ bytecodes (variable)
+ trailer (variable)
The header is a 30-bit integer with the following format:
- (index 0) 9 bits: main part of primitive number (#primitive)
- (index 9) 8 bits: number of literals (#numLiterals)
- (index 17) 1 bit: whether a large frame size is needed (#frameSize)
- (index 18) 6 bits: number of temporary variables (#numTemps)
- (index 24) 4 bits: number of arguments to the method (#numArgs)
- (index 28) 1 bit: high-bit of primitive number (#primitive)
- (index 29) 1 bit: flag bit, ignored by the VM (#flag)
+ (index 0) 9 bits: main part of primitive number (#primitive)
+ (index 9) 8 bits: number of literals (#numLiterals)
+ (index 17) 1 bit: whether a large frame size is needed (#frameSize)
+ (index 18) 6 bits: number of temporary variables (#numTemps)
+ (index 24) 4 bits: number of arguments to the method (#numArgs)
+ (index 28) 1 bit: high-bit of primitive number (#primitive)
+ (index 29) 1 bit: flag bit, ignored by the VM (#flag)
The trailer has two variant formats. In the first variant, the last byte is at least 252 and the last four bytes represent a source pointer into one of the sources files (see #sourcePointer). In the second variant, the last byte is less than 252, and the last several bytes are a compressed version of the names of the method's temporary variables. The number of bytes used for this purpose is the value of the last byte in the method.
"""
Modified: pypy/dist/pypy/lang/smalltalk/squeakimage.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/squeakimage.py (original)
+++ pypy/dist/pypy/lang/smalltalk/squeakimage.py Tue Oct 30 14:49:52 2007
@@ -358,13 +358,13 @@
def fillin_compiledmethod(self, w_compiledmethod):
header = self.chunk.data[0]
#---!!!---- 1 tagged pointer!
- #(index 0) 9 bits: main part of primitive number (#primitive)
- #(index 9) 8 bits: number of literals (#numLiterals)
- #(index 17) 1 bit: whether a large frame size is needed (#frameSize)
- #(index 18) 6 bits: number of temporary variables (#numTemps)
- #(index 24) 4 bits: number of arguments to the method (#numArgs)
- #(index 28) 1 bit: high-bit of primitive number (#primitive)
- #(index 29) 1 bit: flag bit, ignored by the VM (#flag)
+ #(index 0) 9 bits: main part of primitive number (#primitive)
+ #(index 9) 8 bits: number of literals (#numLiterals)
+ #(index 17) 1 bit: whether a large frame size is needed (#frameSize)
+ #(index 18) 6 bits: number of temporary variables (#numTemps)
+ #(index 24) 4 bits: number of arguments to the method (#numArgs)
+ #(index 28) 1 bit: high-bit of primitive number (#primitive)
+ #(index 29) 1 bit: flag bit, ignored by the VM (#flag)
_, primitive, literalsize, islarge, tempsize, numargs, highbit = (
splitter[1,9,8,1,6,4,1](header))
primitive = primitive + (highbit << 10) ##XXX todo, check this
Modified: pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py (original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py Tue Oct 30 14:49:52 2007
@@ -619,10 +619,10 @@
# tests: bytecodePrimValue & bytecodePrimValueWithArg
def test_bc_3_plus_4():
# value0
- # " (self >> #value0) byteCode "
- # " (self >> #value0) literals "
+ # " (self >> #value0) byteCode "
+ # " (self >> #value0) literals "
#
- # ^ [ 3 + 4 ] value
+ # ^ [ 3 + 4 ] value
assert interpret_bc(
[ 137, 117, 200, 164, 4, 32, 33, 176, 125, 201, 124],
fakeliterals(wrap_int(3), wrap_int(4))).value == 7
@@ -630,10 +630,10 @@
def test_bc_x_plus_x_plus_1():
# value1
- # " (self >> #value1) byteCode "
- # " (self >> #value1) literals "
+ # " (self >> #value1) byteCode "
+ # " (self >> #value1) literals "
#
- # ^ [ :x | x + x + 1 ] value: 3
+ # ^ [ :x | x + x + 1 ] value: 3
assert interpret_bc(
[ 137, 118, 200, 164, 7, 104, 16, 16,
176, 118, 176, 125, 32, 202, 124 ],
@@ -641,10 +641,10 @@
def test_bc_x_plus_y():
# value2
- # " (self >> #value2) byteCode "
- # " (self >> #value2) literals "
+ # " (self >> #value2) byteCode "
+ # " (self >> #value2) literals "
#
- # ^ [ :x :y | x + y ] value: 3 value: 4
+ # ^ [ :x :y | x + y ] value: 3 value: 4
def test():
assert interpret_bc(
@@ -658,30 +658,30 @@
def test_bc_push_rcvr_in_block():
# value1
- # " (self >> #value1) byteCode "
- # " (self >> #value1) literals "
+ # " (self >> #value1) byteCode "
+ # " (self >> #value1) literals "
#
- # ^ [ self ] value
+ # ^ [ self ] value
assert interpret_bc(
[ 137, 117, 200, 164, 2, 112, 125, 201, 124 ],
fakeliterals(wrap_int(3))) is objtable.w_nil
def test_bc_value_return():
# valueReturn
- # " (self >> #value1) byteCode "
- # " (self >> #value1) literals "
+ # " (self >> #value1) byteCode "
+ # " (self >> #value1) literals "
#
- # [ ^ 1 ] value. ^ 2
+ # [ ^ 1 ] value. ^ 2
assert interpret_bc(
[ 137, 117, 200, 164, 2, 118, 124, 201, 135, 119, 124 ],
fakeliterals()).value == 1
def test_bc_value_with_args():
# valueWithArgs
- # " (self >> #value1) byteCode "
- # " (self >> #value1) literals "
+ # " (self >> #value1) byteCode "
+ # " (self >> #value1) literals "
#
- # [ :a :b | a - b ] valueWithArguments: #(3 2)
+ # [ :a :b | a - b ] valueWithArguments: #(3 2)
def test():
assert interpret_bc(
[ 137, 119, 200, 164, 6,
@@ -695,7 +695,7 @@
test)
def test_bc_primBytecodeAt_string():
- # ^ 'a' at: 1
+ # ^ 'a' at: 1
def test():
assert interpret_bc(
[ 32, 118, 192, 124],
@@ -705,7 +705,7 @@
test)
def test_bc_primBytecodeAtPut_string():
- # ^ 'a' at: 1 put:'b'
+ # ^ 'a' at: 1 put:'b'
def test():
assert interpret_bc(
[ 32, 118, 33, 193, 124 ],
@@ -715,7 +715,7 @@
test)
def test_bc_primBytecodeAt_with_instvars():
- # ^ self at: 1
+ # ^ self at: 1
w_fakeclass = mockclass(1, name='fakeclass', varsized=True)
w_fakeinst = w_fakeclass.as_class_get_shadow().new(1)
w_fakeinst.store(0, wrap_char("a")) # static slot 0: instance variable
@@ -730,7 +730,7 @@
test)
def test_bc_primBytecodeAtPut_with_instvars():
- # ^ self at: 1 put: #b
+ # ^ self at: 1 put: #b
w_fakeclass = mockclass(1, name='fakeclass', varsized=True)
w_fakeinst = w_fakeclass.as_class_get_shadow().new(1)
w_fakeinst.store(0, wrap_char("a")) # static slot 0: instance variable
@@ -749,7 +749,7 @@
def test_bc_objectAtAndAtPut():
# ^ self objectAt: 1. yields the method header
# ^ self objectAt: 2. yields the first literal (22)
- # ^ self objectAt: 2 put: 3. changes the first literal to 3
+ # ^ self objectAt: 2 put: 3. changes the first literal to 3
# ^ self objectAt: 2. yields the new first literal (3)
prim_meth = model.W_CompiledMethod(0, "")
prim_meth.literals = fakeliterals(22)
Modified: pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py (original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py Tue Oct 30 14:49:52 2007
@@ -229,8 +229,8 @@
py.test.skip("not quite yet")
sourcecode = """fib
^self < 2
- ifTrue: [ 1 ]
- ifFalse: [ (self - 1) fib + (self - 2) fib ]"""
+ ifTrue: [ 1 ]
+ ifFalse: [ (self - 1) fib + (self - 2) fib ]"""
perform(w(10).getclass(), "compile:classified:notifying:", w(sourcecode), w('pypy'), w(None))
assert perform(w(10), "fib") == w(89)
More information about the Pypy-commit
mailing list