Commit Graph

141 Commits

Author SHA1 Message Date
Konstantin Anisimov 53b243c9f8 1) Do not inline in function declared as "inline"
2) Evaluate all arguments except lambdas
2017-12-16 08:08:40 +03:00
Igor Chevdar 03ef9e4855 Added test on special bridges 2017-12-07 17:06:13 +03:00
Igor Chevdar 05179971c1 Added test 2017-12-04 16:09:05 +03:00
Pavel Punegov 0b7ad6e205 Remove obsolete C test files and Makefiles 2017-11-09 12:52:28 +03:00
Ilya Matveev 06c02e5e8d backend: Allow fake nullables in FOR loops 2017-11-09 12:42:49 +03:00
Pavel Punegov d56a4f8830 Fixes to tests: forgotten package names and tests 2017-10-20 18:25:05 +03:00
Pavel Punegov 35505007d2 TestRunner support in test's build.gradle
* Fixes to tests
 * RunKonanTest runs tests build with TestRunner
 * Standalone tests
2017-10-20 18:25:05 +03:00
Pavel Punegov 9d077d7f4f BC native tests port to Konan's TestRunner 2017-10-20 18:25:05 +03:00
Igor Chevdar df3e114f31 Added phase RETURNS_INSERTION
Moved explicit insertion of return statement from code generator to a lowering
2017-10-04 13:31:30 +03:00
SvyatoslavScherbina 786374ef86 Add basic support for class references
Also use class name for `Any.toString` and `Throwable.toString`.
2017-09-26 10:59:45 +03: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 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 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
Ilya Matveev 07c8404a5e backend: Fix enum constructor default parameters
The problem was observed in the follwing code:

enum class A(one: Int, val two: Int = one) ...

The problem is in the `two` default value. Here the enum constructor
lowering used an old (not lowered) symbol for `one`. Also the lowering
didn't copy the default expression for DEFAULT class.
The patch fixes both problems.
2017-06-14 19:42:29 +07:00
Ilya Matveev a18e9dbe0d backend: Don't process FAKE_OVERRIDE properties in lateinit lowering 2017-06-09 19:13:52 +07:00
Igor Chevdar 6116f24abc Added test on callable reference to property 2017-05-24 13:56:08 +03:00
Igor Chevdar 8a789a9ac4 Added test on function overriding return type with Unit 2017-05-16 16:30:29 +03:00
Igor Chevdar 39d1b8956d Test on abstract bridge 2017-05-10 15:44:22 +03:00
Igor Chevdar e600c93dfa Enabled tests with finally blocks on coroutines + added tests 2017-05-04 20:44:36 +05:00
Svyatoslav Scherbina c222eb8f04 Fix conversion between P1.(...)->R and (P1, ...)->R when inlining 2017-05-02 22:18:18 +03:00
Svyatoslav Scherbina a8ab837035 Add failing test 'inline24' 2017-05-02 22:18:18 +03:00
Igor Chevdar 6aa3493de2 Added some tests on coroutines 2017-04-28 13:45:46 +03:00
Igor Chevdar 8a5659456c Fixes bug in local declarations lowering + test 2017-04-28 13:45:46 +03:00
Igor Chevdar 8e38e28f89 Added tests 2017-03-29 15:58:36 +03:00
Igor Chevdar 00e452bcdf Added tests on link stage (disabled for now). 2017-03-27 12:41:58 +03:00
Igor Chevdar a1061246c9 Added tests on lateinit properties 2017-03-21 19:47:41 +03:00
Konstantin Anisimov 864bd9a212 Support cast type operations in inline 2017-03-17 19:29:35 +07:00
Konstantin Anisimov 449b4cd4b1 Minor test improvement 2017-03-17 19:29:35 +07:00
Konstantin Anisimov 22b74c0a3a New tests added 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 023e0c1c70 Remove dead code from test 2017-03-15 20:11:27 +07:00
Svyatoslav Scherbina 62e678a37a backend/tests: add inline21 2017-03-10 18:08:47 +07:00
Igor Chevdar bc0772eab1 Test on link stage. 2017-03-07 20:02:20 +03:00
Igor Chevdar 1a8ce13067 Added tests 2017-03-07 18:35:36 +03:00
Igor Chevdar 8c1c9f5660 Turned off lowering of outer class for inner class constructors.
Constructors of inner classes already have access to their outer class
through its dispatch receiver parameter.
2017-03-06 21:08:56 +03:00
Igor Chevdar 0ff306ad3a Rewrote enum lowering to support usage from other modules.
- Split up enum lowering into two stages: descriptors creation and IR creation.
- Added link stage test.
- Enum.valueOf() uses binary search instead of linear.
2017-03-06 14:35:39 +03:00
Igor Chevdar bf65a78a93 Made bridge methods public.
Added test on usage of a bridge method from different module.
Bridge methods must be public in order use them from other modules.
2017-03-06 14:35:39 +03:00
Konstantin Anisimov c7e4f0f28f New tests added 2017-03-03 18:30:35 +07:00
Igor Chevdar e2f2e31dc1 Added delegated property through map support + tests. 2017-03-01 14:40:10 +03:00
Igor Chevdar 889b28ee87 Added link test, checking correct object field layout. 2017-03-01 14:40:10 +03:00
Igor Chevdar f534616e19 Added tests. 2017-03-01 14:40:10 +03:00
Svyatoslav Scherbina 925b1fb0b6 backend/tests: add tests for == with Nothing/Nothing? 2017-02-27 13:16:12 +07:00
Igor Chevdar 9165d65560 Added tests on interface calls of enum class 2017-02-22 15:37:10 +03:00
Igor Chevdar bb82109ded Added tests on class delegation 2017-02-22 15:35:48 +03:00
Igor Chevdar 4835aa3e74 Added tests on bridges 2017-02-22 15:35:13 +03:00
Konstantin Anisimov 3b5c16076e TESTS: New tests added 2017-02-21 16:12:52 +07:00