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;