[pypy-svn] r15962 - in pypy/dist/pypy: annotation rpython/memory rpython/memory/test
cfbolz at codespeak.net
cfbolz at codespeak.net
Thu Aug 11 16:01:11 CEST 2005
Author: cfbolz
Date: Thu Aug 11 16:01:10 2005
New Revision: 15962
Modified:
pypy/dist/pypy/annotation/bookkeeper.py
pypy/dist/pypy/annotation/model.py
pypy/dist/pypy/rpython/memory/convertlltype.py
pypy/dist/pypy/rpython/memory/lladdress.py
pypy/dist/pypy/rpython/memory/test/test_address.py
Log:
renaming Address to address to have a naming scheme that is similar to
that of lltype: Address will be the lltype that describes addresses.
Modified: pypy/dist/pypy/annotation/bookkeeper.py
==============================================================================
--- pypy/dist/pypy/annotation/bookkeeper.py (original)
+++ pypy/dist/pypy/annotation/bookkeeper.py Thu Aug 11 16:01:10 2005
@@ -339,7 +339,7 @@
result = SomeBuiltin(BUILTIN_ANALYZERS[x], methodname="%s.%s" % (x.__module__, x.__name__))
elif isinstance(x, lltype._ptr):
result = SomePtr(lltype.typeOf(x))
- elif isinstance(x, lladdress.Address):
+ elif isinstance(x, lladdress.address):
assert x is lladdress.NULL
result= SomeAddress(is_null=True)
elif callable(x) or isinstance(x, staticmethod): # XXX
Modified: pypy/dist/pypy/annotation/model.py
==============================================================================
--- pypy/dist/pypy/annotation/model.py (original)
+++ pypy/dist/pypy/annotation/model.py Thu Aug 11 16:01:10 2005
@@ -462,15 +462,15 @@
return False
def lltype_or_address_to_annotation(T):
- from pypy.rpython.memory.lladdress import Address
- if T is Address:
+ from pypy.rpython.memory.lladdress import address
+ if T is address:
return SomeAddress()
return lltype_to_annotation(T)
def annotation_to_lltype_or_address(s_ann):
- from pypy.rpython.memory.lladdress import Address
+ from pypy.rpython.memory.lladdress import address
if isinstance(s_ann, SomeAddress):
- return Address
+ return address
else:
return annotation_to_lltype(s_ann)
Modified: pypy/dist/pypy/rpython/memory/convertlltype.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/convertlltype.py (original)
+++ pypy/dist/pypy/rpython/memory/convertlltype.py Thu Aug 11 16:01:10 2005
@@ -97,7 +97,7 @@
addr = self.convert(_ptr._obj)
else:
addr = lladdress.NULL
- assert isinstance(addr, lladdress.Address)
+ assert isinstance(addr, lladdress.address)
if inline_to_addr is not None:
inline_to_addr.address[0] = addr
return simulatorptr(TYPE, addr)
Modified: pypy/dist/pypy/rpython/memory/lladdress.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/lladdress.py (original)
+++ pypy/dist/pypy/rpython/memory/lladdress.py Thu Aug 11 16:01:10 2005
@@ -4,7 +4,7 @@
from pypy.rpython.rarithmetic import r_uint
-class Address(object):
+class address(object):
def __new__(cls, intaddress=0):
if intaddress == 0:
null = cls.__dict__.get("NULL")
@@ -23,11 +23,11 @@
def __add__(self, offset):
assert isinstance(offset, int)
- return Address(self.intaddress + offset)
+ return address(self.intaddress + offset)
def __sub__(self, other):
if isinstance(other, int):
- return Address(self.intaddress - other)
+ return address(self.intaddress - other)
else:
return self.intaddress - other.intaddress
@@ -76,20 +76,20 @@
class _address_accessor(_accessor):
format = "P"
size = struct.calcsize("P")
- convert_from = Address
- convert_to = Address._getintattr
+ convert_from = address
+ convert_to = address._getintattr
-Address.signed = property(_signed_accessor)
-Address.unsigned = property(_unsigned_accessor)
-Address.char = property(_char_accessor)
-Address.address = property(_address_accessor)
+address.signed = property(_signed_accessor)
+address.unsigned = property(_unsigned_accessor)
+address.char = property(_char_accessor)
+address.address = property(_address_accessor)
-NULL = Address()
+NULL = address()
simulator = MemorySimulator()
def raw_malloc(size):
- return Address(simulator.malloc(size))
+ return address(simulator.malloc(size))
def raw_free(addr):
simulator.free(addr.intaddress)
@@ -98,7 +98,7 @@
simulator.memcopy(addr1.intaddress, addr2.intaddress, size)
def get_address_of_object(obj):
- return Address(simulator.get_address_of_object(obj))
+ return address(simulator.get_address_of_object(obj))
def get_py_object(address):
return simulator.get_py_object(address.intaddress)
@@ -107,6 +107,6 @@
supported_access_types = {"signed": lltype.Signed,
"unsigned": lltype.Unsigned,
"char": lltype.Char,
- "address": Address,
+ "address": address,
}
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 Thu Aug 11 16:01:10 2005
@@ -4,7 +4,7 @@
from pypy.annotation import model as annmodel
from pypy.translator.annrpython import RPythonAnnotator
from pypy.objspace.flow import FlowObjSpace
-from pypy.rpython.memory.lladdress import Address, NULL
+from pypy.rpython.memory.lladdress import address, NULL
from pypy.rpython.memory.lladdress import raw_malloc, raw_free, raw_memcopy
from pypy.rpython.memory.lladdress import get_py_object, get_address_of_object
from pypy.rpython.memory.simulator import MemorySimulatorError
@@ -110,8 +110,8 @@
class TestAddressSimulation(object):
def test_null_is_singleton(self):
- assert Address() is NULL
- assert Address() is Address(0)
+ assert address() is NULL
+ assert address() is address(0)
def test_memory_access(self):
addr = raw_malloc(1000)
More information about the Pypy-commit
mailing list