|
@@ -56,11 +56,16 @@ class ModelverseJit(object):
|
|
|
self.jit_intrinsics = {}
|
|
|
self.compilation_dependencies = {}
|
|
|
self.jit_enabled = True
|
|
|
+ self.direct_calls_allowed = True
|
|
|
|
|
|
def set_jit_enabled(self, is_enabled=True):
|
|
|
"""Enables or disables the JIT."""
|
|
|
self.jit_enabled = is_enabled
|
|
|
|
|
|
+ def allow_direct_calls(self, is_allowed=True):
|
|
|
+ """Allows or disallows direct calls from jitted to jitted code."""
|
|
|
+ self.direct_calls_allowed = is_allowed
|
|
|
+
|
|
|
def mark_entry_point(self, body_id):
|
|
|
"""Marks the node with the given identifier as a function entry point."""
|
|
|
if body_id not in self.no_jit_entry_points and body_id not in self.jitted_entry_points:
|
|
@@ -873,6 +878,9 @@ class AnalysisState(object):
|
|
|
|
|
|
def try_analyze_direct_call(self, func_id, first_param_id):
|
|
|
"""Tries to analyze the given 'call' instruction as a direct call."""
|
|
|
+ if not self.jit.direct_calls_allowed:
|
|
|
+ raise JitCompilationFailedException('Direct calls are not allowed by the JIT.')
|
|
|
+
|
|
|
# Figure out what the 'func' instruction's type is.
|
|
|
func_instruction_op, = yield [("RV", [func_id])]
|
|
|
if func_instruction_op['value'] == 'access':
|
|
@@ -925,7 +933,7 @@ class AnalysisState(object):
|
|
|
inp = None
|
|
|
while True:
|
|
|
inp = yield gen.send(inp)
|
|
|
- # PrimitiveFinished exception will bubble up from here.
|
|
|
+ # PrimitiveFinished exception will bubble up from here.
|
|
|
|
|
|
instruction_analyzers = {
|
|
|
'if' : analyze_if,
|