@@ -332,6 +332,7 @@ object Semantic {
332
332
heapBefore = this .heap
333
333
334
334
def revertHeapChanges ()(using State , Context ) =
335
+ printer.println(" reverting heap changes" )
335
336
this .heap.keys.foreach {
336
337
case warm : Warm =>
337
338
if heapBefore.contains(warm) then
@@ -342,6 +343,7 @@ object Semantic {
342
343
given Env = Env .empty
343
344
given Trace = Trace .empty
344
345
given Promoted = Promoted .empty
346
+ printer.println(" resetting " + warm)
345
347
warm.ensureObjectFreshAndPopulated()
346
348
case _ =>
347
349
}
@@ -469,28 +471,31 @@ object Semantic {
469
471
470
472
def ensureFresh ()(using Cache ): ref.type =
471
473
val obj = Objekt (ref.klass, fields = Map .empty, outers = Map (ref.klass -> ref.outer))
474
+ printer.println(" reset object " + ref)
472
475
cache.updateObject(ref, obj)
473
476
ref
474
477
475
478
/** Update field value of the abstract object
476
479
*
477
480
* Invariant: fields are immutable and only set once
478
481
*/
479
- def updateField (field : Symbol , value : Value )(using Cache , Context ): Unit =
482
+ def updateField (field : Symbol , value : Value )(using Cache , Context ): Unit = log( " set field " + field + " of " + ref + " to " + value) {
480
483
val obj = objekt
481
484
assert(! obj.hasField(field), field.show + " already init, new = " + value + " , old = " + obj.field(field) + " , ref = " + ref)
482
485
val obj2 = obj.copy(fields = obj.fields.updated(field, value))
483
486
cache.updateObject(ref, obj2)
487
+ }
484
488
485
489
/** Update the immediate outer of the given `klass` of the abstract object
486
490
*
487
491
* Invariant: outers are immutable and only set once
488
492
*/
489
- def updateOuter (klass : ClassSymbol , value : Value )(using Cache , Context ): Unit =
493
+ def updateOuter (klass : ClassSymbol , value : Value )(using Cache , Context ): Unit = log( " set outer " + klass + " of " + ref + " to " + value) {
490
494
val obj = objekt
491
495
assert(! obj.hasOuter(klass), klass.show + " already has outer, new = " + value + " , old = " + obj.outer(klass) + " , ref = " + ref)
492
496
val obj2 = obj.copy(outers = obj.outers.updated(klass, value))
493
497
cache.updateObject(ref, obj2)
498
+ }
494
499
end extension
495
500
496
501
extension (value : Value )
0 commit comments