unify simpler heapref cases

This commit is contained in:
Mirek Kratochvil 2023-01-14 23:11:59 +01:00
parent ab86f0f21f
commit 80cf4b03a4

View file

@ -129,6 +129,16 @@ proveStep = St.get >>= go
unify (HeapRef _) VoidRef = uok unify (HeapRef _) VoidRef = uok
unify VoidRef (HeapRef _) = uok unify VoidRef (HeapRef _) = uok
{- actual HeapRefs, these are dereferenced and then unified (sometimes with copying) -} {- actual HeapRefs, these are dereferenced and then unified (sometimes with copying) -}
unify (HeapRef hr) (HeapRef gr)
| BoundRef ha _ <- deref hr
, BoundRef ga _ <- deref gr
, ha == ga = uok
| FreeRef ha <- deref hr
, BoundRef ga _ <- deref gr = setHeap ha (HeapRef ga)
| BoundRef ha _ <- deref hr
, FreeRef ga <- deref gr = setHeap ga (HeapRef ha)
| FreeRef ha <- deref hr
, FreeRef ga <- deref gr = setHeap ha (HeapRef ga)
unify (HeapRef hr') g = unify (HeapRef hr') g =
case deref hr' of case deref hr' of
FreeRef hr -> FreeRef hr ->