Disable perfdata when running JavaToolchainCompileClasses or JavaToolchainCompileBootClasspath

Copybara Import from https://github.com/bazelbuild/rules_java/pull/149

BEGIN_PUBLIC
Disable perfdata when running JavaToolchainCompileClasses or JavaToolchainCompileBootClasspath (#149)

A [recent JDK update](https://github.com/openjdk/jdk/commit/84f23149e22561173feb0e34bca31a7345b43c89#diff-7313eb3d328797a7720fa1b2b73cd159934506593443e45534baad80cb1382b7R924-R927) started printing the following warning message from the JVM
```
[warning][perf,memops] Cannot use file /tmp/hsperfdata_username/2 because it is locked by another process (errno = 11)
```
on linux hosts.  Also referenced from https://github.com/bazelbuild/bazel/issues/3236

This PR disables the perfdata generation when running JavaToolchainCompileClasses or JavaToolchainCompileBootClasspath so this warning message won't be printed.

Closes #149
END_PUBLIC

COPYBARA_INTEGRATE_REVIEW=https://github.com/bazelbuild/rules_java/pull/149 from cheister:no-perfdata 601c3e5ad6959db85917e8297711daaacaa37b22
PiperOrigin-RevId: 614679249
Change-Id: I7e90c0ec0b93ac57763d3a5af546c4af9f7c9dc0
diff --git a/toolchains/default_java_toolchain.bzl b/toolchains/default_java_toolchain.bzl
index 78fdbc7..721192d 100644
--- a/toolchains/default_java_toolchain.bzl
+++ b/toolchains/default_java_toolchain.bzl
@@ -224,6 +224,7 @@
     args.add("-target")
     args.add("8")
     args.add("-Xlint:-options")
+    args.add("-J-XX:-UsePerfData")
     args.add("-d")
     args.add_all([class_dir], expand_directories = False)
     args.add(ctx.file.src)
@@ -241,6 +242,7 @@
 
     args = ctx.actions.args()
     args.add("-XX:+IgnoreUnrecognizedVMOptions")
+    args.add("-XX:-UsePerfData")
     args.add("--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED")
     args.add("--add-exports=jdk.compiler/com.sun.tools.javac.platform=ALL-UNNAMED")
     args.add("--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED")