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 JAVAC = ${BLDJDK_HOME}/bin/javac 81 JAR = ${BLDJDK_HOME}/bin/jar 82 BLDJDK_JAVA = ${BLDJDK_HOME}/bin/java 83 MAINLINE_JAVA = ${MAINLINE_HOME}/bin/java 84 PREMAIN_JAVA = ${PREMAIN_HOME}/bin/java ${PM_OPTS} 85 86 # The following variables should be defined by the main Makefile. 87 # See ../helidon-quickstart-se/Makefile for an example. 88 89 DEMO_CLASSLIST = ${DEMO_NAME}$(PM_VER).classlist 90 DEMO_JSA = ${DEMO_NAME}$(PM_VER).jsa 91 92 # Mainline -- CDS only 93 DEMO_ML_CLASSLIST = ${DEMO_NAME}$(PM_VER).ml.classlist 94 DEMO_ML_JSA = ${DEMO_NAME}$(PM_VER).ml.jsa 95 96 # Mainline -- AOTCache 97 DEMO_ML_AOTCONF = ${DEMO_NAME}$(PM_VER).ml.aotconf 98 DEMO_ML_AOT = ${DEMO_NAME}$(PM_VER).ml.aot 99 100 # Leyden -- AOTCache + profiles + compiled method 101 DEMO_AOTCONF = ${DEMO_NAME}$(PM_VER).aotconf 102 DEMO_AOT = ${DEMO_NAME}$(PM_VER).aot 103 104 # Rules for the following targets should be specified in the main Makefile. 105 # See ../helidon-quickstart-se/Makefile for an example. 106 107 src: ${DEMO_SRC} 108 app: ${DEMO_JAR} 109 artifact: ${DEMO_ARTIFACT} 110 111 # 112 # The following rules should be common to all demos 113 # 114 115 # Run with the build JDK------------------------ 116 runb: ${DEMO_JAR} 117 ${BLDJDK_JAVA} ${DEMO_CMDLINE} 118 119 # No optimizations (Leyden repo)---------------- 120 run0: ${DEMO_JAR} 121 ${PREMAIN_JAVA} ${DEMO_CMDLINE} 122 123 # Static CDS only (Leyden repo)----------------- 124 125 list: ${DEMO_CLASSLIST} 126 jsa: ${DEMO_JSA} 127 128 ${DEMO_CLASSLIST}: ${DEMO_JAR} 129 ${PREMAIN_JAVA} -Xshare:off -XX:DumpLoadedClassList=${DEMO_CLASSLIST} ${DEMO_CMDLINE} 130 131 ${DEMO_JSA}: ${DEMO_CLASSLIST} 132 rm -f ${DEMO_JSA}.log 133 ${PREMAIN_JAVA} -Xshare:dump -XX:SharedClassListFile=${DEMO_CLASSLIST} -XX:SharedArchiveFile=${DEMO_JSA} \ 134 -XX:+AOTClassLinking \ 135 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_JSA}.log \ 136 ${DEMO_CMDLINE} 137 138 runs: ${DEMO_JSA} 139 ${PREMAIN_JAVA} -XX:SharedArchiveFile=${DEMO_JSA} ${DEMO_CMDLINE} 140 141 # Static CDS only (Mainline)----------------- 142 143 list.ml: ${DEMO_ML_CLASSLIST} 144 jsa.ml: ${DEMO_ML_JSA} 145 146 ${DEMO_ML_CLASSLIST}: ${DEMO_JAR} 147 ${MAINLINE_JAVA} -Xshare:off -XX:DumpLoadedClassList=${DEMO_ML_CLASSLIST} ${DEMO_CMDLINE} 148 149 ${DEMO_ML_JSA}: ${DEMO_ML_CLASSLIST} 150 rm -f ${DEMO_ML_JSA}.log 151 ${MAINLINE_JAVA} -Xshare:dump -XX:SharedClassListFile=${DEMO_ML_CLASSLIST} -XX:SharedArchiveFile=${DEMO_ML_JSA} \ 152 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_ML_JSA}.log \ 153 ${DEMO_CMDLINE} 154 155 run0.ml: ${DEMO_JAR} 156 ${MAINLINE_JAVA} ${DEMO_CMDLINE} 157 158 runs.ml: ${DEMO_ML_JSA} 159 ${MAINLINE_JAVA} -XX:SharedArchiveFile=${DEMO_ML_JSA} ${DEMO_CMDLINE} 160 161 # AOTCache (JEP 483) with Mainline (no AOT profile/AOT compiled methods) 162 163 aotconf.ml: ${DEMO_ML_AOTCONF} 164 aot.ml: ${DEMO_ML_AOT} 165 166 ${DEMO_ML_AOTCONF}: ${DEMO_JAR} 167 ${MAINLINE_JAVA} -XX:AOTMode=record -XX:AOTConfiguration=${DEMO_ML_AOTCONF} ${DEMO_CMDLINE} 168 169 ${DEMO_ML_AOT}: ${DEMO_ML_AOTCONF} 170 rm -f ${DEMO_ML_AOT}.log 171 ${MAINLINE_JAVA} -XX:AOTMode=create -XX:AOTConfiguration=${DEMO_ML_AOTCONF} -XX:AOTCache=${DEMO_ML_AOT} \ 172 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_ML_AOT}.log \ 173 ${DEMO_CMDLINE} 174 175 runa.ml: ${DEMO_ML_AOT} 176 ${MAINLINE_JAVA} -XX:AOTMode=on -XX:AOTCache=${DEMO_ML_AOT} ${DEMO_CMDLINE} 177 178 # AOTCache (JEP 483) with Leyden (has AOT profile/AOT compiled methods) 179 180 aotconf: ${DEMO_AOTCONF} 181 aot: ${DEMO_AOT} 182 183 ${DEMO_AOTCONF}: ${DEMO_JAR} 184 ${PREMAIN_JAVA} -XX:AOTMode=record -XX:AOTConfiguration=${DEMO_AOTCONF} ${DEMO_CMDLINE} 185 186 ${DEMO_AOT}: ${DEMO_AOTCONF} 187 rm -f ${DEMO_AOT}.log 188 ${PREMAIN_JAVA} -XX:AOTMode=create -XX:AOTConfiguration=${DEMO_AOTCONF} -XX:AOTCache=${DEMO_AOT} \ 189 -Xlog:cds=debug,cds+class=debug,cds+heap=warning,cds+resolve=debug:file=${DEMO_AOT}.log \ 190 ${DEMO_CMDLINE} 191 192 runa: ${DEMO_AOT} 193 ${PREMAIN_JAVA} -XX:AOTMode=on -XX:AOTCache=${DEMO_AOT} ${DEMO_CMDLINE} 194 195 run: runa 196 197 showenv: 198 @echo "BLDJDK_JAVA = ${BLDJDK_JAVA}" 199 @echo "MAINLINE_JAVA = ${MAINLINE_JAVA}" 200 @echo "PREMAIN_JAVA = ${PREMAIN_JAVA}" 201 202 include ../lib/Bench.gmk