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 -XX:ShenandoahGCMode=passive"
41 
42 # Mitigate code cache effects
43 OPTS="$OPTS -XX:ReservedCodeCacheSize=256M"
44 
45 OPTS_ALL="$OPTS -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 '/iteration (.*) completed/ { $s = $(NF-2); gsub(/\(/, "", $s); printf("%s ", int($s)); } 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: No barriers"
64   run_with $J_ML $OPTS
65 
66   echo
67   echo "Mainline: All barriers"
68   run_with $J_ML $OPTS_ALL
69 fi
70 
71 echo
72 echo "LBE: No barriers"
73 run_with $J_LBE $OPTS
74 
75 echo
76 echo "LBE: All barriers"
77 run_with $J_LBE $OPTS_ALL
78 
79 echo
80 echo "LBE: All barriers, hot-patchable GC state checks in fast-path"
81 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahGCStateCheckHotpatch
82 
83 echo
84 echo "LBE: All barriers, remove GC state checks in fast-path"
85 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahGCStateCheckRemove
86 
87 echo
88 echo "LBE: All barriers, remove both fast- and slow-path"
89 run_with $J_LBE $OPTS_ALL -XX:+ShenandoahSkipBarriers
90