publicclass Main { publicstaticvoid main(String[] args) { if (new Main().$opt$TestFloatPhi() != 33.0f) { thrownew Error("Unexpected result");
}
}
publicfloat $opt$TestFloatPhi() { float a = floatField; float b = 42.0f; if (test1) { // The phi for `a` will be found to be of type float.
a = otherFloatField; // The phi for `b` will be found to be of type int (constants in DEX).
b = 33.0f;
} // Use a different condition to avoid having dx being too clever. if (test2) { // Type propagation now realizes that `b` must be of type float. So // it requests a float equivalent for `b`. Because the phi for `a` is // next to the phi for `b` in the phi list, the compiler used to crash, // assuming that a float phi following a phi *must* be for the same DEX // register.
a = b;
} return a;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.