R8 is a whole-program optimizer that converts Java byte code to
optimized dex code. It can be run with the same general steps (and JAR)
as the existing D8 compiler.
This change adds R8Compiler and the R8 keep-annotation library it relies
on, makes this lib + Android API stubs default libraries for Android
Java/Kotlin, and includes a small update to allow older versions of
dex2oat (33.10) to run.
https://r8.googlesource.com/r8
This change moves the dex2oat profiles for Android Java and Kotlin from
the inline comments (included as part of the default code example) to
being included as a separate file. Templates have been added for this.
dex2oat supports profile-guided compilation. In addition to taking dex
code as an input, it can take a profile as another input, to guide the
compilation. The profile determines which methods need to be compiled,
how calls can be inlined, and so on.
Because Compiler Explorer doesn't support multiple input files, the
profile is added as a comment block in the Java/Kotlin source code. A
post-processor extracts the profile from the comment block into a
separate file, in order to input it to dex2oat.
Adds D8Compiler, which applies to the Android Java and Android Kotlin
languages. D8Compiler instantiates a JavaCompiler or KotlinCompiler
using the java/kotlin dependencies' paths for D8 in the infra repo.
compiler-finder.ts has been updated to allow for duplicate compiler IDs
for 'android-java' and 'android-kotlin', as it is expected that the
compilers used for these languages is the same.