@@ -494,19 +494,17 @@ class Semantic {
494
494
495
495
// ----- Promotion ----------------------------------------------------
496
496
extension (addr : Addr )
497
- /** Whether the object is fully initialized
497
+ /** Whether the object is fully assigned
498
498
*
499
499
* It means all fields and outers are set. For performance, we don't check
500
500
* outers here, because Scala semantics ensure that they are always set
501
501
* before any user code in the constructor.
502
502
*
503
- * The interesting case is the outers for traits. The compiler synthesizes
504
- * proxy accessors for the outers in the class that extends the trait. As
505
- * those outers must be stable values, they are initialized immediately
506
- * following class parameters and before super constructor calls and user
507
- * code in the class body.
503
+ * Note that `isFullyFilled = true` does not mean we can use the
504
+ * object freely, as its fields or outers may still reach uninitialized
505
+ * objects.
508
506
*/
509
- def isFullyInitialized : Contextual [Boolean ] = log(" isFullyInitialized " + addr, printer) {
507
+ def isFullyFilled : Contextual [Boolean ] = log(" isFullyFilled " + addr, printer) {
510
508
val obj = heap(addr)
511
509
addr.klass.baseClasses.forall { klass =>
512
510
! klass.hasSource || {
@@ -525,7 +523,7 @@ class Semantic {
525
523
def tryPromoteCurrentObject : Contextual [Boolean ] = log(" tryPromoteCurrentObject " , printer) {
526
524
promoted.isCurrentObjectPromoted || {
527
525
// If we have all fields initialized, then we can promote This to hot.
528
- thisRef.isFullyInitialized && {
526
+ thisRef.isFullyFilled && {
529
527
promoted.promoteCurrent(thisRef)
530
528
true
531
529
}
@@ -591,7 +589,7 @@ class Semantic {
591
589
*/
592
590
def tryPromote (msg : String , source : Tree ): Contextual [List [Error ]] = log(" promote " + warm.show + " , promoted = " + promoted, printer) {
593
591
val classRef = warm.klass.appliedRef
594
- if classRef.memberClasses.nonEmpty || ! warm.isFullyInitialized then
592
+ if classRef.memberClasses.nonEmpty || ! warm.isFullyFilled then
595
593
return PromoteError (msg, source, trace.toVector) :: Nil
596
594
597
595
val fields = classRef.fields
0 commit comments