[pypy-svn] r24845 - pypy/branch/explicit-exceptions/translator/c
mwh at codespeak.net
mwh at codespeak.net
Thu Mar 23 01:42:43 CET 2006
Author: mwh
Date: Thu Mar 23 01:42:38 2006
New Revision: 24845
Modified:
pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py
Log:
one simplification: gen_exc_checking_var only used half its arguments and its
return value was never used, so tidy there. also, one probable fix, and an
assert, about where the exception-guarded operation has ended up. still not
convinced this is right.
Modified: pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py
==============================================================================
--- pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py (original)
+++ pypy/branch/explicit-exceptions/translator/c/exceptiontransform.py Thu Mar 23 01:42:38 2006
@@ -115,13 +115,14 @@
afterblock = split_block(self.translator, graph, block, i+1)
- var_exc_occured, block = self.gen_exc_checking_var(op, i, block, graph)
+ self.gen_exc_check(block, graph.returnblock)
#non-exception case
block.exits[0].exitcase = block.exits[0].llexitcase = False
if need_exc_matching:
- if not self.raise_analyzer.can_raise(block.operations[-1]):
- print "XXX: operation %s cannot raise, but has exception guarding in graph %s" % (block.operations[-1], graph)
+ assert afterblock.exitswitch == c_last_exception
+ if not self.raise_analyzer.can_raise(afterblock.operations[-1]):
+ print "XXX: operation %s cannot raise, but has exception guarding in graph %s" % (afterblock.operations[-1], graph)
afterblock.exitswitch = None
afterblock.exits = [afterblock.exits[0]]
else:
@@ -177,7 +178,7 @@
startblock.closeblock(Link([result], newgraph.returnblock))
startblock.exits = list(startblock.exits)
newgraph.returnblock.inputargs[0].concretetype = op.result.concretetype
- var_exc_occured, block = self.gen_exc_checking_var(newop, 0, startblock, newgraph)
+ self.gen_exc_check(startblock, newgraph.returnblock)
startblock.exits[0].exitcase = startblock.exits[0].llexitcase = False
excblock = Block([])
var_value = Variable()
@@ -195,25 +196,24 @@
newgraph.exceptblock.inputargs[0].concretetype = self.exc_data.lltype_of_exception_type
newgraph.exceptblock.inputargs[1].concretetype = self.exc_data.lltype_of_exception_value
excblock.closeblock(Link([var_type, var_value], newgraph.exceptblock))
- block.exits[True].target = excblock
- block.exits[True].args = []
+ startblock.exits[True].target = excblock
+ startblock.exits[True].args = []
FUNCTYPE = lltype.FuncType(ARGTYPES, op.result.concretetype)
fptr = Constant(lltype.functionptr(FUNCTYPE, "dummy_exc2", graph=newgraph),
lltype.Ptr(FUNCTYPE))
self.translator.graphs.append(newgraph)
return newgraph, SpaceOperation("direct_call", [fptr] + callargs, op.result)
- def gen_exc_checking_var(self, op, i, block, graph):
+ def gen_exc_check(self, block, returnblock):
var_exc_occured = Variable()
var_exc_occured.concretetype = lltype.Bool
block.operations.append(SpaceOperation("direct_call", [self.rpyexc_occured_ptr], var_exc_occured))
block.exitswitch = var_exc_occured
#exception occurred case
- l = Link([error_value(graph.returnblock.inputargs[0].concretetype)], graph.returnblock)
+ l = Link([error_value(returnblock.inputargs[0].concretetype)], returnblock)
l.prevblock = block
l.exitcase = l.llexitcase = True
block.exits.append(l)
- return var_exc_occured, block
More information about the Pypy-commit
mailing list