1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# D2 diagram of tvix-eval's `Value` type.
#
# can be rendered at https://play.d2lang.com/
#
# colours have meanings:
#
# yellow: recurses
# orange: heap allocation
# red: refcount
#
# this intentionally does *not* include some internal variants
Value -> Null
Value -> Bool
Value -> Integer
Value -> Float
Box*.style.fill: "lightsalmon"
Rc*.style.fill: "salmon"
Vec\<*.style.fill: "salmon"
Value -> String -> NixString -> "Box<str>"
Value -> Path -> "Box<PathBuf>" -> PathBuf
PathBuf.style.fill: "lightsalmon"
# attribute sets are kinda complicated
Value -> Attrs -> "Box<NixAttrs>" -> NixAttrs
NixAttrs -> Empty
NixAttrs -> KV
KV.style.fill: "LemonChiffon"
KV -> Value
KV -> Value
NixAttrs -> Map
Map -> "OrdMap<NixString, Value>" -> "MapEntry<NixString, Value>"
"OrdMap<NixString, Value>".style.fill: "lightsalmon"
"MapEntry<NixString, Value>".style.fill: "salmon"
"MapEntry<NixString, Value>".style.multiple: true
"MapEntry<NixString, Value>" -> NixString
"MapEntry<NixString, Value>" -> Value
"MapEntry<NixString, Value>".style.stroke-width: 15
"MapEntry<NixString, Value>".style.stroke: "lemonchiffon"
Value -> List -> NixList -> "Rc<imbl::Vector<Value>>"
"Rc<imbl::Vector<Value>>" -> "VecEntry<Value>" -> Value
"VecEntry<Value>".style.multiple: true
"VecEntry<Value>".style.fill: "salmon"
"VecEntry<Value>".style.stroke-width: 15
"VecEntry<Value>".style.stroke: "lemonchiffon"
# closures
Value -> Closure -> "Rc<Closure>" -> Closure
Closure -> "Rc<Lambda>" -> Lambda
Lambda -> Chunk
Lambda -> SmolStr: sometimes allocates
SmolStr.style.fill: "lightsalmon"
Lambda -> usize
Lambda -> "Option<Formals>" -> Formals
Formals -> "HashMap<NixString, bool>" -> "MapEntry<NixString, bool>"
"HashMap<NixString, bool>".style.fill: "lightsalmon"
"MapEntry<NixString, bool>".style.fill: "salmon"
"MapEntry<NixString, bool>".style.multiple: true
"MapEntry<NixString, bool>" -> NixString
Closure -> "Rc<Upvalues>" -> Upvalues
Upvalues -> "Vec<Value>"
"Vec<Value>" -> Value
"Vec<Value>".style.stroke-width: 15
"Vec<Value>".style.stroke: "lemonchiffon"
Upvalues -> "Option<Vec<Value>>"
"Option<Vec<Value>>" -> Value
"Option<Vec<Value>>".style.fill: "lightsalmon"
"Option<Vec<Value>>".style.stroke-width: 15
"Option<Vec<Value>>".style.stroke: "lemonchiffon"
Value -> Blueprint -> "Rc<Lambda>"
# builtins
Value -> Builtin -> "Box<BuiltinRepr>" -> BuiltinRepr
BuiltinRepr -> "Rc<dyn BuiltinGen>"
BuiltinRepr -> "Vec<Value>"
# thunks
Value -> Thunk -> "Rc<RefCell<ThunkRepr>>" -> ThunkRepr
ThunkRepr -> Suspended
Suspended -> "Rc<Lambda>"
Suspended -> "Rc<Upvalues>"
ThunkRepr -> Native -> "Box<dyn Fn() -> Result<Value, ErrorKind>>"
ThunkRepr -> Blackhole
ThunkRepr -> Evaluated -> Value
Evaluated.style.fill: "lemonchiffon"
|