Commit Graph

1858 Commits

Author SHA1 Message Date
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
Nikolay Igotti 7a876a3ccd Provide entry point customization (#352) 2017-03-17 17:40:24 +03:00
Svyatoslav Scherbina 47dfe122fc Handle String constructor call in code generator 2017-03-17 21:05:24 +07:00
Svyatoslav Scherbina bb1c52c23b Fix launcher for external box tests with one-letter package 2017-03-17 20:08:36 +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
Nikolay Igotti a2e8c7f638 Do not fail if locale is not supported 2017-03-16 18:02:55 +03: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
Nikolay Igotti 1e5d34bc85 Provide nicer Tetris build env (#350) 2017-03-16 11:58:04 +03:00
Alexander Gorshenev a0fe8b8be8 Removed a parasitic println. 2017-03-16 01:55:57 +04:00
Alexander Gorshenev afdcca86c0 Allow ios and ios-sim targets. 2017-03-16 01:55:36 +04:00
Alexander Gorshenev a7677e2a8b Renamed interop 'target' to 'flavour'. 2017-03-16 01:55:36 +04:00
Nikolay Igotti 7279873bb4 Fix build of interop tests. 2017-03-15 19:19:16 +03:00
Igor Chevdar 6cb0f5ad41 Merge pull request #343 from JetBrains/tetris
Tetris
2017-03-15 11:54:13 -04:00
Igor Chevdar 151bb6793d Review fix 2017-03-15 18:53:06 +03:00
Igor Chevdar 9e8897fdb3 Added reaction to closing the window 2017-03-15 18:53:06 +03:00
Igor Chevdar 97f7a55111 Refactoring 2017-03-15 18:53:06 +03:00
Igor Chevdar 3cf844d589 Simplified user input handling 2017-03-15 18:53:05 +03:00
Igor Chevdar d21d444f58 Hack for flags enums.
refactoring

Made non-virtual function.

Refactoring

Rebase fixes

Revert "Made non-virtual function."

This reverts commit d7bfaa5bd970864f57daf18e46741ca72c5d4fe4.

Reverted hack
2017-03-15 18:52:51 +03:00
Igor Chevdar c437f715c4 Tetris 2017-03-15 18:49:53 +03:00
Nikolay Igotti f3794aa206 Improve interop user experience and docs (#342) 2017-03-15 17:25:10 +03:00
Nikolay Igotti e67d9d4065 Remove Cloneable interface (#347) 2017-03-15 16:20:50 +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
Vasily Levchenko 5215a9b60b STDLIB: added emptyArray() 2017-03-15 15:33:56 +03:00
Svyatoslav Scherbina c9b04bc0bb Fix methods inherited from Any in interop value types 2017-03-15 18:20:06 +07:00
Svyatoslav Scherbina d1859dd280 Improve function types support in interop
* Support `typedef` to function type without pointer;
* Support 64-bit integers in function types;
* Generate opaque function type on JVM if not supported.

Fix other minor bugs.
2017-03-15 18:20:06 +07:00
Nikolay Igotti 397928b066 Release notes. (#316) 2017-03-14 18:56:41 +03: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
Ilya Matveev 10eef395f4 stdlib: Add empty kotlin.experimental package
This patch adds empty kotlin.experimental package to avoid unresolved
reference errors in bitwiseOp tests:

external_codegen_box_binaryOp/bitwiseOp.kt
external_codegen_box_binaryOp/bitwiseOpAny.kt
external_codegen_box_binaryOp/bitwiseOpNullable.kt

Byte/Short bitwise operations are supported in Kotlin Native by default.
2017-03-14 16:24:20 +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
Nikolay Igotti 29726e601f Fix interop tool on Linux 2017-03-14 13:04:33 +03:00
Nikolay Igotti 7615931b84 Add missing exceptions, make exception classes open (#338) 2017-03-14 12:01:37 +03:00
Svyatoslav Scherbina c9e2b5ac69 backend: fix handling unreachable return from inlined function 2017-03-14 13:32:46 +07:00
Svyatoslav Scherbina 37b7940544 Interop: generate fewer adapters when targeting Kotlin Native
Also do some refactoring.
2017-03-14 13:01:38 +07:00
Vasily Levchenko a78f38d26c compiler: 1.1-20170310.145051-441 2017-03-13 19:14:40 +03:00
Ilya Matveev d3945bff3b tests: Add fail() function to TestUtils 2017-03-13 19:03:57 +03:00
Ilya Matveev 8e91da7aad build/tests: Import box() function package in the launcher 2017-03-13 19:03:57 +03:00