|
@@ -282,22 +282,17 @@ class ModelverseKernel(object):
|
|
|
value = "func_result_" + str(ModelverseKernel.counter)
|
|
|
ModelverseKernel.counter += 1
|
|
|
|
|
|
- if func_name in intrinsics:
|
|
|
- #TODO test and fix
|
|
|
- #actual_computation = value + " = " + intrinsics[func_name](*param_list)
|
|
|
- pass
|
|
|
- else:
|
|
|
- param_list = "{" + ", ".join(["'%s': %s" % (k, v) for k, v in param_list.items()]) + "}"
|
|
|
- actual_computation = "%s, = yield [('CALL_ARGS', [_mvk.execute_jit, (_root, %s['id'], _taskname, %s)])]\n" % (value, func_name, param_list)
|
|
|
+ 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
|
|
|
- prev, instruction = prev_func_name + computation + " " * nested_indent + actual_computation, value
|
|
|
+ prev, instruction = prev_func_name + computation + actual_computation.replace("$$INDENT$$", " " * nested_indent), value
|
|
|
else:
|
|
|
# Some indentation, meaning that we don't even use the return value
|
|
|
# Therefore, we only do the yield
|
|
|
- prev, instruction = prev_func_name + computation, " " * indent + actual_computation
|
|
|
+ prev, instruction = prev_func_name + computation, actual_computation.replace("$$INDENT$$", " " * indent)
|
|
|
|
|
|
elif inst_type["value"] == "access":
|
|
|
value, = yield [("RD", [inst, "var"])]
|
|
@@ -348,8 +343,8 @@ class ModelverseKernel(object):
|
|
|
#print(func)
|
|
|
|
|
|
# To write out all generated functions
|
|
|
- with open('/tmp/junk/%s' % suggested_name, 'w') as f:
|
|
|
- f.write(func)
|
|
|
+ #with open('/tmp/junk/%s' % suggested_name, 'w') as f:
|
|
|
+ # f.write(func)
|
|
|
|
|
|
yield [("RETURN", [func])]
|
|
|
|