@@ -470,7 +470,7 @@ object Objects:
470
470
471
471
/** Store the heap as a mutable field to avoid threading it through the program. */
472
472
class MutableData (private [Heap ] var heap : Data ):
473
- private [Heap ] def writeUnion (addr : Addr , value : Value ): Unit =
473
+ private [Heap ] def writeJoin (addr : Addr , value : Value ): Unit =
474
474
heap.get(addr) match
475
475
case None =>
476
476
heap = heap.updated(addr, value)
@@ -479,7 +479,7 @@ object Objects:
479
479
val value2 = value.join(current)
480
480
if value2 != current then
481
481
heap = heap.updated(addr, value2)
482
-
482
+ end MutableData
483
483
484
484
def empty (): MutableData = new MutableData (Map .empty)
485
485
@@ -489,8 +489,8 @@ object Objects:
489
489
def read (addr : Addr )(using mutable : MutableData ): Value =
490
490
mutable.heap(addr)
491
491
492
- def writeUnion (addr : Addr , value : Value )(using mutable : MutableData ): Unit =
493
- mutable.writeUnion (addr, value)
492
+ def writeJoin (addr : Addr , value : Value )(using mutable : MutableData ): Unit =
493
+ mutable.writeJoin (addr, value)
494
494
495
495
def localVarAddr (regions : Regions .Data , sym : Symbol , owner : ClassSymbol ): Addr =
496
496
LocalVarAddr (regions, sym, owner)
@@ -639,7 +639,7 @@ object Objects:
639
639
if arr.addr.owner != State .currentObject then
640
640
errorMutateOtherStaticObject(State .currentObject, arr.addr.owner)
641
641
else
642
- Heap .writeUnion (arr.addr, args.tail.head.value)
642
+ Heap .writeJoin (arr.addr, args.tail.head.value)
643
643
Bottom
644
644
else
645
645
// Array.length is OK
@@ -660,7 +660,7 @@ object Objects:
660
660
if target.isOneOf(Flags .Method ) then
661
661
if target.owner == defn.ArrayModuleClass && target.name == nme.apply then
662
662
val arr = OfArray (State .currentObject, summon[Regions .Data ])
663
- Heap .writeUnion (arr.addr, args.map(_.value).join)
663
+ Heap .writeJoin (arr.addr, args.map(_.value).join)
664
664
arr
665
665
else if target.hasSource then
666
666
val cls = target.owner.enclosingClass.asClass
@@ -846,7 +846,7 @@ object Objects:
846
846
if addr.owner != State .currentObject then
847
847
errorMutateOtherStaticObject(State .currentObject, addr.owner)
848
848
else
849
- Heap .writeUnion (addr, rhs)
849
+ Heap .writeJoin (addr, rhs)
850
850
else
851
851
report.warning(" Mutating a field before its initialization: " + field.show + " . Calling trace:\n " + Trace .show, Trace .position)
852
852
end match
@@ -871,7 +871,7 @@ object Objects:
871
871
case outer : (Ref | Cold .type | Bottom .type ) =>
872
872
if klass == defn.ArrayClass then
873
873
val arr = OfArray (State .currentObject, summon[Regions .Data ])
874
- Heap .writeUnion (arr.addr, Bottom )
874
+ Heap .writeJoin (arr.addr, Bottom )
875
875
arr
876
876
else
877
877
// Widen the outer to finitize the domain. Arguments already widened in `evalArgs`.
@@ -907,7 +907,7 @@ object Objects:
907
907
if sym.is(Flags .Mutable ) then
908
908
val addr = Heap .localVarAddr(summon[Regions .Data ], sym, State .currentObject)
909
909
Env .setLocalVar(sym, addr)
910
- Heap .writeUnion (addr, value)
910
+ Heap .writeJoin (addr, value)
911
911
else
912
912
Env .setLocalVal(sym, value)
913
913
}
@@ -978,7 +978,7 @@ object Objects:
978
978
if addr.owner != State .currentObject then
979
979
errorMutateOtherStaticObject(State .currentObject, addr.owner)
980
980
else
981
- Heap .writeUnion (addr, value)
981
+ Heap .writeJoin (addr, value)
982
982
case _ =>
983
983
report.warning(" [Internal error] Variable not found " + sym.show + " \n env = " + env.show + " . Calling trace:\n " + Trace .show, Trace .position)
984
984
@@ -1541,7 +1541,7 @@ object Objects:
1541
1541
if acc.is(Flags .Mutable ) then
1542
1542
val addr = Heap .fieldVarAddr(summon[Regions .Data ], acc, State .currentObject)
1543
1543
thisV.initVar(acc, addr)
1544
- Heap .writeUnion (addr, value)
1544
+ Heap .writeJoin (addr, value)
1545
1545
else
1546
1546
thisV.initVal(acc, value)
1547
1547
printer.println(acc.show + " initialized with " + value)
@@ -1636,7 +1636,7 @@ object Objects:
1636
1636
if sym.is(Flags .Mutable ) then
1637
1637
val addr = Heap .fieldVarAddr(summon[Regions .Data ], sym, State .currentObject)
1638
1638
thisV.initVar(sym, addr)
1639
- Heap .writeUnion (addr, res)
1639
+ Heap .writeJoin (addr, res)
1640
1640
else
1641
1641
thisV.initVal(sym, res)
1642
1642
0 commit comments