|
@@ -106,7 +106,7 @@ class ModelverseJit(object):
|
|
|
'PrimitiveFinished' : primitive_functions.PrimitiveFinished,
|
|
|
jit_runtime.CALL_FUNCTION_NAME : jit_runtime.call_function,
|
|
|
jit_runtime.GET_INPUT_FUNCTION_NAME : jit_runtime.get_input,
|
|
|
- jit_runtime.JIT_THUNK_CONSTANT_FUNCTION_NAME : self.jit_thunk_constant,
|
|
|
+ jit_runtime.JIT_THUNK_CONSTANT_FUNCTION_NAME : self.jit_thunk_constant_function,
|
|
|
jit_runtime.JIT_THUNK_GLOBAL_FUNCTION_NAME : self.jit_thunk_global,
|
|
|
jit_runtime.UNREACHABLE_FUNCTION_NAME : jit_runtime.unreachable
|
|
|
}
|
|
@@ -582,8 +582,8 @@ class ModelverseJit(object):
|
|
|
self.jit_globals[thunk_name] = __jit_thunk
|
|
|
return thunk_name
|
|
|
|
|
|
- def jit_thunk_constant(self, body_id):
|
|
|
- """Creates a thunk from given body id.
|
|
|
+ def jit_thunk_constant_body(self, body_id):
|
|
|
+ """Creates a thunk from the 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."""
|
|
|
self.lookup_compiled_body(body_id)
|
|
@@ -597,6 +597,15 @@ class ModelverseJit(object):
|
|
|
# Looks like we'll just have to build that thunk after all.
|
|
|
return self.jit_thunk(tree_ir.LiteralInstruction(body_id))
|
|
|
|
|
|
+ def jit_thunk_constant_function(self, body_id):
|
|
|
+ """Creates a thunk from the given function id.
|
|
|
+ This thunk is a function that will invoke the function whose function id is given.
|
|
|
+ The thunk's name in the JIT's global context is returned."""
|
|
|
+ return self.jit_thunk(
|
|
|
+ tree_ir.ReadDictionaryValueInstruction(
|
|
|
+ tree_ir.LiteralInstruction(body_id),
|
|
|
+ tree_ir.LiteralInstruction(jit_runtime.FUNCTION_BODY_KEY)))
|
|
|
+
|
|
|
def jit_thunk_global(self, global_name):
|
|
|
"""Creates a thunk from given global name.
|
|
|
This thunk is a function that will invoke the function whose body id is given.
|