File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,26 @@ let localIdxData = Local(1)
1212struct InvocationKey : Hashable {
1313 let funcName : String
1414 let args : [ IR . Operand ]
15+ private let cachedHashValue : Int
16+
17+ init ( funcName: String , args: [ IR . Operand ] ) {
18+ self . funcName = funcName
19+ self . args = args
20+ var hasher = Hasher ( )
21+ hasher. combine ( funcName)
22+ hasher. combine ( args)
23+ self . cachedHashValue = hasher. finalize ( )
24+ }
25+
26+ func hash( into hasher: inout Hasher ) {
27+ hasher. combine ( cachedHashValue)
28+ }
29+ }
30+
31+ extension InvocationKey : Equatable {
32+ public static func == ( lhs: InvocationKey , rhs: InvocationKey ) -> Bool {
33+ lhs. cachedHashValue == rhs. cachedHashValue && lhs. funcName == rhs. funcName && lhs. args == rhs. args
34+ }
1535}
1636
1737/// MemoCache is a memoization cache of plan invocations
You can’t perform that action at this time.
0 commit comments