Commit Graph

100057 Commits

Author SHA1 Message Date
Alexander Shabalin aad6d2c8f8 [K/N] Add kotlin::ManuallyScoped<T> ^KT-56233
kotlin::ManuallyScoped<T> is a wrapper over T that pins T in place
and has a trivial constructor and destructor. Creation and destruction
of T must be carried out manually by construct and destroy methods.
2023-04-06 11:40:43 +00:00
Alexander Shabalin 6a0e6b11bd [K/N] Add kotlin::RWSpinLock ^KT-56233
Trivially constructible and destructible std::shared_mutex
implementation with additional guarantee that try_* methods fail only if
the mutex is locked.
2023-04-06 11:40:42 +00:00
Alexander Shabalin 9e5a2efb03 [K/N] Add kotlin::raw_ptr<T> helper class ^KT-56233
kotlin::raw_ptr<T> is exactly T* but with the default constructor
setting value to nullptr and with destructive move.
2023-04-06 11:40:42 +00:00
Sebastian Sellmair 4bc1271f55 [Gradle] AbstractCInteropCommonizerTask: Do not use ';' character in fileName
The ';' will later be used as path separator. Therefore,
using the ';' as joiner for multiple cinterop commonizer groups
will confuse the CLI argument parser inside the Commonizer

^KT-57796 Verification Pending
2023-04-06 11:34:07 +00:00
Sebastian Sellmair 59d78b4d96 [Gradle] Create commonize-kt-57796-twoCInteropCommonizerGroups to cover KT-57796 2023-04-06 11:34:07 +00:00
Zalim Bashorov 1e6626338d [CODEOWNERS] Changes in wasm output size tests must be shown to Zalim.Bashorov 2023-04-06 10:14:06 +00:00
Dmitrii Gridin 03eab387c0 [FIR] FirRenderer: render annotation resolve phase as well
^KT-56543
2023-04-06 08:09:41 +00:00
Kirill Rakhman 210e8750f4 [FIR] Deserialize nested typealias
#KT-57689 Fixed
2023-04-06 08:03:12 +00:00
Kirill Rakhman f9540d8f69 [JS] Remove non-functional IGNORE_FIR directive in js box tests 2023-04-06 08:03:12 +00:00
Zalim Bashorov 155eb9b77a [Wasm, stdlib] extract Any::identityHashCode to workaround the bug in FunctionDescriptorFactory
A fix is on its way -- KT-MR-9426.
2023-04-05 20:50:53 +02:00
Zalim Bashorov 46459dfa60 [Wasm] Minor: update expected size after rebase 2023-04-05 20:50:52 +02:00
Zalim Bashorov 2e4a09f841 [Wasm] Replace takeIf with ifEmpty in TeamcityAdapter 2023-04-05 20:50:52 +02:00
Zalim Bashorov 9760e3ee1e [Wasm] Introduce check and error specialized for String to reduce output size 2023-04-05 20:50:52 +02:00
Zalim Bashorov 295acdf2af [Wasm] Rewrite lazy initialization without by lazy and lateinit to reduce overhead 2023-04-05 20:50:52 +02:00
Zalim Bashorov 1a8a4fa65d [Wasm] Don't use by lazy inside Throwable 2023-04-05 20:50:52 +02:00
Zalim Bashorov 67357fa5d4 [Wasm] Replace heavyweight stackTraceToString with "pure" JS stack 2023-04-05 20:50:52 +02:00
Zalim Bashorov 14af47bbd9 [Wasm] Introduce utilities to get package and name of class directly from metadata and use it in some places 2023-04-05 20:50:52 +02:00
Zalim Bashorov f206b0b72d [Wasm] TeamcityAdapter: rewrite lazy property initialization using lateinit 2023-04-05 20:50:52 +02:00
Zalim Bashorov a9b553f16e [Wasm] Don't use by lazy to keep some JS values used by adapters 2023-04-05 20:50:52 +02:00
Zalim Bashorov 494403c4bb [Wasm] Don't use by lazy inside TeamcityAdapter 2023-04-05 20:50:52 +02:00
Zalim Bashorov 2ef47901d0 [Wasm] Introducing private identityHashCode shared between Any's hashCode and toString
It splits the dependency of toString from hashCode that prevents keeping hashCode when toString is used.
2023-04-05 20:50:51 +02:00
Zalim Bashorov 6e3eef7a88 [Wasm] add simple tests to track the size of wasm and mjs files 2023-04-05 20:50:51 +02:00
Zalim Bashorov 1697a28bf0 [Wasm] introduce a directive to check output size in some wasm tests
Syntax:
// WASM_DCE_EXPECTED_OUTPUT_SIZE: <file extension> <expected size in bytes>

Example:
// WASM_DCE_EXPECTED_OUTPUT_SIZE: wasm 10_000
2023-04-05 20:46:13 +02:00
deotime 7aaba3b78a [KT-57607] Fix performance of ArrayList.addAll methods in JS stdlib (#5116)
* Fix performance of ArrayList.addAll methods in JS stdlib: extend the backing array and copy elements manually
* Update expected reachable nodes after DCE in test data

---------

Co-authored-by: Ilya Gorbunov <ilya.gorbunov@jetbrains.com>
2023-04-05 20:18:11 +02:00
Anton Lakotka 11b7fe2c4a [Gradle] Add possibility to disable default multiplatform publications
Additionally, skip pom rewriting mechanism in case
if default publications were disabled to prevent unexpected poms.
2023-04-05 17:58:02 +00:00
Nikolay Lunyak 03e2152957 [FIR JS] Support 2 JS diagnostics
The change in `FirDiagnosticsHandler` ensures
`DEBUG_INFO_DYNAMIC` is still reported in
`FirPsiJsOldFrontendDiagnosticsTestGenerated.testConventions`.

Support `SPREAD_OPERATOR_IN_DYNAMIC_CALL` and
`WRONG_OPERATION_WITH_DYNAMIC`
2023-04-05 16:51:51 +00:00
Nikolay Lunyak 57568770b4 [FIR] Remove redundant imports 2023-04-05 16:51:50 +00:00
Nikolay Lunyak 3b0a923210 [FIR] KT-57665: Make dynamic members' parameters dynamic
Parameter types are not only used "to accept" some data,
but they also are used as inputs for inference
(expected types)

^KT-57665 Fixed
2023-04-05 16:51:50 +00:00
Nikolay Lunyak 18f80b1ab5 [FIR] KT-57665: Ensure the current K2 behavior differs from K1 2023-04-05 16:51:50 +00:00
Dmitrii Gridin d1282b6195 [CODEOWNERS] change owners of generated diagnostics to core team 2023-04-05 16:47:34 +00:00
Pavel Punegov 57904f117f [K/N][test] Add missing opt-in for setUnhandledExceptionHook
This is follow-up to KT-MR-9340

Merge-request: KT-MR-9488
Merged-by: Pavel Punegov <Pavel.Punegov@jetbrains.com>
2023-04-05 16:04:56 +00:00
Sergej Jaskiewicz 3713d95bb1 [klib] Don't deserialize the list of sealed subclasses from klibs
tl;dr the current design of klibs does not allow to properly deserialize
the list of sealed subclasses in a sound way. It is possible that
a subclass of a sealed class is declared in a different file, AND is
private in that file.

A more detailed explanation:

Right now we don't serialize file signatures at all.
However, a private declaration's signature must necessarily include
the file signature.

How do we serialize a private declaration's signature into a klib
and deserialize it later?

**Serialization** is simple: we just serialize the file signature as
an empty protobuf message.

When we are **deserializing** a private declaration, we look at the file
that is being deserialized right now, and construct the file signature
based on that.

This logic, however, doesn't always work. An example is KT-54028.

Basically, if we have a sealed interface with a private implementor
declared in a different file, this breaks:

1. We are deserializing the sealed interface. The deserializer knows
that we are now in the file in which the sealed interface is declared.
2. As part of deserializing the interface, we deserialize its sealed
subclasses.
3. Naturally, we come to deserializing the private implementor that is
declared in another file, but the deserializer still thinks that we are
in the file in which the interface is declared. A wrong signature is
created, which leads to linkage failure.

We *could* fix this by properly serializing the file signature,
i.e. instead of an empty protobuf message we could write the file path
and its package to the klib. However, there a problems with this
approach:

- The current design of signatures allows a situation where two
different files can have the same relative path
(for example, with the help of the `-Xklib-relative-path-base` compiler
flag) *and* the same package, which would introduce ambiguity during
linkage.
- Most importantly, this appoach won't work well with incremental
compilation of klibs. Currently we rely on the assumption that all
cross-file references are handled with public signatures, and private
signatures are only used inside a single file. This allows to move
declarations across files without recompiling it's use sites.

It has been decided to apply the following hacky solution: we just don't
deserialize the list of sealed subclasses from klibs.
The list of sealed subclasses is not used in lowerings, so it should be
safe.

#KT-54028 Fixed
2023-04-05 15:51:54 +00:00
Sergej Jaskiewicz 2f99ac1cc0 [test] Fix handling files with the same names in tests 2023-04-05 15:51:54 +00:00
Sergej Jaskiewicz 7e8874095a [klib] Add documentation comments for IdSignatureComputer 2023-04-05 15:51:53 +00:00
Sergey Bogolepov d87f3cb9cd [K/N] Fix coverage phase condition 2023-04-05 15:46:08 +00:00
Roman Efremov b368b78faa [FE] Prohibit protected members in final expected or actual classes
^KT-28850 Fixed
2023-04-05 15:25:46 +00:00
Nikolay Lunyak 2f5b1dff16 [FIR] Ensure parent checkers are always called 2023-04-05 15:16:31 +00:00
Sergej Jaskiewicz 78d19e143c [JS IR] Don't use JVM-specific mangler in JS IR backend
^KT-54638 Fixed
2023-04-05 14:23:51 +00:00
Vladimir Sukharev 185097f82e [K2/N] Enable tests fixed by KT-56030
^KT-56030

Merge-request: KT-MR-9456
Merged-by: Vladimir Sukharev <Vladimir.Sukharev@jetbrains.com>
2023-04-05 14:21:16 +00:00
Alexander Shabalin 759d5009d6 [K/N] Fix combination of aggressive GC and state check
Merge-request: KT-MR-9483
Merged-by: Alexander Shabalin <Alexander.Shabalin@jetbrains.com>
2023-04-05 13:16:01 +00:00
Nikolay Lunyak 3987efa036 [FIR] Remove the fast path if as insignificant
This if is a bit inconsistent with the
LUB checking approach, so if it doesn't
improve performance it's better to remove it.
2023-04-05 11:13:25 +00:00
Alexander Korepanov 4813b659ab [JS IR] Control an inheritance of non-external entity from external
Add a special annotation @JsExternalInheritorsOnly for marking
 external interfaces and classes. The marked interface or class
 can’t be a parent for non external interfaces, classes or objects.

^KT-57423 Fixed
2023-04-05 09:00:45 +00:00
Kirill Rakhman 6e7b078873 [IR] Refactor IrActualizerUtils to use buildString 2023-04-05 08:44:57 +00:00
Kirill Rakhman 4dfef6ba6f [IR] Fix arguments of backend error messages
#KT-57662 Fixed
2023-04-05 08:44:56 +00:00
Kirill Rakhman 674397be82 [FIR] Trim rendered symbols in diagnostic messages 2023-04-05 08:44:56 +00:00
Roman Efremov 456d3e0f42 [FE] Prohibit expect fun interface to have non-fun actual counterpart
In K1 .isFun is always false for Java classes, so extra check
is added for that. This is not needed for K2, because .isFun is
true for all Java classes. Here it is not necessary to check
that interface has only one method, because such check will be
done in the place where interface implementation is created.

^KT-39362 Fixed
2023-04-05 07:31:58 +00:00
Dmitriy Novozhilov 59d126abc5 [Native] Rename FirSerializer.kt to FirNativeSerializer.kt
This is needed to avoid confusion with files with common parts of
  FIR serialization
2023-04-05 07:31:34 +00:00
Dmitriy Novozhilov 92a59279d5 [FIR] Properly implement serializer extension for klib compilation
^KT-57654 Fixed
2023-04-05 07:31:33 +00:00
Justin Paupore 6604627fa8 Use registered FIR compiler extensions in Analysis API.
This will allow IDE plugins to contribute compiler plugins to analysis,
above and beyond those used for the actual compilation step. These
plugins can be used to, for example, provide declarations for code that
is generated during build by an external tool.

^KT-57763 fixed
2023-04-05 07:31:08 +00:00
Justin Paupore acca7de42d Fix extension point name for FirExtensionRegistrar.
This changes the declared entry point name to match that actually
defined in FirExtensionRegistrarAdapter.

^KT-57763
2023-04-05 07:31:08 +00:00