From 9d14a29f4935feb86d6aed3be1901fb41f21ba19 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Fri, 15 Dec 2017 20:46:31 +0700 Subject: [PATCH] Added a little hack that allows to enable runtime optimizations (#1147) --- .../groovy/org/jetbrains/kotlin/CompileToBitcode.groovy | 2 +- runtime/src/main/cpp/Memory.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy index 6ba41edf1b5..856a443f789 100644 --- a/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy +++ b/buildSrc/plugins/src/main/groovy/org/jetbrains/kotlin/CompileToBitcode.groovy @@ -112,7 +112,7 @@ class CompileCppToBitcode extends DefaultTask { workingDir objDir executable "clang++" args '-std=c++11' - + args '-O2' args compilerArgs args "-I$headersDir" diff --git a/runtime/src/main/cpp/Memory.cpp b/runtime/src/main/cpp/Memory.cpp index 3d302d45a39..6a77f72cc1c 100644 --- a/runtime/src/main/cpp/Memory.cpp +++ b/runtime/src/main/cpp/Memory.cpp @@ -84,6 +84,12 @@ struct FrameOverlay { ArenaContainer* arena; }; +// A little hack that allows to enable -O2 optimizations +// Prevents clang from replacing FrameOverlay struct +// with single pointer. +// Can be removed when FrameOverlay will become more complex +FrameOverlay exportFrameOverlay; + // Current number of allocated containers. int allocCount = 0; int aliveMemoryStatesCount = 0;