[pypy-svn] r14987 - in pypy/dist/pypy/translator/llvm2: . test
ericvrp at codespeak.net
ericvrp at codespeak.net
Sun Jul 24 17:34:50 CEST 2005
Author: ericvrp
Date: Sun Jul 24 17:34:50 2005
New Revision: 14987
Modified:
pypy/dist/pypy/translator/llvm2/codewriter.py
pypy/dist/pypy/translator/llvm2/funcnode.py
pypy/dist/pypy/translator/llvm2/opwriter.py
pypy/dist/pypy/translator/llvm2/test/test_exception.py
Log:
Moving stuff to other computer and avoiding long time between checkins
Modified: pypy/dist/pypy/translator/llvm2/codewriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/codewriter.py (original)
+++ pypy/dist/pypy/translator/llvm2/codewriter.py Sun Jul 24 17:34:50 2005
@@ -100,12 +100,12 @@
def invoke(self, targetvar, returntype, functionref, argrefs, argtypes, label, except_label):
arglist = ["%s %s" % item for item in zip(argtypes, argrefs)]
- self.indent("%s = invoke %s %s(%s) to label %s except label %s" % (targetvar, returntype, functionref,
+ self.indent("%s = invoke %s %s(%s) to label %%%s except label %%%s" % (targetvar, returntype, functionref,
", ".join(arglist), label, except_label))
def invoke_void(self, functionref, argrefs, argtypes, label, except_label):
arglist = ["%s %s" % item for item in zip(argtypes, argrefs)]
- self.indent("invoke void %s(%s) to label %s except label %s" % (functionref, ", ".join(arglist), label, except_label))
+ self.indent("invoke void %s(%s) to label %%%s except label %%%s" % (functionref, ", ".join(arglist), label, except_label))
def cast(self, targetvar, fromtype, fromvar, targettype):
self.indent("%(targetvar)s = cast %(fromtype)s "
Modified: pypy/dist/pypy/translator/llvm2/funcnode.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/funcnode.py (original)
+++ pypy/dist/pypy/translator/llvm2/funcnode.py Sun Jul 24 17:34:50 2005
@@ -150,7 +150,9 @@
codewriter.comment(str(op), indent=True)
opname = op.opname
if op_index == last_direct_call:
- opname = 'direct_invoke'
+ opname = 'direct_invoke' #XXX or can op.opname be overwritten?
+ opwriter.node = self #XXX or make all operations know their node?
+ opwriter.block = block #XXX or make all operations know their block?
opwriter.write_operation(op, opname)
def write_startblock(self, codewriter, block):
Modified: pypy/dist/pypy/translator/llvm2/opwriter.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/opwriter.py (original)
+++ pypy/dist/pypy/translator/llvm2/opwriter.py Sun Jul 24 17:34:50 2005
@@ -7,7 +7,7 @@
from pypy.translator.llvm2.node import LLVMNode, ConstantLLVMNode
from pypy.translator.llvm2.atomic import is_atomic
from pypy.translator.llvm2.log import log
-#from pypy.rpython.extfunctable import table as extfunctable
+nextexclabel = py.std.itertools.count().next
log = log.opwriter
class OpWriter(object):
@@ -189,11 +189,23 @@
functionref = self.db.repr_arg(op.args[0])
argrefs = self.db.repr_arg_multi(op.args[1:])
argtypes = self.db.repr_arg_type_multi(op.args[1:])
+
+ link = self.block.exits[0]
+ assert link.exitcase is None
+ label = self.node.block_to_name[link.target]
+
+ assert len(self.block.exits) > 1
+ link = self.block.exits[1] #XXX need an additional block if we catch multiple exc.types!
+ exc_label = self.node.block_to_name[link.target]
+ #exc_label = 'exception_block.%d' % nextexclabel()
+
if returntype != "void":
self.codewriter.invoke(targetvar, returntype, functionref, argrefs,
- argtypes, 'PYPY_LABEL', 'PYPY_EXCEPT_LABEL')
+ argtypes, label, exc_label)
else:
- self.codewriter.invoke_void(functionref, argrefs, argtypes, 'PYPY_LABEL', 'PYPY_EXCEPT_LABEL')
+ self.codewriter.invoke_void(functionref, argrefs, argtypes, label, exc_label)
+
+ #self.codewriter.label(exc_label)
def malloc(self, op):
targetvar = self.db.repr_arg(op.result)
Modified: pypy/dist/pypy/translator/llvm2/test/test_exception.py
==============================================================================
--- pypy/dist/pypy/translator/llvm2/test/test_exception.py (original)
+++ pypy/dist/pypy/translator/llvm2/test/test_exception.py Sun Jul 24 17:34:50 2005
@@ -9,7 +9,6 @@
self.n = n
def test_simple1():
- import time
def raise_(i):
if i:
raise TestException()
@@ -17,9 +16,9 @@
return 3
def fn(i):
try:
- a = time.time() + raise_(i) + 11
- b = time.time() + raise_(i) + 12
- c = time.time() + raise_(i) + 13
+ a = raise_(i) + 11
+ b = raise_(i) + 12
+ c = raise_(i) + 13
return a+b+c
except TestException:
return 7
More information about the Pypy-commit
mailing list