I’ve tried to use this project https://github.com/scalacenter/scalac-profiling, but since it requires the project to profile to use scala 2.12.x and given my current project is big and won’t be easy to migrate.
I went and review the work from @jvican that was merged in 2.12 https://github.com/scala/scala/pull/6034, I started rebasing it into the 2.11 branch, I cherry-picked the commits and made them compatible to source and target jvm versions.
However I’ve hit a wall when rebuilding the compiler and I need some help into what is the best direction to take here.
Currently the issue right now is in the class
scala.reflect.internal.util.AlmostFinalValue, the package
java.lang.invoke is used extensively, specially the MethodHandle is the one that throws an error when rebuilding the compiler.
I’ve been looking for a way to downgrade this code to be jdk6 compatible but still not luck.
Here is the error message that I get:
~/var/www/foss/scala • ant Buildfile: /Users/raul/var/www/foss/scala/build.xml desired.jars.uptodate: boot: init.git: init: [copy] Copying 2 files to /Users/raul/var/www/foss/scala/build/deps/junit [copy] Copying 28 files to /Users/raul/var/www/foss/scala/build/deps/pax.exam [copy] Copying 4 files to /Users/raul/var/www/foss/scala/build/deps/partest [copy] Copying 1 file to /Users/raul/var/www/foss/scala/build/deps/repl [copy] Copying 5 files to /Users/raul/var/www/foss/scala/build/deps/scaladoc [echo] Using Scala 2.11.5 for STARR. [copy] Copying 5 files to /Users/raul/var/www/foss/scala/build/deps/starr [echo] build time: 6 January 2018, 23:30:49 [echo] java version: Java HotSpot(TM) 64-Bit Server VM 1.8.0_152-ea (1.8) [echo] java args: -Xms1536M -Xmx1536M -Xss1M -XX:MaxPermSize=192M -XX:+UseParallelGC [echo] javac args: [echo] scalac args: -feature [echo] scalac quick args: -feature [echo] git date: 20180106-001229 [echo] git hash: 43f6e4508a [echo] maven version: 2.11.6-SNAPSHOT [echo] OSGi version: 2.11.6.v20180106-001229-43f6e4508a [echo] canonical version: 2.11.6-20180106-001229-43f6e4508a asm.done: forkjoin.done: locker.start: locker.lib: locker.reflect: [javac] Compiling 1 source file to /Users/raul/var/www/foss/scala/build/locker/classes/reflect [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5 [javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release [javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options. [javac] /Users/raul/var/www/foss/scala/src/reflect/scala/reflect/internal/util/StatisticsStatics.java:36: error: method invoked with incorrect number of arguments; expected 0, found 1 [javac] return ((BooleanContainer)(Object) COLD_STATS_GETTER.invokeExact()).isEnabledNow(); [javac] ^ BUILD FAILED /Users/raul/var/www/foss/scala/build.xml:1092: The following error occurred while executing this line: /Users/raul/var/www/foss/scala/build-ant-macros.xml:275: The following error occurred while executing this line: /Users/raul/var/www/foss/scala/build-ant-macros.xml:282: The following error occurred while executing this line: /Users/raul/var/www/foss/scala/build-ant-macros.xml:135: Compile failed; see the compiler error output for details. Total time: 3 seconds