Commit Graph

1190 Commits

Author SHA1 Message Date
Alexander Gorshenev 77cbd39907 Global initializers for wasm32. 2017-08-09 17:34:26 +03:00
Alexander Gorshenev 26d383c8be Support grow() operation for wasm32 memory. 2017-08-09 17:23:40 +03:00
Igor Chevdar e615b08ab7 Set escape analysis to analyze all types including value types.
Since a value type might be boxed and this information is missing in IR
the analysis cannot distinguish value types and boxes, so let it analyze
all for now.
2017-08-08 13:45:46 +03:00
Igor Chevdar 56e08e40e8 Added some corner tests on escape analysis 2017-08-07 16:45:51 +03:00
Igor Chevdar 31d2618b9c Made escape analysis a bit more conservative for now 2017-08-07 16:45:51 +03:00
Robert Hencke 72ca603d71 Reduce boilerplate for applying kotlin-gradle-plugin. 2017-08-07 17:25:52 +07:00
Alexander Gorshenev a0e15a7776 Eliminated some warnings. 2017-08-07 12:36:32 +03:00
Igor Chevdar 9eb2bb7fbc Fixed some bugs in escape analysis 2017-08-04 17:48:50 +03:00
Alexander Gorshenev 21ad2d97e6 Fix broken build.
The fix for d8 readline() broke hello1 and hello2 tests.
2017-08-04 15:50:27 +03:00
Alexander Gorshenev b4660d03a1 Initial .wasm file generation for the wasm32 target.
Some basic launcher.js and runtime.
2017-08-03 17:51:48 +03:00
igotti-google 5e55a75d59 Work around 32-bit build problem (struct merging by LLVM) 2017-08-03 00:39:09 +03:00
Nikolay Igotti beb10306dd Add Kotlin object inspection to simplify debugging (#763) 2017-08-02 18:55:52 +03:00
Igor Chevdar eabe2435bf Rewrote escape analysis 2017-08-02 18:44:04 +03:00
Ilya Matveev effe54d470 stdlib: Add also function 2017-08-02 20:20:09 +07:00
Vasily Levchenko d0ec24a5f2 [kotlin compiler][update] 1.1-20170729.003925-731 2017-07-31 12:56:29 +03:00
Vasily Levchenko f07273d55f [debug][test] build fix 2017-07-28 17:52:58 +03:00
Ilya Matveev 12f815eabb backend: Add a call lowering pass before inlining
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.
2017-07-27 11:49:54 +07:00
Ilya Matveev 0e67fbb7ad tests: Add assert tests 2017-07-27 11:49:54 +07:00
Ilya Matveev a2e9fa324b backend: Use symbols for assertions processing 2017-07-27 11:49:54 +07:00
Ilya Matveev de5bc71ffc backend: Correct assertion in 'for' loop lowering
The frontend uses one of two origins for loop variables:
LOOP_VARIABLE and IMPLICIT_LOOP_VARIABLE. This patch takes
this into account.
2017-07-25 22:26:17 +07:00
Ilya Matveev bef8d6bef1 backend: Set 'origin' property for generated variables in 'for' loops 2017-07-25 22:26:17 +07:00
Ilya Matveev 42c4391654 backend: Process 'until MIN_VALUE' in for loops
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.
2017-07-25 22:26:17 +07:00
Ilya Matveev 295ab0a679 [kotlin compiler][update] 1.1-20170724.005554-711 2017-07-24 15:54:16 +07:00
Ilya Matveev 0ddc002b8d backend: Use IrComposite instead of IrBlock in headers of 'for' loops 2017-07-20 10:35:40 +07:00
Ilya Matveev d6e0f67d4e tests: Add test for nested 'for' loops 2017-07-18 17:05:58 +07:00
Ilya Matveev 6ea341be06 tests: Move 'for' loop lowering tests into 'controlflow' directory 2017-07-18 17:05:58 +07:00
Ilya Matveev 745fc711f8 backend: Add caching for unary and binary operation symbols 2017-07-18 17:05:58 +07:00
Ilya Matveev 01f0540fac backend: Don't cast step in 'for' loop lowering 2017-07-18 17:05:58 +07:00
Ilya Matveev 3184ae57c6 backend: Don't calculate last element in 'for' loop if the step is 1 2017-07-18 17:05:58 +07:00
Ilya Matveev a97a310987 tests: Add tests for empty ranges in 'for' loops 2017-07-18 17:05:58 +07:00
Ilya Matveev d474f207e3 backend: Don't create a Progression objects in 'for' loops
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)
}
2017-07-18 17:05:58 +07:00
Nikolay Igotti 06e31939dd WebAssembly effort (#721) 2017-07-14 16:44:46 +03:00
Alexander Gorshenev 55c4966203 Moved clang flags out of the root build.gardle.
Collected clang args in ClangArgs.kt
Switched dependencies/build.gradle to KonanTarget.
Introduced KonanProperties to take care of target specific properties.
2017-07-12 18:31:09 +03:00
Vasily Levchenko 1d532729a8 [linker] more enhancments (idea inspections) 2017-07-12 06:46:35 -07:00
vvlevchenko 96d5341852 [backend][properties] try suffixied property first and common then (#735)
* [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.
2017-07-12 06:43:45 -07:00
Alexander Gorshenev cd9d0ab768 Warn on duplicate library inclusion. 2017-07-12 14:45:29 +03:00
Vasily Levchenko addb6e08d8 [link][debug] when build debug build, it's better to use -O0 opt flags 2017-07-10 07:25:17 -07:00
Vasily Levchenko 27517b0db1 [codegen][debug] make runtime debug information friendly to generated one.
- 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
2017-07-10 07:25:17 -07:00
Alexander Gorshenev 5b25613e23 Separated Zipped and Unzipped libraries.
Picking up files right from the zip filesystem, if possible.
2017-07-06 12:36:35 +03:00
Vasily Levchenko 56c1f2b07c [codegen][clean up] warnings, inspections and absolete comments
- useless_is_checked
- unreachable_code
- a lot of unneeded string templates
- removed extra curly backets in string templates.
2017-07-05 06:42:37 -07:00
Alexander Gorshenev 5effdcb1d2 Pass linkerOpts from .def to klib manifest. 2017-07-04 17:58:30 +03:00
Alexander Gorshenev e2516f42e6 Moved KonanLibrary to use KonanTarget. 2017-07-04 17:58:30 +03:00
Alexander Gorshenev edde21827c A little bit more of utils abstracting us from java api. 2017-07-04 17:58:30 +03:00
Konstantin Anisimov 0582d8f1bd Build function -> file map
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
2017-07-03 19:54:14 +07:00
Vasily Levchenko db4388a343 [kotlin compiler][update] 1.1-20170701.191134-644 2017-07-03 04:09:14 -07:00
Ilya Matveev 6f35106337 dependencies: Add "airplane mode"
The patch adds airplaneMode parameter in konan.properties.
If airplaneMode = true the dependency downloader will throw
an exception instead of downloading a missing dependency.
2017-06-28 10:37:49 +07:00
Vasily Levchenko 974426d70d [codegen][debug] opt build fix 2017-06-27 05:20:40 -07:00
Alexander Gorshenev e257445a3b Konan Library reshuffle.
Distributed classes into several files.
Eliminated Base64 encoding of protobufs, it was a kt.bc library leftover.
2017-06-26 19:46:51 +03:00
Vasily Levchenko 9fc16260c6 [link stage][macos] forcebly mute dsymutil warning about absence of _main symbol. 2017-06-22 00:33:17 -07:00
Alexander Gorshenev 7615c36f2e Slightly tweaked klib utility to work with suffix-less klib names. 2017-06-21 17:09:04 +03:00