mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 03:08:27 +08:00
compiler: handle async RPC as last statement in try block.
Fixes #1107.
This commit is contained in:
parent
7bd7b6592a
commit
93af5d2a03
@ -1339,6 +1339,12 @@ class LLVMIRGenerator:
|
||||
self.llbuilder.call(self.llbuiltin("llvm.stackrestore"), [llstackptr])
|
||||
|
||||
if fun_type.async:
|
||||
# If this RPC is called using an `invoke` ARTIQ IR instruction, there will be
|
||||
# no other instructions in this basic block. Since this RPC is async, it cannot
|
||||
# possibly raise an exception, so add an explicit jump to the normal successor.
|
||||
if llunwindblock:
|
||||
self.llbuilder.branch(llnormalblock)
|
||||
|
||||
return ll.Undefined
|
||||
|
||||
# T result = {
|
||||
|
@ -223,6 +223,17 @@ class _RPCCalls(EnvExperiment):
|
||||
def builtin(self):
|
||||
sleep(1.0)
|
||||
|
||||
@rpc(flags={"async"})
|
||||
def async_rpc(self):
|
||||
pass
|
||||
|
||||
@kernel
|
||||
def async_in_try(self):
|
||||
try:
|
||||
self.async_rpc()
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
|
||||
class RPCCallsTest(ExperimentCase):
|
||||
def test_args(self):
|
||||
@ -239,6 +250,7 @@ class RPCCallsTest(ExperimentCase):
|
||||
self.assertTrue((exp.numpy_full() == numpy.full(10, 20)).all())
|
||||
self.assertTrue(numpy.isnan(exp.numpy_nan()).all())
|
||||
exp.builtin()
|
||||
exp.async_in_try()
|
||||
|
||||
|
||||
class _Annotation(EnvExperiment):
|
||||
|
Loading…
Reference in New Issue
Block a user