Reflection: fix callBy for functions with 32 * N parameters

Optimization in 2439c22ff6 introduced an array `absentArguments` with
default values of all parameter types, which is copied in `callBy`
instead of being recomputed each time. Unfortunately, its size was
computed incorrectly: `maskSize` should only take into account
value parameters (see the `parameter.kind == KParameter.Kind.VALUE`
check in `callBy`).

This led to an issue where if the function had 32 * N value parameters
and 1 receiver parameter, `maskSize` was greater by 1 than expected,
which caused an exception due to mismatching argument array sizes.

 #KT-61304 Fixed
This commit is contained in:
Alexander Udalov
2023-08-31 17:59:30 +02:00
committed by Space Team
parent 421cd9929b
commit 34f52aaeda
10 changed files with 201 additions and 1 deletions
@@ -35784,6 +35784,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/reflection/callBy/jvmStaticInObject.kt");
}
@TestMetadata("kt61304.kt")
public void testKt61304() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/kt61304.kt");
}
@TestMetadata("manyArgumentsNoneDefaultConstructor.kt")
public void testManyArgumentsNoneDefaultConstructor() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/manyArgumentsNoneDefaultConstructor.kt");
@@ -35814,6 +35819,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/reflection/callBy/mfvcFunctionsAndConstructors.kt");
}
@TestMetadata("mfvcKt61304.kt")
public void testMfvcKt61304() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/mfvcKt61304.kt");
}
@TestMetadata("mfvcMembers.kt")
public void testMfvcMembers() throws Exception {
runTest("compiler/testData/codegen/box/reflection/callBy/mfvcMembers.kt");