Commit Graph

389 Commits

Author SHA1 Message Date
Dmitriy Dolovov c1fb40a436 [IR] Enhance error reporting for IR linking issues
^KT-44626

Typical use case:
- There are two KLIB libraries: A and B.
- Library A has two versions: A.v1 (older) and A.v2 (newer).
- A.v2 is ABI-incompatible with A.v1.
- B depends on A and was compiled against A.v1.
- An attempt to build the application with A.v2 and B fails with weird error message. It's unclear for end user what's wrong and what needs to be done to fix the issue.

The fix improves error reporting for the following particular cases:
- A symbol that is gone (KT-41378)
- A class that became a typealias (KT-47285, KT-46697)
- A typealias that became a class (KT-46340)
2021-08-10 14:02:40 +03:00
Dmitriy Dolovov 672b972b38 [Native] Add '-Xexternal-dependencies' CLI parameter to pass external deps
^KT-44626
2021-08-10 14:02:35 +03:00
Alexander Shabalin 7e04bb4bf1 [K/N] Refactor unhandled exception handling API
* Do not reset unhandled exception hook
* Add processUnhandledException to perform default unhandled exception
  processing
* Add terminateWithUnhandledException to report the unhandled exception
  and terminate the program
* Use the default unhandled exception processing in entrypoint, interop
  boundaries and in Worker.executeAfter
* Add -Xworker-exception-handling to control exception processing of
  Worker.executeAfter. By default its the old behaviour with the old MM,
  and new behaviour with the new MM.
2021-08-10 08:22:55 +00:00
Ilya Matveev 6c7f04ffc6 [K/N][tests] Fix disabling stress_gc_allocations for No-op GC 2021-08-07 06:28:50 +00:00
Alexander Udalov c821aba3bd Fix warnings in native modules 2021-08-06 22:37:00 +02:00
Sergey Bogolepov d64cb24643 [K/N] Don't pass -target-cpu to clang
It is not supported by bitcode embedding on Apple platforms.
Instead, we set it in function attributes directly as Clang does.
2021-08-06 14:19:41 +00:00
Svyatoslav Scherbina a22ef02e47 Native: disable compiler caches for experimental memory model
Experimental MM doesn't support compiler caches yet.
2021-08-05 15:22:00 +00:00
Svyatoslav Scherbina 4abbac1ff1 Native: improve code that handles unsupported compiler caches 2021-08-05 15:22:00 +00:00
Dmitriy Novozhilov ca9cbf7eb7 Fix warnings in K/Native code 2021-08-03 07:40:57 +00:00
Svyatoslav Scherbina fb27459b2e Native: fix downloading dependencies when producing cache 2021-08-03 07:01:08 +00:00
Sergey Bogolepov bfc3f35d94 [K/N] Disable stress_gc_allocations for watchos_simulator_arm64 2021-08-03 05:42:07 +00:00
Sergey Bogolepov 922fcc4049 [K/N] Fix windows dynamic tests for LLD
Adjust compilation and linking flags to workaround absence of direct
DLL linkage in LLD.
2021-08-03 05:42:07 +00:00
Sergey Bogolepov c7c78e0e1a [K/N] Use LLD 12.0.1 for MinGW targets
Clang-produced and GCC-produced binaries might be ABI-incompatible on
MinGW. Explanation on GitHub: msys2/MINGW-packages/issues/6855#issuecomment-680859662.
TL;DR: GCC-generated sections are 16-byte-padded, while Clang ones are
not. It causes problems during merge of COMDAT sections.
I observed the problem during compilation of runtime tests, but it is
possible that the problem could affect main compilation pipeline as well.
https://reviews.llvm.org/D86659 (which landed in LLVM 12) fixes
the problem. So we have another motivation for switching to LLD besides
https://youtrack.jetbrains.com/issue/KT-47605.

The only known downside is unsupported defsym which causes slight binary
size increase. I think it is doable.
2021-08-03 05:42:06 +00:00
Sergey Bogolepov 02aebd6565 [K/N] Update LLVM stubs to 11.1.0
Also add necessary changes to CoverageMappingC.cpp to make it compile.
2021-08-03 05:42:02 +00:00
Igor Chevdar 2c068b8c5a [K/N][IR] Fix for https://youtrack.jetbrains.com/issue/KT-47814 2021-08-02 19:22:08 +05:00
Igor Chevdar 448376f073 [K/N][IR][optmz] Global analysis for top-level initializers
The analysis' goal is to remove redundant calls to initializers
2021-07-31 01:40:00 +05:00
Igor Chevdar 9c6943b8c4 [K/N][IR] Split Devirtualization onto phases
The analysis itself and applying its results to the IR
2021-07-31 01:40:00 +05:00
Igor Chevdar b11201be81 [K/N][IR][runtime] Implemented lazy per-file initialization strategy 2021-07-31 01:39:59 +05:00
Aleksandr Samofalov 5ee87e126d KMA-51 Use local ObjCExportMapper in ObjCExportTranslatorMobile 2021-07-30 13:13:26 +03:00
Aleksandr Samofalov d72a399982 KMA-51 Create API to use ObjCExportTranslator to translate functions in IDE 2021-07-30 13:13:26 +03:00
Alexander Gorshenev 9148094bbd Garbage collection capable wrappers for skia interop 2021-07-30 12:54:51 +03:00
Dmitriy Dolovov b505486063 K/N, Minor: Drop unused exception class: KonanIrDeserializationException 2021-07-29 12:56:45 +03:00
Dmitriy Dolovov 50d150ace5 K/N: Avoid reporting excessive "error: compilation failed: null" message
This could happen if the source of the exception is inside of KotlinIrLinker/KonanIrLinker or IR deserializers.
2021-07-29 12:56:40 +03:00
Svyatoslav Scherbina a63f218dd3 Stop using ModuleDescriptor.name for top-level ObjCExport name prefix
^KT-47809 Fixed

Do similar for C export.
2021-07-28 12:46:11 +00:00
Alexander Shabalin 48a2b23b3a Add a separate compiler switch for runtime asserts 2021-07-28 07:43:08 +00:00
Alexander Udalov 91c39ed01c Build: remove obsolete compiler arguments
These compiler arguments enable features which are enabled by default in
the current Kotlin anyway.

The only exception is in :compiler:cli which uses an old language
version.
2021-07-27 13:35:38 +02:00
Pavel Kunyavskiy be0a0a7784 [K/N] Support escape analysis with new mm 2021-07-27 08:22:02 +00:00
max-kammerer 5b21444805 Update worker11.kt 2021-07-21 13:36:02 +02:00
Leonid Startsev 4bc521249b kotlinx.serialization: Support InheritableSerialInfo 2021-07-21 10:06:12 +00:00
Ilya Matveev 1c5361dacd [K/N] disable throwThroughBridge test for wasm32 2021-07-20 07:19:38 +00:00
Ilya Chernikov 56805dded8 [minor] IR: minor builtins infrastructure fixes 2021-07-16 02:24:40 +03:00
Ilya Chernikov cb4999f23c Native: port native to the new IrBuiltIns 2021-07-16 02:24:22 +03:00
Ilya Chernikov dee0487185 IR: Refactor IrBuiltIns to abstract it from descriptors 2021-07-16 02:24:18 +03:00
Andrey Kuleshov 26a71af6b3 [Native, All platforms] HotFix of the incorrect parsing of long strings to Float and Double (#4492)
### What's done:
- Fixed incorrect logic of String.toFloat() and String.toDouble().
  Long string without any digits were treated as Float or Double:
  "this string does not look as float isn't it?".toFloat() == "Infinity".

- Fixed incorrect parsing of floating point constants "NaN" and "Infinity":
  String values like "NaNPICEZy" or "InfinityN" were treated as valid numbers.

- Merged parsing logic for Double and Float:
  Removed the code duplication, unified methods, made the code more Kotlin-like, not C++-like.

- Updated tests:
  Removed useless tests that checked nothing, updated tests with regression scenarios.
2021-07-15 14:47:55 +07:00
Roman Artemev 447900c3f2 [K/N] Make sure all module names are uniq
In case of klib -> binary compilation there were two different modules
with the same. It breaks invariant about uniqueness if module name.
2021-07-15 03:09:46 +03:00
Georgy Bronnikov 49619cda48 Restore Native compilation 2021-07-14 21:20:23 +03:00
Elena Lepilkina c401cf961d [K/N][C interop] Support Kotlin special names processing (KT-47209 fixed) 2021-07-13 11:56:31 +00:00
Roman Artemev 0326518fc9 [KLIB] Cutting down usages of moduleDescriptor in linker
Replace map key `ModuleDescriptor` with `String` which is module name
2021-07-13 14:43:42 +03:00
Roman Artemev eadf252de9 [KLIB] Provide KotlinLibrary for Konan Interop Deserializer 2021-07-13 14:43:41 +03:00
Elena Lepilkina 025e572462 [K/N] Fixed case with parameter which can be optimized with BCE 2021-07-13 09:22:13 +00:00
Elena Lepilkina c096e6a3eb [K/N] Analyze vals in bounds check elimination 2021-07-13 09:22:11 +00:00
Elena Lepilkina 9503627864 Changed an order of processing loops in ForLoopsLowering 2021-07-13 09:22:11 +00:00
Elena Lepilkina 0e04c21625 [K/N] Bounds check elimination in basic for loops forms 2021-07-13 09:22:10 +00:00
Elena Lepilkina 7975311ca2 [K/N] Added tests for bounds checks 2021-07-13 09:22:09 +00:00
Elena Lepilkina ac074207c7 [K/N] ForLoopsLowering: Use get without bounds check in ArrayIterationHandler 2021-07-13 09:22:08 +00:00
Alexander Udalov d33debdf7c IR: minor, cleanup Symbols 2021-07-10 15:33:25 +02:00
Pavel Kunyavskiy 31857f23a3 [K/N] Refactoring: remove copypaste 2021-07-09 08:53:08 +00:00
Pavel Kunyavskiy 594ff1474d [K/N] Make llvm Int1 boolean, not byte 2021-07-09 08:53:08 +00:00
Pavel Kunyavskiy eec8fdf16a [K/N] Implement isExperimentalMM intrinsic 2021-07-09 08:53:07 +00:00
Sergey Bogolepov f05110f99b [K/N] Add some tests for https://youtrack.jetbrains.com/issue/KT-47605 2021-07-07 07:50:57 +00:00