Beispiel #1
0
 def _make_layoutbuilder(self):
     # make a TransformerLayoutBuilder and save it on the translator
     # where it can be fished and reused by the FrameworkGCTransformer
     from rpython.memory.gctransform import framework
     translator = self.translator
     self.layoutbuilder = framework.TransformerLayoutBuilder(translator)
     self.layoutbuilder.delay_encoding()
     if not hasattr(translator, '_jit2gc'):
         translator._jit2gc = {}
     translator._jit2gc['layoutbuilder'] = self.layoutbuilder
Beispiel #2
0
    def ensure_layoutbuilder(cls, translator):
        jit2gc = getattr(translator, '_jit2gc', None)
        if jit2gc:
            assert 'invoke_after_minor_collection' in jit2gc
            return jit2gc['layoutbuilder']
        marker = cls.marker
        GCClass = cls.gcpolicy.transformerclass.GCClass
        layoutbuilder = framework.TransformerLayoutBuilder(translator, GCClass)
        layoutbuilder.delay_encoding()

        def seeme():
            marker[0] += 1

        translator._jit2gc = {
            'layoutbuilder': layoutbuilder,
            'invoke_after_minor_collection': seeme,
        }
        return layoutbuilder