v0.8 preparations. (#1762)
This commit is contained in:
@@ -1,3 +1,15 @@
|
||||
## v0.8 (Jul 2018)
|
||||
* Singleton objects are frozen after creation, and shared between threads
|
||||
* String and primitives types are frozen by default
|
||||
* Common stdlib with Kotlin/JVM and Kotlin/JS
|
||||
* Implemented `kotlin.random.*` and `Collection.shuffle`
|
||||
* Implemented atomic integers and atomic references
|
||||
* Multiple bugfixes in compiler (coroutines, inliner)
|
||||
* Support 32-bit iOS (target `ios_arm32`)
|
||||
* New experimental Gradle plugin
|
||||
* Support XCode 9.4.1
|
||||
* Optimizations (switch by enum, memory management)
|
||||
|
||||
## v0.7.1 (Jun 2018)
|
||||
* Bugfixes in the runtime (indexOf, GC for kotlin.Array, enum equality) and the compiler
|
||||
* Fix NSBlock problem, preventing upload of binaries to the AppStore
|
||||
|
||||
@@ -20,18 +20,21 @@ C language header, allowing to use all public APIs available in your Kotlin/Nati
|
||||
See `samples/python_extension` as an example of using such shared object to provide a bridge between Python and
|
||||
Kotlin/Native.
|
||||
|
||||
|
||||
Q: How do I create static library or an object file?
|
||||
|
||||
A: Use `-produce static` compiler switch, or `konanArtifacts { static('foo') {} }` in Gradle.
|
||||
It will produce platform-specific static object (.a library format) and C language header, allowing to
|
||||
use all public APIs available in your Kotlin/Native program from C/C++ code.
|
||||
|
||||
|
||||
Q: How do I run Kotlin/Native behind corporate proxy?
|
||||
|
||||
A: As Kotlin/Native need to download platform specific toolchain, you need to specify
|
||||
`-Dhttp.proxyHost=xxx -Dhttp.proxyPort=xxx` as compiler's or `gradlew` arguments,
|
||||
or set it via `JAVA_OPTS` environment variable.
|
||||
|
||||
|
||||
Q: How do I specify custom Objective-C prefix/name for my Kotlin framework?
|
||||
|
||||
A: Use `-module_name` compiler option or matching Gradle DSL statement, i.e.
|
||||
@@ -40,3 +43,18 @@ framework("MyCustomFramework") {
|
||||
extraOpts '-module_name', 'TheName'
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Q: Why do I see `InvalidMutabilityException`?
|
||||
|
||||
A: It likely happens, because you are trying to mutate a frozen object. Object could transfer to the
|
||||
frozen state either explicitly, as objects reachable from objects on which `konan.worker.freeze` is called,
|
||||
or implicitly (i.e. reachable from `enum` or global singleton object - see next question).
|
||||
|
||||
|
||||
Q: How do I make a singleton object mutable?
|
||||
|
||||
A: Currently, singleton objects are immutable (i.e. frozen after creation), and it's generally considered
|
||||
a good practise to have global state immutable. If for some reasons you need mutable state inside such an
|
||||
object, use `@konan.ThreadLocal` annotation on the object. Also `konan.worker.AtomicReference` class could be
|
||||
used to store different pointers to frozen objects in a frozen object and atomically update those.
|
||||
+5
-4
@@ -25,11 +25,12 @@ the following platforms:
|
||||
(`-target linux`, default on Linux hosts)
|
||||
* Microsoft Windows x86-64 (tested on Windows 7 and Windows 10), host and target (`-target mingw`,
|
||||
default on Windows hosts)
|
||||
* Apple iOS (armv7 and arm64 devices, x86 simulator), cross-compiled target (`-target ios_arm64`), hosted on macOS
|
||||
* Apple iOS (armv7 and arm64 devices, x86 simulator), cross-compiled target
|
||||
(`-target ios_arm32|ios_arm64|ios_x64`), hosted on macOS
|
||||
* Linux arm32 hardfp, Raspberry Pi, cross-compiled target (`-target raspberrypi`), hosted on Linux
|
||||
* Linux mips big endian, cross-compiled target (`-target mips`), hosted on Linux
|
||||
* Linux mips little endian, cross-compiled target (`-target mipsel`), hosted on Linux
|
||||
* Android arm32 and arm64 (`-target android_arm32` and `-target android_arm64`) target, hosted on Linux or macOS
|
||||
* Linux MIPS big endian, cross-compiled target (`-target mips`), hosted on Linux
|
||||
* Linux MIPS little endian, cross-compiled target (`-target mipsel`), hosted on Linux
|
||||
* Android arm32 and arm64 (`-target android_arm32|android_arm64`) target, hosted on Linux or macOS
|
||||
* WebAssembly (`-target wasm32`) target, hosted on Linux, Windows or macOS
|
||||
|
||||
Adding support for other target platforms shouldn't be too hard, if LLVM support is available.
|
||||
|
||||
@@ -117,6 +117,11 @@ class AtomicNativePtr(private var value: NativePtr) {
|
||||
@SymbolName("Kotlin_AtomicReference_checkIfFrozen")
|
||||
external private fun checkIfFrozen(ref: Any?)
|
||||
|
||||
/**
|
||||
* An atomic reference to a frozen Kotlin object. Can be used in concurrent scenarious
|
||||
* and must be zeroed out (with `compareAndSwap(get(), null)`) once no longer needed.
|
||||
* Otherwise memory leak could happen.
|
||||
*/
|
||||
@Frozen
|
||||
class AtomicReference<T>(private var value: T? = null) {
|
||||
// A spinlock to fix potential ARC race. Not an AtomicInt just for the effeciency sake.
|
||||
|
||||
Reference in New Issue
Block a user