[pypy-svn] r17052 - in pypy/dist/pypy/rpython: . memory/test

cfbolz at codespeak.net cfbolz at codespeak.net
Mon Aug 29 19:48:08 CEST 2005


Author: cfbolz
Date: Mon Aug 29 19:48:07 2005
New Revision: 17052

Modified:
   pypy/dist/pypy/rpython/llinterp.py
   pypy/dist/pypy/rpython/memory/test/test_address.py
Log:
implement op_raw_free in llinterp + test


Modified: pypy/dist/pypy/rpython/llinterp.py
==============================================================================
--- pypy/dist/pypy/rpython/llinterp.py	(original)
+++ pypy/dist/pypy/rpython/llinterp.py	Mon Aug 29 19:48:07 2005
@@ -449,6 +449,10 @@
         assert self.llt.typeOf(size) == self.llt.Signed
         return lladdress.raw_malloc(size)
 
+    def op_raw_free(self, addr):
+        assert self.llt.typeOf(addr) == lladdress.Address
+        lladdress.raw_free(addr)
+
     def op_raw_load(self, addr, typ, offset):
         assert isinstance(addr, lladdress.address)
         value = getattr(addr, str(typ).lower())[offset]

Modified: pypy/dist/pypy/rpython/memory/test/test_address.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_address.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_address.py	Mon Aug 29 19:48:07 2005
@@ -230,7 +230,9 @@
             addr = raw_malloc(10000)
             same_offset = (addr + 2 * offset - offset) - addr 
             addr.char[offset] = char
-            return (addr + same_offset).char[0]
+            result = (addr + same_offset).char[0]
+            raw_free(addr)
+            return result
         res = interpret(f, [10, "c"])
         assert res == "c"
         res = interpret(f, [12, "x"])
@@ -245,7 +247,7 @@
         assert not res
         res = interpret(f, [0])
         assert res
-        
+
 
 class TestAddressSimulation(object):
     def test_null_is_singleton(self):



More information about the Pypy-commit mailing list