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_HP=
9 if [ -d build/linux-x86_64-server-release/images/jdk/ ]; then
10 J_HP=build/linux-x86_64-server-release/images/jdk/bin/java
11 elif [ -d build/linux-aarch64-server-release/images/jdk/ ]; then
12 J_HP=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 }
54
55 echo
56 echo ------
57 echo $*
58
59 echo
60 echo "Hotpatching: Concurrent"
61 run_with $J_HP $OPTS
62
63 #echo
64 #echo "Hotpatching: Passive, No barriers"
65 #run_with $J_HP $OPTS_PASSIVE_NONE
66
67 #echo
68 #echo "Hotpatching: Passive, All barriers"
69 #run_with $J_HP $OPTS_PASSIVE_ALL
70
71 if [ "x" != "x$J_ML" ]; then
72 echo
73 echo "Mainline: Concurrent"
74 run_with $J_ML $OPTS
75
76 # echo
77 # echo "Mainline: Passive, No barriers"
78 # run_with $J_ML $OPTS_PASSIVE_NONE
79
80 # echo
81 # echo "Mainline: Passive, All barriers"
82 # run_with $J_ML $OPTS_PASSIVE_ALL
83 fi
84
85