Commit Graph

2181 Commits

Author SHA1 Message Date
Svyatoslav Scherbina 1828f7a374 Native: fix curl sample test 2023-02-03 15:30:56 +00:00
Igor Chevdar 32ce254001 [K/N] Added a filecheck test on suspend lambdas tail calls 2023-02-03 11:14:54 +00:00
Igor Chevdar 707fbe7a6c [K/N] Follow-up for the fix for #KT-55869 2023-02-03 11:14:54 +00:00
Igor Chevdar c871ccc4dd [K/N][IR] Turned off partial tail call optimization
It is difficult to implement properly tail calls for a real coroutine (when there
are other non tail calls), because of continuation interception semantics. And the
benefits aren't clear at this point, so let's turn it off for now.
2023-02-03 11:14:53 +00:00
Igor Chevdar 716853dd00 [K/N][IR] Tail call optimization for suspend lambdas 2023-02-03 11:14:53 +00:00
Nikita Bobko ae661dd11b Fix :kotlin-native:backend.native compilation on CI
This commit fixes:
```
./gradlew :kotlin-native:backend.native:compileCompilerKotlin -PdeployVersion=1.9.0-dev-900
```

`-PdeployVersion=1.9.0-dev-900` is important for reproducibility (it's
not necessarily `1.9.0-dev-900` any version starting with `1.9.0-dev`
will reproduce the problem)
2023-02-02 10:56:20 +01:00
Dmitriy Novozhilov 89c42e20c9 [FIR] Consistently use _function_ instead of _functional_ in names of classes and functions 2023-02-02 08:24:52 +00:00
Dmitriy Novozhilov 67aa80562d [FE] Completely replace FunctionClassKind with FunctionalTypeKind
FunctionalTypeKind can be used in FE 1.0 too, so there is no need to
  keep both classes. Also, removal of FunctionClassKind simplifies work
  with FunctionalTypeKind in common code, like Analysis Api
2023-02-02 08:24:50 +00:00
Sergey Bogolepov 6c449e29cd [K/N] Add a link for the target deprecation message 2023-02-02 08:24:02 +00:00
Jake Wharton e821523b90 Implement RandomAccess on NS(Mutable)Array bridges
This communicates to runtime tests that calls to `get` are O(1).
2023-02-01 18:39:53 +02:00
Sergey Bogolepov 02c46d17aa [K/N] Add a trivial test coverage for use Foundation 2023-02-01 15:34:26 +00:00
Mark Mann ba4ba27afd Fix regression where was removed from generated modulemaps 2023-02-01 15:34:25 +00:00
Vladimir Sukharev 26b6c0b310 [K2/N] Unlock old testinfra runs with K2 frontend
Merge-request: KT-MR-8552
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-01 15:28:14 +00:00
Aleksei.Glushko b01ef8465a [K/N] Add ring/GenericArrayView bench
also .gitignore cmake-build-debug on all levels

Merge-request: KT-MR-8412
Merged-by: Alexey Glushko <aleksei.glushko@jetbrains.com>
2023-02-01 15:16:09 +00:00
Nikita Bobko 62b27b4613 Cleanup: drop KlibIrVersion
Review: https://jetbrains.team/p/kt/reviews/8401
In scope of: KT-55082

Because this version isn't used for anything. We have KotlinAbiVersion
to version the IR format.
2023-02-01 15:13:34 +01:00
Nikita Bobko dff13ec584 Minor klib cleanups
Review: https://jetbrains.team/p/kt/reviews/8401

- Code style
- Drop unused properties in kotlin-native/build.gradle
- kotlin-native/build.gradle: drop unused import
- use final instead of open when possible

This is just a cleanup commit. It neither fixes any issue/bug, nor
introduces new behaviour.

Feel free to revert this commit if you find out that it breaks something
2023-02-01 15:13:34 +01:00
Vladimir Sukharev 08489c5734 [K2/N] KT-56218 Serialize receiver annotations
Merge-request: KT-MR-8624
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-02-01 13:33:55 +00:00
Ivan Kochurkin 6bdd0edd6c [FIR2IR] Add Fir2IrCommonMemberStorage, get rid of merge in Fir2Ir storages
Extract DescriptorSignatureComposerStub and WrappedDescriptorSignatureComposer to separate classes
2023-02-01 11:42:46 +00:00
Ivan Kochurkin e601b01be2 [FIR2IR] Use single IrBuiltInsOverFir for all MPP source modules
^KT-56229 Fixed
2023-02-01 11:42:45 +00:00
Ivan Kochurkin 001b11f285 [FIR2IR] Use single SymbolTable and SignatureComposer for all MPP modules
Merge createModuleFragmentWithSignaturesIfNeeded and createModuleFragmentWithoutSignatures
into the createModuleFragmentWithSignaturesIfNeeded
2023-02-01 11:42:44 +00:00
Sebastian Sellmair b6ea04d789 [K/N] Don't add linkDependencies when serializing a metadata klib
^KT-56205 Verification Pending
2023-01-31 16:15:19 +00:00
Nikita Nazarov fe5a8f664a Add debug information for inline function parameters (#5050)
Add debug information for inline function parameters

Previously during debugging Kotlin/Native applications you couldn't inspect the inline function or inline lambda parameters. This happened because the debug information for them wasn't generated at all. To fix this issue we have to store the information about which expressions were inlined instead of which parameters. This commit adds a new mapping, which allows storing the required information during the inlining phase. The mapping is then reused during the bitcode generation phase to add the debug information for inline function parameters.

^KT-55440
2023-01-31 11:02:48 +01:00
Pavel Kunyavskiy cb655d2d37 [K/N] Fix work with adapted function references
Their parsing was totally incorrect for K2, and sometimes incorrect for
K1. After this commit it uses same code as for JVM.

^KT-55462
2023-01-30 19:44:49 +00:00
Svyatoslav Scherbina 7ef7d0e062 Native: fix Deprecation ObjCExport test after updating version to 1.9
Starting from language version 1.9, deprecation is not propagated
through overrides (see KT-47902 for more details).
As a result, after updating langauge version to 1.9 in 66544a4,
testObjCExport started to fail, because it expected the old behaviour.
This commit updates the test correspondingly.
2023-01-30 15:45:18 +00:00
Pavel Punegov c9aeadd31f [K/N] Remove old Compiler and Meta Version ^KT-55677 Fixed
* Replace it with KotlinCompilerVersion
* K/N version should be set now with `deployVersion`.
* Cleanup deprecated functions in older versions
 of the Gradle plugin
* Cleanup tests for older versions of compiler downloader

Merge-request: KT-MR-8436
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-01-30 13:10:08 +00:00
Svyatoslav Scherbina 322a8a443b Native: add included forward declarations into cinterop klib manifest
This allows the compiler to limit imports from "magic" packages like
cnames.structs to forward declarations actually present in dependent
cinterop klibs.

The manifest already had `exportForwardDeclarations` field, but
- it didn't include Objective-C forward declarations (@class, @protocol)
- it has a slightly different meaning (the export list enables importing
  the listed declarations through the interop package of the library,
  while the include list shouldn't do that), so we better avoid mixing
  them.
2023-01-30 11:00:33 +00:00
Svyatoslav Scherbina 86a29a7b07 Native: correct ObjCExport test for forward declarations
The test relies on the fact that any name can be imported from a "magic"
package like `objcnames.classes`.
This was the case for K1, but likely won't be for K2: the compiler
should allow importing only those names that are actually
forward-declared in a cinterop library.

This commit changes the test that way. In particular, moves it to a
different task that has a cinterop dependency.
2023-01-30 11:00:32 +00:00
Svyatoslav Scherbina 445d44b79a K2/Native: simplify forward declarations test to make it work with K2 2023-01-30 11:00:32 +00:00
Svyatoslav Scherbina f3ed006ed9 Native: add a test for forward declarations with two cinterop libs 2023-01-30 11:00:31 +00:00
Svyatoslav Scherbina d4f5d5297f K2/Native: simplify forward declarations test to make it work with K2 2023-01-30 11:00:31 +00:00
Svyatoslav Scherbina 46a85d9729 Native: add a test for cinterop forward declarations 2023-01-30 11:00:30 +00:00
Svyatoslav Scherbina f3c29e1707 K2/Native: fix ModuleDescriptor dependencies in fir2ir phase
Previous implementation set Nth ModuleDescriptor dependencies to the
first N modules. This is not always correct: for example, when producing
a metadata klib (-Xmetadata-klib) for HMPP, metadata dependencies might
have inexact or missing depends= in their manifests.

This commit sets ModuleDescriptor dependencies to all other
deserialized modules. The same approach is used for K1. That way, the
implementation is more reliable.

^KT-56071
2023-01-27 16:32:33 +00:00
Svyatoslav Scherbina f6fa78b653 K2/Native: fix builtIns predicate in fir2ir phase
Old implementation expected that builtIns should be based on a library
with no dependencies, usually stdlib. But that doesn't work properly in
some cases, e.g. when producing a metadata klib (-Xmetadata-klib) for
HMPP. In that case, some of the metadata dependencies can have no
depends= in the manifest, leading to the compiler choosing such a module
instead of stdlib.

This commit makes it look for a library that is explicitly stdlib
instead.

^KT-56071
2023-01-27 16:32:32 +00:00
Sergej Jaskiewicz bd18fd40ea [K/N] Remap type args of SAM interfaces in FunctionReferenceLowering
#KT-56188 Fixed
2023-01-27 15:26:32 +00:00
Sergej Jaskiewicz 61fc3e99b1 [K/N] Fix generics in FunctionReferenceLowering for more edge cases
There were still some cases where the generated function reference class
would contain references to generic parameters that were not in scope.
One example of that was `Array<*>::get`. Before this fix the generated
function reference class would still contain a reference to the
type parameter declared in the `Array` class.

Also, the logic of generifying the generated function reference class
was incorrect. For example, for function `fun <A, B> foo()` if we had
a reference `::foo<T, T>` (where `T` comes from the outer scope),
the class would still contain two generic parameter, despite that only
one generic parameter from the outer scope was referenced.
This is also fixed here.
2023-01-27 15:26:30 +00:00
Troels Bjerre Lund 73e420d69d [K/N] custom-alloc: Fix off-by-one in threshold
The existing threshold for determining between medium and large page
does not take the dummy block into account, meaning that an allocation
on the threshold will lead to a loop that only terminates when the
process goes out of memory.


Co-authored-by: Troels Lund <troels@google.com>

Merge-request: KOTLIN-MR-618
Merged-by: Alexander Shabalin <alexander.shabalin@jetbrains.com>
2023-01-27 14:03:55 +00:00
Sergey Bogolepov f5d4984274 Update HACKING.md 2023-01-26 17:49:06 +02:00
Sergey Bogolepov c074cf6635 [K/N] Update HACKING.md to reflect -Xsave-llvm-ir-directory 2023-01-26 14:32:49 +00:00
Sergey Bogolepov b9a7921b10 [K/N] Remove obsolete todo message
Since we run ReturnsInsertionPhase on per-file basis,
prerequisites check is triggered only if modules has files.
2023-01-26 14:32:49 +00:00
Sergey Bogolepov 362cff892b [K/N] Code cleanup 2023-01-26 14:32:49 +00:00
Sergey Bogolepov 9f4e086ff9 [K/N] Fix filecheck tests 2023-01-26 14:32:48 +00:00
Sergey Bogolepov 851d84a865 [K/N] Enable proper LLVM IR dump and verify actions
Also introduce -Xsave-llvm-ir-directory argument
that should be used instead of -Xtemporary-files-dir
as a location for LLVM IR from phases.
Motivation for this change: it is simpler to implement
and unties LLVM actions from the awful TempFiles class.
2023-01-26 14:32:48 +00:00
Sergey Bogolepov 0febffedbd [K/N] Add LlvmIrHolder adapter interface for debugging purposes
Similar to KotlinBackendIrHolder and BackendContextHolder interfaces.
2023-01-26 14:32:47 +00:00
Sergey Bogolepov 60ff50dc51 [K/N] Enable IR validation and dumping for more phases 2023-01-26 14:32:47 +00:00
Sergey Bogolepov 10f9000d46 [K/N] Add utility adapter interfaces for flexible phase processing
In the new dynamic driver we have various contexts, inputs and outputs.
To make it possible to validate and dump IR uniformly, we need a couple
of adapter interfaces that will be accessed from phase actions.
2023-01-26 14:32:46 +00:00
Sergey Bogolepov c828ac6167 [K/N] Re-enable lowering prerequisites 2023-01-26 14:32:46 +00:00
Sergey Bogolepov 4c11f6ff30 [K/N] Normalize lowering names 2023-01-26 14:32:46 +00:00
Sergey Bogolepov 5d44f01a88 [K/N] Remove old ToplevelPhases.kt
It contains only commented CheckSamSuperTypes phase which is disabled
for quite some time. If we ever need this lowering again it could be
found in this commit.
2023-01-26 14:32:45 +00:00
Sergey Bogolepov d7e44dc46a [K/N] Port lowerings from old builders to the new ones 2023-01-26 14:32:45 +00:00
Sergey Bogolepov f9d0755f94 [K/N] Introduce more createFileLoweringPhase overloads
They simplify porting from the old builders
2023-01-26 14:32:45 +00:00