Skip to content

Commit

Permalink
Align 9.4 launcher with 10
Browse files Browse the repository at this point in the history
Features like --logcache and --nocache go hand in hand with
--cache and automatic use of the jsa file. The rest of the changes
largely support using jsa.
  • Loading branch information
headius committed Feb 22, 2025
1 parent e9b798c commit a3b2bb7
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions bin/jruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -u
# shellcheck disable=1007
# -----------------------------------------------------------------------------
# jruby.bash - Start Script for the JRuby interpreter
# jruby.sh - Start Script for the JRuby interpreter
# -----------------------------------------------------------------------------

# ----- Guarantee local variables are available -------------------------------
Expand Down Expand Up @@ -145,6 +145,7 @@ NO_BOOTCLASSPATH=false
VERIFY_JRUBY=false
print_environment_log=false
regenerate_jsa_file=false
log_cds=false

if [ -z "${JRUBY_OPTS-}" ]; then
JRUBY_OPTS=""
Expand Down Expand Up @@ -419,8 +420,10 @@ java_is_modular() {
}

if java_is_modular; then
use_jsa_file=true
use_modules=true
else
use_jsa_file=false
use_modules=false
fi
readonly use_modules
Expand Down Expand Up @@ -623,9 +626,15 @@ do
--cache)
echo "EXPERIMENTAL: Regenerating the JRuby AppCDS archive at $jruby_jsa_file"
echo "EXPERIMENTAL: Log output at ${jruby_jsa_file}.log"
use_jsa_file=false
regenerate_jsa_file=true
rm -f "$jruby_jsa_file"
append java_args -XX:ArchiveClassesAtExit="$jruby_jsa_file" -Xlog:cds=off -Xlog:cds=info:file="$jruby_jsa_file".log ;;
append java_args -XX:ArchiveClassesAtExit="$jruby_jsa_file" -Xlog:cds=off -Xlog:cds+dynamic=off
;;
--nocache)
use_jsa_file=false ;;
--logcache)
log_cds=true ;;
# Abort processing on the double dash
--) break ;;
# Other opts go to ruby
Expand Down Expand Up @@ -701,12 +710,16 @@ if $use_modules; then
fi

# If we have a jruby.jsa file, enable AppCDS
if [ -f "$JRUBY_JSA" ]; then
if $use_jsa_file; then
add_log
add_log "Detected Class Data Sharing archive:"
add_log " $JRUBY_JSA"

JAVA_OPTS="$JAVA_OPTS -XX:SharedArchiveFile=$JRUBY_JSA"
JAVA_OPTS="$JAVA_OPTS -XX:SharedArchiveFile=$JRUBY_JSA -Xlog:cds=off"
if $log_cds; then
add_log "Logging CDS output to:"
add_log " $JRUBY_JSA.log"
append java_args -Xlog:cds=info:file="$JRUBY_JSA".log
fi
fi
fi

Expand Down

0 comments on commit a3b2bb7

Please sign in to comment.