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"
40 
41 # Mitigate code cache effects
42 OPTS="$OPTS -XX:ReservedCodeCacheSize=256M"
43 
44 OPTS_PASSIVE_NONE="$OPTS -XX:ShenandoahGCMode=passive"
45 OPTS_PASSIVE_ALL="$OPTS_PASSIVE_NONE -XX:+ShenandoahLoadRefBarrier -XX:+ShenandoahSATBBarrier -XX:+ShenandoahCASBarrier -XX:+ShenandoahCloneBarrier"
46 
47 run_with() {
48   P=$*
49   for I in `seq 1 3`; do
50     echo -n " run $I: "
51     $P $W 2>&1 | awk '/completed warmup|PASSED/ { printf "%s ", $(NF-2)} END { print "" }'
52   done
53   echo -n " stats: "
54   $P -XX:+CITime $W 2>&1 | grep Tier4
55 }
56 
57 echo
58 echo ------
59 echo $*
60 
61 if [ "x" != "x$J_ML" ]; then
62   echo
63   echo "Mainline: Concurrent"
64   run_with $J_ML $OPTS
65 
66   echo
67   echo "Mainline: Passive, No barriers"
68   run_with $J_ML $OPTS_PASSIVE_NONE
69 
70   echo
71   echo "Mainline: Passive, All barriers"
72   run_with $J_ML $OPTS_PASSIVE_ALL
73 fi
74 
75 echo
76 echo "LBE: Concurrent"
77 run_with $J_LBE $OPTS
78 
79 echo
80 echo "LBE: Concurrent, no barrier elision"
81 run_with $J_LBE $OPTS -XX:-ShenandoahElideBarriers
82 
83 echo
84 echo "LBE: Passive, No barriers"
85 run_with $J_LBE $OPTS_PASSIVE_NONE
86 
87 echo
88 echo "LBE: Passive, All barriers"
89 run_with $J_LBE $OPTS_PASSIVE_ALL