mirror of https://github.com/m-labs/artiq.git
compiler.embedding: instantiate type of even the first embedding of an RPC.
This commit is contained in:
parent
cde21bcd26
commit
0a794fe7e4
|
@ -670,11 +670,8 @@ class Stitcher:
|
|||
return typ
|
||||
|
||||
if function in self.functions:
|
||||
function_name, function_type = self.functions[function]
|
||||
if types.is_rpc_function(function_type):
|
||||
function_type = function_type.map(instantiate)
|
||||
return function_name, function_type
|
||||
|
||||
result = self.functions[function]
|
||||
else:
|
||||
if hasattr(function, "artiq_embedded"):
|
||||
if function.artiq_embedded.function is not None:
|
||||
# Insert the typed AST for the new function and restart inference.
|
||||
|
@ -682,19 +679,23 @@ class Stitcher:
|
|||
# the final call.
|
||||
function_node = self._quote_embedded_function(function)
|
||||
self._inject(function_node)
|
||||
return function_node.name, self.globals[function_node.name]
|
||||
result = function_node.name, self.globals[function_node.name]
|
||||
elif function.artiq_embedded.syscall is not None:
|
||||
# Insert a storage-less global whose type instructs the compiler
|
||||
# to perform a system call instead of a regular call.
|
||||
return self._quote_foreign_function(function, loc,
|
||||
result = self._quote_foreign_function(function, loc,
|
||||
syscall=function.artiq_embedded.syscall)
|
||||
else:
|
||||
assert False
|
||||
else:
|
||||
# Insert a storage-less global whose type instructs the compiler
|
||||
# to perform an RPC instead of a regular call.
|
||||
return self._quote_foreign_function(function, loc,
|
||||
syscall=None)
|
||||
result = self._quote_foreign_function(function, loc, syscall=None)
|
||||
|
||||
function_name, function_type = result
|
||||
if types.is_rpc_function(function_type):
|
||||
function_type = function_type.map(instantiate)
|
||||
return function_name, function_type
|
||||
|
||||
def _quote(self, value, loc):
|
||||
synthesizer = self._synthesizer(loc)
|
||||
|
|
Loading…
Reference in New Issue