[JVM] Do not unbox when local variable initialized with null.
This is already the case for straightline code such as
```
inline fun <R> f(size: Int, block: () -> R): R {
var result: R
result = block()
return result
}
```
However, if the local variable introduction happens at a merge
point as in the following example, we allow the unboxing but
only do it halfway. The initialization of the local is still
done with a null value.
```
inline fun <R> f(size: Int, block: () -> R): R {
var result: R
while (true) {
result = block()
if (size == 0) break
}
return result
}
```
This change disallows unboxing for this move complicated
case as well by bailing out if a local use is with a
TaintedBoxedValue (merge of Object and Integer).
^KT-48394 Fixed.
This commit is contained in:
committed by
TeamCityServer
parent
580f1d51f6
commit
8dee3c1ca0
+5
@@ -1510,6 +1510,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/kt46859.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt48394.kt")
|
||||
public void testKt48394() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/kt48394.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt5493.kt")
|
||||
public void testKt5493() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/boxingOptimization/kt5493.kt");
|
||||
|
||||
Reference in New Issue
Block a user