diff --git a/artiq/coredevice/core.py b/artiq/coredevice/core.py index 55aa598ee..199d02b25 100644 --- a/artiq/coredevice/core.py +++ b/artiq/coredevice/core.py @@ -56,15 +56,16 @@ class Core: self.core = self self.comm.core = self self.target = target + self.analyzed = False self.compiler = nac3artiq.NAC3(target) def close(self): self.comm.close() def compile(self, method, args, kwargs, embedding_map, file_output=None): - if core_language._allow_registration: + if not self.analyzed: self.compiler.analyze(core_language._registered_functions, core_language._registered_classes) - core_language._allow_registration = False + self.analyzed = True if hasattr(method, "__self__"): obj = method.__self__ diff --git a/artiq/language/core.py b/artiq/language/core.py index cb1908d26..379f57aaa 100644 --- a/artiq/language/core.py +++ b/artiq/language/core.py @@ -46,18 +46,15 @@ def ceil64(x): return ceil(x) -_allow_registration = True # Delay NAC3 analysis until all referenced variables are supposed to exist on the CPython side. _registered_functions = set() _registered_classes = set() def _register_function(fun): - assert _allow_registration import_cache.add_module_to_cache(getmodule(fun)) _registered_functions.add(fun) def _register_class(cls): - assert _allow_registration import_cache.add_module_to_cache(getmodule(cls)) _registered_classes.add(cls)