|
@@ -160,27 +160,8 @@ class ModelverseKernel(object):
|
|
|
yield [("END_TRY", [])]
|
|
|
|
|
|
def execute_jit_internal(self, task_root, inst, taskname, params):
|
|
|
- print("EXEC INTERNAL")
|
|
|
- print("For instruction: " + str(inst))
|
|
|
- print("With params: " + str(params))
|
|
|
inst, = yield [("RD", [inst, "body"])]
|
|
|
- #gen = self.execute_jit(task_root, inst, taskname, params)
|
|
|
result, = yield [("CALL_ARGS", [self.execute_jit, [task_root, inst, taskname, params, False]])]
|
|
|
- #print("Got generator: " + str(gen))
|
|
|
-
|
|
|
- """
|
|
|
- def handle_jit_failed(exception):
|
|
|
- # Try again, but this time without the JIT.
|
|
|
- gen = self.get_inst_phase_generator(inst_v, self.phase_v, task_root)
|
|
|
- yield [("TAIL_CALL", [gen])]
|
|
|
-
|
|
|
- yield [("TRY", [])]
|
|
|
- yield [("CATCH", [jit.JitCompilationFailedException, handle_jit_failed])]
|
|
|
- result, = yield [("CALL", [gen])]
|
|
|
- yield [("END_TRY", [])]
|
|
|
-
|
|
|
- """
|
|
|
- print("FUNCTION " + str(self.jit.get_global_name(inst)) + " returned " + str(result))
|
|
|
raise primitive_functions.PrimitiveFinished(result)
|
|
|
|
|
|
def get_inst_phase_generator(self, inst_v, phase_v, task_root):
|
|
@@ -406,7 +387,6 @@ class ModelverseKernel(object):
|
|
|
if inst is None:
|
|
|
raise ValueError('body_id cannot be None: ' + str(suggested_name))
|
|
|
elif inst in self.jit.jitted_entry_points:
|
|
|
- print("Found previously compiled version: " + str(self.jit.jitted_entry_points[inst]))
|
|
|
raise primitive_functions.PrimitiveFinished(
|
|
|
self.jit.jit_globals[self.jit.jitted_entry_points[inst]])
|
|
|
|
|
@@ -416,8 +396,6 @@ class ModelverseKernel(object):
|
|
|
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)
|
|
|
- else:
|
|
|
- print("Found previously compiled version: " + str(suggested_name))
|
|
|
|
|
|
raise primitive_functions.PrimitiveFinished(compiled_func)
|
|
|
|
|
@@ -445,13 +423,11 @@ class ModelverseKernel(object):
|
|
|
# Have the JIT compile the function.
|
|
|
compiled_func, = yield [("CALL_ARGS", [self.jit_compile, (task_root, inst)])]
|
|
|
# Run the compiled function.
|
|
|
- print("Calling function %s with parameters: " % str(compiled_func) + str(parameters))
|
|
|
results = yield [("CALL_KWARGS", [compiled_func, parameters])]
|
|
|
if results is None:
|
|
|
raise Exception("%s: primitive finished without returning a value!" % (self.debug_info[taskname]))
|
|
|
else:
|
|
|
result, = results
|
|
|
- print("Finished: " + str(result))
|
|
|
|
|
|
if store:
|
|
|
# Clean up the current stack, as if a return happened
|