compiler.embedding: instantiate type of even the first embedding of an RPC.

This commit is contained in:
whitequark 2015-11-27 14:55:47 +08:00
parent cde21bcd26
commit 0a794fe7e4
1 changed files with 25 additions and 24 deletions

View File

@ -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)