From 52f76ced67a438d23d6d20927614b89dd8e48c18 Mon Sep 17 00:00:00 2001 From: Jerry Zhao Date: Wed, 20 Oct 2021 14:21:21 -0700 Subject: [PATCH] Set JAVA_TOOL_OPTIONS environment variable instead of nonstandard JAVA_OPTS (#1013) * Set JAVA_TOOL_OPTIONS environment variable instead of nonstandard JAVA_OPTS The JAVA_TOOL_OPTIONS environment variable is passed to all Java processes. This is useful for Java processes that somehow miss the flags passed in via command line, in particular, the JVM launched by initialization of the SBT thin client only sees flags passed in by JAVA_TOOL_OPTIONS. * Update CI with JAVA_TOOL_OPTIONS --- .circleci/do-rtl-build.sh | 2 +- .circleci/run-firesim-scala-tests.sh | 2 +- variables.mk | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.circleci/do-rtl-build.sh b/.circleci/do-rtl-build.sh index 3a5d56ca..95f3c903 100755 --- a/.circleci/do-rtl-build.sh +++ b/.circleci/do-rtl-build.sh @@ -82,7 +82,7 @@ do export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ - make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_OPTS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" ${mapping[$key]}" + make -j$REMOTE_MAKE_NPROC -C $REMOTE_MAKE_DIR FIRRTL_LOGLEVEL=info JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" ${mapping[$key]}" done run "rm -rf $REMOTE_CHIPYARD_DIR/project" diff --git a/.circleci/run-firesim-scala-tests.sh b/.circleci/run-firesim-scala-tests.sh index a848df62..0a74adb8 100755 --- a/.circleci/run-firesim-scala-tests.sh +++ b/.circleci/run-firesim-scala-tests.sh @@ -59,4 +59,4 @@ run "export RISCV=\"$TOOLS_DIR\"; \ export PATH=\"$REMOTE_VERILATOR_DIR/bin:\$PATH\"; \ export VERILATOR_ROOT=\"$REMOTE_VERILATOR_DIR\"; \ export COURSIER_CACHE=\"$REMOTE_WORK_DIR/.coursier-cache\"; \ - make -C $REMOTE_FIRESIM_DIR JAVA_OPTS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" testOnly ${mapping[$1]}" + make -C $REMOTE_FIRESIM_DIR JAVA_TOOL_OPTIONS=\"$REMOTE_JAVA_OPTS\" SBT_OPTS=\"$REMOTE_SBT_OPTS\" testOnly ${mapping[$1]}" diff --git a/variables.mk b/variables.mk index 5d136e80..1279c28e 100644 --- a/variables.mk +++ b/variables.mk @@ -153,7 +153,7 @@ sim_common_files ?= $(build_dir)/sim_files.common.f # java arguments used in sbt ######################################################################################### JAVA_HEAP_SIZE ?= 8G -JAVA_OPTS ?= -Xmx$(JAVA_HEAP_SIZE) -Xss8M -XX:MaxPermSize=256M -Djava.io.tmpdir=$(base_dir)/.java_tmp +export JAVA_TOOL_OPTIONS ?= -Xmx$(JAVA_HEAP_SIZE) -Xss8M -XX:MaxPermSize=256M -Djava.io.tmpdir=$(base_dir)/.java_tmp ######################################################################################### # default sbt launch command @@ -175,7 +175,7 @@ override SCALA_BUILDTOOL_DEPS += $(SBT_THIN_CLIENT_TIMESTAMP) SBT_CLIENT_FLAG = --client endif -SBT ?= java $(JAVA_OPTS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) $(SBT_CLIENT_FLAG) +SBT ?= java $(JAVA_TOOL_OPTIONS) -jar $(ROCKETCHIP_DIR)/sbt-launch.jar $(SBT_OPTS) $(SBT_CLIENT_FLAG) SBT_NON_THIN ?= $(subst $(SBT_CLIENT_FLAG),,$(SBT)) define run_scala_main