Commit Graph

46 Commits

Author SHA1 Message Date
Elena Lepilkina 1b4ee63f30 [K/N] Deprecate and remove from supported list relaxed memory model 2021-11-02 12:04:46 +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
Igor Chevdar 0cece79856 [K/N][IR][codegen] Use LazyIr for cached libraries
It's not that simple because we still need inline functions bodies
and classes fields which aren't present in Lazy IR. To overcome this,
save additional binary info for a cached library and then use it when needed
2021-10-05 10:47:52 +05:00
Sergey Bogolepov 7a3f33ad0b [K/N] Add option to save unoptimized bitcode
Add `-Xsave-llvm-ir` option that stores LLVM IR text into temporary
directory right after IrToBitcode translation. This is required for
FileCheck-based tests and just helpful during development.
2021-10-01 14:18:00 +00:00
Ilya Matveev bfe336b0db [K/N] Add an option to specify a bundle ID of a produced framework 2021-09-21 09:26:54 +00:00
Ilya Matveev 8b52411292 [K/N] Allow running compiler with exported libs and without sources 2021-09-21 09:26:51 +00:00
Mikhail Glukhikh 007cf2ce7c Rename AnalysisFlags.useExperimental to optIn 2021-09-10 16:29:18 +03:00
Elena Lepilkina aaf666e0e1 [K/N] Turn on mimalloc by default for experimental MM 2021-09-09 13:41:37 +00:00
Alexander Udalov 0213c25c9b Remove obsolete check for language version and IR backends 2021-09-01 16:30:41 +02:00
Svyatoslav Scherbina 5bdfa14a37 Native: make -Xbinary=memoryModel= equivalent to -memory-model=
In particular, the former now enables lazy initialization and hook-based
worker exception handling too, as intended.
2021-08-29 07:35:32 +00:00
Alexander Shabalin a279b2230f [K/N] Logging for runtime 2021-08-25 08:04:01 +00:00
Stanislav Erokhin 9becb2c468 Add compiler performance metrics
WIP
2021-08-24 16:33:12 +03:00
Svyatoslav Scherbina 9877a7271a Native: use binary options machinery for memory model
Old compiler flag (-memory-model) will work too.
2021-08-24 09:36:23 +00:00
Svyatoslav Scherbina ee3663afa4 Native: use binary options machinery for runtime assertions mode 2021-08-24 09:36:23 +00:00
Svyatoslav Scherbina 7cc1ea8801 Native: introduce binary options machinery 2021-08-24 09:36:22 +00:00
Sergey Bogolepov c7faf9b4df [K/N] Add -Xllvm-variant` compiler option
We need a handle that allows user to pick `dev` variant instead of
`user` one just in case.
Additionally, I added a possibility to provide a path to an arbitrary
LLVM distribution because it is useful for development purposes.
2021-08-23 10:13:36 +00:00
Alexander Shabalin a7460e9061 [K/N] Enable lazy property initialization with the new MM 2021-08-19 18:23:01 +00: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
Alexander Udalov c821aba3bd Fix warnings in native modules 2021-08-06 22:37:00 +02:00
Svyatoslav Scherbina fb27459b2e Native: fix downloading dependencies when producing cache 2021-08-03 07:01:08 +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
Igor Chevdar b11201be81 [K/N][IR][runtime] Implemented lazy per-file initialization strategy 2021-07-31 01:39:59 +05: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
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
Sergey Bogolepov 9ed97a27f1 [K/N] Introduce LLD compatibility checker for MinGW
We are going to switch to LLD linker for MinGW targets.
Right now LLD for MinGW doesn't support all features
of ld.bfd and thus this change might be breaking for some users.
To make transition smoother, we run lld -### to show a warning to user
so they can update their compilation options before LLD will be turned
on by default.

More details: https://youtrack.jetbrains.com/issue/KT-47605
2021-07-07 07:50:57 +00:00
Victor Petukhov 74aa8e7497 Get rid of singleOrNull of NullabilityAnnotationStates 2021-07-06 09:54:31 +03:00
Pavel Kunyavskiy 1ba04fdd21 [K/N] Introduce external calls checker compiler option 2021-07-05 08:35:23 +00:00
Alexander Shabalin e240b8a8ee Add a separate aggressive GC mode 2021-06-18 12:03:02 +00:00
Alexander Shabalin cf47d95aa5 Rename SingleThreadMarkAndSweep into SameThreadMarkAndSweep 2021-06-10 09:59:38 +00:00
Vasily Levchenko 79600f32d2 [codegenerator][refactor] extract method for tramboline generation 2021-06-09 11:39:57 +02:00
Vasily Levchenko bebede9e4f [codegeneration][debug info] enchance debugger behaviour for paramterless when
- generates tramboline like a11b07f6c3 on -Xg-generate-when-marker=enable
- fixes issue KT-33364
2021-06-09 11:39:55 +02:00
Alexander Shabalin 5e456ed82b Put GC implementations into separate modules.
The mm module now compiles separately for each GC implementation.
2021-05-04 10:23:16 +00:00
Vasily Levchenko a11b07f6c3 [codegeneration][debug info] generates marker of inlined function body on call site
- makes debuger breakpoint resolution more accurate
- restore expected behavior stack_trace_inline test
- fixes kt-33055
2021-04-07 15:04:56 +00:00
Svyatoslav Scherbina df77cd303f Don't use exitProcess to indicate a failure in Native library resolver
If Native compiler performs exitProcess, it crashes Gradle daemon that
runs the compiler.
2021-04-06 13:18:07 +00:00
Ting-Yuan Huang dba127a4d8 Add AnalysisHandlerExtension extension point for K2Native
frontendPhase is moved out of back phases to allow frontend only mode.

AnalysisHandlerExtension allows compiler plugins to:
1. Intercept and override the default analysis.
2. Utilize the compiler infrastructure to do custom analysis.

A well know plugin on the JVM platform is KAPT.
2021-03-29 20:41:06 +03:00
Vladimir Ivanov fd02802028 [Native] Export KDoc into generated native header 2021-03-09 16:50:23 +03:00
Alexander Gorshenev 47a34dbaaf No need to explicitly deprecate -Xdisable-fake-override-validator
A warning is produced automagically

(cherry picked from commit bc19f73b37567853d52d79574c319c95466e648c)
2020-11-28 21:13:49 +01:00
Alexander Gorshenev 07db1de4da Made -Xfake-override-validator off by default
Deprected -Xdisable-fake-override-validator

(cherry picked from commit 0abe4e46c497645b07e9e55088135813bd1a7437)
2020-11-28 21:13:48 +01:00
Igor Chevdar 606fbe37fc [IR] Turned off IR validation for everything but our tests 2020-11-28 21:12:17 +01:00
Alexander Shabalin ee508efb23 Add a switch to destroy runtime only on shutdown (#4482) 2020-11-28 21:01:54 +01:00
Alexander Gorshenev edfdc88d6d Dropped outdated klib version compatibility mechanisms
(cherry picked from commit 31fe91b6553ba08b83c581bfa8341e4a21805e97)
2020-11-28 20:56:42 +01:00
Sergey Bogolepov e2cb099d2b [KT-40670] Allow override konan.properties
It is painful to edit konan.properties just to override some value (e.g. compiler flags or LLVM location), especially if it is needed only in a single project. Thus `-Xoverride-konan-properties` is added.
2020-11-28 20:48:57 +01:00
Stanislav Erokhin f624800b84 Move everything under kotlin-native folder
I was forced to manually do update the following files, because otherwise
they would be ignored according .gitignore settings. Probably they
should be deleted from repo.

Interop/.idea/compiler.xml
Interop/.idea/gradle.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_runtime_1_0_3.xml
Interop/.idea/libraries/Gradle__org_jetbrains_kotlin_kotlin_stdlib_1_0_3.xml
Interop/.idea/modules.xml
Interop/.idea/modules/Indexer/Indexer.iml
Interop/.idea/modules/Runtime/Runtime.iml
Interop/.idea/modules/StubGenerator/StubGenerator.iml
backend.native/backend.native.iml
backend.native/bc.frontend/bc.frontend.iml
backend.native/cli.bc/cli.bc.iml
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2Native.kt
backend.native/cli.bc/src/org/jetbrains/kotlin/cli/bc/K2NativeCompilerArguments.kt
backend.native/tests/link/lib/foo.kt
backend.native/tests/link/lib/foo2.kt
backend.native/tests/teamcity-test.property
2020-10-27 21:00:28 +03:00