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_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 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 }
55 
56 echo
57 echo ------
58 echo $*
59 
60 echo
61 echo "Hotpatching: Concurrent"
62 run_with $J_HP $OPTS
63 
64 #echo
65 #echo "Hotpatching: Passive, No barriers"
66 #run_with $J_HP $OPTS_PASSIVE_NONE
67 
68 #echo
69 #echo "Hotpatching: Passive, All barriers"
70 #run_with $J_HP $OPTS_PASSIVE_ALL
71 
72 if [ "x" != "x$J_ML" ]; then
73   echo
74   echo "Mainline: Concurrent"
75   run_with $J_ML $OPTS
76 
77 #  echo
78 #  echo "Mainline: Passive, No barriers"
79 #  run_with $J_ML $OPTS_PASSIVE_NONE
80 
81 #  echo
82 #  echo "Mainline: Passive, All barriers"
83 #  run_with $J_ML $OPTS_PASSIVE_ALL
84 fi
85 
86