1 # Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. 2 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 # 4 # This code is free software; you can redistribute it and/or modify it 5 # under the terms of the GNU General Public License version 2 only, as 6 # published by the Free Software Foundation. 7 # 8 # This code is distributed in the hope that it will be useful, but WITHOUT 9 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 # version 2 for more details (a copy is included in the LICENSE file that 12 # accompanied this code). 13 # 14 # You should have received a copy of the GNU General Public License version 15 # 2 along with this work; if not, write to the Free Software Foundation, 16 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 # 18 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 # or visit www.oracle.com if you need additional information or have any 20 # questions. 21 22 #=============================================================================== 23 # HOWTO 24 #=============================================================================== 25 26 # Build the app from source code 27 # make app 28 # 29 # Run with all Leyden optimizations (new workflow) 30 # make run 31 # make runn 32 # 33 # Run with all CDS static archive only (with Leyden repo) 34 # make runs 35 # 36 # Run without Leyden optimizations (with Leyden repo) 37 # make run0 38 # 39 40 #=============================================================================== 41 # Environment Config 42 #=============================================================================== 43 44 # The best way to set the paths to various JDKs is to use environment variables to 45 # set the values for the following variables. E.g. 46 # export BLDJDK_HOME=/home/$USER/jdk21 47 # export MAINLINE_HOME=/home/$USER/repo/jdk/build/linux-x64/images/jdk 48 # export PREMAIN_HOME=/home/$USER/leyden/jdk/build/linux-x64/images/jdk 49 # make run 50 51 # *** NOTE: JDK 21 is needed to build most of the demos 52 ifndef BLDJDK_HOME 53 BLDJDK_HOME = /work/official/jdk21 54 endif 55 56 # Points to your build with https://github.com/openjdk/jdk 57 # For comparison purposes, this build should be the latest version of the mainline that 58 # has been merged into https://github.com/openjdk/leyden/tree/premain 59 ifndef MAINLINE_HOME 60 MAINLINE_HOME = /work/official/jdk24 61 endif 62 63 # Points to your build with https://github.com/openjdk/leyden/tree/premain 64 ifndef PREMAIN_HOME 65 PREMAIN_HOME = /work/bld/le4/images/jdk 66 endif 67 68 # Override this if your system's MVM version is too old (to point to your own build of mvn, etc) 69 ifndef MVN 70 MVN = mvn 71 endif 72 73 #=============================================================================== 74 # Common Makefile rules for Leyden demos 75 #=============================================================================== 76 77 # Options passed to PREMAIN_JAVA. See compare_premain_builds in ./Bench.gmk 78 PM_OPTS = 79 80 JAR = ${BLDJDK_HOME}/bin/jar 81 BLDJDK_JAVA = ${BLDJDK_HOME}/bin/java 82 MAINLINE_JAVA = ${MAINLINE_HOME}/bin/java 83 PREMAIN_JAVA = ${PREMAIN_HOME}/bin/java ${PM_OPTS} 84 85 # The following variables should be defined by the main Makefile. 86 # See ../helidon-quickstart-se/Makefile for an example. 87 88 DEMO_CLASSLIST = ${DEMO_NAME}$(PM_VER).classlist 89 DEMO_JSA = ${DEMO_NAME}$(PM_VER).jsa 90 91 # Mainline -- CDS only 92 DEMO_ML_CLASSLIST = ${DEMO_NAME}$(PM_VER).ml.classlist 93 DEMO_ML_JSA = ${DEMO_NAME}$(PM_VER).ml.jsa 94 95 # Mainline -- AOTCache 96 DEMO_ML_AOTCONF = ${DEMO_NAME}$(PM_VER).ml.aotconf 97 DEMO_ML_AOT = ${DEMO_NAME}$(PM_VER).ml.aot 98 99 # Leyden -- AOTCache + profiles + compiled method 100 DEMO_AOTCONF = ${DEMO_NAME}$(PM_VER).aotconf 101 DEMO_AOT = ${DEMO_NAME}$(PM_VER).aot 102 103 # Rules for the following targets should be specified in the main Makefile. 104 # See ../helidon-quickstart-se/Makefile for an example. 105 106 src: ${DEMO_SRC} 107 app: ${DEMO_JAR} 108 artifact: ${DEMO_ARTIFACT} 109 110 # 111 # The following rules should be common to all demos 112 # 113 114 # Run with the build JDK------------------------ 115 runb: ${DEMO_JAR} 116 ${BLDJDK_JAVA} ${DEMO_CMDLINE} 117 118 # No optimizations (Leyden repo)---------------- 119 run0: ${DEMO_JAR} 120 ${PREMAIN_JAVA} ${DEMO_CMDLINE} 121 122 # Static CDS only (Leyden repo)----------------- 123 124 list: ${DEMO_CLASSLIST} 125 jsa: ${DEMO_JSA} 126 127 ${DEMO_CLASSLIST}: ${DEMO_JAR} 128 ${PREMAIN_JAVA} -Xshare:off -XX:DumpLoadedClassList=${DEMO_CLASSLIST} ${DEMO_CMDLINE} 129 130 ${DEMO_JSA}: ${DEMO_CLASSLIST} 131 rm -f ${DEMO_JSA}.log 132 ${PREMAIN_JAVA} -Xshare:dump -XX:SharedClassListFile=${DEMO_CLASSLIST} -XX:SharedArchiveFile=${DEMO_JSA} \ 133 -XX:+AOTClassLinking \ 134 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_JSA}.log \ 135 ${DEMO_CMDLINE} 136 137 runs: ${DEMO_JSA} 138 ${PREMAIN_JAVA} -XX:SharedArchiveFile=${DEMO_JSA} ${DEMO_CMDLINE} 139 140 # Static CDS only (Mainline)----------------- 141 142 list.ml: ${DEMO_ML_CLASSLIST} 143 jsa.ml: ${DEMO_ML_JSA} 144 145 ${DEMO_ML_CLASSLIST}: ${DEMO_JAR} 146 ${MAINLINE_JAVA} -Xshare:off -XX:DumpLoadedClassList=${DEMO_ML_CLASSLIST} ${DEMO_CMDLINE} 147 148 ${DEMO_ML_JSA}: ${DEMO_ML_CLASSLIST} 149 rm -f ${DEMO_ML_JSA}.log 150 ${MAINLINE_JAVA} -Xshare:dump -XX:SharedClassListFile=${DEMO_ML_CLASSLIST} -XX:SharedArchiveFile=${DEMO_ML_JSA} \ 151 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_ML_JSA}.log \ 152 ${DEMO_CMDLINE} 153 154 run0.ml: ${DEMO_JAR} 155 ${MAINLINE_JAVA} ${DEMO_CMDLINE} 156 157 runs.ml: ${DEMO_ML_JSA} 158 ${MAINLINE_JAVA} -XX:SharedArchiveFile=${DEMO_ML_JSA} ${DEMO_CMDLINE} 159 160 # AOTCache (JEP 483) with Mainline (no AOT profile/AOT compiled methods) 161 162 aotconf.ml: ${DEMO_ML_AOTCONF} 163 aot.ml: ${DEMO_ML_AOT} 164 165 ${DEMO_ML_AOTCONF}: ${DEMO_JAR} 166 ${MAINLINE_JAVA} -XX:AOTMode=record -XX:AOTConfiguration=${DEMO_ML_AOTCONF} ${DEMO_CMDLINE} 167 168 ${DEMO_ML_AOT}: ${DEMO_ML_AOTCONF} 169 rm -f ${DEMO_ML_AOT}.log 170 ${MAINLINE_JAVA} -XX:AOTMode=create -XX:AOTConfiguration=${DEMO_ML_AOTCONF} -XX:AOTCache=${DEMO_ML_AOT} \ 171 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_ML_AOT}.log \ 172 ${DEMO_CMDLINE} 173 174 runa.ml: ${DEMO_ML_AOT} 175 ${MAINLINE_JAVA} -XX:AOTMode=on -XX:AOTCache=${DEMO_ML_AOT} ${DEMO_CMDLINE} 176 177 # AOTCache (JEP 483) with Leyden (has AOT profile/AOT compiled methods) 178 179 aotconf: ${DEMO_AOTCONF} 180 aot: ${DEMO_AOT} 181 182 ${DEMO_AOTCONF}: ${DEMO_JAR} 183 ${PREMAIN_JAVA} -XX:AOTMode=record -XX:AOTConfiguration=${DEMO_AOTCONF} ${DEMO_CMDLINE} 184 185 ${DEMO_AOT}: ${DEMO_AOTCONF} 186 rm -f ${DEMO_AOT}.log 187 ${PREMAIN_JAVA} -XX:AOTMode=create -XX:AOTConfiguration=${DEMO_AOTCONF} -XX:AOTCache=${DEMO_AOT} \ 188 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_AOT}.log \ 189 ${DEMO_CMDLINE} 190 191 runa: ${DEMO_AOT} 192 ${PREMAIN_JAVA} -XX:AOTMode=on -XX:AOTCache=${DEMO_AOT} ${DEMO_CMDLINE} 193 194 run: runa 195 196 showenv: 197 @echo "BLDJDK_JAVA = ${BLDJDK_JAVA}" 198 @echo "MAINLINE_JAVA = ${MAINLINE_JAVA}" 199 @echo "PREMAIN_JAVA = ${PREMAIN_JAVA}" 200 201 include ../lib/Bench.gmk