v0.3.1 preparations. (#806)

This commit is contained in:
Nikolay Igotti
2017-08-24 15:03:19 +03:00
committed by GitHub
parent 8957320504
commit 69bf28cc23
9 changed files with 171 additions and 28 deletions
+10
View File
@@ -1,3 +1,13 @@
## v0.3.1 (Aug 2017) ##
* Improvements in C interop tools (function pointers, bitfields, bugfixes)
* Improvements to Gradle plugin and dependency downloader
* Support for immutable data linked into an executable via ImmutableDataBlob class
* Kotlin 1.1.4 supported
* Basic variable inspection support in the debugger
* Some performance improvements ("for" loops, memory management)
* .klib improvements (keep options from .def file, faster inline handling)
* experimental workers API added (see [`sample`](https://github.com/JetBrains/kotlin-native/blob/master/samples/workers))
## v0.3 (Jun 2017) ##
* Preliminary support for x86-64 Windows hosts and targets
* Support for producing native activities on 32- and 64-bit Android targets
+5 -4
View File
@@ -34,12 +34,12 @@ the following platforms:
To run _Kotlin/Native_ JDK8 for the host platform has to be installed.
Note that Java 9 not yet supported.
The language and library version supported by this EAP release mostly match Kotlin 1.1.
The language and library version supported by this EAP release mostly match Kotlin 1.1.4.
However, there are certain limitations, see section [Known Limitations](#limitations).
Currently _Kotlin/Native_ uses reference counting based memory management scheme with a cycle
collection algorithm. Multiple threads could be used, but no objects shared
between threads are allowed.
collection algorithm. Multiple threads could be used, but objects must be explicitly transferred
between threads, and same object couldn't be accessed by two threads concurrently.
_Kotlin/Native_ provides efficient interoperability with libraries written in C, and supports
automatic generation of Kotlin bindings from a C header file.
@@ -100,4 +100,5 @@ Notice that property delegation (including lazy properties) *does* work.
b kfun:main(kotlin.Array<kotlin.String>)
to set breakpoint in main function of your application. Single stepping and step into shall work,
variable inspection does not work yet. See [`DEBUGGING.md`](https://github.com/JetBrains/kotlin-native/blob/master/DEBUGGING.md)
variable inspection partially works (not on val's, var's only).
See [`DEBUGGING.md`](https://github.com/JetBrains/kotlin-native/blob/master/DEBUGGING.md)
+50
View File
@@ -0,0 +1,50 @@
## Making release of Kotlin/Native ##
### Move version up in the repository ###
* Increment `konanVersion` in topmost `gradle.properties`.
* Create entry for new release in CHANGELOG.md file (consult git history for features included)
* Update RELEASE_NOTES.md with actual information on the released bits
### Create tagged release branch ###
git checkout -b v0.X-fixes
git tag -a v0.X -m "version 0.X"
git push --set-upstream origin origin v0.X-fixes --tags
### Build for all supported platforms ###
Repeat those steps for Mac OS X, Linux x86-64 and Windows x64 machines/VMs:
git pull
git checkout -b v0.X-fixes origin/v0.X-fixes
./gradlew clean bundle
Make sure all samples are buildable from the bundle with both Gradle and shell script builds.
### Create GitHub release ###
Create release at [`GitHub release page`](https://github.com/JetBrains/kotlin-native/releases).
We usually mark 0.X releases as pre-releases.
Upload builds created on the previous step to the GitHub release page.
### Upload builds ###
Upload build to CDN at upload.cds.intellij.net/kotlin/native.
Bundles are available at http://download.jetbrains.com/kotlin/native/<build>
in few minutes after upload.
Upload Gradle plugin to BinTray
BINTRAY_USER=... BINTRAY_KEY=... ./gradlew :tools:gradle-plugin:bintrayUpload
### Blog post ###
Notify #kotlin-native channel on public slack.
Write a meaningfully sized blog post describing new release at https://blog.jetbrains.com.
Login at https://blog.jetbrains.com/kotlin/wp-login.php. Synchronize with @abreslav and @yole.
Publish and enjoy!
-23
View File
@@ -1,23 +0,0 @@
/*
* Copyright 2010-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
buildscript {
ext.kotlin_version = '1.0.3'
apply from: "$rootDir/gradle/kotlinGradlePlugin.gradle"
}
apply plugin: 'java'
apply plugin: 'kotlin'
+1 -1
View File
@@ -24,5 +24,5 @@ kotlinCompilerRepo=https://dl.bintray.com/jetbrains/kotlin-native-dependencies
#kotlinCompilerRepo=http://oss.sonatype.org/content/repositories/snapshots
#kotlinCompilerRepo=http://dl.bintray.com/kotlin/kotlin-dev
kotlinCompilerModule=org.jetbrains.kotlin:kotlin-compiler:1.1-20170818.205557-805
konanVersion=0.3
konanVersion=0.3.1
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
+1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env bash
EXCLUDE=()
BUILD_SCRIPT="build.sh"
+41
View File
@@ -0,0 +1,41 @@
# Workers
This example shows how one could implement computation offload to other workers
(usually mapped to OS threads) and transfer data back and forth between workers.
Idea of workers is to avoid most common problems with concurrent programming, related
to simultaneous computations on the same data. Instead, each object belongs to
one or other worker's object graph, but could be disconnected from one worker
and connected to other worker. This relies on fact that memory management
engine can ensure, that one worker doesn't keep references to certain object and
whatever it refers to, and so the object could be safely transferred to another worker.
Workers do not share any state (i.e. globals and Kotlin static objects have different
values in different workers), but share executable code of the program and some
immutable data, such as immutable binary blobs. But Kotlin objects can be transferred
between workers, as long, as they do not refer to objects, having external references.
The transfer is implemented with the function `schedule()` having the following signature
fun <T1, T2>
schedule(mode: TransferMode,
producer: () -> T1,
@VolatileLambda job: (T1) -> T2): Future<T2>
Kotlin/Native runtime invokes `producer()` function, and makes sure object it produces
have a property, that no external references to subgraph rooted by this object, exists.
If property doesn't hold, either (depending on `mode` argument) exception is being thrown
or program may crash unexpectedly.
Then, pointer to stateless lambda `job` along with the stable pointer to parameter object
is being added to the target worker's queue, and `Future` object matching to the query
is being created. Once worker peeks the job from the queue, it executes stateless lambda
with object provided, and stores stable pointer to result in future's data. Whenever
future is being consumed, object is passed to the consumer's callback.
This particular example starts several workers, and gives them some computational jobs.
Then it continues execution, and waits on future objects encapsulating the
computation results. Afterwards, worker execution termination is requested with the
`requestTermination()` operation.
To build use `./build.sh`.
To run use `./build/konan/bin/Worker.kexe`
+35
View File
@@ -0,0 +1,35 @@
import konan.worker.*
data class WorkerArgument(val intParam: Int, val stringParam: String)
data class WorkerResult(val intResult: Int, val stringResult: String)
fun main(args: Array<String>) {
val COUNT = 5
val workers = Array(COUNT, { _ -> startWorker()})
for (attempt in 1 .. 3) {
val futures = Array(workers.size, { workerIndex -> workers[workerIndex].schedule(TransferMode.CHECKED, {
WorkerArgument(workerIndex, "attempt $attempt") }) { input ->
var sum = 0
for (i in 0..input.intParam * 1000) {
sum += i
}
WorkerResult(sum, input.stringParam + " result")
}
})
val futureSet = futures.toSet()
var consumed = 0
while (consumed < futureSet.size) {
val ready = futureSet.waitForMultipleFutures(10000)
ready.forEach {
it.consume { result ->
if (result.stringResult != "attempt $attempt result") throw Error("Unexpected $result")
consumed++ }
}
}
}
workers.forEach {
it.requestTermination().consume { _ -> }
}
println("OK")
}
+28
View File
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
DIR=$(cd "$(dirname "${BASH_SOURCE[0]}" )" && pwd )
PATH=$DIR/../../dist/bin:$DIR/../../bin:$PATH
SUFFIX=kexe
if [ x$TARGET == x ]; then
case "$OSTYPE" in
darwin*) TARGET=macbook ;;
linux*) TARGET=linux ;;
msys*) TARGET=mingw; SUFFIX=exe ;;
*) echo "unknown: $OSTYPE" && exit 1;;
esac
fi
var=CFLAGS_${TARGET}
CFLAGS=${!var}
var=LINKER_ARGS_${TARGET}
LINKER_ARGS=${!var}
var=COMPILER_ARGS_${TARGET}
COMPILER_ARGS=${!var} # add -opt for an optimized build.
mkdir -p $DIR/build/bin/
konanc $COMPILER_ARGS -target $TARGET $DIR/Workers.kt \
-o $DIR/build/bin/Workers || exit 1
echo "Artifact could be found at $DIR/build/bin/Workers.$SUFFIX"