1 #!/bin/bash
2
3 # Run with e.g. ./run-dacapo.sh fop -n 400
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 DACAPO=dacapo
24 if [ ! -d $DACAPO ]; then
25 echo "Download Dacapo to $DACAPO"
26 exit 1
27 fi
28 W="-jar $DACAPO/dacapo-23.11-MR2-chopin.jar $*"
29
30 OPTS="-XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions"
31
32 # Only C2, only COH
33 OPTS="$OPTS -XX:-TieredCompilation -XX:+UseCompactObjectHeaders -XX:+UseCompressedOops"
34
35 # Heap config
36 OPTS="$OPTS -Xmx10g -Xms10g -XX:+UseTransparentHugePages -XX:+AlwaysPreTouch"
37
38 # GC config
39 OPTS="$OPTS -XX:+UseShenandoahGC -XX:ShenandoahGCMode=passive"
40
41 # Mitigate code cache effects
42 OPTS="$OPTS -XX:ReservedCodeCacheSize=256M"
43
44 # Opts for testing individual barriers
45 OPTS_LRB="-XX:+ShenandoahLoadRefBarrier"
46 OPTS_SAT="-XX:+ShenandoahSATBBarrier"
47 OPTS_CAS="-XX:+ShenandoahCASBarrier"
48 OPTS_CLN="-XX:+ShenandoahCloneBarrier"
49
50 OPTS_ALL="$OPTS $OPTS_LRB $OPTS_SAT $OPTS_CAS $OPTS_CLN"
51
52 run_with() {
53 P=$*
54 for I in `seq 1 3`; do
55 echo -n " run $I: "
56 $P $W 2>&1 | awk '/completed warmup|PASSED/ { printf "%s ", $(NF-2)} END { print "" }'
57 done
58 echo -n " stats: "
59 $P -XX:+CITime $W 2>&1 | grep Tier4
60 }
61
62 echo
63 echo ------
64 echo $*
65
66 if [ "x" != "x$J_ML" ]; then
67 echo
68 echo "Mainline: No barriers"
69 run_with $J_ML $OPTS
70
71 echo
72 echo "Mainline: Only LRB barriers"
73 # run_with $J_ML $OPTS $OPTS_LRB
74
75 echo
76 echo "Mainline: Only SAT barriers"
77 # run_with $J_ML $OPTS $OPTS_SAT
78
79 echo
80 echo "Mainline: Only CAS barriers"
81 # run_with $J_ML $OPTS $OPTS_CAS
82
83 echo
84 echo "Mainline: Only Clone barriers"
85 # run_with $J_ML $OPTS $OPTS_CLN
86
87 echo
88 echo "Mainline: All barriers"
89 run_with $J_ML $OPTS_ALL
90 fi
91
92 echo
93 echo "LBE: No barriers"
94 run_with $J_LBE $OPTS
95
96 echo
97 echo "LBE: Only LRB barriers"
98 #run_with $J_LBE $OPTS $OPTS_LRB
99
100 echo
101 echo "LBE: Only SAT barriers"
102 #run_with $J_LBE $OPTS $OPTS_SAT
103
104 echo
105 echo "LBE: Only CAS barriers"
106 #run_with $J_LBE $OPTS $OPTS_CAS
107
108 echo
109 echo "LBE: Only Clone barriers"
110 #run_with $J_LBE $OPTS $OPTS_CLN
111
112 echo
113 echo "LBE: All barriers"
114 run_with $J_LBE $OPTS_ALL
115
116 echo
117 echo "LBE: All barriers, hot-patchable GC state checks in fast-path"
118 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahGCStateCheckHotpatch
119
120 echo
121 echo "LBE: All barriers, remove GC state checks in fast-path"
122 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahGCStateCheckRemove
123
124 echo
125 echo "LBE: All barriers, remove both fast- and slow-path"
126 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahSkipBarriers
127