Skip to content

Commit a4966d7

Browse files
authored
[NFC] Document that PossibleContents is not a distributive lattice (#7349)
As proven in #7331 (comment)
1 parent 9ae16af commit a4966d7

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/ir/possible-contents.h

+19
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,25 @@ namespace wasm {
6161
// not track what they might be, so we must assume the worst
6262
// in the calling code.
6363
//
64+
// This is a lattice, but it is not a distributive lattice
65+
// (https://en.wikipedia.org/wiki/Lattice_(order)#Distributivity):
66+
//
67+
// Cone(ref func) ^ [(ref.func $foo) u (ref.null func)] =
68+
// Cone(ref func) ^ Cone(ref null func) = ;; best shape that can
69+
// ;; hold both a ref.func
70+
// ;; and a null
71+
// Cone(ref func)
72+
//
73+
// while
74+
//
75+
// [Cone(ref func) ^ (ref.func $foo)] u [Cone(ref func) ^ (ref.null func)] =
76+
// (ref.func $foo) u none =
77+
// (ref.func $foo)
78+
//
79+
// "Fixing" this would require us to support a shape that includes both a
80+
// ref.func and a null, and does not "forget" the ref.func as Cone does. It is
81+
// not clear if that would be worth the complexity and overhead.
82+
//
6483
class PossibleContents {
6584
struct None : public std::monostate {};
6685

0 commit comments

Comments
 (0)