|
@@ -136,6 +136,27 @@ def __list_append(a, b):
|
|
|
b_tmp),
|
|
|
a_tmp.create_load())
|
|
|
|
|
|
+def __log(a):
|
|
|
+ # Original definition:
|
|
|
+ #
|
|
|
+ # def log(a, **remainder):
|
|
|
+ # a_value, = yield [("RV", [a])]
|
|
|
+ # print("== LOG == " + str(a_value))
|
|
|
+ # raise PrimitiveFinished(a)
|
|
|
+
|
|
|
+ a_tmp = tree_ir.StoreLocalInstruction(None, a)
|
|
|
+ return tree_ir.CompoundInstruction(
|
|
|
+ tree_ir.create_block(
|
|
|
+ a_tmp,
|
|
|
+ tree_ir.PrintInstruction(
|
|
|
+ tree_ir.BinaryInstruction(
|
|
|
+ tree_ir.LiteralInstruction("== LOG == "),
|
|
|
+ '+',
|
|
|
+ tree_ir.CallInstruction(
|
|
|
+ tree_ir.LoadGlobalInstruction('str'),
|
|
|
+ [tree_ir.ReadValueInstruction(a_tmp.create_load())])))),
|
|
|
+ a_tmp.create_load())
|
|
|
+
|
|
|
MISC_INTRINSICS = {
|
|
|
# Reference equality
|
|
|
'element_eq' :
|
|
@@ -251,7 +272,10 @@ MISC_INTRINSICS = {
|
|
|
create_get_length(tree_ir.ReadOutgoingEdgesInstruction(a))),
|
|
|
|
|
|
'list_read' : __list_read,
|
|
|
- 'list_append' : __list_append
|
|
|
+ 'list_append' : __list_append,
|
|
|
+
|
|
|
+ # log
|
|
|
+ 'log' : __log
|
|
|
}
|
|
|
|
|
|
def register_time_intrinsic(target_jit):
|