Example #1
0
 def test_regalloc_exitswitch_2(self):
     v1 = Variable(); v1.concretetype = rclass.CLASSTYPE
     v2 = Variable(); v2.concretetype = rclass.CLASSTYPE
     v3 = Variable(); v3.concretetype = rclass.CLASSTYPE
     v4 = Variable(); v4.concretetype = rclass.CLASSTYPE
     block = Block([])
     block.operations = [
         SpaceOperation('res_call', [], v1),
         SpaceOperation('-live-', [], None),
         ]
     graph = FunctionGraph('f', block, v4)
     exclink = Link([v2], graph.returnblock)
     exclink.llexitcase = 123     # normally an exception class
     exclink.last_exception = v2
     exclink.last_exc_value = "unused"
     block.exitswitch = c_last_exception
     block.closeblock(Link([v1], graph.returnblock),
                      exclink)
     #
     self.check_assembler(graph, """
         res_call -> %i0
         -live-
         catch_exception L1
         int_return %i0
         ---
         L1:
         goto_if_exception_mismatch $123, L2
         last_exception -> %i0
         int_return %i0
         ---
         L2:
         reraise
     """)
Example #2
0
 def copy_link(self, link, prevblock):
     newargs = [self.get_new_name(a) for a in link.args] + self.passon_vars(prevblock)
     newlink = Link(newargs, self.copy_block(link.target), link.exitcase)
     newlink.last_exception = self.get_new_name(link.last_exception)
     newlink.last_exc_value = self.get_new_name(link.last_exc_value)
     if hasattr(link, 'llexitcase'):
         newlink.llexitcase = link.llexitcase
     return newlink
Example #3
0
 def copy_link(self, link, prevblock):
     newargs = [self.get_new_name(a) for a in link.args] + self.passon_vars(prevblock)
     newlink = Link(newargs, self.copy_block(link.target), link.exitcase)
     newlink.last_exception = self.get_new_name(link.last_exception)
     newlink.last_exc_value = self.get_new_name(link.last_exc_value)
     if hasattr(link, 'llexitcase'):
         newlink.llexitcase = link.llexitcase
     return newlink
Example #4
0
 def test_regalloc_exitswitch_2(self):
     v1 = Variable()
     v1.concretetype = rclass.CLASSTYPE
     v2 = Variable()
     v2.concretetype = rclass.CLASSTYPE
     v3 = Variable()
     v3.concretetype = rclass.CLASSTYPE
     v4 = Variable()
     v4.concretetype = rclass.CLASSTYPE
     block = Block([])
     block.operations = [
         SpaceOperation('res_call', [], v1),
         SpaceOperation('-live-', [], None),
     ]
     graph = FunctionGraph('f', block, v4)
     exclink = Link([v2], graph.returnblock)
     exclink.llexitcase = 123  # normally an exception class
     exclink.last_exception = v2
     exclink.last_exc_value = "unused"
     block.exitswitch = c_last_exception
     block.closeblock(Link([v1], graph.returnblock), exclink)
     #
     self.check_assembler(
         graph, """
         res_call -> %i0
         -live-
         catch_exception L1
         int_return %i0
         ---
         L1:
         goto_if_exception_mismatch $123, L2
         last_exception -> %i0
         int_return %i0
         ---
         L2:
         reraise
     """)