Beispiel #1
0
    def setup_method(self, meth):
        class config_(object):
            class translation(object):
                gc = self.gc
                gcrootfinder = 'asmgcc'
                gctransformer = 'framework'
                gcremovetypeptr = False
        class FakeTranslator(object):
            config = config_
        class FakeCPU(object):
            def cast_adr_to_int(self, adr):
                if not adr:
                    return 0
                try:
                    ptr = llmemory.cast_adr_to_ptr(adr, gc_ll_descr.WB_FUNCPTR)
                    assert ptr._obj._callable == \
                           llop1._write_barrier_failing_case
                    return 42
                except lltype.InvalidCast:
                    ptr = llmemory.cast_adr_to_ptr(
                        adr, gc_ll_descr.WB_ARRAY_FUNCPTR)
                    assert ptr._obj._callable == \
                           llop1._write_barrier_from_array_failing_case
                    return 43

        gcdescr = get_description(config_)
        translator = FakeTranslator()
        llop1 = FakeLLOp()
        gc_ll_descr = GcLLDescr_framework(gcdescr, FakeTranslator(), None,
                                          llop1)
        gc_ll_descr.initialize()
        llop1.gcheaderbuilder = gc_ll_descr.gcheaderbuilder
        self.llop1 = llop1
        self.gc_ll_descr = gc_ll_descr
        self.fake_cpu = FakeCPU()
Beispiel #2
0
    def setup_method(self, meth):
        class config_(object):
            class translation(object):
                gc = 'hybrid'
                gcrootfinder = 'asmgcc'
                gctransformer = 'framework'
                gcremovetypeptr = False

        gcdescr = get_description(config_)
        self.gc_ll_descr = GcLLDescr_framework(gcdescr,
                                               None,
                                               None,
                                               None,
                                               really_not_translated=True)
        self.gc_ll_descr.write_barrier_descr.has_write_barrier_from_array = (
            lambda cpu: True)

        #
        class FakeCPU(object):
            def sizeof(self, STRUCT):
                descr = SizeDescrWithVTable(102)
                descr.tid = 9315
                return descr

        self.cpu = FakeCPU()
Beispiel #3
0
 def setup_method(self, meth):
     class config_(object):
         class translation(object):
             gc = 'hybrid'
             gcrootfinder = 'asmgcc'
             gctransformer = 'framework'
             gcremovetypeptr = False
     gcdescr = get_description(config_)
     self.gc_ll_descr = GcLLDescr_framework(gcdescr, None, None, None,
                                            really_not_translated=True)
     self.gc_ll_descr.write_barrier_descr.has_write_barrier_from_array = (
         lambda cpu: True)
     #
     class FakeCPU(object):
         def sizeof(self, STRUCT):
             descr = SizeDescrWithVTable(102)
             descr.tid = 9315
             return descr
     self.cpu = FakeCPU()
Beispiel #4
0
 def setup_method(self, meth):
     class FakeTranslator:
         pass
     class config:
         class translation:
             gc = 'hybrid'
             gcrootfinder = 'asmgcc'
             gctransformer = 'framework'
     class FakeCPU:
         def cast_adr_to_int(self, adr):
             ptr = llmemory.cast_adr_to_ptr(adr, gc_ll_descr.WB_FUNCPTR)
             assert ptr._obj._callable == llop1._write_barrier_failing_case
             return 42
     gcdescr = get_description(config)
     translator = FakeTranslator()
     llop1 = FakeLLOp()
     gc_ll_descr = GcLLDescr_framework(gcdescr, FakeTranslator(), llop1)
     gc_ll_descr.initialize()
     self.llop1 = llop1
     self.gc_ll_descr = gc_ll_descr
     self.fake_cpu = FakeCPU()
Beispiel #5
0
 def setup_method(self, meth):
     class config_:
         class translation:
             gc = 'hybrid'
             gcrootfinder = 'asmgcc'
             gctransformer = 'framework'
             gcremovetypeptr = False
     class FakeTranslator:
         config = config_
     class FakeCPU:
         def cast_adr_to_int(self, adr):
             ptr = llmemory.cast_adr_to_ptr(adr, gc_ll_descr.WB_FUNCPTR)
             assert ptr._obj._callable == llop1._write_barrier_failing_case
             return 42
     gcdescr = get_description(config_)
     translator = FakeTranslator()
     llop1 = FakeLLOp()
     gc_ll_descr = GcLLDescr_framework(gcdescr, FakeTranslator(), llop1)
     gc_ll_descr.initialize()
     self.llop1 = llop1
     self.gc_ll_descr = gc_ll_descr
     self.fake_cpu = FakeCPU()
Beispiel #6
0
    def setup_method(self, meth):
        class config_(object):
            class translation(object):
                gc = self.gc
                gcrootfinder = 'asmgcc'
                gctransformer = 'framework'
                gcremovetypeptr = False

        class FakeTranslator(object):
            config = config_

        class FakeCPU(object):
            def cast_adr_to_int(self, adr):
                if not adr:
                    return 0
                try:
                    ptr = llmemory.cast_adr_to_ptr(adr, gc_ll_descr.WB_FUNCPTR)
                    assert ptr._obj._callable == \
                           llop1._write_barrier_failing_case
                    return 42
                except lltype.InvalidCast:
                    ptr = llmemory.cast_adr_to_ptr(
                        adr, gc_ll_descr.WB_ARRAY_FUNCPTR)
                    assert ptr._obj._callable == \
                           llop1._write_barrier_from_array_failing_case
                    return 43

        gcdescr = get_description(config_)
        translator = FakeTranslator()
        llop1 = FakeLLOp()
        gc_ll_descr = GcLLDescr_framework(gcdescr, FakeTranslator(), None,
                                          llop1)
        gc_ll_descr.initialize()
        llop1.gcheaderbuilder = gc_ll_descr.gcheaderbuilder
        self.llop1 = llop1
        self.gc_ll_descr = gc_ll_descr
        self.fake_cpu = FakeCPU()
Beispiel #7
0
 def set_translator(self, translator):
     self.translator = translator
     self.rtyper = translator.rtyper
     self.gcdescr = gc.get_description(translator.config)