|
@@ -328,7 +328,6 @@ class ModelverseKernel(object):
|
|
|
initial_instruction = inst
|
|
|
|
|
|
(params, _, is_mutable), = yield [("CALL_ARGS", [self.jit.jit_signature, (inst,)])]
|
|
|
- #if suggested_name is None or is_mutable:
|
|
|
if is_mutable:
|
|
|
print("Ignoring mutable or unreadable: %s" % suggested_name)
|
|
|
raise jit.JitCompilationFailedException("FAIL")
|
|
@@ -356,26 +355,29 @@ class ModelverseKernel(object):
|
|
|
|
|
|
def jit_compile(self, task_root, inst):
|
|
|
# Try to retrieve the suggested name.
|
|
|
- suggested_name = self.jit.get_global_name(inst)
|
|
|
- if suggested_name is None:
|
|
|
- suggested_name = "func_%s" % str(inst)
|
|
|
- #print("Exec function " + str(suggested_name))
|
|
|
-
|
|
|
# Have the JIT compile the function.
|
|
|
if inst is None:
|
|
|
+ suggested_name = self.jit.get_global_name(inst)
|
|
|
+ if suggested_name is None:
|
|
|
+ suggested_name = "func_%s" % str(inst)
|
|
|
raise ValueError('body_id cannot be None: ' + str(suggested_name))
|
|
|
+
|
|
|
elif inst in self.jit.jitted_entry_points:
|
|
|
raise primitive_functions.PrimitiveFinished(
|
|
|
self.jit.jit_globals[self.jit.jitted_entry_points[inst]])
|
|
|
-
|
|
|
- compiled_func = self.jit.lookup_compiled_body(inst)
|
|
|
- if compiled_func is None:
|
|
|
- compiled_func, = yield [("CALL_ARGS", [self.read_function, (inst, suggested_name)])]
|
|
|
- exec(str(compiled_func), self.jit.jit_globals)
|
|
|
- compiled_func = self.jit.jit_globals[suggested_name]
|
|
|
- self.jit.register_compiled(inst, compiled_func, suggested_name)
|
|
|
-
|
|
|
- raise primitive_functions.PrimitiveFinished(compiled_func)
|
|
|
+ else:
|
|
|
+ compiled_func = self.jit.lookup_compiled_body(inst)
|
|
|
+
|
|
|
+ if compiled_func is None:
|
|
|
+ suggested_name = self.jit.get_global_name(inst)
|
|
|
+ if suggested_name is None:
|
|
|
+ suggested_name = "func_%s" % str(inst)
|
|
|
+ compiled_func, = yield [("CALL_ARGS", [self.read_function, (inst, suggested_name)])]
|
|
|
+ exec(compiled_func, self.jit.jit_globals)
|
|
|
+ compiled_func = self.jit.jit_globals[suggested_name]
|
|
|
+ self.jit.register_compiled(inst, compiled_func, suggested_name)
|
|
|
+
|
|
|
+ raise primitive_functions.PrimitiveFinished(compiled_func)
|
|
|
|
|
|
def execute_jit(self, task_root, inst, taskname, params = {}, store=False):
|
|
|
# execute_jit
|