This commit introduces support for calling and referencing local functions and
objects in evaluate expression on the IR backend.
The primary incision is a lowering inserted after Local Declaration Lowering,
that uses the intermediate data structures recorded by LDL to rewrite calls to
local functions to the appropriate function in the binary, instead of predicting
the compilation strategy. The required changes to the rest of the pipeline
facilitate piping the required data around.
The key to this transformation is that _captures by the local function_ must be
introduced as _captures by the fragment function_, such that the evaluator
infrastructure can find the appropriate values at run-time. This is necessary
due to the strategy of compiling local functions to static functions instead of
closures.
Additional test coverage of stepping behavior support the corresponding changes
in the Evaluator, part of the Kotlin Debugger plug-in.
Compiler supposed to generate such method inside the
LocalFileKotlinClass class, but because of the KT-18489 method
getContainingLibrary is not generated. Because of that we potentially
could get AbstractMethodError. In order to fix that we are adding
explicit ovverride in java super class
This only affects JVM IR, and this is similar to how this was done in
the old JVM backend in `CallBasedArgumentGenerator.generateVararg`.
#KT-52146 Fixed
Now common SourceSet output will have '_common' suffix, while all
variants will have the same name - '<module-name>.kotlin_module'.
This change is required for KSP as short-term workaround, as they
are using some internal properties/methods, which was mangled before
this change and hard to access in different variants.
^KT-52138 Fixed
^KT-52050 Verification Pending
The issue described in KT-52050 happened, because forwardDeclarations
were not carried into next commonization steps. For commonization
it is fair to choose the union of all modules forwardDeclarations
as common dependency (instead of a union), since we can assume that
all those forward declarations will be provided.
The test project will be compiled and proves that
'platform.posix.DIR' retains it's 'CPointed' supertype.
The test is expected to fail on platforms that do not support
macos (windows and linux), since the issue seems to be caused
by optimistic, single platform propagation.
The Kotlin/Native compiler uses `.deleteOnExit()` as a substitute for
"delete after the compilation". But when the compiler runs in a Gradle
daemon, `.deleteOnExit()` means "delete on Gradle daemon exit", which
might be not soon. If a single Gradle daemon runs the compiler many
times, the remaining temporary files can consume quite a lot of disk
space. For example, this is the case for the Kotlin build.
Replace some of `.deleteOnExit()` calls with an explicit removal of
temporary files at the end of a compilation session.
If the session is from the other module, it might not know about
FirFiles which are relevant for transforming and resolving the
declaration
^KT-52136 Fixed
Implement an in-memory cache that uses a combination of strong
references and `SoftReference`s so that it adapts to memory
availability.
Cache eviction is currently performed after loading a classpath snapshot
(this can be changed later if necessary).
Evicted cache entries' values will be converted from strong references
into `SoftReference`s so that they can still be used for as long as the
JVM allows them.
There are 2 types of cache eviction:
- Least recently used: Oldest entries will be evicted
- Memory usage limit: If memory is limited, all entries will be
evicted
Test: Added InMemoryCacheWithEvictionTest unit test
^KT-51978 In Progress
In case there are several proxy functions for indy lambdas in the same
container, its names are "...__proxy", "...__proxy-0", "...__proxy-1",
..., yet before this change, only the first one was sanitized. So if
it's happening inside a constructor, `<init>` was left unrenamed which
led to ClassFormatError.
#KT-52040 Fixed
Extending by external plugins:
project.kotlinArtifactsExtension.apply {
artifactConfigs.all {
//add custom extension to artifact config DSL
(it as ExtensionAware).extensions.create("myConfig", Config::class.java)
}
artifacts.all {
val config = it.extensions.findByName("myConfig") as Config
//configure additional tasks, etc
//here we can use artifact parameters
}
}