diff options
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | stubs/src/kotlin/proxy/KotlinProxyOverrides.java | 8 |
2 files changed, 9 insertions, 0 deletions
@@ -329,6 +329,7 @@ via `org.gradle.jvmargs` or the daemon's own args): | property | default | meaning | |---|---|---| +| `kotlin.proxy.pgoProfileDir` | unset | for an image built with `--pgo-instrument`: each compile writes `<dir>/<uuid>.iprof`. Merge them with `native-image-utils merge-pgo-profiles --input-dir=<dir> --output-file=<file>`. | | `kotlin.proxy.nativeImage` | unset | native-image distribution root (it holds `bin/kotlinc-native-image.sh`), for example `~/source/kotlin/prepare/compiler-native-image/build/dist`. If unset, the stub downloads the JetBrains release into `<user.dir>/native-image/`. | The marker file is what proves the stub ran **inside the out-of-process diff --git a/stubs/src/kotlin/proxy/KotlinProxyOverrides.java b/stubs/src/kotlin/proxy/KotlinProxyOverrides.java index e03c04d..996e06c 100644 --- a/stubs/src/kotlin/proxy/KotlinProxyOverrides.java +++ b/stubs/src/kotlin/proxy/KotlinProxyOverrides.java @@ -30,6 +30,7 @@ import java.util.Collections; import java.util.Comparator; import java.util.IdentityHashMap; import java.util.Map; +import java.util.UUID; import java.util.stream.Stream; /** @@ -118,6 +119,13 @@ public final class KotlinProxyOverrides { } ArrayList<String> cmd = new ArrayList<String>(); cmd.add(nativeImage.toString()); + // For an image built with --pgo-instrument. Each compile writes its own profile, because parallel + // compiles share the working directory and overwrite each other's default.iprof. + String pgoProfileDir = System.getProperty("kotlin.proxy.pgoProfileDir"); + if (pgoProfileDir != null && !pgoProfileDir.isEmpty()) { + new File(pgoProfileDir).mkdirs(); + cmd.add("-XX:ProfilesDumpFile=" + new File(pgoProfileDir, UUID.randomUUID() + ".iprof")); + } cmd.addAll(GeneratedJvmArguments.buildCommandArgs(arguments)); cmd.addAll(arguments.getFreeArgs()); ProcessBuilder builder = new ProcessBuilder(cmd); |
