Commit Graph

52 Commits

Author SHA1 Message Date
Nikolay Igotti 5517ed7296 GTK sample (#515)
* GTK sample

* Add full UTF8 recoding ability to interop
2017-04-20 23:09:36 +03:00
Svyatoslav Scherbina 3f84ba462f Rework interop callbacks
*   Do not rely on type inference and `CFunctionType`;
*   Represent struct-typed parameters and return values as `CValue<*>`
    (currently supported only on JVM).
2017-04-20 17:36:22 +03:00
Alexander Gorshenev 8d2c6e4878 Separated native and jvm staticCFunction() because for native it needs not be inline now. 2017-04-18 13:54:37 +03:00
Svyatoslav Scherbina 20d95ae4c8 Implement methods for conversions between Long and CPointer 2017-04-17 18:02:05 +03:00
Svyatoslav Scherbina 716efe7310 Workaround incomplete inline for interop's readValue 2017-04-10 17:28:25 +03:00
Svyatoslav Scherbina a50b38da5a Implement StableObjPtr for Kotlin N 2017-04-03 15:03:26 +03:00
Svyatoslav Scherbina 7f0b8a6778 Fix number of interop issues 2017-03-31 17:24:41 +03:00
Svyatoslav Scherbina 50c3be3fc2 Simplify working with values in interop
* Access primitive interop array elements and struct fields without `.value`
* Simplify C*Var* interop types names
2017-03-31 11:44:07 +03:00
Svyatoslav Scherbina 4a1b2721d8 Eliminate some warnings from Kotlin code 2017-03-30 14:54:55 +03:00
Nikolay Igotti 0cbd34086e Added JB copyright (#417) 2017-03-30 09:51:58 +03:00
Svyatoslav Scherbina b7695b4f20 Make NativePtr.toLong() public 2017-03-29 15:14:40 +03:00
SvyatoslavScherbina c1d9dc1cbb Replace CArray by CPointer (#406)
Also do some cleanup.
2017-03-28 17:44:08 +03:00
Svyatoslav Scherbina 6eb0ceb572 fixup! Implement interop integer conversions to be used with type inference 2017-03-28 12:23:23 +03:00
Svyatoslav Scherbina f65044c7bb Implement interop integer conversions to be used with type inference 2017-03-28 12:23:23 +03:00
Svyatoslav Scherbina 757c306341 Support enum arguments and return values in interop variadic functions 2017-03-28 10:15:06 +03:00
Svyatoslav Scherbina a6b89e3a0d Expose interop enum .value through CEnum interface 2017-03-28 10:15:06 +03:00
SvyatoslavScherbina c4abb8f706 Implement varargs in interop for Kotlin N (#393)
* Implement CValues.equals and .hashCode

* Add trivial test for interop varargs

* Implement varargs in interop for Kotlin N

* Compile and link runtime with libffi

* Fix few places.
2017-03-27 16:44:24 +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 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
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
Svyatoslav Scherbina 46fde200be Interop/Runtime: add allocArrayOf(vararg Float) 2017-03-13 11:00:33 +07:00
Svyatoslav Scherbina 9e716291c1 Interop, backend: add partial support for callbacks
Support callbacks that don't take or return structs by value.
2017-03-01 16:14:17 +07:00
Svyatoslav Scherbina 3411ce2e8c Interop, backend: refactor and reorder interop lowering
* Do not break type compatibility when lowering interop intrinsics.
* Place interop lowering before callable reference lowering.
* Add other improvements to interop implementation.
2017-03-01 16:14:17 +07:00
Svyatoslav Scherbina f8d54fc8f7 Interop: extract constants defined as (preprocessor) macros
Support all macros extending to integer and floating-point constant expressions.

Also do some refactoring.
2017-02-21 16:42:14 +07:00
Svyatoslav Scherbina 01dd86d3b5 Interop, backend: add bitsTo{Float,Double} intrinsics 2017-02-21 16:42:14 +07:00
Svyatoslav Scherbina 6939398521 Interop/Runtime: fix major bug: alloc C strings using correct placement 2017-02-06 11:58:10 +07:00
Svyatoslav Scherbina 49815f72e0 Interop/Runtime: add support for Kotlin Native
Also add minor improvements, fix bugs and workaround missing features.
2017-02-06 11:58:10 +07:00
Alexander Gorshenev 3f65eeaeab Changed byte array copying to a more efficient mechanism. 2016-12-29 16:07:43 +04:00
Alexander Gorshenev e48c5a7215 Introduced
nativeMemUtils.getByteArray
and
    nativeMemUtils.putByteArray
for faster memory copy.
2016-12-20 19:32:27 +04:00
Svyatoslav Scherbina 8dc42bbe35 Interop: support allocating zero bytes 2016-11-30 15:00:55 +07:00
Svyatoslav Scherbina c988175431 Review feedback: move kotlin_.cinterop package to kotlinx 2016-11-23 11:40:17 +07:00
Svyatoslav Scherbina 453a360707 Interop/Runtime: add minor code improvements 2016-11-22 16:47:05 +07:00
Svyatoslav Scherbina 950bc62c7b Review feedback, part 1 2016-11-22 16:45:31 +07:00
Svyatoslav Scherbina a58d682d40 Interop: remove old version 2016-11-22 13:19:49 +07:00
Svyatoslav Scherbina 183f6a6d2f Interop/Indexer: update prebuilts with new interop versions
also port Interop/Runtime/libcallbacks to new interop
2016-11-22 13:19:49 +07:00
Svyatoslav Scherbina f0df5f9435 Interop: implement new version 2016-11-22 13:02:07 +07:00
Svyatoslav Scherbina 3095044420 build: use Kotlin 1.1-M02 to build all Kotlin JVM sources 2016-11-22 13:01:14 +07:00
Svyatoslav Scherbina 8a66de216d Interop: rework String auto conversion
use memScoped
2016-11-22 13:01:04 +07:00
Svyatoslav Scherbina 674713f429 backend: instantiate string literals statically
also improve other code for static instantiation
2016-11-07 17:42:47 +07:00
Svyatoslav Scherbina e7558f9ddc build: add target native SDK as downloadable dependency
also improve Gradle native toolchains configuration
2016-11-02 17:02:14 +07:00
Vasily Levchenko 771be7bef8 attempt to fix mac build 2016-10-26 06:21:31 +03:00
Svyatoslav Scherbina 61e1d91c03 backend.native: use common/hash to compute hashes for RTTI 2016-10-19 13:42:53 +03:00
Svyatoslav Scherbina d43b0f62bc Interop/Runtime: implement trivial lexical mem scopes 2016-10-19 13:33:51 +03:00
Svyatoslav Scherbina e4bc19b145 build: download llvm and libffi from the JFrog repo 2016-10-17 17:35:57 +03:00
Svyatoslav Scherbina bd449b2ac3 Interop/Runtime: properly initialize ffi_type for structs 2016-10-14 16:28:14 +03:00
Svyatoslav Scherbina b4db26f846 Interop/Runtime: do not reuse JNI local ref globally 2016-10-14 16:28:14 +03:00
Svyatoslav Scherbina 98a0e86646 Interop/Runtime: fix building on Linux
use correct libffi*.a variant
2016-10-11 10:57:29 +03:00
Svyatoslav Scherbina af09ce085c Interop: implement callbacks using libffi 2016-10-10 18:41:59 +03:00
Svyatoslav Scherbina 80ed5a2461 Interop: add minor improvements 2016-09-29 17:41:54 +07:00