ソースを参照

Manually compile set_overlap, as there does seem to be something bad going on there

Yentl Van Tendeloo 8 年 前
コミット
a7ab1ebc0b
2 ファイル変更11 行追加0 行削除
  1. 1 0
      bootstrap/semi_primitives.alc
  2. 10 0
      kernel/modelverse_kernel/compiled.py

+ 1 - 0
bootstrap/semi_primitives.alc

@@ -250,6 +250,7 @@ String function dict_to_string(d : Element):
 	return result!
 
 Element function set_overlap(sa : Element, sb : Element):
+	// This has a compiled version as there seems to be a non-deterministic bug in this code, or at least in the executed code
 	Element result
 	Element elem
 

+ 10 - 0
kernel/modelverse_kernel/compiled.py

@@ -207,3 +207,13 @@ def create_tuple(a, b, **remainder):
                      ("CD", [result, 1, b]),
                     ]
     raise PrimitiveFinished(result)
+
+def set_overlap(a, b, **remainder):
+    a_keys, b_keys, res = yield [("RDK", [a]), ("RDK", [b]), ("CN", [])]
+    a_values = yield [("RV", [i]) for i in a_keys]
+    b_values = yield [("RV", [i]) for i in b_keys]
+
+    result = set(a_values) & set(b_values)
+    yield [("CD", [res, value, res]) for value in result]
+
+    raise PrimitiveFinished(res)