[pypy-commit] lang-smalltalk storage: Fixed tests (except test_strategies.py which is not functional).

anton_gulenko noreply at buildbot.pypy.org
Tue Mar 25 15:35:28 CET 2014


Author: Anton Gulenko <anton.gulenko at googlemail.com>
Branch: storage
Changeset: r696:fdf0149a0aae
Date: 2014-03-25 15:35 +0100
http://bitbucket.org/pypy/lang-smalltalk/changeset/fdf0149a0aae/

Log:	Fixed tests (except test_strategies.py which is not functional).
	Added BootstrappedObjSpace in util.py for tests.

diff --git a/spyvm/model.py b/spyvm/model.py
--- a/spyvm/model.py
+++ b/spyvm/model.py
@@ -439,7 +439,7 @@
         return self.w_class
 
     def __str__(self):
-        if isinstance(self, W_PointersObject) and self.has_shadow():
+        if isinstance(self, W_PointersObject) and self.has_shadow() and self.shadow.has_getname:
             return self._get_shadow().getname()
         else:
             name = None
@@ -627,7 +627,7 @@
     def as_context_get_shadow(self, space):
         from spyvm.shadow import ContextPartShadow
         # XXX TODO should figure out itself if its method or block context
-        if self._get_shadow() is None:
+        if not isinstance(self.shadow, ContextPartShadow):
             if ContextPartShadow.is_block_context(self, space):
                 return self.as_blockcontext_get_shadow(space)
             return self.as_methodcontext_get_shadow(space)
diff --git a/spyvm/plugins/bitblt.py b/spyvm/plugins/bitblt.py
--- a/spyvm/plugins/bitblt.py
+++ b/spyvm/plugins/bitblt.py
@@ -53,7 +53,7 @@
         MaskTable.append(r_uint((2 ** (i + 1)) - 1))
     AllOnes = r_uint(0xFFFFFFFF)
 
-    def sync_cache(self):
+    def attach_shadow(self):
         pass
 
     def intOrIfNil(self, w_int, i):
@@ -734,7 +734,7 @@
     def intOrIfNil(self, w_int, i):
         return intOrIfNil(self.space, w_int, i)
 
-    def sync_cache(self):
+    def attach_shadow(self):
         self.invalid = True
         if self.size() < 5:
             return
@@ -756,8 +756,8 @@
         w_offset = self.fetch(4)
         assert isinstance(w_offset, model.W_PointersObject)
         if not w_offset is self.space.w_nil:
-            self.offsetX = self.intOrIfNil(w_offset._fetch(self.space, 0), 0)
-            self.offsetY = self.intOrIfNil(w_offset._fetch(self.space, 1), 0)
+            self.offsetX = self.intOrIfNil(w_offset.fetch(self.space, 0), 0)
+            self.offsetY = self.intOrIfNil(w_offset.fetch(self.space, 1), 0)
         self.pixPerWord = 32 / self.depth
         self.pitch = (self.width + (self.pixPerWord - 1)) / self.pixPerWord | 0
         if self.w_bits.size() < (self.pitch * self.height):
diff --git a/spyvm/shadow.py b/spyvm/shadow.py
--- a/spyvm/shadow.py
+++ b/spyvm/shadow.py
@@ -11,7 +11,8 @@
     can be attached at run-time to any Smalltalk object.
     """
     _attrs_ = ['_w_self', 'space']
-
+    has_getname = True
+    
     def __init__(self, space, w_self):
         self.space = space
         self._w_self = w_self
@@ -40,6 +41,7 @@
 
 class ListStorageShadow(AbstractShadow):
     _attrs_ = ['storage']
+    has_getname = False
     
     def __init__(self, space, w_self, size):
         AbstractShadow.__init__(self, space, w_self)
@@ -60,6 +62,7 @@
 
 class WeakListStorageShadow(AbstractShadow):
     _attrs_ = ['storage']
+    has_getname = False
     
     def __init__(self, space, w_self, size):
         AbstractShadow.__init__(self, space, w_self)
@@ -79,6 +82,7 @@
     _attrs_ = ['version']
     import_from_mixin(version.VersionMixin)
     version = None
+    has_getname = True
     
     def __init__(self, space, w_self):
         ListStorageShadow.__init__(self, space, w_self, 0)
@@ -337,7 +341,7 @@
         "NOT_RPYTHON"     # this is only for testing.
         if self._s_methoddict is None:
             w_methoddict = model.W_PointersObject(self.space, None, 2)
-            w_methoddict._store(self.space, 1, model.W_PointersObject(self.space, None, 0))
+            w_methoddict.store(self.space, 1, model.W_PointersObject(self.space, None, 0))
             self._s_methoddict = w_methoddict.as_methoddict_get_shadow(self.space)
             self.s_methoddict().sync_method_cache()
         self.s_methoddict().invalid = False
@@ -450,6 +454,12 @@
         AbstractRedirectingShadow.__init__(self, space, w_self)
         self.instances_w = {}
 
+    def copy_field_from(self, n0, other_shadow):
+        try:
+            AbstractRedirectingShadow.copy_field_from(self, n0, other_shadow)
+        except error.SenderChainManipulation, e:
+            assert e.s_context == self
+        
     def copy_from(self, other_shadow):
         # Some fields have to be initialized before the rest, to ensure correct initialization.
         privileged_fields = self.fields_to_copy_first()
@@ -463,6 +473,9 @@
             if n0 not in privileged_fields:
                 self.copy_field_from(n0, other_shadow)
         
+    def fields_to_copy_first(self):
+        return []
+        
     @staticmethod
     def is_block_context(w_pointers, space):
         method_or_argc = w_pointers.fetch(space, constants.MTHDCTX_METHOD)
diff --git a/spyvm/test/jit.py b/spyvm/test/jit.py
--- a/spyvm/test/jit.py
+++ b/spyvm/test/jit.py
@@ -13,15 +13,12 @@
 
 from rpython.jit.metainterp.test.test_ajit import LLJitMixin
 
-
+from .util import bootstrap_class
 from spyvm import model, interpreter, primitives, shadow
 from spyvm import objspace, squeakimage
 from spyvm.tool.analyseimage import create_squeakimage, create_testimage
 from rpython.rlib.streamio import open_file_as_stream
 
-
-mockclass = objspace.bootstrap_class
-
 space = objspace.ObjSpace()
 
 # expose the bytecode's values as global constants.
diff --git a/spyvm/test/test_bitblt.py b/spyvm/test/test_bitblt.py
--- a/spyvm/test/test_bitblt.py
+++ b/spyvm/test/test_bitblt.py
@@ -1,7 +1,8 @@
 from spyvm import model, shadow, constants, interpreter, objspace
 from spyvm.plugins import bitblt
+from .util import BootstrappedObjSpace
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 # copy from test_miniimage
 def w(any):
diff --git a/spyvm/test/test_bootstrappedimage.py b/spyvm/test/test_bootstrappedimage.py
--- a/spyvm/test/test_bootstrappedimage.py
+++ b/spyvm/test/test_bootstrappedimage.py
@@ -1,6 +1,6 @@
 import py
 from spyvm import squeakimage, model, constants
-from spyvm import interpreter, shadow, objspace
+from spyvm import interpreter, shadow
 from spyvm.test import test_miniimage as tools
 from spyvm.test.test_miniimage import perform, w
 
@@ -10,7 +10,7 @@
 
 def find_symbol_in_methoddict_of(string, s_class):
     s_methoddict = s_class.s_methoddict()
-    s_methoddict.sync_cache()
+    s_methoddict.sync_method_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
         if each.as_string() == string:
diff --git a/spyvm/test/test_interpreter.py b/spyvm/test/test_interpreter.py
--- a/spyvm/test/test_interpreter.py
+++ b/spyvm/test/test_interpreter.py
@@ -1,13 +1,15 @@
 import py
+from .util import bootstrap_class as _bootstrap_class
 from spyvm import model, interpreter, primitives, shadow
 from spyvm import objspace, wrapper, constants
+from .util import BootstrappedObjSpace
 
-def mockclass(space, instsize, w_superclass=None, w_metaclass=None,
+def bootstrap_class(space, instsize, w_superclass=None, w_metaclass=None,
                     name='?', format=shadow.POINTERS, varsized=True):
-    return objspace.bootstrap_class(space, instsize, w_superclass, w_metaclass,
+    return _bootstrap_class(space, instsize, w_superclass, w_metaclass,
                     name, format, varsized)
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 interp = interpreter.Interpreter(space)
 def step_in_interp(ctxt): # due to missing resets in between tests
     interp._loop = False
@@ -56,16 +58,12 @@
             space.w_special_selectors.atput0(space, index, symbol)
             assert space.get_special_selector(methname) is symbol
         s_class.installmethod(symbol, prim_meth)
-
-        assert space.w_nil.shadow is None
     try:
         func(active_context) if active_context else func()
     finally:
         # Uninstall those methods:
-        assert space.w_nil.shadow is None
         for (w_class, _, _, methname) in methods:
             s_class = w_class.as_class_get_shadow(space)
-            s_class.update()
             s_class.s_methoddict().update()
 
 def fakesymbol(s, _cache={}):
@@ -147,7 +145,7 @@
 def test_pushReceiverVariableBytecode(bytecode = (pushReceiverVariableBytecode(0) +
                                                   pushReceiverVariableBytecode(1) +
                                                   pushReceiverVariableBytecode(2))):
-    w_demo = mockclass(space, 3).as_class_get_shadow(space).new()
+    w_demo = bootstrap_class(space, 3).as_class_get_shadow(space).new()
     w_demo.store(space, 0, "egg")
     w_demo.store(space, 1, "bar")
     w_demo.store(space, 2, "baz")
@@ -182,7 +180,7 @@
                                              fakesymbol("c")]
 
 def test_pushLiteralVariableBytecode(bytecode=pushLiteralVariableBytecode(0)):
-    w_association = mockclass(space, 2).as_class_get_shadow(space).new()
+    w_association = bootstrap_class(space, 2).as_class_get_shadow(space).new()
     w_association.store(space, 0, "mykey")
     w_association.store(space, 1, "myvalue")
     w_frame, s_frame = new_frame(bytecode)
@@ -192,7 +190,7 @@
 
 def test_storeAndPopReceiverVariableBytecode(bytecode=storeAndPopReceiverVariableBytecode,
                                              popped=True):
-    shadow = mockclass(space, 8).as_class_get_shadow(space)
+    shadow = bootstrap_class(space, 8).as_class_get_shadow(space)
     for index in range(8):
         w_object = shadow.new()
         w_frame, s_frame = new_frame(pushConstantTrueBytecode + bytecode(index))
@@ -365,8 +363,8 @@
     assert s_frame.stack() == []
 
 def test_bytecodePrimNew():
-    w_fakeclassclass = mockclass(space, 10, name='fakeclassclass')
-    w_fakeclass = mockclass(space, 1, name='fakeclass', varsized=False,
+    w_fakeclassclass = bootstrap_class(space, 10, name='fakeclassclass')
+    w_fakeclass = bootstrap_class(space, 1, name='fakeclass', varsized=False,
                             w_metaclass=w_fakeclassclass)
     w_frame, s_frame = new_frame(bytecodePrimNew)
     s_frame.push(w_fakeclass)
@@ -380,8 +378,8 @@
     assert w_fakeinst.size() == 1
 
 def test_bytecodePrimNewWithArg():
-    w_fakeclassclass = mockclass(space, 10, name='fakeclassclass')
-    w_fakeclass = mockclass(space, 1, name='fakeclass', varsized=True,
+    w_fakeclassclass = bootstrap_class(space, 10, name='fakeclassclass')
+    w_fakeclass = bootstrap_class(space, 1, name='fakeclass', varsized=True,
                             w_metaclass=w_fakeclassclass)
     w_frame, s_frame = new_frame(bytecodePrimNewWithArg)
     s_frame.push(w_fakeclass)
@@ -396,7 +394,7 @@
     assert w_fakeinst.size() == 3
 
 def test_bytecodePrimSize():
-    w_fakeclass = mockclass(space, 2, name='fakeclass', varsized=True)
+    w_fakeclass = bootstrap_class(space, 2, name='fakeclass', varsized=True)
     w_fakeinst = w_fakeclass.as_class_get_shadow(space).new(5)
     w_frame, s_frame = new_frame(bytecodePrimSize)
     s_frame.push(w_fakeinst)
@@ -440,13 +438,13 @@
         assert s_active_context.stack() == [result]
 
 def test_sendLiteralSelectorBytecode():
-    w_class = mockclass(space, 0)
+    w_class = bootstrap_class(space, 0)
     w_object = w_class.as_class_get_shadow(space).new()
     sendBytecodesTest(w_class, w_object, sendLiteralSelectorBytecode(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)
+    shadow = bootstrap_class(space, 0).as_class_get_shadow(space)
     method = model.W_CompiledMethod(len(bytecode))
     method.literalsize = 1
     method.bytes = bytecode
@@ -565,7 +563,7 @@
     test_pushLiteralVariableBytecode(extendedPushBytecode + chr((3<<6) + 0))
 
 def storeAssociation(bytecode):
-    w_association = mockclass(space, 2).as_class_get_shadow(space).new()
+    w_association = bootstrap_class(space, 2).as_class_get_shadow(space).new()
     w_association.store(space, 0, "mykey")
     w_association.store(space, 1, "myvalue")
     w_frame, s_frame = new_frame(pushConstantOneBytecode + bytecode)
@@ -587,7 +585,7 @@
 
 def test_callPrimitiveAndPush_fallback():
     w_frame, s_frame = new_frame(bytecodePrimAdd)
-    shadow = mockclass(space, 0).as_class_get_shadow(space)
+    shadow = bootstrap_class(space, 0).as_class_get_shadow(space)
     w_method = model.W_CompiledMethod(0)
     w_method.argsize = 1
     w_method.tempsize = 1
@@ -623,14 +621,14 @@
                                           space.w_false, space.w_true]
 
 def test_singleExtendedSendBytecode():
-    w_class = mockclass(space, 0)
+    w_class = bootstrap_class(space, 0)
     w_object = w_class.as_class_get_shadow(space).new()
     sendBytecodesTest(w_class, w_object, singleExtendedSendBytecode + chr((0<<5)+0))
 
 def test_singleExtendedSuperBytecode(bytecode=singleExtendedSuperBytecode + chr((0<<5) + 0)):
-    w_supersuper = mockclass(space, 0)
-    w_super = mockclass(space, 0, w_superclass=w_supersuper)
-    w_class = mockclass(space, 0, w_superclass=w_super)
+    w_supersuper = bootstrap_class(space, 0)
+    w_super = bootstrap_class(space, 0, w_superclass=w_supersuper)
+    w_class = bootstrap_class(space, 0, w_superclass=w_super)
     w_object = w_class.as_class_get_shadow(space).new()
     # first call method installed in w_class
     bytecodes = singleExtendedSendBytecode + chr(0)
@@ -667,12 +665,12 @@
         assert s_caller_context.stack() == []
 
 def test_secondExtendedSendBytecode():
-    w_class = mockclass(space, 0)
+    w_class = bootstrap_class(space, 0)
     w_object = w_class.as_class_get_shadow(space).new()
     sendBytecodesTest(w_class, w_object, secondExtendedSendBytecode + chr(0))
 
 def test_doubleExtendedDoAnythinBytecode():
-    w_class = mockclass(space, 0)
+    w_class = bootstrap_class(space, 0)
     w_object = w_class.as_class_get_shadow(space).new()
 
     sendBytecodesTest(w_class, w_object, doubleExtendedDoAnythingBytecode + chr((0<<5) + 0) + chr(0))
@@ -802,7 +800,7 @@
 
 def test_bc_primBytecodeAt_with_instvars():
     #   ^ self at: 1
-    w_fakeclass = mockclass(space, 1, name='fakeclass', varsized=True)
+    w_fakeclass = bootstrap_class(space, 1, name='fakeclass', varsized=True)
     w_fakeinst = w_fakeclass.as_class_get_shadow(space).new(1)
     w_fakeinst.store(space, 0, space.wrap_char("a")) # static slot 0: instance variable
     w_fakeinst.store(space, 1, space.wrap_char("b")) # varying slot 1
@@ -817,7 +815,7 @@
 
 def test_bc_primBytecodeAtPut_with_instvars():
     #   ^ self at: 1 put: #b
-    w_fakeclass = mockclass(space, 1, name='fakeclass', varsized=True)
+    w_fakeclass = bootstrap_class(space, 1, name='fakeclass', varsized=True)
     w_fakeinst = w_fakeclass.as_class_get_shadow(space).new(1)
     w_fakeinst.store(space, 0, space.wrap_char("a")) # static slot 0: instance variable
     w_fakeinst.store(space, 1, space.wrap_char("a")) # varying slot 1
diff --git a/spyvm/test/test_largeinteger.py b/spyvm/test/test_largeinteger.py
--- a/spyvm/test/test_largeinteger.py
+++ b/spyvm/test/test_largeinteger.py
@@ -1,7 +1,7 @@
 import py
 import operator
 from spyvm import squeakimage, model, constants, error
-from spyvm import interpreter, shadow, objspace, primitives
+from spyvm import interpreter, shadow, primitives
 from spyvm.test import test_miniimage as tools
 from spyvm.test.test_miniimage import perform, w
 from spyvm.test.test_primitives import MockFrame
@@ -10,10 +10,9 @@
 
 space, interp = tools.setup_module(tools, filename='bootstrapped.image')
 
-
 def find_symbol_in_methoddict_of(string, s_class):
     s_methoddict = s_class.s_methoddict()
-    s_methoddict.sync_cache()
+    s_methoddict.sync_method_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
         if each.as_string() == string:
@@ -30,7 +29,7 @@
     initialize_class(w("string").getclass(tools.space))
 
 def perform_primitive(rcvr, w_selector, *args):
-    code = rcvr.getclass(space).shadow.lookup(w_selector).primitive()
+    code = rcvr.class_shadow(space).lookup(w_selector).primitive()
     assert code
     func = primitives.prim_holder.prim_table[code]
     s_frame = MockFrame([rcvr] + list(args)).as_context_get_shadow(space)
diff --git a/spyvm/test/test_miniimage.py b/spyvm/test/test_miniimage.py
--- a/spyvm/test/test_miniimage.py
+++ b/spyvm/test/test_miniimage.py
@@ -2,16 +2,12 @@
 #       NOT relying on order of methods
 #       using setup_module(module) now
 import py
-from spyvm import squeakimage
-from spyvm import model
-from spyvm import constants
-from spyvm import interpreter
-from spyvm import shadow
-from spyvm import objspace
+from spyvm import squeakimage, model, constants, interpreter, shadow, objspace
+from .util import BootstrappedObjSpace
 # lazy initialization of test data, ie ImageReader and Float class
 
 def setup_module(module, filename='mini.image'):
-    space = objspace.ObjSpace()
+    space = BootstrappedObjSpace()
     from spyvm.tool.analyseimage import image_dir
     module.mini_image = image_dir.join(filename)
     module.reader = open_miniimage(space)
@@ -113,27 +109,21 @@
     assert str(w0) == "a ProcessorScheduler"
 
 def test_special_classes0():
+    def test_classname(so_index, expected_name):
+        obj = image.special(so_index)
+        obj.as_class_get_shadow(space)
+        assert str(obj) == expected_name
     image = get_image()
     # w = image.special(constants.SO_BITMAP_CLASS)
     # assert str(w) == "Bitmap class"
-    w = image.special(constants.SO_SMALLINTEGER_CLASS)
-    assert str(w) == "SmallInteger class"
-    w = image.special(constants.SO_STRING_CLASS)
-    assert str(w) == "String class"
-    w = image.special(constants.SO_ARRAY_CLASS)
-    assert str(w) == "Array class"
-    w = image.special(constants.SO_FLOAT_CLASS)
-    assert str(w) == "Float class"
-    w = image.special(constants.SO_METHODCONTEXT_CLASS)
-    assert str(w) == "MethodContext class"
-    w = image.special(constants.SO_BLOCKCONTEXT_CLASS)
-    assert str(w) == "BlockContext class"
-    w = image.special(constants.SO_POINT_CLASS)
-    assert str(w) == "Point class"
-    w = image.special(constants.SO_LARGEPOSITIVEINTEGER_CLASS)
-    assert str(w) == "LargePositiveInteger class"
-    w = image.special(constants.SO_MESSAGE_CLASS)
-    assert str(w) == "Message class"
+    test_classname(constants.SO_SMALLINTEGER_CLASS, "SmallInteger class")
+    test_classname(constants.SO_ARRAY_CLASS, "Array class")
+    test_classname(constants.SO_FLOAT_CLASS, "Float class")
+    test_classname(constants.SO_METHODCONTEXT_CLASS, "MethodContext class")
+    test_classname(constants.SO_BLOCKCONTEXT_CLASS, "BlockContext class")
+    test_classname(constants.SO_POINT_CLASS, "Point class")
+    test_classname(constants.SO_LARGEPOSITIVEINTEGER_CLASS, "LargePositiveInteger class")
+    test_classname(constants.SO_MESSAGE_CLASS, "Message class")
 
     # to be continued
 
@@ -406,7 +396,7 @@
     from spyvm import primitives
     w_o = space.wrap_list([1, 2, 3])
     w_methoddict = w_o.class_shadow(space)._s_superclass._s_superclass.w_methoddict()
-    w_methoddict.as_methoddict_get_shadow(space).sync_cache()
+    w_methoddict.as_methoddict_get_shadow(space).sync_method_cache()
     selectors_w = w_methoddict.shadow.methoddict.keys()
     w_sel = None
     for sel in selectors_w:
diff --git a/spyvm/test/test_model.py b/spyvm/test/test_model.py
--- a/spyvm/test/test_model.py
+++ b/spyvm/test/test_model.py
@@ -1,14 +1,13 @@
 import py
 import math
 import socket
+from .util import bootstrap_class, BootstrappedObjSpace
 from spyvm import model, shadow
 from spyvm.shadow import MethodNotFound
 from spyvm import objspace, error, display
 from rpython.rlib.rarithmetic import intmask, r_uint
 
-mockclass = objspace.bootstrap_class
-
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 w_foo = space.wrap_string("foo")
 w_bar = space.wrap_string("bar")
 
@@ -21,14 +20,14 @@
 
 
 def test_new():
-    w_mycls = mockclass(space, 0)
+    w_mycls = bootstrap_class(space, 0)
     w_myinstance = w_mycls.as_class_get_shadow(space).new()
     assert isinstance(w_myinstance, model.W_PointersObject)
     assert w_myinstance.getclass(space).is_same_object(w_mycls)
     assert w_myinstance.class_shadow(space) is w_mycls.as_class_get_shadow(space)
 
 def test_new_namedvars():
-    w_mycls = mockclass(space, 3)
+    w_mycls = bootstrap_class(space, 3)
     w_myinstance = w_mycls.as_class_get_shadow(space).new()
     assert isinstance(w_myinstance, model.W_PointersObject)
     assert w_myinstance.getclass(space).is_same_object(w_mycls)
@@ -38,7 +37,7 @@
     assert w_myinstance.fetch(space, 1) is w_myinstance
 
 def test_bytes_object():
-    w_class = mockclass(space, 0, format=shadow.BYTES)
+    w_class = bootstrap_class(space, 0, format=shadow.BYTES)
     w_bytes = w_class.as_class_get_shadow(space).new(20)
     assert w_bytes.getclass(space).is_same_object(w_class)
     assert w_bytes.size() == 20
@@ -50,7 +49,7 @@
     py.test.raises(IndexError, lambda: w_bytes.getchar(20))
 
 def test_c_bytes_object():
-    w_class = mockclass(space, 0, format=shadow.BYTES)
+    w_class = bootstrap_class(space, 0, format=shadow.BYTES)
     w_bytes = w_class.as_class_get_shadow(space).new(20)
     w_bytes.convert_to_c_layout()
     assert w_bytes.getclass(space).is_same_object(w_class)
@@ -63,7 +62,7 @@
     py.test.raises(IndexError, lambda: w_bytes.getchar(20))
 
 def test_word_object():
-    w_class = mockclass(space, 0, format=shadow.WORDS)
+    w_class = bootstrap_class(space, 0, format=shadow.WORDS)
     w_bytes = w_class.as_class_get_shadow(space).new(20)
     assert w_bytes.getclass(space).is_same_object(w_class)
     assert w_bytes.size() == 20
@@ -75,7 +74,7 @@
     py.test.raises(AssertionError, lambda: w_bytes.getword(20))
 
 def test_c_word_object():
-    w_class = mockclass(space, 0, format=shadow.WORDS)
+    w_class = bootstrap_class(space, 0, format=shadow.WORDS)
     w_bytes = w_class.as_class_get_shadow(space).new(20)
     w_bytes.convert_to_c_layout()
     assert w_bytes.getclass(space).is_same_object(w_class)
@@ -93,11 +92,11 @@
             self.val = val
         def as_compiledmethod_get_shadow(self, space):
             return self.val
-    w_class = mockclass(space, mockmethod(0))
+    w_class = bootstrap_class(space, mockmethod(0))
     shadow = w_class.as_class_get_shadow(space)
     shadow.installmethod(w_foo, mockmethod(1))
     shadow.installmethod(w_bar, mockmethod(2))
-    w_subclass = mockclass(space, 0, w_superclass=w_class)
+    w_subclass = bootstrap_class(space, 0, w_superclass=w_class)
     subshadow = w_subclass.as_class_get_shadow(space)
     assert subshadow.s_superclass() is shadow
     subshadow.installmethod(w_foo, mockmethod(3))
@@ -111,8 +110,8 @@
     py.test.raises(MethodNotFound, subshadow.lookup, "zork")
 
 def test_w_compiledin():
-    w_super = mockclass(space, 0)
-    w_class = mockclass(space, 0, w_superclass=w_super)
+    w_super = bootstrap_class(space, 0)
+    w_class = bootstrap_class(space, 0, w_superclass=w_super)
     supershadow = w_super.as_class_get_shadow(space)
     supershadow.installmethod(w_foo, model.W_CompiledMethod(0))
     classshadow = w_class.as_class_get_shadow(space)
@@ -127,7 +126,7 @@
 def test_hashes():
     w_five = model.W_SmallInteger(5)
     assert w_five.gethash() == 5
-    w_class = mockclass(space, 0)
+    w_class = bootstrap_class(space, 0)
     w_inst = w_class.as_class_get_shadow(space).new()
     assert w_inst.hash == w_inst.UNASSIGNED_HASH
     h1 = w_inst.gethash()
@@ -211,10 +210,10 @@
     test_not_is_same_object(space.wrap_char('d'), space.wrap_float(3.0))
 
 def test_become_pointers():
-    w_clsa = mockclass(space, 3)
+    w_clsa = bootstrap_class(space, 3)
     w_a = w_clsa.as_class_get_shadow(space).new()
 
-    w_clsb = mockclass(space, 4)
+    w_clsb = bootstrap_class(space, 4)
     w_b = w_clsb.as_class_get_shadow(space).new()
 
     hasha = w_a.gethash()
@@ -235,9 +234,9 @@
     assert w_a.fetch(space, 1) is w_a
 
 def test_become_with_shadow():
-    w_clsa = mockclass(space, 3)
+    w_clsa = bootstrap_class(space, 3)
     s_clsa = w_clsa.as_class_get_shadow(space)
-    w_clsb = mockclass(space, 4)
+    w_clsb = bootstrap_class(space, 4)
     s_clsb = w_clsb.as_class_get_shadow(space)
     res = w_clsa.become(w_clsb)
     assert res
@@ -399,7 +398,7 @@
 def test_weak_pointers():
     from spyvm.shadow import WEAK_POINTERS
 
-    w_cls = mockclass(space, 1)
+    w_cls = bootstrap_class(space, 1)
     s_cls = w_cls.as_class_get_shadow(space)
     s_cls.instance_kind = WEAK_POINTERS
 
diff --git a/spyvm/test/test_objectspace.py b/spyvm/test/test_objectspace.py
--- a/spyvm/test/test_objectspace.py
+++ b/spyvm/test/test_objectspace.py
@@ -1,8 +1,9 @@
 import py
 import sys
 from spyvm import objspace
+from .util import BootstrappedObjSpace
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 def ismetaclass(w_cls):
     # Heuristic to detect if this is a metaclass. Don't use apart
@@ -12,7 +13,7 @@
 
 def test_every_class_is_an_instance_of_a_metaclass():
     for (nm, w_cls) in space.classtable.items():
-        assert ismetaclass(w_cls) or ismetaclass(w_cls.s_class._w_self)
+        assert ismetaclass(w_cls) or ismetaclass(w_cls.w_class)
 
 def test_every_metaclass_inherits_from_class_and_behavior():
     s_Class = space.classtable['w_Class'].as_class_get_shadow(space)
diff --git a/spyvm/test/test_primitives.py b/spyvm/test/test_primitives.py
--- a/spyvm/test/test_primitives.py
+++ b/spyvm/test/test_primitives.py
@@ -1,22 +1,21 @@
 import py
 import os
 import math
+from .util import bootstrap_class
 from spyvm.primitives import prim_table, PrimitiveFailedError
-from spyvm import model, shadow, interpreter, strategies
+from spyvm import model, shadow, interpreter
 from spyvm import constants, primitives, objspace, wrapper, display
 from spyvm.plugins import bitblt
+from .util import BootstrappedObjSpace
 
 from rpython.rlib.rfloat import INFINITY, NAN, isinf, isnan
 
-mockclass = objspace.bootstrap_class
-
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 class MockFrame(model.W_PointersObject):
     def __init__(self, stack):
         self.space = space
         size = 6 + len(stack) + 6
-        self.strategy = strategies.ListStorageStrategy.singleton
         self.initialize_storage(space, size)
         self.store_all(space, [None] * 6 + stack + [space.w_nil] * 6)
         s_self = self.as_blockcontext_get_shadow(space)
@@ -27,7 +26,7 @@
         self.w_class = space.w_MethodContext
 
     def as_blockcontext_get_shadow(self, space):
-        if not self.shadow:
+        if not isinstance(self.shadow, shadow.BlockContextShadow):
             self.shadow = shadow.BlockContextShadow(space, self)
         return self.shadow
 
@@ -221,7 +220,7 @@
     assert prim(primitives.FLOAT_TIMES_TWO_POWER, [213.0, 1020]).value == float('inf')
 
 def test_at():
-    w_obj = mockclass(space, 0, varsized=True).as_class_get_shadow(space).new(1)
+    w_obj = bootstrap_class(space, 0, varsized=True).as_class_get_shadow(space).new(1)
     foo = wrap("foo")
     w_obj.store(space, 0, foo)
     assert prim(primitives.AT, [w_obj, 1]) is foo
@@ -232,11 +231,11 @@
     assert prim(primitives.AT, [w_obj, 1]) == foo
 
 def test_invalid_at():
-    w_obj = mockclass(space, 0).as_class_get_shadow(space).new()
+    w_obj = bootstrap_class(space, 0).as_class_get_shadow(space).new()
     prim_fails(primitives.AT, [w_obj, 1])
 
 def test_at_put():
-    w_obj = mockclass(space, 0, varsized=1).as_class_get_shadow(space).new(1)
+    w_obj = bootstrap_class(space, 0, varsized=1).as_class_get_shadow(space).new(1)
     assert prim(primitives.AT_PUT, [w_obj, 1, 22]).value == 22
     assert prim(primitives.AT, [w_obj, 1]).value == 22
 
@@ -249,13 +248,13 @@
     assert prim(primitives.AT, [w_str, 3]).value == ord('c')
 
 def test_invalid_at_put():
-    w_obj = mockclass(space, 0).as_class_get_shadow(space).new()
+    w_obj = bootstrap_class(space, 0).as_class_get_shadow(space).new()
     prim_fails(primitives.AT_PUT, [w_obj, 1, 22])
 
 def test_size():
-    w_obj = mockclass(space, 0, varsized=True).as_class_get_shadow(space).new(0)
+    w_obj = bootstrap_class(space, 0, varsized=True).as_class_get_shadow(space).new(0)
     assert prim(primitives.SIZE, [w_obj]).value == 0
-    w_obj = mockclass(space, 3, varsized=True).as_class_get_shadow(space).new(5)
+    w_obj = bootstrap_class(space, 3, varsized=True).as_class_get_shadow(space).new(5)
     assert prim(primitives.SIZE, [w_obj]).value == 5
 
 def test_size_of_compiled_method():
@@ -279,7 +278,7 @@
     prim_fails(primitives.OBJECT_AT, ["q", constants.CHARACTER_VALUE_INDEX+2])
 
 def test_invalid_object_at_put():
-    w_obj = mockclass(space, 1).as_class_get_shadow(space).new()
+    w_obj = bootstrap_class(space, 1).as_class_get_shadow(space).new()
     prim_fails(primitives.OBJECT_AT_PUT, [w_obj, 2, 42])
 
 def test_string_at_put():
@@ -344,7 +343,7 @@
 
 def test_as_oop():
     # I checked potato, and that returns the hash for as_oop
-    w_obj = mockclass(space, 0).as_class_get_shadow(space).new()
+    w_obj = bootstrap_class(space, 0).as_class_get_shadow(space).new()
     w_obj.hash = 22
     assert prim(primitives.AS_OOP, [w_obj]).value == 22
 
@@ -485,7 +484,7 @@
 def test_new_method():
     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)
+    shadow = bootstrap_class(space, 0).as_class_get_shadow(space)
     w_method = prim(primitives.NEW_METHOD, [space.w_CompiledMethod, len(bytecode), 1025])
     assert w_method.literalat0(space, 0).value == 1025
     assert w_method.literalsize == 2
@@ -497,7 +496,7 @@
     assert w_v.bytes == list(IMAGENAME)
 
 def test_clone():
-    w_obj = mockclass(space, 1, varsized=True).as_class_get_shadow(space).new(1)
+    w_obj = bootstrap_class(space, 1, varsized=True).as_class_get_shadow(space).new(1)
     w_obj.atput0(space, 0, space.wrap_int(1))
     w_v = prim(primitives.CLONE, [w_obj])
     assert space.unwrap_int(w_v.at0(space, 0)) == 1
@@ -812,7 +811,7 @@
 
     try:
         monkeypatch.setattr(w_frame.shadow, "_sendSelfSelector", perform_mock)
-        monkeypatch.setattr(bitblt.BitBltShadow, "sync_cache", sync_cache_mock)
+        monkeypatch.setattr(bitblt.BitBltShadow, "attach_shadow", sync_cache_mock)
         with py.test.raises(CallCopyBitsSimulation):
             prim_table[primitives.BITBLT_COPY_BITS](interp, w_frame.as_context_get_shadow(space), argument_count-1)
     finally:
diff --git a/spyvm/test/test_shadow.py b/spyvm/test/test_shadow.py
--- a/spyvm/test/test_shadow.py
+++ b/spyvm/test/test_shadow.py
@@ -1,8 +1,8 @@
 import random
-from spyvm import model, shadow, constants, interpreter
-from spyvm import objspace, strategies
+from spyvm import model, shadow, constants, interpreter, objspace
+from .util import BootstrappedObjSpace
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 w_Object = space.classtable['w_Object']
 w_Metaclass  = space.classtable['w_Metaclass']
@@ -42,7 +42,7 @@
     w_class.store(space, constants.CLASS_FORMAT_INDEX, space.wrap_int(format))
     if name is not None:
         w_class.store(space, constants.CLASS_NAME_INDEX, space.wrap_string(name))
-    w_class.as_class_get_shadow(space).s_methoddict().sync_cache()
+    w_class.as_class_get_shadow(space).s_methoddict().sync_method_cache()
     return w_class
 
 def basicshape(name, format, kind, varsized, instsize):
@@ -156,18 +156,18 @@
 
 def assert_contains_nils(w_obj):
     for i in range(w_obj.size()):
-        assert model.w_nil == w_obj.strategy.fetch(i, space, w_obj)
+        assert model.w_nil == w_obj.fetch(space, i)
 
 def test_attach_mc():
     w_m = method()
     w_object = methodcontext(pc=13, method=w_m)
     s_object = w_object.as_methodcontext_get_shadow(space)
-    assert_contains_nils(w_object)
+    assert s_object.fetch(1).value == 13
 
 def test_attach_bc():
     w_object = blockcontext(pc=13)
     s_object = w_object.as_blockcontext_get_shadow(space)
-    assert_contains_nils(w_object)
+    assert s_object.fetch(1).value == 13
 
 def test_replace_to_bc():
     w_object = blockcontext(pc=13)
@@ -177,7 +177,7 @@
     assert ([s_newobject.fetch(i) for i in range(s_newobject.size())] ==
             [s_object.fetch(i) for i in range(s_newobject.size())])
     assert w_object.shadow is s_newobject
-    assert_contains_nils(w_object)
+    assert s_object.fetch(1).value == 13
 
 def test_compiledmethodshadow():
     from test_model import joinbits
@@ -240,17 +240,17 @@
     w_class = build_smalltalk_class("Demo", 0x90, methods=methods)
     s_class = w_class.as_class_get_shadow(space)
     s_methoddict = s_class.s_methoddict()
-    s_methoddict.sync_cache()
+    s_methoddict.sync_method_cache()
     i = 0
-    key = s_methoddict.w_self()._fetch(s_methoddict.space, constants.METHODDICT_NAMES_INDEX+i)
+    key = s_methoddict.w_self().fetch(s_methoddict.space, constants.METHODDICT_NAMES_INDEX+i)
     while key is space.w_nil:
         i = i + 1
-        key = s_methoddict.w_self()._fetch(s_methoddict.space, constants.METHODDICT_NAMES_INDEX+i)
+        key = s_methoddict.w_self().fetch(s_methoddict.space, constants.METHODDICT_NAMES_INDEX+i)
 
     assert (s_class.lookup(key) is foo.as_compiledmethod_get_shadow(space)
             or s_class.lookup(key) is bar.as_compiledmethod_get_shadow(space))
     # change that entry
-    w_array = s_class.w_methoddict()._fetch(s_class.space, constants.METHODDICT_VALUES_INDEX)
+    w_array = s_class.w_methoddict().fetch(s_class.space, constants.METHODDICT_VALUES_INDEX)
     version = s_class.version
     w_array.atput0(space, i, baz)
 
@@ -269,8 +269,8 @@
     key = space.wrap_string('foo')
 
     s_md = w_parent.as_class_get_shadow(space).s_methoddict()
-    s_md.sync_cache()
-    w_ary = s_md._w_self._fetch(s_md.space, constants.METHODDICT_VALUES_INDEX)
+    s_md.sync_method_cache()
+    w_ary = s_md._w_self.fetch(s_md.space, constants.METHODDICT_VALUES_INDEX)
     s_md._w_self.atput0(space, 0, key)
     w_ary.atput0(space, 0, w_method)
 
diff --git a/spyvm/test/test_squeakimage.py b/spyvm/test/test_squeakimage.py
--- a/spyvm/test/test_squeakimage.py
+++ b/spyvm/test/test_squeakimage.py
@@ -2,10 +2,10 @@
 from spyvm import squeakimage
 from spyvm.squeakimage import chrs2int, chrs2long, swapped_chrs2long
 from spyvm import objspace
-
+from .util import BootstrappedObjSpace
 from struct import pack
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 # ----- helpers ----------------------------------------------
 
diff --git a/spyvm/test/test_strategies.py b/spyvm/test/test_strategies.py
--- a/spyvm/test/test_strategies.py
+++ b/spyvm/test/test_strategies.py
@@ -1,5 +1,5 @@
 import py
-from spyvm import wrapper, model, interpreter, objspace, strategies
+from spyvm import wrapper, model, interpreter, strategies
 from spyvm.model import w_nil
 from spyvm.test import test_miniimage as tools
 from spyvm.error import WrapperException, FatalError
diff --git a/spyvm/test/test_wrapper.py b/spyvm/test/test_wrapper.py
--- a/spyvm/test/test_wrapper.py
+++ b/spyvm/test/test_wrapper.py
@@ -1,10 +1,10 @@
 import py
 from spyvm import wrapper, model, interpreter, objspace
 from spyvm.error import WrapperException, FatalError
-
+from .util import BootstrappedObjSpace
 from spyvm.test.test_interpreter import new_frame as new_frame_tuple
 
-space = objspace.ObjSpace()
+space = BootstrappedObjSpace()
 
 def new_frame():
     return new_frame_tuple("")[0]
diff --git a/spyvm/test/test_zin_squeak_4_5_image.py b/spyvm/test/test_zin_squeak_4_5_image.py
--- a/spyvm/test/test_zin_squeak_4_5_image.py
+++ b/spyvm/test/test_zin_squeak_4_5_image.py
@@ -13,7 +13,7 @@
 
 def find_symbol_in_methoddict_of(string, s_class):
     s_methoddict = s_class.s_methoddict()
-    s_methoddict.sync_cache()
+    s_methoddict.sync_method_cache()
     methoddict_w = s_methoddict.methoddict
     for each in methoddict_w.keys():
         if each.as_string() == string:
diff --git a/spyvm/test/util.py b/spyvm/test/util.py
new file mode 100644
--- /dev/null
+++ b/spyvm/test/util.py
@@ -0,0 +1,176 @@
+from spyvm import model, shadow, objspace, version, constants
+from rpython.rlib.objectmodel import instantiate
+
+class BootstrappedObjSpace(objspace.ObjSpace):
+    
+    def make_bootstrap_classes(self):
+        def define_core_cls(name, w_superclass, w_metaclass):
+            assert name.startswith('w_')
+            w_class = bootstrap_class(self, instsize=0,    # XXX
+                                      w_superclass=w_superclass,
+                                      w_metaclass=w_metaclass,
+                                      name=name[2:])
+            self.classtable[name] = w_class
+            return w_class
+
+        #   A complete minimal setup (including Behavior) would look like this
+        #
+        #   class:              superclass:         metaclass:
+        #   ------------------- ------------------- -------------------
+        #   Object              *nil                 Object class
+        #   Behavior            Object              Behavior class
+        #   ClassDescription    Behavior            ClassDescription class
+        #   Class               ClassDescription    Class class
+        #   Metaclass           ClassDescription    Metaclass class
+        #   Object class        *Class              *Metaclass
+        #   Behavior class      Object class        *Metaclass
+        #   ClassDescription cl Behavior class      *Metaclass
+        #   Class class         ClassDescription cl *Metaclass
+        #   Metaclass class     ClassDescription cl *Metaclass
+
+        #    Class Name            Super class name
+        cls_nm_tbl = [
+            ["w_Object",           "w_ProtoObject"], # there is not ProtoObject in mini.image
+            ["w_Behavior",         "w_Object"],
+            ["w_ClassDescription", "w_Behavior"],
+            ["w_Class",            "w_ClassDescription"],
+            ["w_Metaclass",        "w_ClassDescription"],
+            ]
+        define_core_cls("w_ProtoObjectClass", None, None)
+        w_ProtoObjectClass = self.classtable["w_ProtoObjectClass"]
+        define_core_cls("w_ProtoObject", None, w_ProtoObjectClass)
+        for (cls_nm, super_cls_nm) in cls_nm_tbl:
+            meta_nm = cls_nm + "Class"
+            meta_super_nm = super_cls_nm + "Class"
+            w_metacls = define_core_cls(meta_nm, self.classtable[meta_super_nm], None)
+            define_core_cls(cls_nm, self.classtable[super_cls_nm], w_metacls)
+        w_Class = self.classtable["w_Class"]
+        w_Metaclass = self.classtable["w_Metaclass"]
+        # XXX
+        proto_shadow = w_ProtoObjectClass.shadow
+        proto_shadow.store_w_superclass(w_Class)
+        # at this point, all classes that still lack a w_class are themselves
+        # metaclasses
+        for nm, w_cls_obj in self.classtable.items():
+            if w_cls_obj.w_class is None:
+                w_cls_obj.w_class = w_Metaclass
+
+        def define_cls(cls_nm, supercls_nm, instvarsize=0, format=shadow.POINTERS,
+                       varsized=False):
+            assert cls_nm.startswith("w_")
+            meta_nm = cls_nm + "Class"
+            meta_super_nm = supercls_nm + "Class"
+            w_Metaclass = self.classtable["w_Metaclass"]
+            w_meta_cls = self.classtable[meta_nm] = \
+                         bootstrap_class(self, 0,   # XXX
+                                         self.classtable[meta_super_nm],
+                                         w_Metaclass,
+                                         name=meta_nm[2:])
+            w_cls = self.classtable[cls_nm] = \
+                         bootstrap_class(self, instvarsize,
+                                         self.classtable[supercls_nm],
+                                         w_meta_cls,
+                                         format=format,
+                                         varsized=varsized,
+                                         name=cls_nm[2:])
+
+        define_cls("w_Magnitude", "w_Object")
+        define_cls("w_Character", "w_Magnitude", instvarsize=1)
+        define_cls("w_Number", "w_Magnitude")
+        define_cls("w_Integer", "w_Number")
+        define_cls("w_SmallInteger", "w_Integer")
+        define_cls("w_LargePositiveInteger", "w_Integer", format=shadow.BYTES)
+        define_cls("w_Float", "w_Number", format=shadow.BYTES)
+        define_cls("w_Message", "w_Object")
+        define_cls("w_Collection", "w_Object")
+        define_cls("w_SequenceableCollection", "w_Collection")
+        define_cls("w_ArrayedCollection", "w_SequenceableCollection")
+        define_cls("w_Array", "w_ArrayedCollection", varsized=True)
+        define_cls("w_String", "w_ArrayedCollection", format=shadow.BYTES)
+        define_cls("w_Bitmap", "w_ArrayedCollection", varsized=True, format=shadow.WORDS)
+        define_cls("w_UndefinedObject", "w_Object")
+        define_cls("w_Boolean", "w_Object")
+        define_cls("w_True", "w_Boolean")
+        define_cls("w_False", "w_Boolean")
+        define_cls("w_ByteArray", "w_ArrayedCollection", format=shadow.BYTES)
+        define_cls("w_MethodDict", "w_Object", instvarsize=2, varsized=True)
+        define_cls("w_CompiledMethod", "w_ByteArray", format=shadow.COMPILED_METHOD)
+        define_cls("w_ContextPart", "w_Object")
+        define_cls("w_MethodContext", "w_ContextPart")
+        define_cls("w_Link", "w_Object")
+        define_cls("w_Process", "w_Link")
+        define_cls("w_Point", "w_Object")
+        define_cls("w_LinkedList", "w_SequenceableCollection")
+        define_cls("w_Semaphore", "w_LinkedList")
+        define_cls("w_BlockContext", "w_ContextPart",
+                   instvarsize=constants.BLKCTX_STACK_START)
+        define_cls("w_BlockClosure", "w_Object",
+                   instvarsize=constants.BLKCLSR_SIZE,
+                   varsized=True)
+        # make better accessors for classes that can be found in special object
+        # table
+        for name in constants.classes_in_special_object_table.keys():
+            name = 'w_' + name
+            setattr(self, name, self.classtable.get(name))
+
+    def make_bootstrap_objects(self):
+        def bld_char(i):
+            w_cinst = self.w_Character.as_class_get_shadow(self).new()
+            w_cinst.store(self, constants.CHARACTER_VALUE_INDEX,
+                          model.W_SmallInteger(i))
+            return w_cinst
+        w_charactertable = model.W_PointersObject(self,
+            self.classtable['w_Array'], 256)
+        self.w_charactertable = w_charactertable
+        for i in range(256):
+            self.w_charactertable.atput0(self, i, bld_char(i))
+
+
+        # Very special nil hack: in order to allow W_PointersObject's to
+        # initialize their fields to nil, we have to create it in the model
+        # package, and then patch up its fields here:
+        def patch_nil(w_nil):
+            w_nil.space = self
+            w_nil.s_class = self.classtable['w_UndefinedObject'].as_class_get_shadow(self)
+            w_nil.initialize_storage(self, 0)
+            return w_nil
+        w_nil = self.w_nil = patch_nil(model.w_nil)
+
+        w_true = self.classtable['w_True'].as_class_get_shadow(self).new()
+        self.w_true = w_true
+        w_false = self.classtable['w_False'].as_class_get_shadow(self).new()
+        self.w_false = w_false
+        self.w_minus_one = model.W_SmallInteger(-1)
+        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(self,
+            self.classtable['w_Array'], len(constants.SPECIAL_SELECTORS) * 2)
+        self.w_special_selectors = w_special_selectors
+
+        self.objtable = {}
+        for name in constants.objects_in_special_object_table:
+            name = "w_" + name
+            try:
+                self.objtable[name] = locals()[name]
+            except KeyError, e:
+                self.objtable[name] = None
+    
+
+def bootstrap_class(space, instsize, w_superclass=None, w_metaclass=None,
+                    name='?', format=shadow.POINTERS, varsized=False):
+    w_class = model.W_PointersObject(space, w_metaclass, 0)
+    s = instantiate(shadow.ClassShadow)
+    s.space = space
+    s.version = version.Version()
+    s._w_self = w_class
+    s.subclass_s = {}
+    s._s_superclass = None
+    s.store_w_superclass(w_superclass)
+    s.name = name
+    s._instance_size = instsize
+    s.instance_kind = format
+    s._s_methoddict = None
+    s.instance_varsized = varsized or format != shadow.POINTERS
+    w_class.store_shadow(s)
+    return w_class


More information about the pypy-commit mailing list