@@ -35,7 +35,7 @@ const ROArgsT = ReadOnlyVector{Any, ArgsT}
35
35
const ACDict{K, V} = Dict{K, V}
36
36
const ShapeVecT = SmallV{UnitRange{Int}}
37
37
const ShapeT = Union{Unknown, ShapeVecT}
38
- const IdentT = Union{IDType, Nothing}
38
+ const IdentT = Union{Tuple{UInt, IDType}, Tuple{ Nothing, Nothing} }
39
39
40
40
"""
41
41
Enum used to differentiate between variants of `BasicSymbolicImpl.ACTerm`.
@@ -171,22 +171,22 @@ override_properties(obj::BSImpl.Type) = override_properties(MData.variant_type(o
171
171
172
172
function override_properties (obj:: Type{<:BSImpl.Variant} )
173
173
@match obj begin
174
- :: Type{<:BSImpl.Sym} => (; id = nothing , hash2 = 0 )
175
- :: Type{<:BSImpl.Term} => (; id = nothing , hash = 0 , hash2 = 0 )
176
- :: Type{<:BSImpl.AddOrMul} => (; id = nothing , hash = 0 , hash2 = 0 )
177
- :: Type{<:BSImpl.Div} => (; id = nothing , hash2 = 0 )
178
- :: Type{<:BSImpl.Pow} => (; id = nothing , hash2 = 0 )
174
+ :: Type{<:BSImpl.Sym} => (; id = ( nothing , nothing ) , hash2 = 0 )
175
+ :: Type{<:BSImpl.Term} => (; id = ( nothing , nothing ) , hash = 0 , hash2 = 0 )
176
+ :: Type{<:BSImpl.AddOrMul} => (; id = ( nothing , nothing ) , hash = 0 , hash2 = 0 )
177
+ :: Type{<:BSImpl.Div} => (; id = ( nothing , nothing ) , hash2 = 0 )
178
+ :: Type{<:BSImpl.Pow} => (; id = ( nothing , nothing ) , hash2 = 0 )
179
179
_ => throw (UnimplementedForVariantError (override_properties, obj))
180
180
end
181
181
end
182
182
183
183
function ordered_override_properties (obj:: Type{<:BSImpl.Variant} )
184
184
@match obj begin
185
- :: Type{<:BSImpl.Sym} => (0 , nothing )
186
- :: Type{<:BSImpl.Term} => (0 , 0 , nothing )
187
- :: Type{<:BSImpl.AddOrMul} => (ArgsT (), 0 , 0 , nothing )
188
- :: Type{<:BSImpl.Div} => (0 , nothing )
189
- :: Type{<:BSImpl.Pow} => (0 , nothing )
185
+ :: Type{<:BSImpl.Sym} => (0 , ( nothing , nothing ) )
186
+ :: Type{<:BSImpl.Term} => (0 , 0 , ( nothing , nothing ) )
187
+ :: Type{<:BSImpl.AddOrMul} => (ArgsT (), 0 , 0 , ( nothing , nothing ) )
188
+ :: Type{<:BSImpl.Div} => (0 , ( nothing , nothing ) )
189
+ :: Type{<:BSImpl.Pow} => (0 , ( nothing , nothing ) )
190
190
_ => throw (UnimplementedForVariantError (override_properties, obj))
191
191
end
192
192
end
410
410
411
411
function isequal_bsimpl (a:: BSImpl.Type , b:: BSImpl.Type , full)
412
412
a === b && return true
413
- ida = a. id
414
- idb = b. id
413
+ taskida, ida = a. id
414
+ taskidb, idb = b. id
415
415
ida === idb && ida != = nothing && return true
416
416
typeof (a) === typeof (b) || return false
417
417
@@ -420,7 +420,7 @@ function isequal_bsimpl(a::BSImpl.Type, b::BSImpl.Type, full)
420
420
Ta === Tb || return false
421
421
422
422
423
- if full && ida != = idb && ida != = nothing && idb != = nothing
423
+ if full && ida != = idb && ida != = nothing && idb != = nothing && taskida == taskidb
424
424
return false
425
425
end
426
426
@@ -596,9 +596,10 @@ const ENABLE_HASHCONSING = Ref(true)
596
596
const WKD = TaskLocalValue {WeakKeyDict{BSImpl.Type, Nothing}} (WeakKeyDict{BSImpl. Type, Nothing})
597
597
const WVD = TaskLocalValue {WeakValueDict{UInt, BSImpl.Type}} (WeakValueDict{UInt, BSImpl. Type})
598
598
const WCS = TaskLocalValue {WeakCacheSet{BSImpl.Type}} (WeakCacheSet{BSImpl. Type})
599
+ const TASK_ID = TaskLocalValue {UInt} (() -> rand (UInt))
599
600
600
601
function generate_id ()
601
- return IDType ()
602
+ return (TASK_ID[], IDType () )
602
603
end
603
604
604
605
const TOTAL = TaskLocalValue {Int} (Returns (0 ))
@@ -651,7 +652,7 @@ function hashcons(s::BSImpl.Type{T})::BSImpl.Type{T} where {T}
651
652
# cache[h] = s
652
653
# k = s
653
654
# end
654
- if k. id === nothing
655
+ if k. id === ( nothing , nothing )
655
656
k. id = generate_id ()
656
657
end
657
658
return k
0 commit comments