Commit Graph

87184 Commits

Author SHA1 Message Date
Steven Schäfer f05f9882ab IR: Handle annotation instantiations in constructor calls 2021-08-23 23:04:35 +02:00
Steven Schäfer fc6c2c9631 jvm-abi-gen: Reformat files and add comments 2021-08-23 18:25:33 +02:00
Steven Schäfer 023db4f376 jvm-abi-gen: Use the configured MessageCollector to write ABI jars 2021-08-23 18:25:33 +02:00
Steven Schäfer 6d518c8e57 JVM IR: Mark annotation implementation classes as anonymous
And add tests to ensure that annotation implementation classes are
handled correctly in jvm-abi-gen.
2021-08-23 18:25:33 +02:00
Steven Schäfer 19660f11a7 jvm-abi-gen: Remove WhenMapping classes from ABI if possible 2021-08-23 18:25:33 +02:00
Steven Schäfer ec4d7b2bb6 jvm-abi-gen: Add tests for uses of private Kotlin classes from Java 2021-08-23 18:25:33 +02:00
Steven Schäfer 8de6a5224f jvm-abi-gen: Mark annotation implementation classes as public...
...if they are used from public inline functions in the same file.
2021-08-23 18:25:33 +02:00
Steven Schäfer 6756420725 jvm-abi-gen: Add tests for KT-40133 and KT-40340 2021-08-23 18:25:33 +02:00
Steven Schäfer 5059513106 jvm-abi-gen: Strip inline functions in private classes
Inline functions in private classes can only be accessed from Java and
we do not need to preserve their bodies for the abi.
2021-08-23 18:25:33 +02:00
Steven Schäfer 3ffe495346 jvm-abi-gen: Mark all anonymous objects in inline function scope as public
Anonymous objects inside of a private inline function nested in a public
inline function can still escape.
2021-08-23 18:25:33 +02:00
Steven Schäfer d94817cfb6 jvm-abi-gen: Don't strip nested classes from the Kotlin Metadata 2021-08-23 18:25:33 +02:00
Steven Schäfer 4a59af3b8b jvm-abi-gen: Update metadata version if needed 2021-08-23 18:25:33 +02:00
Steven Schäfer 1b5214a2dc JVM: Fix usage of ClassBuilder API in AnonymousObjectTransformer 2021-08-23 18:25:33 +02:00
Steven Schäfer c156613141 jvm-abi-gen: always keep annotation classes 2021-08-23 18:25:33 +02:00
Steven Schäfer c9b0cc5b32 JVM: Only produce inline SAM wrappers in public inline scope 2021-08-23 18:25:33 +02:00
Steven Schäfer 50bbf4f269 JVM IR: Remove special descriptor origin for lambdas.
This was a hack to allow plugins to identify anonymous classes in
inline function scope. However, this stopped working for anonymous
objects with the introduction of IrBasedDescriptors and became redundant
with the public ABI bit in the Kotlin Metadata annotation.
2021-08-23 18:25:33 +02:00
Steven Schäfer 8efb955ab5 JVM: Add more tests to jvm-abi-gen 2021-08-23 18:25:33 +02:00
Steven Schäfer d08990ebb4 JVM: New single-pass implementation for jvm-abi-gen 2021-08-23 18:25:33 +02:00
Steven Schäfer a54503cede JVM: Add an extension point for file output 2021-08-23 18:25:33 +02:00
Steven Schäfer de9d2919a8 JVM Metadata: Add a bit to mark anonymous objects in inline functions
Anonymous objects in the scope of an inline functions are copied to
all call-sites. This makes them part of the public ABI of a Kotlin
library.

We introduce a flag to mark all classes in the scope of an inline
function. When compiling with assertions enabled, we check that
this flag is set whenever we inline an anonymous object from another
module.
2021-08-23 18:25:33 +02:00
Sergey Bogolepov 254fc53b17 [K/N] Disable mimalloc for MinGW on Linux and Windows
There is a case-sensitivity problem when cross-compiling to MinGW.
https://github.com/microsoft/mimalloc/commit/71ac98a fixes the problem,
but it is not included into our current version of mimalloc.
2021-08-23 16:01:37 +00:00
Sergey Bogolepov c50ae1ffe6 [K/N] Don't check for MSVC on Linux and macOS hosts 2021-08-23 16:01:36 +00:00
Sergey Bogolepov 1381221ef8 [K/N] Use smaller mingw-w64-i686 toolchain as well 2021-08-23 16:01:36 +00:00
Sergey Bogolepov 1315fdaf56 [K/N] Proper MinGW cross-compilation support 2021-08-23 16:01:36 +00:00
Sergey Bogolepov 6953d29922 [K/N] Use smaller mingw-w64-x86_64 toolchain
We don't need LLVM components there anymore because they live in
a separate dependency now.
2021-08-23 16:01:35 +00:00
Ilya Chernikov caa44e413d Abstract FIR cli pipeline from core environment and related entities 2021-08-23 16:50:40 +03:00
Dmitriy Novozhilov 40614507d3 [FE 1.0] Report warning about new IL operator resolve in initializers and default values
^KT-48361 Fixed
2021-08-23 16:20:41 +03:00
pyos a15a5aa429 JVM_IR: generate instance fields even when reification is needed
The inliner supports that, we just need to generate the reification
markers on GETFIELD to instance fields.
2021-08-23 14:27:51 +02:00
Ilmir Usmanov c01c356817 Do not extend LVT ranges during inplace arguments inlining
Otherwise, R8 does not transform kotlin-reflect, failing bootstrap.
Leaving end label the same is safe, since we do not remove labels during
transformation.
2021-08-23 11:51:30 +00:00
Mikhael Bogdanov 92e94a4068 Add JDK 17 test configuration 2021-08-23 13:48:35 +02:00
Dmitriy Novozhilov 27ac7dbf9a [Test] Unmute passing codegen tests 2021-08-23 14:29:12 +03:00
pyos 17afe1b546 Fail on redundant IGNORE_BACKEND directives, as before 2021-08-23 14:29:10 +03:00
Mikhail Glukhikh 255eb87375 Provide more clear API around AnnotationChecker.applicableTargetSet 2021-08-23 14:18:38 +03:00
Mikhail Glukhikh 19ab0ab2f8 FIR: approximate intersections in public position properly
#KT-48166 Fixed
2021-08-23 14:18:36 +03:00
Mikhail Glukhikh 7b0e5927cb Report EXPERIMENTAL_ANNOTATION_ON_WRONG_TARGET without explicit @Target
#KT-48349 Fixed
2021-08-23 14:18:34 +03:00
Andrey Zinovyev 865fccdd29 [FIR] Add messages for JvmRecord diagnostics
Also fix some tests
2021-08-23 10:33:24 +00:00
Andrey Zinovyev a3049b35c2 [FIR] Add ILLEGAL_JAVA_LANG_RECORD_SUPERTYPE diagnostic 2021-08-23 10:33:24 +00:00
Andrey Zinovyev 09a1d54865 [FIR] Add JVM_RECORD_EXTENDS_CLASS diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev 8c2d37917f [FIR] Add DELEGATION_BY_IN_JVM_RECORD diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev 3314c8faac [FIR] Add FIELD_IN_JVM_RECORD diagnostic 2021-08-23 10:33:23 +00:00
Andrey Zinovyev dbc1e31e67 [FIR] Add INNER_JVM_RECORD diagnostic 2021-08-23 10:33:22 +00:00
Andrey Zinovyev 49484c4292 [FIR] Add JVM_RECORD_NOT_LAST_VARARG_PARAMETER diagnostic 2021-08-23 10:33:22 +00:00
Andrey Zinovyev bf845b6066 [FIR] Add JVM_RECORD_NOT_VAL_PARAMETER diagnostic 2021-08-23 10:33:21 +00:00
Andrey Zinovyev e8405c41d1 [FIR] Report UNSUPPORTED_FEATURE if jvm records feature is not enabled 2021-08-23 10:33:21 +00:00
Andrey Zinovyev c7008892fd [FIR] Add NON_DATA_CLASS_JVM_RECORD diagnostic 2021-08-23 10:33:21 +00:00
Andrey Zinovyev 84f5d6b149 [FIR] Add JVM_RECORD_WITHOUT_PRIMARY_CONSTRUCTOR_PARAMETERS diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev 3fee87a0f3 [FIR] Add ENUM_JVM_RECORD diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev c8381e9b0f [FIR] Add NON_FINAL_JVM_RECORD diagnostic 2021-08-23 10:33:20 +00:00
Andrey Zinovyev 6b70aecad5 [FIR] Add LOCAL_JVM_RECORD diagnostic 2021-08-23 10:33:19 +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