Use descriptor from resolved call to inline accessors

In case of inline it should be same descriptor (except of fake override), In general case getter could be synthetic accessor and in such case it's not inline
This commit is contained in:
Mikhael Bogdanov
2019-11-25 08:38:38 +01:00
parent 320c5f6f00
commit cf6f823d29
10 changed files with 69 additions and 13 deletions
@@ -1683,7 +1683,7 @@ public abstract class StackValue {
PropertyGetterDescriptor getterDescriptor = descriptor.getGetter();
assert getterDescriptor != null : "Getter descriptor should be not null for " + descriptor;
if (resolvedCall != null && getterDescriptor.isInline()) {
CallGenerator callGenerator = codegen.getOrCreateCallGenerator(resolvedCall, getterDescriptor);
CallGenerator callGenerator = codegen.getOrCreateCallGenerator(resolvedCall, ((PropertyDescriptor)resolvedCall.getResultingDescriptor()).getGetter());
callGenerator.processAndPutHiddenParameters(false);
callGenerator.genCall(getter, resolvedCall, false, codegen);
}
@@ -1764,7 +1764,7 @@ public abstract class StackValue {
PropertySetterDescriptor setterDescriptor = descriptor.getSetter();
if (resolvedCall != null && setterDescriptor != null && setterDescriptor.isInline()) {
assert setter != null : "Setter should be not null for " + descriptor;
CallGenerator callGenerator = codegen.getOrCreateCallGenerator(resolvedCall, setterDescriptor);
CallGenerator callGenerator = codegen.getOrCreateCallGenerator(resolvedCall, ((PropertyDescriptor)resolvedCall.getResultingDescriptor()).getSetter());
if (!skipReceiver) {
putReceiver(v, false);
}
-1
View File
@@ -1,6 +1,5 @@
// IGNORE_BACKEND_FIR: JVM_IR
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// JVM_TARGET: 1.8
open class A(val x: String) {
@@ -0,0 +1,27 @@
// IGNORE_BACKEND_FIR: JVM_IR
// FILE: 1.kt
// WITH_RUNTIME
package test
open class A(var result: String) {
var y
inline get() = if (this is C) this else A(result)
inline set(a: A) {
if (this is C) this else A(a.result.also { this.result = it })
}
}
object C : A("failA")
object B : A("failB")
// FILE: 2.kt
import test.A
import test.B.y
fun box(): String {
y = A("OK")
return y.result
}
@@ -2684,6 +2684,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
@@ -2684,6 +2684,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
@@ -14546,16 +14546,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Jvm8 extends AbstractLightAnalysisModeTest {
@TestMetadata("kt29242.kt")
public void ignoreKt29242() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/kt29242.kt");
}
@TestMetadata("kt33054.kt")
public void ignoreKt33054() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/kt33054.kt");
}
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
@@ -14629,6 +14619,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/jvm8/kt16588.kt");
}
@TestMetadata("kt29242.kt")
public void testKt29242() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/kt29242.kt");
}
@TestMetadata("kt33054.kt")
public void testKt33054() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/kt33054.kt");
}
@TestMetadata("kt6301.kt")
public void testKt6301() throws Exception {
runTest("compiler/testData/codegen/box/jvm8/kt6301.kt");
@@ -2684,6 +2684,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
@@ -2684,6 +2684,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
@@ -59,6 +59,11 @@ public class IrPropertyAccessorsInlineTestsGenerated extends AbstractIrPropertyA
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");
@@ -59,6 +59,11 @@ public class PropertyAccessorsInlineTestsGenerated extends AbstractPropertyAcces
runTest("compiler/testData/codegen/boxInline/property/augAssignmentAndIncViaConvention.kt");
}
@TestMetadata("fromObject.kt")
public void testFromObject() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/fromObject.kt");
}
@TestMetadata("kt22649.kt")
public void testKt22649() throws Exception {
runTest("compiler/testData/codegen/boxInline/property/kt22649.kt");