[pypy-svn] r47915 - in pypy/dist/pypy/lang/smalltalk: . test

niko at codespeak.net niko at codespeak.net
Thu Oct 25 14:09:28 CEST 2007


Author: niko
Date: Thu Oct 25 14:09:26 2007
New Revision: 47915

Modified:
   pypy/dist/pypy/lang/smalltalk/constants.py
   pypy/dist/pypy/lang/smalltalk/interpreter.py
   pypy/dist/pypy/lang/smalltalk/primitives.py
   pypy/dist/pypy/lang/smalltalk/test/test_interpreter.py
   pypy/dist/pypy/lang/smalltalk/test/test_miniimage.py
   pypy/dist/pypy/lang/smalltalk/test/test_primitives.py
Log:
(niko, tudor, lukas)
implement value primitive and sketch of a test



Modified: pypy/dist/pypy/lang/smalltalk/constants.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/constants.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/constants.py	Thu Oct 25 14:09:26 2007
@@ -1,8 +1,6 @@
 
 # ___________________________________________________________________________
 # Slot Names
-#
-# n.b. Off by one from SQUEAK!
 
 CHARACTER_VALUE_INDEX = 0        # Page 630 of the blue book
 
@@ -22,10 +20,13 @@
 ASSOCIATION_KEY_INDEX = 0
 ASSOCIATION_VALUE_INDEX = 1
 
-BLOCK_CONTEXT_INSTRUCTION_POINTER_INDEX = 0
-BLOCK_CONTEXT_BLOCK_ARGUMENT_COUNT_INDEX = 2
-BLOCK_CONTEXT_INITIAL_IP_INDEX = 3
-BLOCK_CONTEXT_HOME_INDEX = 4
+BLOCK_CONTEXT_CALLER_INDEX = 0
+BLOCK_CONTEXT_INSTRUCTION_POINTER_INDEX = 1
+BLOCK_CONTEXT_STACK_POINTER_INDEX = 2
+BLOCK_CONTEXT_BLOCK_ARGUMENT_COUNT_INDEX = 3
+BLOCK_CONTEXT_INITIAL_IP_INDEX = 4
+BLOCK_CONTEXT_HOME_INDEX = 5
+BLOCK_CONTEXT_TEMP_FRAME_START = 6
 
 # ----- special objects indices -------
 

Modified: pypy/dist/pypy/lang/smalltalk/interpreter.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/interpreter.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/interpreter.py	Thu Oct 25 14:09:26 2007
@@ -148,14 +148,14 @@
                 self.push(w_result)
                 return
         arguments = self.stack[len(self.stack)-argcount:]
-        interp.activeContext = method.createFrame(receiver, arguments, self)
+        interp.w_active_context = method.createFrame(receiver, arguments, self)
         self.pop_n(argcount + 1)
 
     def _return(self, object, interp):
         if self.sender is None:   # for tests, when returning from the top-level context
             raise ReturnFromTopLevel(object)
         self.sender.push(object)
-        interp.activeContext = self.sender
+        interp.w_active_context = self.sender
 
     def returnReceiver(self, interp):
         self._return(self.receiver, interp)
@@ -410,7 +410,7 @@
     TWO = objtable.w_two
     
     def __init__(self):
-        self.activeContext = None
+        self.w_active_context = None
 
    
     def interpret(self):
@@ -421,9 +421,9 @@
             return e.object
 
     def step(self):
-        next = self.activeContext.getNextBytecode()
+        next = self.w_active_context.getNextBytecode()
         bytecodeimpl = BYTECODE_TABLE[next]
-        bytecodeimpl(self.activeContext, self)
+        bytecodeimpl(self.w_active_context, self)
         
 class ReturnFromTopLevel(Exception):
     def __init__(self, object):

Modified: pypy/dist/pypy/lang/smalltalk/primitives.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/primitives.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/primitives.py	Thu Oct 25 14:09:26 2007
@@ -53,7 +53,7 @@
 def stack(n):
     def decorator(wrapped):
         def result(args):
-            frame = args.interp.activeContext
+            frame = args.interp.w_active_context
             items = frame.stack[len(frame.stack)-n:]
             res = wrapped(args, items)
             frame.pop_n(n)   # only if no exception occurs!
@@ -512,7 +512,7 @@
 @primitive(PRIMITIVE_BLOCK_COPY)
 @stack(2)
 def func(args, (w_argcnt, w_context)):
-    frame = args.interp.activeContext
+    frame = args.interp.w_active_context
 
     # From B.B.: If receiver is a MethodContext, then it becomes
     # the new BlockContext's home context.  Otherwise, the home
@@ -524,7 +524,7 @@
 
     # The block bytecodes are stored inline: so we skip past the
     # byteodes to invoke this primitive to find them (hence +3)
-    w_new_context = classtable.w_BlockContext.new()
+    w_new_context = classtable.w_BlockContext.new(unwrap_int(w_argcnt))
     initialip = frame.pc + 3
 
     # Initialize various fields.
@@ -536,9 +536,32 @@
     
 @primitive(PRIMITIVE_VALUE)
 def func(args):
-    #w_rcvr = args.interp.activeContext.peek(0)
-    #w_argcnt = w_rcvr.fetch(BLOCK_CONTEXT_BLOCK_ARGUMENT_COUNT_INDEX)
-    raise PrimitiveNotYetWrittenError()
+
+    # If nargs == 4, stack looks like:
+    #  3      2       1      0
+    #  Rcvr | Arg 0 | Arg1 | Arg 2
+    #
+    
+    w_block_ctx = args.interp.w_active_context.peek(args.argument_count-1)
+
+    w_exp_arg_cnt = w_block_ctx.fetch(BLOCK_CONTEXT_BLOCK_ARGUMENT_COUNT_INDEX)
+    exp_arg_cnt = unwrap_int(w_exp_arg_cnt)
+    if args.argument_count != exp_arg_cnt:
+        raise PrimitiveFailedError()
+
+    # Copy the values from the stack such that the most recently pushed
+    # item (index 0) ends up in slot BLOCK_CONTEXT_TEMP_FRAME_START + nargs - 1
+    for idx in range(exp_arg_cnt - 1):
+        w_block_ctx.store(
+            BLOCK_CONTEXT_TEMP_FRAME_START+idx,     
+            w_block_ctx.fetch(exp_arg_cnt - idx - 1))
+
+    # Set some fields
+    w_initial_ip = w_block_ctx.fetch(BLOCK_CONTEXT_INITIAL_IP_INDEX)
+    w_block_ctx.store(BLOCK_CONTEXT_INSTRUCTION_POINTER_INDEX, w_initial_ip)
+    w_block_ctx.store(BLOCK_CONTEXT_STACK_POINTER_INDEX, w_exp_arg_cnt)
+    w_block_ctx.store(BLOCK_CONTEXT_CALLER_INDEX, args.interp.w_active_context)
+    args.interp.w_active_context = w_block_ctx
     
 @primitive(PRIMITIVE_VALUE_WITH_ARGS)
 @stack(2)

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	Thu Oct 25 14:09:26 2007
@@ -34,7 +34,7 @@
                                       argsize=2, tempsize=1)
     w_frame = w_method.createFrame(receiver, ["foo", "bar"])
     interp = interpreter.Interpreter()
-    interp.activeContext = w_frame
+    interp.w_active_context = w_frame
     return interp
 
 def test_create_frame():
@@ -53,7 +53,7 @@
 
 def test_push_pop():
     interp = new_interpreter("")
-    frame = interp.activeContext
+    frame = interp.w_active_context
     frame.push(12)
     frame.push(34)
     frame.push(56)
@@ -74,7 +74,7 @@
 def test_pushReceiverBytecode():
     interp = new_interpreter(pushReceiverBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.activeContext.receiver
+    assert interp.w_active_context.top() == interp.w_active_context.receiver
 
 def test_pushReceiverVariableBytecode(bytecode = (pushReceiverVariableBytecode(0) +
                                                   pushReceiverVariableBytecode(1) +
@@ -87,36 +87,36 @@
     interp.step()
     interp.step()
     interp.step()
-    assert interp.activeContext.stack == ["egg", "bar", "baz"]
+    assert interp.w_active_context.stack == ["egg", "bar", "baz"]
 
 def test_pushTemporaryVariableBytecode(bytecode=(pushTemporaryVariableBytecode(0) +
                                                  pushTemporaryVariableBytecode(1) +
                                                  pushTemporaryVariableBytecode(2))):
     interp = new_interpreter(bytecode)
-    interp.activeContext.settemp(2, "temp")
+    interp.w_active_context.settemp(2, "temp")
     interp.step()
     interp.step()
     interp.step()
-    assert interp.activeContext.stack == ["foo", "bar", "temp"]
+    assert interp.w_active_context.stack == ["foo", "bar", "temp"]
 
 def test_pushLiteralConstantBytecode(bytecode=pushLiteralConstantBytecode(0) +
                                               pushLiteralConstantBytecode(1) +
                                               pushLiteralConstantBytecode(2)):
     interp = new_interpreter(bytecode)
-    interp.activeContext.method.literals = fakeliterals("a", "b", "c")
+    interp.w_active_context.method.literals = fakeliterals("a", "b", "c")
     interp.step()
     interp.step()
     interp.step()
-    assert interp.activeContext.stack == ["a", "b", "c"]
+    assert interp.w_active_context.stack == ["a", "b", "c"]
 
 def test_pushLiteralVariableBytecode(bytecode=pushLiteralVariableBytecode(0)):
     w_association = mockclass(2).as_class_get_shadow().new()
     w_association.store(0, "mykey")
     w_association.store(1, "myvalue")
     interp = new_interpreter(bytecode)
-    interp.activeContext.method.literals = fakeliterals(w_association)
+    interp.w_active_context.method.literals = fakeliterals(w_association)
     interp.step()
-    assert interp.activeContext.stack == ["myvalue"]
+    assert interp.w_active_context.stack == ["myvalue"]
 
 def test_storeAndPopReceiverVariableBytecode(bytecode=storeAndPopReceiverVariableBytecode,
                                              popped=True):
@@ -124,13 +124,13 @@
     for index in range(8):
         w_object = shadow.new()
         interp = new_interpreter(pushConstantTrueBytecode + bytecode(index))
-        interp.activeContext.receiver = w_object
+        interp.w_active_context.receiver = w_object
         interp.step()
         interp.step()
         if popped:
-            assert interp.activeContext.stack == []
+            assert interp.w_active_context.stack == []
         else:
-            assert interp.activeContext.stack == [interp.TRUE]
+            assert interp.w_active_context.stack == [interp.TRUE]
 
         for test_index in range(8):
             if test_index == index:
@@ -141,62 +141,62 @@
 def test_storeAndPopTemporaryVariableBytecode(bytecode=storeAndPopTemporaryVariableBytecode):
     for index in range(8):
         interp = new_interpreter(pushConstantTrueBytecode + bytecode(index))
-        interp.activeContext.temps = [None] * 8
+        interp.w_active_context.temps = [None] * 8
         interp.step()
         interp.step()
-        assert interp.activeContext.stack == []
+        assert interp.w_active_context.stack == []
         for test_index in range(8):
             if test_index == index:
-                assert interp.activeContext.temps[test_index] == interp.TRUE
+                assert interp.w_active_context.temps[test_index] == interp.TRUE
             else:
-                assert interp.activeContext.temps[test_index] == None
+                assert interp.w_active_context.temps[test_index] == None
     
 
 def test_pushConstantTrueBytecode():
     interp = new_interpreter(pushConstantTrueBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.TRUE
+    assert interp.w_active_context.top() == interp.TRUE
 
 def test_pushConstantFalseBytecode():
     interp = new_interpreter(pushConstantFalseBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.FALSE
+    assert interp.w_active_context.top() == interp.FALSE
 
 def test_pushConstantNilBytecode():
     interp = new_interpreter(pushConstantNilBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.NIL
+    assert interp.w_active_context.top() == interp.NIL
 
 def test_pushConstantMinusOneBytecode():
     interp = new_interpreter(pushConstantMinusOneBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.MONE
+    assert interp.w_active_context.top() == interp.MONE
 
 def test_pushConstantZeroBytecode():
     interp = new_interpreter(pushConstantZeroBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.ZERO
+    assert interp.w_active_context.top() == interp.ZERO
     
 def test_pushConstantOneBytecode():
     interp = new_interpreter(pushConstantOneBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.ONE
+    assert interp.w_active_context.top() == interp.ONE
 
 def test_pushConstantTwoBytecode():
     interp = new_interpreter(pushConstantTwoBytecode)
     interp.step()
-    assert interp.activeContext.top()
+    assert interp.w_active_context.top()
 
 def test_pushActiveContextBytecode():
     interp = new_interpreter(pushActiveContextBytecode)
     interp.step()
-    assert interp.activeContext.top() == interp.activeContext
+    assert interp.w_active_context.top() == interp.w_active_context
     
 def test_duplicateTopBytecode():
     interp = new_interpreter(pushConstantZeroBytecode + duplicateTopBytecode)
     interp.step()
     interp.step()
-    assert interp.activeContext.stack == [interp.ZERO, interp.ZERO]
+    assert interp.w_active_context.stack == [interp.ZERO, interp.ZERO]
 
 # w_class - the class from which the method is going to be called
 # (and on which it is going to be installed)
@@ -212,19 +212,19 @@
         shadow.installmethod("foo",
              model.W_CompiledMethod(0, pushConstantOneBytecode + bytecode))
         interp = new_interpreter(bytecodes)
-        interp.activeContext.method.literals = fakeliterals("foo")
-        interp.activeContext.push(w_object)
-        callerContext = interp.activeContext
+        interp.w_active_context.method.literals = fakeliterals("foo")
+        interp.w_active_context.push(w_object)
+        callerContext = interp.w_active_context
         interp.step()
-        assert interp.activeContext.sender == callerContext
-        assert interp.activeContext.stack == []
-        assert interp.activeContext.receiver == w_object
-        assert interp.activeContext.method == shadow.methoddict["foo"]
+        assert interp.w_active_context.sender == callerContext
+        assert interp.w_active_context.stack == []
+        assert interp.w_active_context.receiver == w_object
+        assert interp.w_active_context.method == shadow.methoddict["foo"]
         assert callerContext.stack == []
         interp.step()
         interp.step()
-        assert interp.activeContext == callerContext
-        assert interp.activeContext.stack == [result]
+        assert interp.w_active_context == callerContext
+        assert interp.w_active_context.stack == [result]
 
 def test_sendLiteralSelectorBytecode():
     w_class = mockclass(0)
@@ -239,9 +239,9 @@
     shadow.installmethod("fib:", method)
     w_object = shadow.new()
     interp = new_interpreter(sendLiteralSelectorBytecode(16) + returnTopFromMethod)
-    interp.activeContext.method.literals = fakeliterals("fib:")
-    interp.activeContext.push(w_object)
-    interp.activeContext.push(wrap_int(8))
+    interp.w_active_context.method.literals = fakeliterals("fib:")
+    interp.w_active_context.push(w_object)
+    interp.w_active_context.push(wrap_int(8))
     result = interp.interpret()
     assert primitives.unwrap_int(result) == 34
 
@@ -252,72 +252,72 @@
     s_smallintclass.installmethod("sub", prim_meth)
     try:
         interp = new_interpreter(sendLiteralSelectorBytecode(1 + 16))
-        interp.activeContext.method.literals = fakeliterals("foo", "sub")
-        interp.activeContext.push(wrap_int(50))
-        interp.activeContext.push(wrap_int(8))
-        callerContext = interp.activeContext
+        interp.w_active_context.method.literals = fakeliterals("foo", "sub")
+        interp.w_active_context.push(wrap_int(50))
+        interp.w_active_context.push(wrap_int(8))
+        callerContext = interp.w_active_context
         interp.step()
-        assert interp.activeContext is callerContext
-        assert len(interp.activeContext.stack) == 1
-        w_result = interp.activeContext.pop()
+        assert interp.w_active_context is callerContext
+        assert len(interp.w_active_context.stack) == 1
+        w_result = interp.w_active_context.pop()
         assert primitives.unwrap_int(w_result) == 42
     finally:
         del s_smallintclass.methoddict['sub']    # clean up after you
 
 def test_longJumpIfTrue():
     interp = new_interpreter(longJumpIfTrue(0) + chr(15) + longJumpIfTrue(0) + chr(15))
-    interp.activeContext.push(interp.FALSE)
-    pc = interp.activeContext.pc + 2
+    interp.w_active_context.push(interp.FALSE)
+    pc = interp.w_active_context.pc + 2
     interp.step()
-    assert interp.activeContext.pc == pc
-    interp.activeContext.push(interp.TRUE)
-    pc = interp.activeContext.pc + 2
+    assert interp.w_active_context.pc == pc
+    interp.w_active_context.push(interp.TRUE)
+    pc = interp.w_active_context.pc + 2
     interp.step()
-    assert interp.activeContext.pc == pc + 15
+    assert interp.w_active_context.pc == pc + 15
 
 def test_longJumpIfFalse():
     interp = new_interpreter(pushConstantTrueBytecode + longJumpIfFalse(0) + chr(15) +
                              pushConstantFalseBytecode + longJumpIfFalse(0) + chr(15))
     interp.step()
-    pc = interp.activeContext.pc + 2
+    pc = interp.w_active_context.pc + 2
     interp.step()
-    assert interp.activeContext.pc == pc
+    assert interp.w_active_context.pc == pc
     interp.step()
-    pc = interp.activeContext.pc + 2
+    pc = interp.w_active_context.pc + 2
     interp.step()
-    assert interp.activeContext.pc == pc + 15
+    assert interp.w_active_context.pc == pc + 15
 
 def test_longUnconditionalJump():
     interp = new_interpreter(longUnconditionalJump(0) + chr(15))
-    pc = interp.activeContext.pc + 2
+    pc = interp.w_active_context.pc + 2
     interp.step()
-    assert interp.activeContext.pc == pc + 15
+    assert interp.w_active_context.pc == pc + 15
 
 def test_shortUnconditionalJump():
     interp = new_interpreter(chr(145))
-    pc = interp.activeContext.pc + 1
+    pc = interp.w_active_context.pc + 1
     interp.step()
-    assert interp.activeContext.pc == pc + 2
+    assert interp.w_active_context.pc == pc + 2
 
 def test_shortConditionalJump():
     interp = new_interpreter(pushConstantTrueBytecode + shortConditionalJump(3) +
                              pushConstantFalseBytecode + shortConditionalJump(3))
     interp.step()
-    pc = interp.activeContext.pc + 1
+    pc = interp.w_active_context.pc + 1
     interp.step()
-    assert interp.activeContext.pc == pc
+    assert interp.w_active_context.pc == pc
     interp.step()
-    pc = interp.activeContext.pc + 1
+    pc = interp.w_active_context.pc + 1
     interp.step()
-    assert interp.activeContext.pc == pc + 4
+    assert interp.w_active_context.pc == pc + 4
 
 def test_popStackBytecode():
     interp = new_interpreter(pushConstantTrueBytecode +
                              popStackBytecode)
     interp.step()
-    assert interp.activeContext.stack == [interp.TRUE]
+    assert interp.w_active_context.stack == [interp.TRUE]
     interp.step()
-    assert interp.activeContext.stack == []
+    assert interp.w_active_context.stack == []
 
 def test_extendedPushBytecode():
     test_pushReceiverVariableBytecode(extendedPushBytecode + chr((0<<6) + 0) +
@@ -339,7 +339,7 @@
     w_association.store(0, "mykey")
     w_association.store(1, "myvalue")
     interp = new_interpreter(pushConstantOneBytecode + bytecode)
-    interp.activeContext.method.literals = fakeliterals(w_association)
+    interp.w_active_context.method.literals = fakeliterals(w_association)
     interp.step()
     interp.step()
     assert w_association.fetch(1) == interp.ONE
@@ -360,13 +360,13 @@
     shadow = mockclass(0).as_class_get_shadow()
     shadow.installmethod("+", model.W_CompiledMethod(1, "", 1))
     w_object = shadow.new()
-    interp.activeContext.push(w_object)
-    interp.activeContext.push(interp.ONE)
+    interp.w_active_context.push(w_object)
+    interp.w_active_context.push(interp.ONE)
     interp.step()
-    assert interp.activeContext.method == shadow.methoddict["+"]
-    assert interp.activeContext.receiver is w_object
-    assert interp.activeContext.gettemp(0) == interp.ONE
-    assert interp.activeContext.stack == []
+    assert interp.w_active_context.method == shadow.methoddict["+"]
+    assert interp.w_active_context.receiver is w_object
+    assert interp.w_active_context.gettemp(0) == interp.ONE
+    assert interp.w_active_context.stack == []
 
 def test_bytecodePrimBool():
     interp = new_interpreter(bytecodePrimLessThan +
@@ -376,10 +376,10 @@
                              bytecodePrimEqual +
                              bytecodePrimNotEqual)
     for i in range(6):
-        interp.activeContext.push(interp.ONE)
-        interp.activeContext.push(interp.TWO)
+        interp.w_active_context.push(interp.ONE)
+        interp.w_active_context.push(interp.TWO)
         interp.step()
-    assert interp.activeContext.stack == [interp.TRUE, interp.FALSE,
+    assert interp.w_active_context.stack == [interp.TRUE, interp.FALSE,
                                           interp.TRUE, interp.FALSE,
                                           interp.FALSE, interp.TRUE]
 
@@ -406,16 +406,16 @@
     meth1.literals = fakeliterals("foo")
     meth2.literals = fakeliterals("foo")
     interp = new_interpreter(bytecodes)
-    interp.activeContext.method.literals = fakeliterals("foo")
-    interp.activeContext.push(w_object)
+    interp.w_active_context.method.literals = fakeliterals("foo")
+    interp.w_active_context.push(w_object)
     for w_specificclass in [w_class, w_super, w_supersuper]:
-        callerContext = interp.activeContext
+        callerContext = interp.w_active_context
         interp.step()
-        assert interp.activeContext.sender == callerContext
-        assert interp.activeContext.stack == []
-        assert interp.activeContext.receiver == w_object
+        assert interp.w_active_context.sender == callerContext
+        assert interp.w_active_context.stack == []
+        assert interp.w_active_context.receiver == w_object
         meth = w_specificclass.as_class_get_shadow().methoddict["foo"]
-        assert interp.activeContext.method == meth
+        assert interp.w_active_context.method == meth
         assert callerContext.stack == []
 
 def test_secondExtendedSendBytecode():
@@ -446,3 +446,17 @@
     test_storeAndPopReceiverVariableBytecode(lambda index: doubleExtendedDoAnythingBytecode + chr(6<<5) + chr(index))
 
     storeAssociation(doubleExtendedDoAnythingBytecode + chr(7<<5) + chr(0))
+
+def test_block_copy_and_value():
+
+    py.test.skip("waiting for bytecode")
+    
+    bc_3_plus_4 = None
+    bc_x_plus_x_plus_1 = None
+    bc_x_plus_y = None
+    
+    for bcode in [ bc_3_plus_4, bc_x_plus_x_plus_1, bc_x_plus_y ]:
+        interp = new_interpreter(bcode)
+        res = interp.interpret()
+        assert res == wrap_int(7)
+        

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	Thu Oct 25 14:09:26 2007
@@ -186,14 +186,14 @@
 
     assert w_method
     w_frame = w_method.createFrame(w_object, [])
-    interp.activeContext = w_frame
+    interp.w_active_context = w_frame
 
     print w_method
 
     while True:
         try:
             interp.step()
-            print interp.activeContext.stack
+            print interp.w_active_context.stack
         except interpreter.ReturnFromTopLevel, e:
             return e.object
 

Modified: pypy/dist/pypy/lang/smalltalk/test/test_primitives.py
==============================================================================
--- pypy/dist/pypy/lang/smalltalk/test/test_primitives.py	(original)
+++ pypy/dist/pypy/lang/smalltalk/test/test_primitives.py	Thu Oct 25 14:09:26 2007
@@ -26,23 +26,23 @@
     mapped_stack = [wrap(x) for x in stack]
     frame = MockFrame(mapped_stack)
     interp = interpreter.Interpreter()
-    interp.activeContext = frame
+    interp.w_active_context = frame
     return p.Args(interp, len(stack))
 
 def prim(code, stack):
     args = mock(stack)
     res = prim_table[code](args)
-    assert not len(args.interp.activeContext.stack) # check args are consumed
+    assert not len(args.interp.w_active_context.stack) # check args are consumed
     return res
 
 def prim_fails(code, stack):
     args = mock(stack)
-    orig_stack = list(args.interp.activeContext.stack)
+    orig_stack = list(args.interp.w_active_context.stack)
     try:
         prim_table[code](args)
         py.test.fail("Expected PrimitiveFailedError")
     except PrimitiveFailedError:
-        assert args.interp.activeContext.stack == orig_stack
+        assert args.interp.w_active_context.stack == orig_stack
         
 # smallinteger tests
 def test_small_int_add():
@@ -255,3 +255,5 @@
     assert prim(p.FLOAT_EQUAL, [2.2,2.2]) == objtable.w_true
     assert prim(p.FLOAT_NOTEQUAL, [2.2,2.2]) == objtable.w_false
     
+def test_block_copy_and_value():
+    # see test_interpreter for tests of these opcodes



More information about the Pypy-commit mailing list