|
@@ -499,6 +499,7 @@ class ModelverseJit(object):
|
|
|
|
|
|
def handle_jit_exception(exception):
|
|
|
# If analysis fails, then a JitCompilationFailedException will be thrown.
|
|
|
+ print("EXCEPTION with mutable")
|
|
|
del self.compilation_dependencies[body_id]
|
|
|
for dep in dependencies:
|
|
|
self.mark_no_jit(dep)
|
|
@@ -723,7 +724,14 @@ class ModelverseJit(object):
|
|
|
tree_ir.LiteralInstruction(jit_runtime.FUNCTION_BODY_KEY)),
|
|
|
global_name)
|
|
|
|
|
|
+ def new_compile(self, body_id):
|
|
|
+ print("Compiling body ID " + str(body_id))
|
|
|
+ raise JitCompilationFailedException("Function was marked '%s'." % jit_runtime.MUTABLE_FUNCTION_KEY)
|
|
|
+
|
|
|
+ #raise primitive_functions.PrimitiveFinished("pass")
|
|
|
+
|
|
|
def compile_function_body_interpret(jit, function_name, body_id, task_root, header=None):
|
|
|
+ print("INTERPRET")
|
|
|
"""Create a function that invokes the interpreter on the given function."""
|
|
|
(parameter_ids, parameter_list, _), = yield [
|
|
|
("CALL_ARGS", [jit.jit_signature, (body_id,)])]
|
|
@@ -751,6 +759,7 @@ def compile_function_body_interpret(jit, function_name, body_id, task_root, head
|
|
|
def compile_function_body_baseline(
|
|
|
jit, function_name, body_id, task_root,
|
|
|
header=None, compatible_temporary_protects=False):
|
|
|
+ print("BASELINE")
|
|
|
"""Have the baseline JIT compile the function with the given name and body id."""
|
|
|
(parameter_ids, parameter_list, _), = yield [
|
|
|
("CALL_ARGS", [jit.jit_signature, (body_id,)])]
|
|
@@ -779,6 +788,25 @@ def compile_function_body_baseline(
|
|
|
jit.jit_define_function(function_name, constructed_function))
|
|
|
|
|
|
def compile_function_body_fast(jit, function_name, body_id, _):
|
|
|
+ print("FAST2")
|
|
|
+ """Have the fast JIT compile the function with the given name and body id."""
|
|
|
+ (parameter_ids, parameter_list, _), = yield [
|
|
|
+ ("CALL_ARGS", [jit.jit_signature, (body_id,)])]
|
|
|
+ param_dict = dict(list(zip(parameter_ids, parameter_list)))
|
|
|
+
|
|
|
+ print("Got body bytecode: " + str(body_id))
|
|
|
+ constructed_body, = yield [("CALL_ARGS", [jit.new_compile, (body_id,)])]
|
|
|
+ print("Constructed body:")
|
|
|
+ print(constructed_body)
|
|
|
+
|
|
|
+ constructed_function = create_bare_function(function_name, parameter_list, constructed_body)
|
|
|
+
|
|
|
+ # Convert the function definition to Python code, and compile it.
|
|
|
+ raise primitive_functions.PrimitiveFinished(
|
|
|
+ jit.jit_define_function(function_name, constructed_function))
|
|
|
+
|
|
|
+def compile_function_body_fast_original(jit, function_name, body_id, _):
|
|
|
+ print("FAST_ORIGINAL")
|
|
|
"""Have the fast JIT compile the function with the given name and body id."""
|
|
|
(parameter_ids, parameter_list, _), = yield [
|
|
|
("CALL_ARGS", [jit.jit_signature, (body_id,)])]
|
|
@@ -799,6 +827,7 @@ def compile_function_body_fast(jit, function_name, body_id, _):
|
|
|
|
|
|
# Optimize the tree that was generated.
|
|
|
constructed_body, = yield [("CALL_ARGS", [optimize_tree_ir, (constructed_body,)])]
|
|
|
+ print("OUTPUT: " + str(constructed_body))
|
|
|
constructed_function = create_bare_function(function_name, parameter_list, constructed_body)
|
|
|
|
|
|
# Convert the function definition to Python code, and compile it.
|
|
@@ -985,6 +1014,7 @@ class AdaptiveJitState(object):
|
|
|
def compile_function_body_adaptive(
|
|
|
jit, function_name, body_id, task_root,
|
|
|
temperature_heuristic=favor_loops):
|
|
|
+ print("ADAPTIVE")
|
|
|
"""Compile the function with the given name and body id. An execution engine is picked
|
|
|
automatically, and the function may be compiled again at a later time."""
|
|
|
# The general idea behind this compilation technique is to first use the baseline JIT
|
|
@@ -1004,9 +1034,8 @@ def compile_function_body_adaptive(
|
|
|
if jit.jit_success_log_function is not None:
|
|
|
jit.jit_success_log_function(
|
|
|
"Compiling '%s' with fast-jit." % function_name)
|
|
|
- yield [
|
|
|
- ("TAIL_CALL_ARGS",
|
|
|
- [compile_function_body_fast, (jit, function_name, body_id, task_root)])]
|
|
|
+ yield [("CALL_ARGS", [compile_function_body_fast, (jit, function_name, body_id, task_root)])]
|
|
|
+ print("NEXT...")
|
|
|
|
|
|
temperature_counter_name = jit.import_value(
|
|
|
initial_temperature, function_name + "_temperature_counter")
|