KT-15862 Inline generic functions can unexpectedly box primitives
Previous version of the boxing/unboxing analysis treated merging boxed and non-boxed values as a hazard.
If such merged values are not used (e.g., early return + local variables reused in inlined calls),
corresponding boxing/unboxing operations still can be optimized out.
All information related to boxed value usage by instructions is moved to 'BoxedValueDescriptor'.
Introduce "tainted" (and "clean") boxed values, with the following rules:
merge(B, B) = B, if unboxed types are compatible,
T, otherwise
merge(B, X) = T
merge(T, X) = T
where
X is a non-boxed value,
B is a "clean" boxed value,
T is a "tainted" boxed value.
Postpone decision about value merge hazards until a "tainted" value is used.
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
@kotlin.Metadata
|
||||
public final class TaintedValuesKt {
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static method getOrElse(): int
|
||||
public final static method isNotEmpty(@org.jetbrains.annotations.NotNull p0: java.util.ArrayList): boolean
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
@kotlin.Metadata
|
||||
public final class TaintedValuesBoxKt {
|
||||
public final static field SIZE: int
|
||||
private final static @org.jetbrains.annotations.NotNull field arr: int[]
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
public final static @org.jetbrains.annotations.NotNull method getArr(): int[]
|
||||
public final static method put(p0: java.lang.Object, p1: int, @org.jetbrains.annotations.NotNull p2: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.NotNull p3: kotlin.jvm.functions.Function2, @org.jetbrains.annotations.NotNull p4: kotlin.jvm.functions.Function1, @org.jetbrains.annotations.NotNull p5: kotlin.jvm.functions.Function2): boolean
|
||||
public final static method putNonNegInt(p0: int): boolean
|
||||
}
|
||||
Reference in New Issue
Block a user