forked from M-Labs/artiq
transforms.llvm_ir_generator: compare exn typeinfo using strcmp.
This is necessary to correctly catch exceptions from RPCs.
This commit is contained in:
parent
9ed6b54249
commit
0b69e488e6
|
@ -364,6 +364,8 @@ class LLVMIRGenerator:
|
|||
llty = ll.FunctionType(llvoid, [self.llty_of_type(builtins.TException())])
|
||||
elif name == "__artiq_reraise":
|
||||
llty = ll.FunctionType(llvoid, [])
|
||||
elif name == "strcmp":
|
||||
llty = ll.FunctionType(lli32, [llptr, llptr])
|
||||
elif name == "send_rpc":
|
||||
llty = ll.FunctionType(llvoid, [lli32, llptr],
|
||||
var_arg=True)
|
||||
|
@ -1159,7 +1161,10 @@ class LLVMIRGenerator:
|
|||
if typ is None:
|
||||
self.llbuilder.branch(self.map(target))
|
||||
else:
|
||||
llmatchingclause = self.llbuilder.icmp_unsigned('==', llexnname, llclauseexnname)
|
||||
llexnmatch = self.llbuilder.call(self.llbuiltin("strcmp"),
|
||||
[llexnname, llclauseexnname])
|
||||
llmatchingclause = self.llbuilder.icmp_unsigned('==',
|
||||
llexnmatch, ll.Constant(lli32, 0))
|
||||
with self.llbuilder.if_then(llmatchingclause):
|
||||
self.llbuilder.branch(self.map(target))
|
||||
|
||||
|
|
|
@ -92,6 +92,7 @@ static const struct symbol runtime_exports[] = {
|
|||
{"__artiq_personality", &__artiq_personality},
|
||||
{"__artiq_raise", &__artiq_raise},
|
||||
{"__artiq_reraise", &__artiq_reraise},
|
||||
{"strcmp", &strcmp},
|
||||
{"abort", &ksupport_abort},
|
||||
|
||||
/* proxified syscalls */
|
||||
|
|
Loading…
Reference in New Issue