Commit Graph

940 Commits

Author SHA1 Message Date
Konstantin Anisimov 78d2186f97 Typo fixed 2017-03-23 20:26:24 +07:00
Konstantin Anisimov 8661baabad Bug fix in recursive lambda inlining 2017-03-23 20:26:24 +07:00
Konstantin Anisimov 414a481fe3 If property initializer is inlined, we do not have proper outer scope to evaluate it 2017-03-23 20:26:24 +07:00
Nikolay Igotti b5c60e3082 Support data parsing operations (#380) 2017-03-23 12:54:24 +03:00
Alexander Gorshenev f402b3e180 Tell lto to preserve Konan_main, rather than main. 2017-03-22 17:00:11 +04:00
Alexander Gorshenev 2071414079 Split LINK_STAGE phase into OBJECT_FILES and LINKER sub-phases,
to be able to measure lcc/lto time separately from ld time.
2017-03-22 16:53:15 +04:00
Nikolay Igotti e197573e3e Raspberry Pi target (#365) 2017-03-22 15:43:19 +03:00
Konstantin Anisimov bfc4e1106a Noinline support
Bug fix
2017-03-22 19:22:59 +07:00
Konstantin Anisimov 26f4271906 Type propagation on call sites 2017-03-22 19:22:59 +07:00
Alexander Gorshenev c06eeb096a Removed -compile_as_stdlib mode, as it is not needed anymore.
Moved "compiler hacker" options to use double dash. Like "--verbose linker".
2017-03-22 16:16:50 +04:00
Igor Chevdar dc5edfeda3 Fixed type of callable reference to property with private setter
The actual type of callable reference is presented in IR, take it
from there.
2017-03-22 13:15:45 +03:00
Igor Chevdar 1577938f53 Added assertion 2017-03-21 19:47:41 +03:00
Igor Chevdar a1061246c9 Added tests on lateinit properties 2017-03-21 19:47:41 +03:00
Igor Chevdar 55d3b23cfe Implemented 'lateinit' properties
If property is lateinit, then on each access we need to test its value
and throw UninitializedPropertyAccessException if it is null.
2017-03-21 19:47:41 +03:00
Alexander Gorshenev 2d0aa9dcbb Introduced -nomain flag to disable generation of main(),
in assumption that it is provided by one of the libraries.
2017-03-21 18:05:03 +04:00
Konstantin Anisimov edd8489f6b Evaluation of lambda arguments
DeepCopyIrTree with IrInlineFunctionBody support
2017-03-21 19:23:35 +07:00
Igor Chevdar 02878f14c0 Fixes in build scripts & tools.
Tetris: fixes for full screen mode.
2017-03-21 14:04:30 +03:00
Nikolay Igotti c6845cf929 Implement on-load helper (#364) 2017-03-21 11:44:34 +03:00
Igor Chevdar 3820ea0724 Fix in handling of nested vararg parameters 2017-03-20 19:18:03 +03:00
Igor Chevdar 3d233db3b0 Removed creation of descriptors for Enum.valueOf() & values()
Those descriptors are already presented in enum's declaration and
are perfectly fine. We just need to replace their synthetic bodies
with real implementations.
2017-03-20 12:52:05 +03:00
Svyatoslav Scherbina c9d8d4d57d Implement CValuesRef in interop
* Represent pointer parameters of C functions as `CValuesRef`.
* Represent struct value parameters as `CValue`.
* Implement some helper methods to make the new approach more useful.
* Migrate some code to new interop approach for pointers and values.

Also do not map to `String?`:
- pointers to 8-bit integers;
- pointers to non-const chars.
2017-03-20 15:52:23 +07:00
Svyatoslav Scherbina 47dfe122fc Handle String constructor call in code generator 2017-03-17 21:05:24 +07:00
Konstantin Anisimov 864bd9a212 Support cast type operations in inline 2017-03-17 19:29:35 +07:00
Konstantin Anisimov ba8621389e Output formatting 2017-03-17 19:29:35 +07:00
Konstantin Anisimov bf9cd488ef Turn inlining in inline functions on 2017-03-17 19:29:35 +07:00
Konstantin Anisimov 449b4cd4b1 Minor test improvement 2017-03-17 19:29:35 +07:00
Konstantin Anisimov 384e895f70 Variable substitution leads to necessity to create new SetVariable expressions 2017-03-16 19:29:10 +07:00
Konstantin Anisimov 0ba37d9ac0 getArguments now work with original descriptor
Extension receiver is included in parameter -> argument substitution for lambda
2017-03-16 19:29:10 +07:00
Alexander Gorshenev a0fe8b8be8 Removed a parasitic println. 2017-03-16 01:55:57 +04:00
Alexander Gorshenev a7677e2a8b Renamed interop 'target' to 'flavour'. 2017-03-16 01:55:36 +04:00
Nikolay Igotti f3794aa206 Improve interop user experience and docs (#342) 2017-03-15 17:25:10 +03:00
Konstantin Anisimov 0a39e3c297 ILogging removed 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 13c1198493 Logging removed 2017-03-15 20:11:27 +07:00
Konstantin Anisimov f352c145fd Turn on disabled inlining tests 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 98322d6f55 All arguments evaluated before inlining procedure
Type of "substituteMap" changed to "MutableMap"
Code improved according with Slava's comments
2017-03-15 20:11:27 +07:00
Konstantin Anisimov 22b74c0a3a New tests added 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 39f002db81 Combine parameter evaluation with parameter transformer 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 3ebcf92f8b Intermediate results commit 2017-03-15 20:11:27 +07:00
Konstantin Anisimov 8d62ed20ea Workaround for reified args in "genInstanceOf". Will be replaced with "throw exception" 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 c9b04bc0bb Fix methods inherited from Any in interop value types 2017-03-15 18:20:06 +07:00
SvyatoslavScherbina 2882e6fab7 Improve interop enums (#341)
* Update build to Kotlin 1.1.0

* Add heuristics and options for selecting C enum interop binding style

Also do some refactoring.

* Add ':Interop:Indexer:updatePrebuilt' Gradle task

* Update Interop/Indexer/prebuilt
2017-03-14 18:52:37 +03:00
Vasily Levchenko ec68a3a24e IR: defaults: calculate right this dispatch receiver parameter.
previously in case:
```
fun box(): String {
    val a: A = B(1)
    a.copy(1)
    a.component1()
    return "OK"
}

interface A {
    fun copy(x: Int): A
    fun component1(): Any
}

data class B(val x: Int) : A
```

in stab `B::copy$default` `B::copy` called with `A::this` that behaviour isn't correct, should be `B::this` used.
2017-03-14 18:36:18 +03:00
Alexander Udalov b08ccf07cb Remove usages of Kotlin compiler built-ins (loaded from kotlin-compiler.jar's resources) (#323)
* Do not add dependency on compiler built-ins, add missing declarations

* Drop most usages of KonanPlatform.builtIns

Instead, lookup symbols through the module that is being compiled. This
should be more correct because KonanPlatform.builtIns represents
built-ins loaded from kotlin-compiler.jar's resources

* Minor, make Context.moduleDescriptor lateinit and not null

* Do not ever load KonanBuiltIns from Kotlin compiler anymore

KonanBuiltIns.builtInsModule is now always the module that is being
compiled at the moment. An instance of KonanBuiltIns is thus nothing
more than a helper that loads classes with some predefined names from
the module that is being compiled

* Temporarily disable a part of IR validation
2017-03-14 15:48:42 +03:00
Igor Chevdar ccbf4bb963 Supported KProperty2 and KMutableProperty2 (#340)
Consider this code:
object Delegate {
    operator fun getValue(t: Any?, p: KProperty<*>): String {
        return ""
    }
}

class A {
    val String.ext by Delegate
}

then the type of <p> is KProperty2 (it has 2 receivers).
2017-03-14 08:43:30 -04:00
Svyatoslav Scherbina c9e2b5ac69 backend: fix handling unreachable return from inlined function 2017-03-14 13:32:46 +07:00
Ilya Matveev d3945bff3b tests: Add fail() function to TestUtils 2017-03-13 19:03:57 +03:00
Igor Chevdar 1cd229d8e5 Default enum class should not have primary constructor. (#335)
* Default enum class should not have primary constructor.

* Made simple delegating constructor non-primary + some refactoring.

* Make singleton object constructor primary.
2017-03-13 11:46:11 -04:00
SvyatoslavScherbina b803e95c0b backend: fix kt6590_identityEquals.kt (#333)
Customize `===` for value types to achive the same behavior as with JVM BE
2017-03-13 16:45:33 +03:00
Ilya Matveev 20ffd6d90b tests: Add test for assertion fail 2017-03-13 16:25:48 +03:00