From 8f768fd1dfe0072b2117bb6479c99273f6a03345 Mon Sep 17 00:00:00 2001 From: Eugene Petrenko Date: Fri, 7 Sep 2018 15:30:07 +0300 Subject: [PATCH] more fixed for documentation files (#2016) --- CONCURRENCY.md | 19 ++++++++----------- DEBUGGING.md | 6 ------ FAQ.md | 5 ----- GRADLE_PLUGIN.md | 10 ++-------- IMMUTABILITY.md | 6 ------ INTEROP.md | 6 ------ LIBRARIES.md | 6 ------ MULTIPLATFORM.md | 8 +------- OBJC_INTEROP.md | 10 ++-------- PLATFORM_LIBS.md | 6 ------ 10 files changed, 13 insertions(+), 69 deletions(-) diff --git a/CONCURRENCY.md b/CONCURRENCY.md index d3874f35586..0a716fbf89e 100644 --- a/CONCURRENCY.md +++ b/CONCURRENCY.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Concurrency in Kotlin/Native" ---- - ### Concurrency in Kotlin/Native Kotlin/Native runtime doesn't encourage a classical thread-oriented concurrency @@ -60,8 +54,8 @@ title: "Concurrency in Kotlin/Native" For more complete example please refer to the [workers example](https://github.com/JetBrains/kotlin-native/tree/master/samples/workers) in the Kotlin/Native repository. - -## Object transfer and freezing + +## Object transfer and freezing Important invariant that Kotlin/Native runtime maintains is that object is either owned by a single thread/worker, or is immutable (_shared XOR mutable_). This ensures that the same data has a single mutator, and so no need for @@ -82,7 +76,8 @@ title: "Concurrency in Kotlin/Native" is allowed. Currently, Kotlin/Native runtime only freezes enum objects after creation, although additional autofreezing of certain provably immutable objects could be implemented in the future. -## Object subgraph detachment + +## Object subgraph detachment Object subgraph without external references could be disconnected using `detachObjectGraph` to a `COpaquePointer` value, which could be stored in `void*` data, so disconnected object subgraphs @@ -90,7 +85,8 @@ title: "Concurrency in Kotlin/Native" or worker. Combined with [raw memory sharing](#shared) it allows side channel object transfer between concurrent threads, if worker mechanisms are insufficient for the particular task. -## Raw shared memory + +## Raw shared memory Considering strong ties of Kotlin/Native with C via interoperability, in conjunction with other mechanisms mentioned above one could build popular data structures, like concurrent hashmap or shared cache with @@ -118,7 +114,8 @@ class SharedData(rawPtr: NativePtr) : CStructVar(rawPtr) { So combined with the top level variable declared above, it allows seeing the same memory from different threads and building traditional concurrent structures with platform-specific synchronization primitives. -## Global variables and singletons + +## Global variables and singletons Frequently, global variables are a source of unintended concurrency issues, so _Kotlin/Native_ implements following mechanisms to prevent unintended sharing of state via global objects: diff --git a/DEBUGGING.md b/DEBUGGING.md index 7ef54cc2a14..05eb5bc7ca6 100644 --- a/DEBUGGING.md +++ b/DEBUGGING.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Debugging" ---- - ## Debugging Currently Kotlin native compiler produces debug info compatible with DWARF 2 specification, so modern debugger tools could diff --git a/FAQ.md b/FAQ.md index 15ae624d960..e8464d4ea63 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,8 +1,3 @@ ---- -type: doc -layout: reference -title: "FAQ" ---- ### Q: How do I run my program? A: Define top level function `fun main(args: Array)`, please ensure it's not diff --git a/GRADLE_PLUGIN.md b/GRADLE_PLUGIN.md index a786eae6199..0334f8c784c 100644 --- a/GRADLE_PLUGIN.md +++ b/GRADLE_PLUGIN.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Kotlin/Native Gradle plugin" ---- - # Kotlin/Native Gradle plugin _Note: For the experimental DSL see the [corresponding section](#experimental-plugin)_. @@ -69,7 +63,7 @@ The Kotlin/Native Gradle plugin allows one to build artifacts of the following t * Executable * KLibrary - a library used by Kotlin/Native compiler (`*.klib`) -* Interoperability library - a special type of library providing an interoperability with some native API. See [`INTEROP.md`](INTEROP.md) for details +* Interoperability library - a special type of library providing an interoperability with some native API. See [INTEROP.md](INTEROP.md) for details * Dynamic library (`*.so`/`*.dylib`/`*.dll`) * Objective-C framework * LLVM bitcode @@ -381,7 +375,7 @@ Using a dynamic library is shown in the [python extension sample](samples/python An Objective-C framework can be built using the `framework` artifact block. This block contains the same options as other ones. One may access the framework built using `artifact` property of the building task -(see the [**Tasks**](#Tasks) section). Unlike other artifacts this property points to a directory instead of a regular file. +(see the [**Tasks**](#tasks) section). Unlike other artifacts this property points to a directory instead of a regular file. ``` konanArtifacts { diff --git a/IMMUTABILITY.md b/IMMUTABILITY.md index 0275f6826a9..e8433df3ff8 100644 --- a/IMMUTABILITY.md +++ b/IMMUTABILITY.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Immutability in Kotlin/Native" ---- - # Immutability in Kotlin/Native Kotlin/Native implements strict mutability checks, ensuring diff --git a/INTEROP.md b/INTEROP.md index 38cc134b2c6..c78a160f19a 100644 --- a/INTEROP.md +++ b/INTEROP.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Kotlin/Native interoperability" ---- - # _Kotlin/Native_ interoperability # ## Introduction ## diff --git a/LIBRARIES.md b/LIBRARIES.md index bab3aca865b..a8df27cb0ea 100644 --- a/LIBRARIES.md +++ b/LIBRARIES.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Kotlin/Native libraries" ---- - # Kotlin/Native libraries ## Kotlin compiler specifics diff --git a/MULTIPLATFORM.md b/MULTIPLATFORM.md index 98941cdecc4..8b534e6aab8 100644 --- a/MULTIPLATFORM.md +++ b/MULTIPLATFORM.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Kotlin/Native in multiplatform projects" ---- - # Kotlin/Native in multiplatform projects While Kotlin/Native could be used as the only Kotlin compiler in the project, it is pretty common to combine @@ -374,5 +368,5 @@ framework in order to get code completion). Let's print our greeting: ### Sample A sample implementation which follows these documenation can be found [here](https://github.com/JetBrains/kotlin-mpp-example). -You may also look at the [calculator sample](samples/calculator). It has a simpler structure (particularly both Android app +You may also look at the [calculator sample](https://github.com/JetBrains/kotlin-native/tree/master/samples/calculator). It has a simpler structure (particularly both Android app and Kotlin/Native library are combined in a single Gradle build) but also uses the multiplatform support provided by Kotlin. diff --git a/OBJC_INTEROP.md b/OBJC_INTEROP.md index b30b5e185c0..83c7c6b6717 100644 --- a/OBJC_INTEROP.md +++ b/OBJC_INTEROP.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Kotlin/Native interoperability with Swift/Objective-C" ---- - # _Kotlin/Native_ interoperability with Swift/Objective-C This documents covers some details of Kotlin/Native interoperability with @@ -20,7 +14,7 @@ Swift library can be used in Kotlin code if its API is exported to Objective-C with `@objc`. Pure Swift modules are not yet supported. Kotlin module can be used in Swift/Objective-C code if compiled into a -[framework](GRADLE_PLUGIN.md#framework). See [calculator sample](samples/calculator) +[framework](GRADLE_PLUGIN.md#framework). See [calculator sample](https://github.com/JetBrains/kotlin-native/tree/master/samples/calculator) as an example. ## Mappings @@ -48,7 +42,7 @@ The table below shows how Kotlin concepts are mapped to Swift/Objective-C and vi | `Set` | `Set` | `NSSet` | | | `MutableSet` | `NSMutableSet` | `NSMutableSet` | [note](#collections) | | `Map` | `Dictionary` | `NSDictionary` | | -| `MutableMap` | `NSMutableDictionary` | `NSMutableDictionary` | [note](#mutable-collections) | +| `MutableMap` | `NSMutableDictionary` | `NSMutableDictionary` | [note](#collections) | | Function type | Function type | Block pointer type | [note](#function-types) | ### Name translation diff --git a/PLATFORM_LIBS.md b/PLATFORM_LIBS.md index 4b795ecb131..b470a9299f1 100644 --- a/PLATFORM_LIBS.md +++ b/PLATFORM_LIBS.md @@ -1,9 +1,3 @@ ---- -type: doc -layout: reference -title: "Platform libraries" ---- - # Platform libraries ## Overview