Commits

Lars Wassermann committed 256cc8a

added the space a w_object is created for to that object
the only exception is W_SmallInteger

Comments (0)

Files changed (11)

spyvm/interpreter.py

         else:
             w_selector = selector
 
-        w_method = model.W_CompiledMethod()
+        w_method = model.W_CompiledMethod(self.space)
         w_method.setbytes([chr(124)]) #returnTopFromMethod
         s_method = w_method.as_compiledmethod_get_shadow(self.space)
         s_frame = MethodContextShadow.make_context(
 class W_Float(W_Object):
     """Boxed float value."""
     _attrs_ = ['value']
+    _immutable_fields_ = ['space']
 
     def fillin_fromwords(self, space, high, low):
         from rpython.rlib.rstruct.ieee import float_unpack
         r = (r_ulonglong(high) << 32) | low
         self.value = float_unpack(r, 8)
 
-    def __init__(self, value):
+    def __init__(self, space, value):
+        self.space = space
         self.value = value
 
     def getclass(self, space):
     """Objects with arbitrary class (ie not CompiledMethod, SmallInteger or
     Float)."""
     _attrs_ = ['w_class', 's_class']
+    _immutable_fields_ = ['space']
     s_class = None
 
-    def __init__(self, w_class):
+    def __init__(self, space, w_class):
         if w_class is not None:     # it's None only for testing and space generation
             assert isinstance(w_class, W_PointersObject)
             if w_class.has_shadow():
                 self.s_class = w_class.as_class_get_shadow(w_class._shadow.space)
         self.w_class = w_class
+        self.space = space
 
     def getclass(self, space):
         assert self.w_class is not None
     _shadow = None # Default value
     
     @jit.unroll_safe
-    def __init__(self, w_class, size):
+    def __init__(self, space, w_class, size):
         """Create new object with size = fixed + variable size."""
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         vars = self._vars = [None] * size
         for i in range(size): # do it by hand for the JIT's sake
             vars[i] = w_nil
         return True
         
     def clone(self, space):
-        w_result = W_PointersObject(self.w_class, len(self._vars))
+        w_result = W_PointersObject(self.space, self.w_class, len(self._vars))
         w_result._vars = [self.fetch(space, i) for i in range(len(self._vars))]
         return w_result
 
 class W_BytesObject(W_AbstractObjectWithClassReference):
     _attrs_ = ['bytes']
 
-    def __init__(self, w_class, size):
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+    def __init__(self, space, w_class, size):
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         assert isinstance(size, int)
         self.bytes = ['\x00'] * size
 
         return self.bytes == other.bytes
 
     def clone(self, space):
-        w_result = W_BytesObject(self.w_class, len(self.bytes))
+        w_result = W_BytesObject(self.space, self.w_class, len(self.bytes))
         w_result.bytes = list(self.bytes)
         return w_result
 
 class W_WordsObject(W_AbstractObjectWithClassReference):
     _attrs_ = ['words']
 
-    def __init__(self, w_class, size):
-        W_AbstractObjectWithClassReference.__init__(self, w_class)
+    def __init__(self, space, w_class, size):
+        W_AbstractObjectWithClassReference.__init__(self, space, w_class)
         self.words = [r_uint(0)] * size
         
     def at0(self, space, index0):
                 isinstance(self.words, list))
 
     def clone(self, space):
-        w_result = W_WordsObject(self.w_class, len(self.words))
+        w_result = W_WordsObject(self.space, self.space, self.w_class, len(self.words))
         w_result.words = list(self.words)
         return w_result
 
     _shadow = None # Default value
     _likely_methodname = "<unknown>"
 
-    def __init__(self, bytecount=0, header=0):
+    def __init__(self, space, bytecount=0, header=0):
         self._shadow = None
         self.setheader(header)
         self.bytes = ["\x00"] * bytecount

spyvm/objspace.py

             w_cinst.store(self, constants.CHARACTER_VALUE_INDEX,
                           model.W_SmallInteger(i))
             return w_cinst
-        w_charactertable = model.W_PointersObject(
+        w_charactertable = model.W_PointersObject(self,
             self.classtable['w_Array'], 256)
         self.w_charactertable = w_charactertable
         for i in range(256):
         self.w_zero = model.W_SmallInteger(0)
         self.w_one = model.W_SmallInteger(1)
         self.w_two = model.W_SmallInteger(2)
-        w_special_selectors = model.W_PointersObject(
+        w_special_selectors = model.W_PointersObject(self,
             self.classtable['w_Array'], len(constants.SPECIAL_SELECTORS) * 2)
         self.w_special_selectors = w_special_selectors
 
         import math
         bytes_len = int(math.log(val) / math.log(0xff)) + 1
         bytes_len = 4 if 4 > bytes_len else bytes_len
-        w_result = model.W_BytesObject(self.classtable['w_LargePositiveInteger'], bytes_len)
+        w_result = model.W_BytesObject(self, self.classtable['w_LargePositiveInteger'], bytes_len)
         for i in range(bytes_len):
             w_result.setchar(i, chr(intmask((val >> i*8) & 255)))
         return w_result
 
     def wrap_float(self, i):
-        return model.W_Float(i)
+        return model.W_Float(self, i)
 
     def wrap_string(self, string):
         w_inst = self.w_String.as_class_get_shadow(self).new(len(string))
 def bootstrap_class(space, instsize, w_superclass=None, w_metaclass=None,
                     name='?', format=shadow.POINTERS, varsized=False):
     from spyvm import model
-    w_class = model.W_PointersObject(w_metaclass, 0)
+    w_class = model.W_PointersObject(space, w_metaclass, 0)
                                              # a dummy placeholder for testing
     # XXX
     s = instantiate(shadow.ClassShadow)

spyvm/primitives.py

 @expose_primitive(NEW_METHOD, unwrap_spec=[object, int, int])
 def func(interp, s_frame, w_class, bytecount, header):
     # We ignore w_class because W_CompiledMethod is special
-    w_method = model.W_CompiledMethod(bytecount, header)
+    w_method = model.W_CompiledMethod(interp.space, bytecount, header)
     return w_method
 
 # ___________________________________________________________________________
     def new(self, extrasize=0):
         w_cls = self.w_self()
         if self.instance_kind == POINTERS:
-            w_new = model.W_PointersObject(w_cls, self.instsize()+extrasize)
+            w_new = model.W_PointersObject(self.space, w_cls, self.instsize()+extrasize)
         elif self.instance_kind == WORDS:
-            w_new = model.W_WordsObject(w_cls, extrasize)
+            w_new = model.W_WordsObject(self.space, w_cls, extrasize)
         elif self.instance_kind == BYTES:
-            w_new = model.W_BytesObject(w_cls, extrasize)
+            w_new = model.W_BytesObject(self.space, w_cls, extrasize)
         elif self.instance_kind == COMPILED_METHOD:
-            w_new = model.W_CompiledMethod(extrasize)
+            w_new = model.W_CompiledMethod(self.space, extrasize)
         else:
             raise NotImplementedError(self.instance_kind)
         return w_new
     def initialize_methoddict(self):
         "NOT_RPYTHON"     # this is only for testing.
         if self._s_methoddict is None:
-            w_methoddict = model.W_PointersObject(None, 2)
-            w_methoddict._store(1, model.W_PointersObject(None, 0))
+            w_methoddict = model.W_PointersObject(self.space, None, 2)
+            w_methoddict._store(1, model.W_PointersObject(self.space, None, 0))
             self._s_methoddict = w_methoddict.as_methoddict_get_shadow(self.space)
             self.s_methoddict().sync_cache()
         self.s_methoddict().invalid = False
         # into the right places in the W_PointersObject
         # XXX could hack some more to never have to create the _vars of w_result
         contextsize = w_home.as_methodcontext_get_shadow(space).myblocksize()
-        w_result = model.W_PointersObject(space.w_BlockContext, contextsize)
+        w_result = model.W_PointersObject(space, space.w_BlockContext, contextsize)
         s_result = BlockContextShadow(space, w_result)
         s_result_non_fresh = s_result # XXX: find a better solution to translation err
         s_result = jit.hint(s_result, access_directly=True, fresh_virtualizable=True)

spyvm/squeakimage.py

                 self.w_object = objectmodel.instantiate(model.W_CompiledMethod)
             else:
                 assert 0, "not reachable"
+        self.w_object.space = self.space
         return self.w_object
 
     def fillin_w_object(self):

spyvm/test/test_interpreter.py

     # Install faked compiled methods that just invoke the primitive:
     for (w_class, primnum, argsize, methname) in methods:
         s_class = w_class.as_class_get_shadow(space)
-        prim_meth = model.W_CompiledMethod(0)
+        prim_meth = model.W_CompiledMethod(space, 0)
         prim_meth.primitive = primnum
         prim_meth.argsize = argsize
         symbol = fakesymbol(methname)
 
 def new_frame(bytes, receiver=space.w_nil, space=space):
     assert isinstance(bytes, str)
-    w_method = model.W_CompiledMethod(len(bytes))
+    w_method = model.W_CompiledMethod(space, len(bytes))
     w_method.islarge = 1
     w_method.bytes = bytes
     w_method.argsize=2
     w_method.tempsize=8
-    w_method.setliterals([model.W_PointersObject(None, 2)])
+    w_method.setliterals([model.W_PointersObject(space, None, 2)])
     s_frame = w_method.as_compiledmethod_get_shadow(space).create_frame(space, receiver, ["foo", "bar"])
     return s_frame.w_self(), s_frame
 
 def test_create_frame():
-    w_method = model.W_CompiledMethod(len("hello"))
+    w_method = model.W_CompiledMethod(space, len("hello"))
     w_method.bytes="hello"
     w_method.islarge = 1
     w_method.argsize=2
           (returnNil, space.w_nil),
           (returnTopFromMethod, space.w_one) ]:
         shadow = w_class.as_class_get_shadow(space)
-        w_method = model.W_CompiledMethod(2)
+        w_method = model.W_CompiledMethod(space, 2)
         w_method.bytes = pushConstantOneBytecode + bytecode
         literals = fakeliterals(space, "foo")
         w_foo = literals[0]
 def test_fibWithArgument():
     bytecode = ''.join(map(chr, [ 16, 119, 178, 154, 118, 164, 11, 112, 16, 118, 177, 224, 112, 16, 119, 177, 224, 176, 124 ]))
     shadow = mockclass(space, 0).as_class_get_shadow(space)
-    method = model.W_CompiledMethod(len(bytecode))
+    method = model.W_CompiledMethod(space, len(bytecode))
     method.literalsize = 1
     method.bytes = bytecode
     method.argsize = 1
 def test_callPrimitiveAndPush_fallback():
     w_frame, s_frame = new_frame(bytecodePrimAdd)
     shadow = mockclass(space, 0).as_class_get_shadow(space)
-    w_method = model.W_CompiledMethod(0)
+    w_method = model.W_CompiledMethod(space, 0)
     w_method.argsize = 1
     w_method.tempsize = 1
     w_method.literalsize = 1
     # first call method installed in w_class
     bytecodes = singleExtendedSendBytecode + chr(0)
     # which does a call to its super
-    meth1 = model.W_CompiledMethod(2)
+    meth1 = model.W_CompiledMethod(space, 2)
     meth1.bytes = pushReceiverBytecode + bytecode
     literals = fakeliterals(space, "foo")
     foo = literals[0]
     meth1.setliterals(literals)
     w_class.as_class_get_shadow(space).installmethod(foo, meth1)
     # and that one again to its super
-    meth2 = model.W_CompiledMethod(2)
+    meth2 = model.W_CompiledMethod(space, 2)
     meth2.bytes = pushReceiverBytecode + bytecode
     meth2.setliterals(fakeliterals(space, foo))
     w_super.as_class_get_shadow(space).installmethod(foo, meth2)
-    meth3 = model.W_CompiledMethod(0)
+    meth3 = model.W_CompiledMethod(space, 0)
     w_supersuper.as_class_get_shadow(space).installmethod(foo, meth3)
     w_frame, s_frame = new_frame(bytecodes)
     s_frame.w_method().setliterals(literals)
     #   ^ self objectAt: 2.          yields the first literal (22)
     #   ^ 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(header=1024)
+    prim_meth = model.W_CompiledMethod(space, header=1024)
     prim_meth.setliterals(fakeliterals(space, 22))
     oal = fakeliterals(space, "objectAt:")
     oalp = fakeliterals(space, "objectAt:put:", 3)
         0x00, 0x11, 0x10, 0x75, 0xb6, 0x9a, 0x75, 0xa4, 0x09, 0x8c, 0x00, 0x01, 
         0x10, 0x76, 0xb1, 0xca, 0x10, 0xb0, 0x7d, 0x8e, 0x00, 0x00, 0x8c, 0x00, 
         0x00, 0x20, 0xca, 0x7c]))
-    w_method = model.W_CompiledMethod(len(bytes))
+    w_method = model.W_CompiledMethod(space, len(bytes))
     w_method.islarge = 1
     w_method.bytes = bytes
     w_method.argsize=0
         0x10, 0x76, 0xb1, 0xca, 0x10, 0xb0, 0x7d, 0x8e, 0x00, 0x00, 0x8c, 0x00,
         0x00, 0x20, 0xca, 0x7c]))
 
-    w_method = model.W_CompiledMethod(len(bytes))
+    w_method = model.W_CompiledMethod(space, len(bytes))
     w_method.islarge = 1
     w_method.bytes = bytes
     w_method.argsize=0

spyvm/test/test_model.py

     w_super = mockclass(space, 0)
     w_class = mockclass(space, 0, w_superclass=w_super)
     supershadow = w_super.as_class_get_shadow(space)
-    supershadow.installmethod(w_foo, model.W_CompiledMethod(0))
+    supershadow.installmethod(w_foo, model.W_CompiledMethod(space, 0))
     classshadow = w_class.as_class_get_shadow(space)
     classshadow.initialize_methoddict()
     assert classshadow.lookup(w_foo).w_compiledin is w_super
 
 def test_compiledmethod_setchar():
-    w_method = model.W_CompiledMethod(3)
+    w_method = model.W_CompiledMethod(space, 3)
     w_method.setchar(0, "c")
     assert w_method.bytes == list("c\x00\x00")
 
     assert h1 == w_inst.hash
 
 def test_compiledmethod_at0():
-    w_method = model.W_CompiledMethod()
+    w_method = model.W_CompiledMethod(space)
     w_method.bytes = list("abc")
     w_method.header = 100
     w_method.setliterals(['lit1', 'lit2'])
     assert space.unwrap_int(w_method.at0(space, 14)) == ord('c')
 
 def test_compiledmethod_atput0():
-    w_method = model.W_CompiledMethod(3)
+    w_method = model.W_CompiledMethod(space, 3)
     newheader = joinbits([0,2,0,0,0,0],[9,8,1,6,4,1])
     assert w_method.getliteralsize() == 0
     w_method.atput0(space, 0, space.wrap_int(newheader))
 
 def test_compiledmethod_atput0_not_aligned():
     header = joinbits([0,2,0,0,0,0],[9,8,1,6,4,1])
-    w_method = model.W_CompiledMethod(3, header)
+    w_method = model.W_CompiledMethod(space, 3, header)
     with py.test.raises(error.PrimitiveFailedError):
         w_method.atput0(space, 7, 'lit1')
     with py.test.raises(error.PrimitiveFailedError):
         w_method.atput0(space, 9, space.wrap_int(5))
 
-def test_is_same_object(w_o1=model.W_PointersObject(None,0), w_o2=None):
+def test_is_same_object(w_o1=model.W_PointersObject(space, None,0), w_o2=None):
     if w_o2 is None:
         w_o2 = w_o1
     assert w_o1.is_same_object(w_o2)
     assert w_o2.is_same_object(w_o1)
     
-def test_not_is_same_object(w_o1=model.W_PointersObject(None,0),w_o2=model.W_PointersObject(None,0)):
+def test_not_is_same_object(w_o1=model.W_PointersObject(space, None,0),w_o2=model.W_PointersObject(space, None,0)):
     assert not w_o1.is_same_object(w_o2)
     assert not w_o2.is_same_object(w_o1)
     w_o2 = model.W_SmallInteger(2)
     assert not w_o1.is_same_object(w_o2)
     assert not w_o2.is_same_object(w_o1)
-    w_o2 = model.W_Float(5.5)
+    w_o2 = model.W_Float(space, 5.5)
     assert not w_o1.is_same_object(w_o2)
     assert not w_o2.is_same_object(w_o1)
 
 def test_intfloat_is_same_object():
     test_is_same_object(model.W_SmallInteger(1), model.W_SmallInteger(1))
     test_is_same_object(model.W_SmallInteger(100), model.W_SmallInteger(100))
-    test_is_same_object(model.W_Float(1.100), model.W_Float(1.100))
+    test_is_same_object(model.W_Float(space, 1.100), model.W_Float(space, 1.100))
 
 def test_intfloat_notis_same_object():
-    test_not_is_same_object(model.W_SmallInteger(1), model.W_Float(1))
-    test_not_is_same_object(model.W_Float(100), model.W_SmallInteger(100))
-    test_not_is_same_object(model.W_Float(1.100), model.W_Float(1.200))
+    test_not_is_same_object(model.W_SmallInteger(1), model.W_Float(space, 1))
+    test_not_is_same_object(model.W_Float(space, 100), model.W_SmallInteger(100))
+    test_not_is_same_object(model.W_Float(space, 1.100), model.W_Float(space, 1.200))
     test_not_is_same_object(model.W_SmallInteger(101), model.W_SmallInteger(100))
 
 def test_charis_same_object():
 
 def test_word_atput():
     i = model.W_SmallInteger(100)
-    b = model.W_WordsObject(None, 1)
+    b = model.W_WordsObject(space, None, 1)
     b.atput0(space, 0, i)
     assert 100 == b.getword(0)
     i = space.classtable['w_LargePositiveInteger'].as_class_get_shadow(space).new(4)
     assert b.getword(0) == 3221225472
 
 def test_word_at():
-    b = model.W_WordsObject(None, 1)
+    b = model.W_WordsObject(space, None, 1)
     b.setword(0, 100)
     r = b.at0(space, 0)
     assert isinstance(r, model.W_SmallInteger)
     assert r.size() == 4
 
 def test_float_at():
-    b = model.W_Float(64.0)
+    b = model.W_Float(space, 64.0)
     r = b.fetch(space, 0)
     assert isinstance(r, model.W_BytesObject)
     assert r.size() == 4
     assert r.value == 0
 
 def test_float_at_put():
-    target = model.W_Float(1.0)
+    target = model.W_Float(space, 1.0)
     for f in [1.0, -1.0, 1.1, 64.4, -0.0, float('nan'), float('inf')]:
-        source = model.W_Float(f)
+        source = model.W_Float(space, f)
         target.store(space, 0, source.fetch(space, 0))
         target.store(space, 1, source.fetch(space, 1))
         if math.isnan(f):

spyvm/test/test_primitives.py

 def test_size_of_compiled_method():
     literalsize = 3
     bytecount = 3
-    w_cm = model.W_CompiledMethod(bytecount)
+    w_cm = model.W_CompiledMethod(space, bytecount)
     w_cm.literalsize = literalsize
     assert prim(primitives.SIZE, [w_cm]).value == (literalsize+1)*constants.BYTES_PER_WORD + bytecount
 

spyvm/test/test_shadow.py

                                                w_Metaclass)
     w_methoddict = build_methoddict(methods)
     size = constants.CLASS_NAME_INDEX + 1
-    w_class = model.W_PointersObject(w_classofclass, size)
+    w_class = model.W_PointersObject(space, w_classofclass, size)
     w_class.store(space, constants.CLASS_SUPERCLASS_INDEX, w_superclass)
     w_class.store(space, constants.CLASS_METHODDICT_INDEX, w_methoddict)
     w_class.store(space, constants.CLASS_FORMAT_INDEX, space.wrap_int(format))
     yield basicshape, "CompiledMeth", 0xE02,   shadow.COMPILED_METHOD, True, 0
 
 def test_methoddict():
-    methods = {'foo': model.W_CompiledMethod(0),
-               'bar': model.W_CompiledMethod(0)}
+    methods = {'foo': model.W_CompiledMethod(space, 0),
+               'bar': model.W_CompiledMethod(space, 0)}
     w_class = build_smalltalk_class("Demo", 0x90, methods=methods)
     classshadow = w_class.as_class_get_shadow(space)
     methoddict = classshadow.s_methoddict().methoddict
         assert methods[w_key.as_string()].as_compiledmethod_get_shadow(space) is value
 
 def method(tempsize=3,argsize=2, bytes="abcde"):
-    w_m = model.W_CompiledMethod()
+    w_m = model.W_CompiledMethod(space)
     w_m.bytes = bytes
     w_m.tempsize = tempsize
     w_m.argsize = argsize
 
 def methodcontext(w_sender=space.w_nil, pc=1, stackpointer=0, stacksize=5,
                   method=method()):
-    w_object = model.W_PointersObject(space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+method.tempsize+stacksize)
+    w_object = model.W_PointersObject(space, space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+method.tempsize+stacksize)
     w_object.store(space, constants.CTXPART_SENDER_INDEX, w_sender)
     w_object.store(space, constants.CTXPART_PC_INDEX, space.wrap_int(pc))
     w_object.store(space, constants.CTXPART_STACKP_INDEX, space.wrap_int(method.tempsize+stackpointer))
 
 def blockcontext(w_sender=space.w_nil, pc=1, stackpointer=1, stacksize=5,
                   home=methodcontext()):
-    w_object = model.W_PointersObject(space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+stacksize)
+    w_object = model.W_PointersObject(space, space.w_MethodContext, constants.MTHDCTX_TEMP_FRAME_START+stacksize)
     w_object.store(space, constants.CTXPART_SENDER_INDEX, w_sender)
     w_object.store(space, constants.CTXPART_PC_INDEX, space.wrap_int(pc))
     w_object.store(space, constants.CTXPART_STACKP_INDEX, space.wrap_int(stackpointer))
     from test_model import joinbits
     header = joinbits([0,2,0,1,0,0],[9,8,1,6,4,1])
 
-    w_compiledmethod = model.W_CompiledMethod(3, header)
+    w_compiledmethod = model.W_CompiledMethod(space, 3, header)
     w_compiledmethod.setbytes(list("abc"))
     shadow = w_compiledmethod.as_compiledmethod_get_shadow(space)
     assert shadow.bytecode == "abc"
 
 def test_cached_methoddict():
     # create a methoddict
-    foo = model.W_CompiledMethod(0)
-    bar = model.W_CompiledMethod(0)
-    baz = model.W_CompiledMethod(0)
+    foo = model.W_CompiledMethod(space, 0)
+    bar = model.W_CompiledMethod(space, 0)
+    baz = model.W_CompiledMethod(space, 0)
     methods = {'foo': foo,
                'bar': bar}
     w_class = build_smalltalk_class("Demo", 0x90, methods=methods)
     i = 0
     key = s_methoddict.w_self()._fetch(constants.METHODDICT_NAMES_INDEX+i)
     while key is space.w_nil:
+        i = i + 1
         key = s_methoddict.w_self()._fetch(constants.METHODDICT_NAMES_INDEX+i)
-        i = i + 1
 
     assert (s_class.lookup(key) is foo.as_compiledmethod_get_shadow(space)
             or s_class.lookup(key) is bar.as_compiledmethod_get_shadow(space))
     w_array = s_class.w_methoddict()._fetch(constants.METHODDICT_VALUES_INDEX)
     version = s_class.version
     w_array.atput0(space, i, baz)
-
     assert s_class.lookup(key) is baz.as_compiledmethod_get_shadow(space)
     assert version is not s_class.version
 
 def test_updating_class_changes_subclasses():
     w_parent = build_smalltalk_class("Demo", 0x90,
-            methods={'bar': model.W_CompiledMethod(0)})
+            methods={'bar': model.W_CompiledMethod(space, 0)})
     w_class = build_smalltalk_class("Demo", 0x90,
-            methods={'foo': model.W_CompiledMethod(0)}, w_superclass=w_parent)
+            methods={'foo': model.W_CompiledMethod(space, 0)}, w_superclass=w_parent)
     s_class = w_class.as_class_get_shadow(space)
     version = s_class.version
 
-    w_method = model.W_CompiledMethod(0)
+    w_method = model.W_CompiledMethod(space, 0)
     key = space.wrap_string('foo')
 
     s_md = w_parent.as_class_get_shadow(space).s_methoddict()

spyvm/test/test_wrapper.py

     return new_frame_tuple("")[0]
 
 def test_simpleread():
-    w_o = model.W_PointersObject(None, 2)
+    w_o = model.W_PointersObject(space, None, 2)
     w = wrapper.Wrapper(space, w_o)
     w_o._vars[0] = "hello"
     assert w.read(0) == "hello"
     py.test.raises(WrapperException, "w.write(2, \"test\")")
 
 def test_accessor_generators():
-    w_o = model.W_PointersObject(None, 1)
+    w_o = model.W_PointersObject(space, None, 1)
     w = wrapper.LinkWrapper(space, w_o)
     w_o._vars[0] = "hello"
     assert w.next_link() == "hello"
     assert w.next_link() == "boe"
 
 def link(w_next='foo'):
-    w_object = model.W_PointersObject(None, 1)
+    w_object = model.W_PointersObject(space, None, 1)
     wrapper.LinkWrapper(space, w_object).store_next_link(w_next)
     return w_object
 
 def test_linked_list():
-    w_object = model.W_PointersObject(None,2)
+    w_object = model.W_PointersObject(space, None,2)
     w_last = link(space.w_nil)
     w_lb1 = link(w_last)
     w_lb2 = link(w_lb1)
                 w_suspended_context=space.w_nil,
                 priority=0):
     w_priority = space.wrap_int(priority)
-    w_process = model.W_PointersObject(None, 4)
+    w_process = model.W_PointersObject(space, None, 4)
     process = wrapper.ProcessWrapper(space, w_process)
     process.store_next_link(w_next)
     process.store_my_list(w_my_list)
     return process
 
 def new_processlist(processes_w=[]):
-    w_processlist = model.W_PointersObject(None, 2)
+    w_processlist = model.W_PointersObject(space, None, 2)
     w_first = space.w_nil
     w_last = space.w_nil
     for w_process in processes_w[::-1]:
     else:
         maxpriority = 5
         prioritydict = {}
-    w_prioritylist = model.W_PointersObject(None, maxpriority)
+    w_prioritylist = model.W_PointersObject(space, None, maxpriority)
     prioritylist = wrapper.Wrapper(space, w_prioritylist)
     for i in range(maxpriority):
         prioritylist.write(i, new_processlist(prioritydict.get(i, []))._w_self)
 
 def new_scheduler(w_process=space.w_nil, prioritydict=None):
     priority_list = new_prioritylist(prioritydict)
-    w_scheduler = model.W_PointersObject(None, 2)
+    w_scheduler = model.W_PointersObject(space, None, 2)
     scheduler = wrapper.SchedulerWrapper(space, w_scheduler)
     scheduler.store_active_process(w_process)
     scheduler.write(0, priority_list._w_self)
     return scheduler
 
 def new_semaphore(excess_signals=0):
-    w_semaphore = model.W_PointersObject(None, 3)
+    w_semaphore = model.W_PointersObject(space, None, 3)
     semaphore = wrapper.SemaphoreWrapper(space, w_semaphore)
     semaphore.store_excess_signals(excess_signals)
     return semaphore