Some inlined calls may require additional processing before the
inlining pass. E.g. assert() calls must be removed if assertions are
disabled by compiler flags. This patch adds an additional pass
before inlining and uses it for assertions removal.
This patch takes into account a corner case available for loops
over a progression (see backend.native/tests/external/codegen/box/
ranges/forInUntil/forInUntilMinint.kt test):
for (i in 0 until Int.MIN_VALUE) { ... }
Here we cannot use subtraction to obtain a right bound of the loop
due to an overflow. Instead we consider any loop with MIN_VALUE in
it's right bound as empty loop. Such behaviour is similar to the one
of 'until' method.
So now the empty check for a loops with 'until' call:
for (i in first until bound) { ... }
is as follows:
val last = getProgressionLast(first, bound, step) // Only if step==1
if (first <= last && bound > <Int|Long|Char>.MIN_VALUE) {
do { ... } while(i != last)
}
Further improvements: We can generate a simpler IR for some simple
frequent cases (e.g. for until calls without steps) and eliminate
loops if we can prove that they are empty.
Previously, Long.humanReadable would display byte unit suffixes as `kB`, `MB`, etc., even though the calculations on byte counts were using base 2 for calculations.
I've revised this to display sizes in the format of `kiB` or `MiB`, for kebibyte, and mebibyte - the base 2 unit equivalents of kilobyte and megabyte respectively.
This patch optimizes the following pattern:
for (i in first..last step st) { ... }
In this case we need to create a Progression object and then call its
iterator() method causing at least 2 allocation per loop. This change
replaces such loops with the following constuction:
var inductionVar = first
checkProgressionStep(step) // check if step > 0
last = getProgressionLastElement(first, last, step)
if (first <= last) {
do {
i = inductionVar
inductionVar += step
...
} while(i != last)
}
The patch makes the plugin to set default input directories
(src/main/kotlin and src/main/c_interop) at task construction
rather than setting them during compiler command line building.
It allows gradle to perform up-to-date checks correctly.
Collected clang args in ClangArgs.kt
Switched dependencies/build.gradle to KonanTarget.
Introduced KonanProperties to take care of target specific properties.
* [backend][properties] try suffixied property first and common then
This is temporal version and should be replaced with some unified version shared between interior tool and kaitlin compiler.
for some resons with -O0 build fails with absence of definition zopen function on macos
nming /usr/lib shows that there're no libraries defining this symbol, drfined by the way
in /usr/include/stdio.h
- inroduced function generation context containing mostly functionality local to function generation
- initial debug location is linked with basic block.
- then on each expression location is tuned.
- removed manual placement of debug location dictations over the place.
- refactoring removed unused declarations
Serialize/deserialize file name
Define FileEntryImpl
Provide IrReturnableBlock with information about source file
Move file iteration in NoJavaUtil
Insert future description comments
Move debug info (source file name) from IrFunction to IrDeclaration