Commit Graph

560 Commits

Author SHA1 Message Date
Pavel Kunyavskiy d127815626 Refactor DataClassMembersGenerator.kt for better work with LazyIr
^KT-49428
2021-11-03 07:22:28 +00:00
Pavel Kunyavskiy f4a88bde4e [K/N] Force static constants and boxing caches be same values
^KT-49403
2021-11-03 07:21:25 +00:00
Elena Lepilkina 1b4ee63f30 [K/N] Deprecate and remove from supported list relaxed memory model 2021-11-02 12:04:46 +00:00
Elena Lepilkina f67941e244 [K/N] Replaced safe points to prologue 2021-11-02 12:04:45 +00:00
Elena Lepilkina 15dcfa2837 [K/N] Fix new FileCheck tests after rebase 2021-11-02 12:04:45 +00:00
Elena Lepilkina d8c9536edd [K/N] Fixes in tests and check function in optimized mode 2021-11-02 12:04:44 +00:00
Elena Lepilkina a878b2e530 [K/N] Changed condition for adding EnterFrame/LeaveFrame 2021-11-02 12:04:43 +00:00
Elena Lepilkina 27490ca7ce [K/N] Removed extra consition for C to Kotlin bridges because they have already needed annotation 2021-11-02 12:04:43 +00:00
Elena Lepilkina 23e5079391 [K/N] Added test for checking C callback set with Kotlin function throwing exception 2021-11-02 12:04:43 +00:00
Elena Lepilkina 751f1a3b91 [K/N] Added FileCheck for noreturn attribute absence for suspend functions 2021-11-02 12:04:42 +00:00
Elena Lepilkina 48e3df5224 [K/N] Small refactoring (review fixes) 2021-11-02 12:04:42 +00:00
Elena Lepilkina b716872988 [K/N] All bridges should have cleanup landingpad block (BB with return can be called before setting terminated function used as reason to add Enter/Leave frame functions) 2021-11-02 12:04:41 +00:00
Elena Lepilkina 2d72f4d5a9 [K/N] Added checks for tests that current frame after catch is right 2021-11-02 12:04:40 +00:00
Elena Lepilkina ccddf5b2d5 [K/N] Don't add safe point and state switching after setCurrentFrame in cleanup landingpad 2021-11-02 12:04:40 +00:00
Elena Lepilkina 28e30f7a45 [K/N] Replace thread state switching in objC interop before setting frame in kandingpad block 2021-11-02 12:04:40 +00:00
Elena Lepilkina c228bfb18f [K/N] Fix ObjC bridges LeaveFrame generation (return values in bridges are produced before epilogue block) 2021-11-02 12:04:39 +00:00
Elena Lepilkina dba645bce1 [K/N] Fix FileCheck test, now compiler produces call instruction 2021-11-02 12:04:39 +00:00
Elena Lepilkina 555bcc0adb [K/N] Don't set noreturn attribute for suspend functions to prevent LLVM SimplifySFG Pass from removing needed BB 2021-11-02 12:04:38 +00:00
Elena Lepilkina a8c1a31be9 [K/N] Added setting frame in catch block in C bridges 2021-11-02 12:04:38 +00:00
Elena Lepilkina c294365068 [K/N] Catch exceptions in CAdapters when caches enabled (KT-47828 fixed) 2021-11-02 12:04:38 +00:00
Elena Lepilkina d8b456e8b6 [K/N] Rework code generation for exception handler 2021-11-02 12:04:37 +00:00
Elena Lepilkina cde51ecc3a [K/N] Added function SetCurrentFrame to use in unwind block 2021-11-02 12:04:37 +00:00
Sergey Bogolepov d072a3ca59 [K/N] Fix fileCheckTest temporary files dir 2021-10-29 04:07:31 +00:00
Sergey Bogolepov 95bd5fcc4b [K/N] Update filecheck tests for different ABIs 2021-10-29 04:07:31 +00:00
Sergey Bogolepov 49fdeb73ee [K/N] Make default LLVM attributes target-specific
Unfortunately, the world of native development is diverse,
and we can't generate one bitcode that is correct on every platform.
What is important to us is that AAPCS64 and Windows x64 extend
<32 bit arguments on callee side, so we can't use zext/sext args for them.
2021-10-29 04:07:30 +00:00
Sergey Bogolepov fdd020eab6 [K/N] Tests for function attributes in bitcode generator
Besides, well, tests themselves, this commit extends FileCheck infra to
make it possible to test bitcode for direct and reverse interop.
2021-10-29 04:07:30 +00:00
Sergey Bogolepov 851f4d86d9 [K/N] Include cstubs into -Xsave-llvm-ir
This way we are able to FileCheck interop bridges.
2021-10-29 04:07:29 +00:00
Sergey Bogolepov 71fb8f90d4 [K/N] Drop UnsignedValuePassing
We don't need it anymore since codegen now handles unsigned types.
2021-10-29 04:07:29 +00:00
Sergey Bogolepov e37d669dc3 [K/N] Opt-in for meaningful names for in "objc2kotlin" bridges
It is hard to run FileCheck tests over generated ObjC bridges because
they share the same name ("objc2kotlin"). To overcome this hurdle,
this commit introduces a compiler flag that appends function name to
"objc2_kotlin". This change might be useful for end-users, for example,
it makes stacktraces more readable. But it will require additional
testing and polishing which is out of the scope of this change.
2021-10-29 04:07:28 +00:00
Sergey Bogolepov cf3296c94c [K/N] LLVM attributes at call-sites
(I messed up commit history and all changes had to be squashed. Sorry.)

The commit is originated from KT-48591. The root of the problem is
following: we unconditionally added sext to all value parameters of
imported functions. To fix this problem we have to pass zext/sext
depending on the parameter type.

To make things right and future-proof, we decided to refactor
a significant part of IR to bitcode translator: when generating callsite
compiler "looks" at callee and applies its attributes to the callsite.
There are several sources of attributes:
1. External LLVM functions from runtime: just copy-paste attributes.
2. Direct IR calls: infer attributes from the declaration.
3. Virtual calls: use available declaration, so almost the same as prev.
4. External declarations functions: manual labor!

Specifying attributes at all callsites (including Kotlin->Kotlin) makes
things uniform and a little easier to implement.
All in all, the delta is significant, but comprehensible. In some places
I managed to make it seamless by changing declaration type and its
usages types simultaneously. In others (ObjCExport), unfortunately,
things got a little messy.

#KT-48722 fixed
2021-10-29 04:07:28 +00:00
Alexander Shabalin c678702847 [K/N] Add tests on Atomic integers ^KT-49348 2021-10-27 13:54:35 +00:00
Elena Lepilkina 453e4b1830 [K/N] Added FileCheck tests on bound check elimination 2021-10-27 12:02:06 +00:00
Pavel Kunyavskiy 4b49356a56 [K/N] Remove some descriptor usages from lowerings 2021-10-26 13:26:04 +00:00
Pavel Kunyavskiy 55ac3e78d2 [K/N] Remove some descriptor usages from Ir.kt 2021-10-26 13:26:03 +00:00
Mikhail Glukhikh 37b95972db Uncomment warning about -Xopt-in deprecation 2021-10-26 13:38:40 +03:00
Svyatoslav Scherbina 99447a11c1 Native: fix ^KT-49384
Don't report errors for projections in nested type arguments of
SAM conversion target types.
2021-10-26 10:12:30 +00:00
Svyatoslav Scherbina 65bea27431 Native: add test for ^KT-48876
The issue itself was already fixed in 981a6ffe.
2021-10-26 10:10:26 +00:00
Sergej Jaskiewicz b27b202c28 [IR] Deduplicate StringConcatenationLowering in K/N
The common lowering is updated based on
fac1cf189c
2021-10-26 08:44:52 +00:00
Mattia Iavarone c92e34ca9f [Native] Enable real Android Native executables (#4624)
* Add AndroidProgramType binary option, override entry point, fix linker flags

* Add Konan_main_standalone entry point to the Android runtime

* Add compiler warning

* Make standalone programs print to stdout

* Fix warning message and readability
2021-10-26 11:33:17 +07:00
Pavel Punegov 634812f96f [K/N][build] Split stdlib and endorsed libraries build and caching
Due to the usage of dist as an input and output at the same time by
different tasks Gradle issued warning about Execution optimizations
turning off. The fix is to split inputs and outputs in the build and
cache tasks of stdlib and endorsed libs.
2021-10-22 09:29:19 +00:00
Pavel Kunyavskiy 653fc85461 [K/N] Move basic blocks with lazy init to middle of function
CoreSymbolication heuristics assume that last instruction in function
corresponds to last function line. This is not always true anyway,
but with this hack this will happen more often.
2021-10-21 12:18:40 +00:00
Aleksei.Cherepanov 276fb77155 Fix incremental build after changing Java const used as class property
Report Java static final constant with InlineConstantTracker, used as class property in Kotlin for further registration in JPS

#KT-49177 Fixed
2021-10-20 15:06:19 +03:00
Pavel Kunyavskiy 172373c57e [K/N] Add tests for flexible arrays in interop
^KT-48074
2021-10-19 13:45:00 +00:00
Sergey Bogolepov 8d2234b37a Add a test for KT-49212 2021-10-18 07:19:11 +00:00
Sergey Bogolepov 2230aed4e2 Fix KT-49212 2021-10-18 07:19:10 +00:00
Igor Chevdar f1c1094393 [K/N][optmz] Fix for https://youtrack.jetbrains.com/issue/KT-49234 2021-10-15 14:08:17 +00:00
Pavel Kunyavskiy 533eb589cb [K/N] Add tests for static initialisation of ConstantValues 2021-10-14 11:22:28 +00:00
Pavel Kunyavskiy 89414eb214 [K/N] Transform some KProperties to ConstantValue 2021-10-14 11:22:27 +00:00
Pavel Kunyavskiy f03c897dc4 [K/N] Move fields from KFunctionImpl to functions 2021-10-14 11:22:27 +00:00
Pavel Kunyavskiy 7a52ed73de [K/N] Simplify KPropertyImpl 2021-10-14 11:22:27 +00:00