Commit Graph

95277 Commits

Author SHA1 Message Date
Evgeniy.Zhelenskiy 406bc4e497 [IR] Fix compilation of MFVC in different module
#KT-1179
2022-10-07 12:42:08 +00:00
Evgeniy.Zhelenskiy a788433aac [IR] Add MFVC generation tests
#KT-1179
2022-10-07 12:42:07 +00:00
Evgeniy.Zhelenskiy 73b0fac657 [IR] Implement equals call correct generation for MFVC
#KT-1179
2022-10-07 12:42:07 +00:00
Evgeniy.Zhelenskiy ee2d327243 [IR] Implement bridges generation for MFVC
#KT-1179
2022-10-07 12:42:06 +00:00
Evgeniy.Zhelenskiy 2896f5613d [IR] Implement MFVC basic flattening
#KT-1179
2022-10-07 12:42:06 +00:00
Evgeniy.Zhelenskiy 93ffd9f233 Revert "rra/zhelenskiy/flattening_impl"
This reverts commit b7f5c039a6.
2022-10-07 12:42:05 +00:00
Abduqodiri Qurbonzoda 71381ec8e2 [K/N] HashMap/HashSet doesn't reclaim storage after removing elements #KT-53310 2022-10-07 11:19:31 +00:00
Alexander Udalov 4dcf50d483 Fix reflection for repeated annotations with array arguments
This is related to 8308f5d7d3 (KT-44977).

It turns out that it's necessary to create `ArrayValue` with a
precomputed type not only in case of annotations stored directly in
Kotlin metadata (i.e. annotations on types and type parameters), but
also for arguments of repeated annotations. The reason is that repeated
annotations are stored in an array themselves, as an argument to another
(container) annotation. The annotation-reading code unwraps this array
to load repeated annotations as individual instances of
`AnnotationDescriptor`, but in contrast to loading normal annotations,
it doesn't set `source` to the reflection object, it uses `NO_SOURCE`
(see BinaryClassAnnotationAndConstantLoaderImpl.AbstractAnnotationArgumentVisitor.visitArray).

So when kotlin-reflect is later asked for the arguments of the
annotation, it needs to recreate the reflection object from
`AnnotationDescriptor` in `util.kt`. Doing so requires knowing the array
type, which is now present because we're creating a `TypedArrayValue`
(previously `DeserializedArrayValue`) in places where arrays are read as
annotation arguments.

Alternative solution would be to fix source passed to
`AnnotationDescriptorImpl` in the annotation-reading code, but that
seems a bit messy because the code is very abstract and is used in lots
of other places.

 #KT-53279 Fixed
2022-10-07 10:48:51 +00:00
Alexander Udalov 51ce829b96 Fix reflection class lookup in default package
Do not append "." to the name of the class in the default package.
2022-10-07 10:48:51 +00:00
Dmitriy Novozhilov e290fa5f7b Add workaround for KT-54318 2022-10-07 10:38:52 +00:00
Dmitriy Novozhilov 5c1eaa6fa4 Advance bootstrap to 1.8.20-dev-649 2022-10-07 10:38:52 +00:00
pyos 46d7b66e59 FIR CFG: remove liveness analysis from lambda reassignment analyzer
Handling try/catch and break/continue is too hard here, and failing to
do that properly can create incorrect smartcast. Better be conservative
and assume all code is live.
2022-10-07 08:56:05 +00:00
pyos 3160470201 Minor: change a test to be more precise 2022-10-07 08:56:04 +00:00
pyos a9ae1fcdf9 FIR CFG: handle loops and try/catch when analyzing smartcasts in lambdas
See KT-50092
2022-10-07 08:56:04 +00:00
pyos d054617b8e FIR CFG: handle reassignments with explicit receivers more precisely
When a looping control structure has a reassignment with an explicit
receiver, we don't need to erase its smartcast info as it has to be a
non-local property and is thus automatically unstable anyway. However,
we should still do that upon reaching the assignment itself for slightly
more precise error messages (as the property not just "could be"
reassigned, but *has been* reassigned already).
2022-10-07 08:56:03 +00:00
pyos 77c2601382 Add a test where a local variable has the same name as a property 2022-10-07 08:56:02 +00:00
Ilya Goncharov 03bea0dbaa [Gradle, JS] Disable test when difference between ABI 2022-10-07 08:46:50 +00:00
Evgeniy.Zhelenskiy b7f5c039a6 rra/zhelenskiy/flattening_impl
[IR] Remove unused MFVC getters

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Add context receivers test, fix a flattening fields bug

Signed-off-by: Evgeniy.Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>

#KT-1179

[IR] Support `try` for MFVC

#KT-1179

[IR] Support `if` and `when` for MFVC, fix several bugs, refactor

#KT-1179

[IR] Rename MFVC tests + Add test for get-field optimization

#KT-1179

[IR] Suppress temporary test failing on Android

Bug is fixed in https://jetbrains.team/p/kt/reviews/6452

#KT-1179

[IR] Document the new MFVC lowering classes when necessary

#KT-1179

[IR] Correct work of the new MFVC lowering classes

#KT-1179

[IR] Prepare MFVC-lowering for the new MFVC classes

#KT-1179

[IR] Fix MFVC with type arguments/parameters

#KT-1179

[IR] Support MFVC with type parameters

#KT-1179

[IR] Integrate MFVC with Inline classes

#KT-1179

[IR] Fix compilation of MFVC in different module

#KT-1179

[IR] Add MFVC generation tests

#KT-1179

[IR] Implement equals call correct generation for MFVC

#KT-1179

[IR] Implement bridges generation for MFVC

#KT-1179

[IR] Implement MFVC basic flattening

#KT-1179

Merge-request: KT-MR-6213
Merged-by: Evgeniy Zhelenskiy <Evgeniy.Zhelenskiy@jetbrains.com>
2022-10-06 20:45:45 +00:00
Alexander Shabalin 5c9802ae84 [K/N] Optimize intrusive_forward_list usage in GCs ^KT-54163
* Add fallible push to intrusive_forward_list.
* Add fallible pop to intrusive_forward_list.
* Get rid of size_ member in intrusive_forward_list.
* Force all intrusive_forward_list items to have non-null next().
* Get rid of explicit colors in STMS and CMS.
* Do not queue weak reference for later processing in Mark.

Merge-request: KT-MR-7263
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2022-10-06 20:16:53 +00:00
Nikolay Krasko e7074e8a92 Fix flaky TARGET_JVM_VERSION_ATTRIBUTE presence in gradle plugins
For some reason TARGET_JVM_VERSION_ATTRIBUTE was not always set in the
resulting artifacts for runtimeElementsConfigurationName and
apiElementsConfigurationName variants

It could be reproduced locally with by executing
`gradle kotlin-allopen:publishToMavenLocal`

The fix can be checked via
`gradle kotlin-allopen:outgoingVariants`

^KTI-920 Fixed
2022-10-06 13:43:19 +00:00
Sergey Bogolepov d7fff3ca01 [K/N] Add -Xforce-compiler-driver=(static, dynamic) flag
Useful for development purposes when one wants to compare
the outputs of different drivers.
2022-10-06 13:10:50 +00:00
Sergey Bogolepov 6ef4277d89 [K/N] Introduce multiple compiler drivers
We want to move from current compilation pipeline
that is defined in TopLevelPhases.kt to a "dynamic" one.
The main drawback of the current one is that it is built
around single Context, single IR module, single compiler output, etc.
It is now as flexible as Kotlin/Native compiler requires.
For example, it is pretty hard to support multiple Apple frameworks
or a proper separate compilation.
To mitigate this problem, we are going to move to a new "dynamic"
compiler pipeline that relies on an explicit data passing between
different compiler phases. For example, it allows to use single phase
output as an input for multiple independent subsequent phases. Or
vice versa, e.g. use outputs of multiple "produce object file" phases by
a single linker phase.

This commit introduces `CompilerDriver` hierarchy which is required
during transition period.
2022-10-06 13:10:50 +00:00
Alexander Korepanov 89d3060e00 [JS IR] Drop unused JsRecordExtractedLocalClasses logic 2022-10-06 11:56:06 +00:00
Alexander Korepanov 86c72a5b9e [JS IR] Drop unused all export collecting logic 2022-10-06 11:56:06 +00:00
Steven Schäfer 93bf54266a FIR: Implement moduleDescriptor in Fir2IrPluginContext
A ModuleDescriptor is needed to create external package fragments with
descriptors (see JvmSymbols.kt). Descriptorless external package
fragments can fail in code using obsolete descriptor based APIs.
2022-10-06 10:37:28 +00:00
Pavel Punegov 6b97a7657d [K/N] Publish bundles to maven
Makes build be able to publish bundles to the maven. It uses common
properties and settings as all other Kotlin publications.
Add usage of the Gradle base plugin and correct version and name setting
for archive tasks
2022-10-06 12:18:48 +02:00
Sebastian Sellmair 127c5120dd Only fail parsing KotlinToolingVersion if parsing major or minor fails
^KT-54301 Verification Pending
2022-10-06 07:54:41 +00:00
Igor Chevdar 05016596df [K/N][codegen] Refactored debug info building 2022-10-06 07:12:32 +00:00
Dmitriy Novozhilov 9b63dde1c3 Add error-level OptIn on safeAs, cast and assertedCast functions in addToStdlib
Usage of this function is unsafe because it does not have native compiler
  support. This means that compiler won't report UNCHECKED_CAST,
  CAST_NEVER_SUCCEED or similar diagnostics in case of error cast
  (which can happen immediately or after some refactoring of class hierarchy)
2022-10-06 06:57:07 +00:00
Dmitriy Novozhilov 1cd4f3ad2f [FIR] Get rid of all usages of cast in FIR modules 2022-10-06 06:57:06 +00:00
Dmitriy Novozhilov ee21c966e1 [FIR] Get rid of all usages of safeAs in FIR modules 2022-10-06 06:57:06 +00:00
pyos 8d33de4297 JVM: partially reify typeOf and signatures as soon as possible
E.g. when substituting T -> Array<T>, write the bytecode for the
Array<...> part for typeOf.

This fixes various issues where either Array nesting levels, nullability
information (for typeOf), or entire reification markers were missing,
causing incorrect outputs ranging from missing `?`s to missing `[]`s to
just reified types not really being reified.

^KT-53761 Fixed
2022-10-06 00:58:25 +02:00
Steven Schäfer 2e6817042c IR Validation: Skip INVISIBLE_FAKE members when validating descriptors 2022-10-05 23:48:18 +02:00
Steven Schäfer 1567b27090 Psi2IR: Fix IR types for Java property setters with non-Unit return type 2022-10-05 23:48:18 +02:00
Steven Schäfer 31807a7977 Tests: Print backend errors in test results 2022-10-05 23:48:18 +02:00
Steven Schäfer 860615ece1 JVM IR: Fix unbound symbols in IrPluginContext 2022-10-05 23:48:18 +02:00
Anton Lakotka c358df7033 [Gradle] Include WATCHOS_DEVICE_ARM64 to Commonize unix platform test
^KT-53107
2022-10-05 19:32:05 +00:00
Anton Lakotka e57f9384b9 [Gradle] Use KonanTarget's name instead of calling toString()
^KT-53107
2022-10-05 19:32:04 +00:00
Anton Lakotka eb5a2f65bd [Gradle] Fix tests after adding watchosDeviceArm64 target
^KT-53107
2022-10-05 19:32:04 +00:00
Anton Lakotka fd5c061c0b [Gradle] Use more granular arm64 clang macro's for fat frameworks
After introducing watchOsDeviceArm64 target it conflicted with existing
watchOsArm64 target. Because both having the same Konan Architecture as
Arm64. This is not entirely correct and actual
architectures are different. So it requires more precise macros for
fat framework.

* __ARM64_ARCH_8_32__ for `watchOsArm64` which is based on `arm64_32`
* __ARM64_ARCH_8__ for other arm64 devices including `watchOsDeviceArm64`

^KT-53107
2022-10-05 19:32:03 +00:00
Anton Lakotka 1b3cc0dfaa [Gradle] Register watchosDeviceArm64 in commonizer
^KT-53107
2022-10-05 19:32:03 +00:00
Anton Lakotka 1b7f673e94 [Gradle] Register watchosDeviceArm64 in apple-specific tasks
^KT-53107
2022-10-05 19:32:03 +00:00
Anton Lakotka efa331feed [Gradle] Add arm64 architecture of watchos to AppleSdk object
^KT-53107
2022-10-05 19:32:02 +00:00
Anton Lakotka 640ba1ecfa [Gradle] Add watchosDeviceArm64 to nativeTargetsWithSimulatorTests
^KT-53107
2022-10-05 19:32:02 +00:00
Anton Lakotka 02c9cf74b4 [Gradle] Add watchosDeviceArm64 to KotlinArtifactsExtension
Generate via `generateAbstractKotlinArtifactsExtensionImplementation`

^KT-53107
2022-10-05 19:32:02 +00:00
Anton Lakotka 54d21634aa [Gradle, KPM] Add watchosDeviceArm64 KPM Variant
Generate via `generateKpmNativeVariants`

^KT-53107
2022-10-05 19:32:01 +00:00
Anton Lakotka 3fe5601a70 [Gradle] Add watchosDeviceArm64 target preset
Generate via `generateMppTargetContainerWithPresets`

^KT-53107 Verification Pending
2022-10-05 19:32:01 +00:00
Ilya Kirillov fceb3425c8 [Analysis API FIR] fix invalid usages of CachedValue
it should not cache map as values are stored on soft references
2022-10-05 15:53:54 +00:00
Ilya Kirillov 457069090b [Analysis API FIR] fix LLFirResolveSession creation for KtNotUnderContentRootModule 2022-10-05 15:53:54 +00:00
Ilya Kirillov 4de311f671 [Analysis API FIR] remove unused CachingKtAnalysisSessionProvider.getFirResolveSession(KtSymbol) 2022-10-05 15:53:53 +00:00