Quellcode durchsuchen

The use of compiled functions became a parameter in the Modelverse

Yentl Van Tendeloo vor 9 Jahren
Ursprung
Commit
4fa0039a35
1 geänderte Dateien mit 12 neuen und 10 gelöschten Zeilen
  1. 12 10
      kernel/modelverse_kernel/main.py

+ 12 - 10
kernel/modelverse_kernel/main.py

@@ -16,6 +16,7 @@ class ModelverseKernel(object):
         self.returnvalue = None
         self.success = True
         self.generators = {}
+        self.allow_compiled = True
         self.debug_info = "(no debug information found)"
 
     def execute_yields(self, username, operation, params, reply):
@@ -434,16 +435,17 @@ class ModelverseKernel(object):
             # Resolved a global, so this is a string
             # Potentially, this might even be a function that we have precompiled already!
             # So check whether this is the case or not
-            compiled_function = getattr(compiled_functions, var_name, None)
-            if compiled_function is not None:
-                # We have a compiled function ready!
-                print("Using compiled version of '%s'" % var_name)
-
-                # Now we have to bind the ID to the compiled functions
-                # For this, we read out the body of the resolved data
-                compiler_val = yield [("RD", [variable, "value"])]
-                compiler_body = yield [("RD", [compiler_val, "body"])]
-                self.compiled[compiler_body] = compiled_function
+            if self.allow_compiled:
+                compiled_function = getattr(compiled_functions, var_name, None)
+                if compiled_function is not None:
+                    # We have a compiled function ready!
+                    print("Using compiled version of '%s'" % var_name)
+
+                    # Now we have to bind the ID to the compiled functions
+                    # For this, we read out the body of the resolved data
+                    compiler_val = yield [("RD", [variable, "value"])]
+                    compiler_body = yield [("RD", [compiler_val, "body"])]
+                    self.compiled[compiler_body] = compiled_function
 
         else:
             phase_link, returnvalue_link, new_phase = \