Skip to content

Commit

Permalink
more fixed for documentation files (JetBrains#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyzzz authored and olonho committed Sep 7, 2018
1 parent f79146c commit 8f768fd
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 69 deletions.
19 changes: 8 additions & 11 deletions CONCURRENCY.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.


## <a name="transfer"></a>Object transfer and freezing
<a name="transfer"></a>
## 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
Expand All @@ -82,15 +76,17 @@ 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.

## <a name="detach"></a>Object subgraph detachment
<a name="detach"></a>
## 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
could be stored in C data structure, and later attached back with `attachObjectGraph<T>` in arbitrary thread
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.

## <a name="shared"></a>Raw shared memory
<a name="shared"></a>
## 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
Expand Down Expand Up @@ -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.

## <a name="top_level"></a>Global variables and singletons
<a name="top_level"></a>
## 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:
Expand Down
6 changes: 0 additions & 6 deletions DEBUGGING.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 0 additions & 5 deletions FAQ.md
Original file line number Diff line number Diff line change
@@ -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<String>)`, please ensure it's not
Expand Down
10 changes: 2 additions & 8 deletions GRADLE_PLUGIN.md
Original file line number Diff line number Diff line change
@@ -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)_.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions IMMUTABILITY.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
type: doc
layout: reference
title: "Immutability in Kotlin/Native"
---

# Immutability in Kotlin/Native

Kotlin/Native implements strict mutability checks, ensuring
Expand Down
6 changes: 0 additions & 6 deletions INTEROP.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
type: doc
layout: reference
title: "Kotlin/Native interoperability"
---

# _Kotlin/Native_ interoperability #

## Introduction ##
Expand Down
6 changes: 0 additions & 6 deletions LIBRARIES.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
type: doc
layout: reference
title: "Kotlin/Native libraries"
---

# Kotlin/Native libraries

## Kotlin compiler specifics
Expand Down
8 changes: 1 addition & 7 deletions MULTIPLATFORM.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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.
10 changes: 2 additions & 8 deletions OBJC_INTEROP.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 0 additions & 6 deletions PLATFORM_LIBS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
---
type: doc
layout: reference
title: "Platform libraries"
---

# Platform libraries

## Overview
Expand Down

0 comments on commit 8f768fd

Please sign in to comment.