1 #!/bin/bash
 2 
 3 # Run with e.g. ./run-renaissance.sh fj-kmeans -r 10
 4 
 5 set -euo pipefail
 6 
 7 # Look around for release JDK image
 8 J_LBE=
 9 if [ -d build/linux-x86_64-server-release/images/jdk/ ]; then
10   J_LBE=build/linux-x86_64-server-release/images/jdk/bin/java
11 elif [ -d build/linux-aarch64-server-release/images/jdk/ ]; then
12   J_LBE=build/linux-aarch64-server-release/images/jdk/bin/java
13 else
14   echo "Cannot find JDK"
15   exit 1
16 fi
17 
18 J_ML=
19 if [ -d jdk-mainline/ ]; then
20   J_ML=jdk-mainline/bin/java
21 fi
22 
23 RNS=renaissance-gpl-0.16.1.jar
24 if [ ! -r $RNS ]; then
25   echo "Download Renaissance to $RNS"
26   exit 1
27 fi
28 W="-jar $RNS $*"
29 
30 
31 OPTS="-XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions"
32 
33 # Only C2, only COH
34 OPTS="$OPTS -XX:-TieredCompilation -XX:+UseCompactObjectHeaders"
35 
36 # Heap config
37 OPTS="$OPTS -Xmx10g -Xms10g -XX:+UseTransparentHugePages -XX:+AlwaysPreTouch"
38 
39 # GC config
40 OPTS="$OPTS -XX:+UseShenandoahGC"
41 
42 # Mitigate code cache effects
43 OPTS="$OPTS -XX:ReservedCodeCacheSize=256M"
44 
45 OPTS_PASSIVE_NONE="$OPTS -XX:ShenandoahGCMode=passive"
46 OPTS_PASSIVE_ALL="$OPTS_PASSIVE_NONE -XX:+ShenandoahLoadRefBarrier -XX:+ShenandoahSATBBarrier -XX:+ShenandoahCASBarrier -XX:+ShenandoahCloneBarrier"
47 
48 run_with() {
49   P=$*
50   for I in `seq 1 3`; do
51     echo -n " run $I: "
52     $P $W 2>&1 | awk '/iteration (.*) completed/ { $s = $(NF-2); gsub(/\(/, "", $s); printf("%s ", int($s)); } END { print "" }' 
53   done
54   echo -n " stats: "
55   $P -XX:+CITime $W 2>&1 | grep Tier4
56 }
57 
58 echo
59 echo ------
60 echo $*
61 
62 if [ "x" != "x$J_ML" ]; then
63   echo
64   echo "Mainline: Concurrent"
65   run_with $J_ML $OPTS
66 
67   echo
68   echo "Mainline: Passive, No barriers"
69   run_with $J_ML $OPTS_PASSIVE_NONE
70 
71   echo
72   echo "Mainline: Passive, All barriers"
73   run_with $J_ML $OPTS_PASSIVE_ALL
74 fi
75 
76 echo
77 echo "LBE: Concurrent"
78 run_with $J_LBE $OPTS
79 
80 echo
81 echo "LBE: Concurrent, no barrier elision"
82 run_with $J_LBE $OPTS -XX:-ShenandoahElideBarriers
83 
84 echo
85 echo "LBE: Passive, No barriers"
86 run_with $J_LBE $OPTS_PASSIVE_NONE
87 
88 echo
89 echo "LBE: Passive, All barriers"
90 run_with $J_LBE $OPTS_PASSIVE_ALL