Commit Graph

412 Commits

Author SHA1 Message Date
Dominic Fischer ce4c4f62f7 Fix typo (#3718) 2019-12-25 14:14:53 +03:00
Sergey Bogolepov 178ba2944b [Interop][watchos_arm64] Fix platform libs generation
Pass -O2 flag to Clang to avoid inline asm in wrappers.
2019-12-19 20:10:59 +07:00
Sergey Bogolepov 34323be304 [StubIr][Metadata] Add support for classes and constructors 2019-12-16 13:06:35 +07:00
Sergey Bogolepov 37f9161ec2 [StubIr][Metadata] Add MappingExtensions class
Parent nodes may introduce some kind of context to their children. For example, type parameters.
Because of that we wrap all extension functions into MappingExtensions class.
2019-12-16 13:06:35 +07:00
Sergey Bogolepov 7e0a65e480 [StubIr][Metadata] Preparations for class metadata support
ClassStubs are containers themselves. Thus we need to make metadata emitter recursive and:
1. Pass context from parent nodes to children.
2. Return result of translation from children back to parent.
2019-12-16 13:06:35 +07:00
Sergey Bogolepov c42b588f12 [StubIr][UniqId] Extend StubIrUniqIdProvider
1. Add support for classes and constructors
2. Lift restrictions on functions and properties
2019-12-16 13:06:35 +07:00
Sergey Bogolepov 47fe152748 [StubIr] StubOrigin improvements
1. Add `isMeta` to StubOrigin.ObjCClass and StubOrigin.ObjCProtocol. It allows to provide proper UniqId to corresponding ClassStubs.
2. Rename StubOrigin.None to StubOrigin.Synthetic because it is makes name self-explaining.
2019-12-16 13:06:35 +07:00
Sergey Bogolepov 0438c7cf85 [StubIr] Refactor ClassStub
1. Add explicit primary constructor
2. Add constructor to the companion object

All these changes are required to make ClassStub translation to KmClass easier.
2019-12-16 13:06:35 +07:00
Sergey Bogolepov f64eecbdad [StubIr] Get rid of ConstructorParameterStub
Replaced it with FunctionParameterStub.
2019-12-16 13:06:35 +07:00
Sergey Bogolepov e187a4b40b [Interop][Metadata] Emit chunked metadata 2019-12-16 13:06:35 +07:00
Sergey Bogolepov b6b447c0d5 [Interop][Metadata] Mark UniqId as public
Public declaration's UniqId should have MSB == 1.
Despite we using our own mangling scheme we still need to respect this convention.
Otherwise IrLinker will go crazy searching for missing local declaration.
2019-12-03 17:23:39 +07:00
Sergey Bogolepov f10965cbec [Interop][StubIR] Add "abstract" member stub modality 2019-12-03 17:23:39 +07:00
Sergey Bogolepov 32bea765f0 [Interop] Add tests for StubIr to metadata translation. 2019-12-03 17:23:39 +07:00
Sergey Bogolepov ee672f31df [Interop] Started to work on StubIr -> Metadata translator
Basic support for function, global properties, and type aliases.
Also added AbbreviatedStubType to make translation to metadata a bit easier.
2019-12-03 17:23:39 +07:00
Sergey Bogolepov 0712a2ae48 [Interop][StubIr] Add origin to TypealiasStub 2019-12-03 17:23:39 +07:00
Sergey Bogolepov a4486de7fa [Interop][StubIr] Add origin to PropertyStub 2019-12-03 17:23:39 +07:00
Sergey Bogolepov cd07dec326 [Interop][StubIr] Add classifier property to AnnotationStub
to make translation to metadata easier
2019-12-03 17:23:39 +07:00
Sergey Bogolepov a194ec18e7 [cinterop] Fix mapping of typedefs to pointers to typedefs
Mapping type aliases from stub ir to metadata is kinda tricky.
We need to preserve references to type alias declarations when translating
expanded types. The problem is that we translate C declarations and types independently.
In the most cases these processes are coherent. But not for type aliases to pointers to type aliases.
This commit fixes it.
2019-12-03 17:23:39 +07:00
Sergey Bogolepov e714f1e067 [Interop] Move dependency resolution into processCLib
Because metadata mode doesn't call compiler we need to
resolve dependencies (including stdlib) by hand. This logic was partially
implemented in `InteropCompiler.kt`. So we move it into `processCLib`.
2019-12-03 17:23:39 +07:00
Sergey Bogolepov 2e22d5a389 [Interop] Add dependency on kotlinx-metadata-klib 2019-12-03 17:23:39 +07:00
Alexander Gorshenev fcba683e72 A native counterpart for plubing metadata and ir versions to klib manifest
(cherry picked from commit 06a515393df6c1c071a551353a2a82fd2252a24c)
2019-12-02 15:23:00 +01:00
Vladimir Ivanov f6f02a69c4 Char-based enum shall be mapped to integer-based (#3621)
* Char-based enum shall be mapped to integer-basede

* revised, using actual base type and Byte for constants of CharType

* minor cleanup
2019-11-29 17:19:10 +03:00
Vladimir Ivanov f1b4a9f150 Fix interop support of struct containing simd (#3602) 2019-11-22 14:38:05 +03:00
Vladimir Ivanov 2358edf4e8 simd-128 basic support (#3498) 2019-11-13 19:16:35 +03:00
Sergey Bogolepov 54f4a1216e [Interop] Introduce InteropMangler (#3574)
To be able to reference external declarations from KLIBs we need to compute UniqId
for them. Thus we add InteropMangler that can compute mangle
(which in turn is used for UniqId) for declarations from NativeIndex.
2019-11-13 14:48:00 +07:00
Sergey Bogolepov e8ad4712d3 [interop] Prepare interop driver for a metadata-only mode. 2019-11-05 18:41:38 +07:00
Igor Chevdar 71ab6e0f82 Bumped both bootstrap compiler and usual compiler versions 2019-10-31 18:33:14 +03:00
Ilya Matveev 838cccf275 Workaround clang crash in cinterop tool (KT-34467) 2019-10-23 18:04:40 +03:00
LepilkinaElena e21ab4f1e7 Creating fat jar with shadow plugin and collisions detector (#3466) 2019-10-21 12:32:06 +03:00
Nikolay Igotti f578ce88f5 Compiler daemon (#3442) 2019-10-14 18:44:27 +03:00
Sergey Bogolepov c675fff032 Fix typo in assertion 2019-10-10 17:56:48 +03:00
Sergey Bogolepov 303f6638f4 [StubIR][Interop] Rework StubIR type system to make it usable for metadata-based interop 2019-10-10 15:46:21 +03:00
LepilkinaElena bd0e0dd2e7 Deprecate -compilerOpts and -linkerOpts in cinterop (#3450) 2019-10-10 14:26:12 +03:00
Nikolay Igotti 64be2b7fdc Revert "Compiler daemon (#3442)"
This reverts commit e4fb6fd271.
2019-10-09 20:58:27 +03:00
Igor Chevdar e4fb6fd271 Compiler daemon (#3442) 2019-10-09 20:35:13 +03:00
Sergey Bogolepov c42a53bcc9 [C Interop] Use CCall annotation for global getters and setters. (#3420) 2019-10-07 10:00:17 +03:00
SvyatoslavScherbina 25820bd227 Fix JVM cinterop callbacks when loaded with custom classloader (#3411) 2019-10-04 16:07:42 +03:00
Sergey Bogolepov 592f31a969 [watchOS] Add support of watch_arm64 target. (#3404)
* [watchOS] Add support of watch_arm64 target.
Since there is no support of `arm64_32` in LLVM 8
we compile bitcode that was generated for `watchos_arm32` to `arm64_32-apple-watchos`.
2019-10-01 19:03:45 +03:00
SvyatoslavScherbina b7ad1d9907 Improve determining which C enum constants are explicitly defined (#3384)
Improve determining which C enum constants are explicitly defined
2019-09-27 19:56:09 +03:00
Nikolay Igotti 0123dc955a Update to XCode 11. (#3375) 2019-09-27 14:18:59 +03:00
Sergey Bogolepov 094f113e06 Move ABI-specific parts of forward interop to the separate file. 2019-09-16 15:06:09 +07:00
Sergey Bogolepov bcaf986e3a [watchOS][targets] Add support for 32bit Apple Watch. 2019-09-16 15:06:09 +07:00
Vladimir Ivanov 05ce6e1e84 [KT-32929] Filter exceptions from objc alloc (#3318)
Issue: 
SIGSEGV in Throwable.printStackTrace when terminating after ObjC alloc exception

Root-cause: 
Corrupted kotlin.Throwable has been sent as ReportUnhandledException() parameter

Fix: 
Use @FilterException which terminates correctly with objc_terminate
2019-09-13 14:50:23 +03:00
Ilya Matveev 31e2fa28ad Interop: Use package name in wrapper names
Linking two interop libraries containing the same declaration
causes a 'symbol multiply defined' error. This patch fixes it
by using FQ-names for wrapper functions.
2019-09-08 19:17:59 +07:00
Sergey Bogolepov 237b7ef182 Preliminary tvOS support. 2019-09-07 12:48:45 +07:00
LepilkinaElena 8e0e346492 CLI library rework (#3215) 2019-09-06 17:49:12 +03:00
Sergey Bogolepov e3f4d09aeb Generate C wrapper instead of bridge for all functions. (#3153)
[C Interop] Generate C wrapper instead of bridge for all functions.
2019-08-29 11:04:10 +07:00
Ilya Matveev e8d8df6928 Tests: Support two-stage compilation (src -> klib -> kexe) 2019-08-27 12:02:02 +07:00
Svyatoslav Scherbina 7efab59bc1 Support importing non-conventional parameterless Objective-C init
Thus fix #2522 by supporting -[NSOutputStream initToMemory].
2019-08-13 16:25:51 +03:00
LepilkinaElena b25f018fe0 Fix of dependency (#3205) 2019-07-23 11:01:33 +03:00