Skip to content

Commit 34ab48e

Browse files
committed
Add more debugging information
1 parent 4f58ce0 commit 34ab48e

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

compiler/src/dotty/tools/dotc/transform/init/Semantic.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ object Semantic {
332332
heapBefore = this.heap
333333

334334
def revertHeapChanges()(using State, Context) =
335+
printer.println("reverting heap changes")
335336
this.heap.keys.foreach {
336337
case warm: Warm =>
337338
if heapBefore.contains(warm) then
@@ -342,6 +343,7 @@ object Semantic {
342343
given Env = Env.empty
343344
given Trace = Trace.empty
344345
given Promoted = Promoted.empty
346+
printer.println("resetting " + warm)
345347
warm.ensureObjectFreshAndPopulated()
346348
case _ =>
347349
}
@@ -469,28 +471,31 @@ object Semantic {
469471

470472
def ensureFresh()(using Cache): ref.type =
471473
val obj = Objekt(ref.klass, fields = Map.empty, outers = Map(ref.klass -> ref.outer))
474+
printer.println("reset object " + ref)
472475
cache.updateObject(ref, obj)
473476
ref
474477

475478
/** Update field value of the abstract object
476479
*
477480
* Invariant: fields are immutable and only set once
478481
*/
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) {
480483
val obj = objekt
481484
assert(!obj.hasField(field), field.show + " already init, new = " + value + ", old = " + obj.field(field) + ", ref = " + ref)
482485
val obj2 = obj.copy(fields = obj.fields.updated(field, value))
483486
cache.updateObject(ref, obj2)
487+
}
484488

485489
/** Update the immediate outer of the given `klass` of the abstract object
486490
*
487491
* Invariant: outers are immutable and only set once
488492
*/
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) {
490494
val obj = objekt
491495
assert(!obj.hasOuter(klass), klass.show + " already has outer, new = " + value + ", old = " + obj.outer(klass) + ", ref = " + ref)
492496
val obj2 = obj.copy(outers = obj.outers.updated(klass, value))
493497
cache.updateObject(ref, obj2)
498+
}
494499
end extension
495500

496501
extension (value: Value)

0 commit comments

Comments
 (0)