|
@@ -102,6 +102,7 @@ class ModelverseKernel(object):
|
|
|
def execute_rule(self, taskname):
|
|
|
task_root, = yield [("RD", [self.root, taskname])]
|
|
|
if task_root is None:
|
|
|
+ yield [("SLEEP", [0.01, False])]
|
|
|
yield None
|
|
|
else:
|
|
|
task_frame, = yield [("RD", [task_root, "frame"])]
|
|
@@ -128,7 +129,6 @@ class ModelverseKernel(object):
|
|
|
elif inst_v is None:
|
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[taskname], inst_v, self.phase_v))
|
|
|
else:
|
|
|
- #print("%-30s(%s) -- %s" % (inst_v["value"], self.phase_v, taskname))
|
|
|
gen = self.get_inst_phase_generator(inst_v, self.phase_v, task_root)
|
|
|
elif inst_v is None:
|
|
|
raise Exception("%s: error understanding command (%s, %s)" % (self.debug_info[taskname], inst_v, self.phase_v))
|
|
@@ -324,7 +324,7 @@ class ModelverseKernel(object):
|
|
|
|
|
|
param_list = "{" + ", ".join(["'%s': %s" % (k, v) for k, v in param_list.items()]) + "}"
|
|
|
actual_computation = "$$INDENT$$%s, = yield [('CALL_ARGS', [_mvk.execute_jit, (_root, %s['id'], _taskname, %s)])]\n" % (value, func_name, param_list)
|
|
|
-
|
|
|
+
|
|
|
if indent == 0:
|
|
|
# No indent, meaning that we use it inline
|
|
|
# Therefore, we output the prev and value individually
|
|
@@ -334,6 +334,7 @@ class ModelverseKernel(object):
|
|
|
# Therefore, we only do the yield
|
|
|
prev, instruction = prev_func_name + computation, actual_computation.replace("$$INDENT$$", " " * indent)
|
|
|
|
|
|
+
|
|
|
elif inst_type["value"] == "access":
|
|
|
value, = yield [("RD", [inst, "var"])]
|
|
|
(prev, instruction), = yield [("CALL_ARGS", [self.print_instruction, (value, 0, nested_indent)])]
|
|
@@ -452,15 +453,19 @@ class ModelverseKernel(object):
|
|
|
self.jit.register_compiled(inst, compiled_func, suggested_name)
|
|
|
|
|
|
# Run the compiled function.
|
|
|
- results = yield [("CALL_KWARGS", [compiled_func, params])]
|
|
|
- if results is None:
|
|
|
- raise Exception("%s: primitive finished without returning a value!" % (self.debug_info[taskname]))
|
|
|
+ if compiled_func == primitive_functions.dict_read:
|
|
|
+ if "value" not in params['b']:
|
|
|
+ params['b']['value'], = yield [("RV", [params['b']['id']])]
|
|
|
+ result, = yield [("RD", [params['a']['id'], params['b']['value']])]
|
|
|
+ result = {'id': result}
|
|
|
else:
|
|
|
- result, = results
|
|
|
-
|
|
|
- #print("Got result: " + str(result))
|
|
|
- if result is None:
|
|
|
- result = {'id': None, 'value': None}
|
|
|
+ results = yield [("CALL_KWARGS", [compiled_func, params])]
|
|
|
+ if results is None:
|
|
|
+ raise Exception("%s: primitive finished without returning a value!" % (self.debug_info[taskname]))
|
|
|
+ else:
|
|
|
+ result, = results
|
|
|
+ if result is None:
|
|
|
+ result = {'id': None, 'value': None}
|
|
|
|
|
|
if store:
|
|
|
# Clean up the current stack, as if a return happened
|