|
@@ -196,7 +196,10 @@ class ModelverseJit(object):
|
|
|
def get_compiled_name(self, body_id):
|
|
|
"""Gets the name of the compiled version of the given body node in the JIT
|
|
|
global state."""
|
|
|
- return self.jitted_entry_points[body_id]
|
|
|
+ if body_id in self.jitted_entry_points:
|
|
|
+ return self.jitted_entry_points[body_id]
|
|
|
+ else:
|
|
|
+ return None
|
|
|
|
|
|
def mark_no_jit(self, body_id):
|
|
|
"""Informs the JIT that the node with the given identifier is a function entry
|
|
@@ -562,11 +565,13 @@ class ModelverseJit(object):
|
|
|
"""Creates a thunk from given body id.
|
|
|
This thunk is a function that will invoke the function whose body id is given.
|
|
|
The thunk's name in the JIT's global context is returned."""
|
|
|
- if self.lookup_compiled_body(body_id) is not None:
|
|
|
+ self.lookup_compiled_body(body_id)
|
|
|
+ compiled_name = self.get_compiled_name(body_id)
|
|
|
+ if compiled_name is not None:
|
|
|
# We might have compiled the function with the given body id already. In that case,
|
|
|
# we need not bother with constructing the thunk; we can return the compiled function
|
|
|
# right away.
|
|
|
- return self.get_compiled_name(body_id)
|
|
|
+ return compiled_name
|
|
|
else:
|
|
|
# Looks like we'll just have to build that thunk after all.
|
|
|
return self.jit_thunk(tree_ir.LiteralInstruction(body_id))
|
|
@@ -579,8 +584,11 @@ class ModelverseJit(object):
|
|
|
# we need not bother with constructing the thunk; we can return the compiled function
|
|
|
# right away.
|
|
|
body_id = self.get_global_body_id(global_name)
|
|
|
- if body_id is not None and self.lookup_compiled_body(body_id) is not None:
|
|
|
- return self.get_compiled_name(body_id)
|
|
|
+ if body_id is not None:
|
|
|
+ self.lookup_compiled_body(body_id)
|
|
|
+ compiled_name = self.get_compiled_name(body_id)
|
|
|
+ if compiled_name is not None:
|
|
|
+ return compiled_name
|
|
|
|
|
|
# Looks like we'll just have to build that thunk after all.
|
|
|
# We want to look up the global function like so
|