1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#
# Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
include MakeFileStart.gmk
################################################################################
include CopyFiles.gmk
include JarArchive.gmk
include JavaCompilation.gmk
include TestFilesCompilation.gmk
ifeq ($(JMH_CORE_JAR), )
$(info Error: JMH is missing. Please use configure --with-jmh.)
$(error Cannot continue)
endif
#### Variables
MICROBENCHMARK_SRC := $(TOPDIR)/test/micro
MICROBENCHMARK_IMAGE_DIR := $(TEST_IMAGE_DIR)/micro
MICROBENCHMARK_JAR := $(MICROBENCHMARK_IMAGE_DIR)/benchmarks.jar
MICROBENCHMARK_OUTPUT := $(SUPPORT_OUTPUTDIR)/test/micro
MICROBENCHMARK_CLASSES := $(MICROBENCHMARK_OUTPUT)/classes
MICROBENCHMARK_GENSRC := $(MICROBENCHMARK_OUTPUT)/gensrc
MICROBENCHMARK_JAR_BIN := $(MICROBENCHMARK_OUTPUT)/jar
MICROBENCHMARK_TOOLS_CLASSES := $(MICROBENCHMARK_OUTPUT)/tools-classes
JMH_UNPACKED_DIR := $(MICROBENCHMARK_OUTPUT)/jmh_jars
JMH_UNPACKED_JARS_DONE := $(JMH_UNPACKED_DIR)/_unpacked.marker
# External dependencies
WHITEBOX_JAR := $(SUPPORT_OUTPUTDIR)/test/lib/wb.jar
JMH_COMPILE_JARS := $(JMH_CORE_JAR) $(JMH_GENERATOR_JAR) $(WHITEBOX_JAR)
JMH_RUNTIME_JARS := $(JMH_CORE_JAR) $(JMH_COMMONS_MATH_JAR) $(JMH_JOPT_SIMPLE_JAR)
# Native dependencies
MICROBENCHMARK_NATIVE_SRC_DIRS := $(MICROBENCHMARK_SRC)
MICROBENCHMARK_NATIVE_OUTPUT := $(MICROBENCHMARK_OUTPUT)/native
MICROBENCHMARK_NATIVE_EXCLUDE :=
###
# Need double \n to get new lines and no trailing spaces
MICROBENCHMARK_MANIFEST := Build: $(FULL_VERSION)\n\
\nJMH-Version: $(JMH_VERSION)\n\
\nName: OpenJDK Microbenchmark Suite
#### Compile Targets
# Building microbenchmark requires the jdk.unsupported and java.management modules.
# sun.security.util is required to compile Cache benchmark.
# jmh uses annotation processors to generate the benchmark jar and thus
# requires the use of -processor option during benchmark compilation.
# Build microbenchmark suite for the current JDK
$(eval $(call SetupJavaCompilation, BUILD_JDK_MICROBENCHMARK, \
TARGET_RELEASE := $(TARGET_RELEASE_NEWJDK_UPGRADED), \
SMALL_JAVA := false, \
CLASSPATH := $(JMH_COMPILE_JARS), \
CREATE_API_DIGEST := true, \
DISABLED_WARNINGS := restricted this-escape processing rawtypes removal cast \
serial preview dangling-doc-comments, \
SRC := $(MICROBENCHMARK_SRC), \
BIN := $(MICROBENCHMARK_CLASSES), \
JAVAC_FLAGS := \
--add-exports java.base/jdk.internal.classfile.components=ALL-UNNAMED \
--add-exports java.base/jdk.internal.classfile.impl=ALL-UNNAMED \
--add-exports java.base/jdk.internal.event=ALL-UNNAMED \
--add-exports java.base/jdk.internal.foreign=ALL-UNNAMED \
--add-exports java.base/jdk.internal.jimage=ALL-UNNAMED \
--add-exports java.base/jdk.internal.misc=ALL-UNNAMED \
--add-exports java.base/jdk.internal.util=ALL-UNNAMED \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-exports java.base/sun.invoke.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util=ALL-UNNAMED \
--add-exports java.base/sun.security.util.math=ALL-UNNAMED \
--add-exports java.base/sun.security.util.math.intpoly=ALL-UNNAMED \
--enable-preview \
-XDsuppressNotes \
-processor org.openjdk.jmh.generators.BenchmarkProcessor \
-s $(MICROBENCHMARK_GENSRC), \
JAVA_FLAGS := \
--add-exports java.base/jdk.internal.vm=ALL-UNNAMED \
--add-modules jdk.unsupported \
--enable-preview \
--limit-modules java.management, \
))
$(BUILD_JDK_MICROBENCHMARK): $(JMH_COMPILE_JARS)
# Unpacking dependencies for inclusion in the benchmark JARs
$(JMH_UNPACKED_JARS_DONE): $(JMH_RUNTIME_JARS)
$(RM) -r $(JMH_UNPACKED_DIR)
$(MKDIR) -p $(JMH_UNPACKED_DIR)
$(foreach jar, $(JMH_RUNTIME_JARS), \
$$($(UNZIP) -oq $(jar) -d $(JMH_UNPACKED_DIR)))
$(RM) -r $(JMH_UNPACKED_DIR)/META-INF
$(TOUCH) $@
# Copy dependency files for inclusion in the benchmark JARs
$(eval $(call SetupCopyFiles, COPY_JAXP_TEST_XML, \
SRC := $(TOPDIR)/test/jaxp/javax/xml/jaxp/unittest, \
DEST := $(MICROBENCHMARK_CLASSES)/org/openjdk/bench/javax/xml, \
FILES := \
stream/XMLStreamWriterTest/message_12.xml \
validation/tck/reZ003vExc23082309.xml \
transform/msgAttach.xml, \
FLATTEN := true, \
))
# Create benchmarks JAR file with benchmarks for both the old and new JDK
$(eval $(call SetupJarArchive, BUILD_JDK_JAR, \
DEPENDENCIES := $(BUILD_JDK_MICROBENCHMARK) $(JMH_UNPACKED_JARS_DONE) $(COPY_JAXP_TEST_XML), \
SRCS := $(MICROBENCHMARK_CLASSES) $(JMH_UNPACKED_DIR), \
BIN := $(MICROBENCHMARK_JAR_BIN), \
SUFFIXES := .*, \
EXCLUDE_FILES := _the.BUILD_JDK_MICROBENCHMARK_batch \
_the.BUILD_JDK_MICROBENCHMARK.vardeps _unpacked.marker, \
EXTRA_MANIFEST_ATTR := $(MICROBENCHMARK_MANIFEST), \
JARMAIN := org.openjdk.jmh.Main, \
JAR := $(MICROBENCHMARK_JAR), \
))
# Setup compilation of native library dependencies
$(eval $(call SetupTestFilesCompilation, BUILD_MICROBENCHMARK_LIBRARIES, \
TYPE := LIBRARY, \
SOURCE_DIRS := $(MICROBENCHMARK_NATIVE_SRC_DIRS), \
OUTPUT_DIR := $(MICROBENCHMARK_NATIVE_OUTPUT), \
EXCLUDE := $(MICROBENCHMARK_NATIVE_EXCLUDE), \
))
# Setup copy of native dependencies to image output dir
$(eval $(call SetupCopyFiles, COPY_MICROBENCHMARK_NATIVE, \
SRC := $(MICROBENCHMARK_NATIVE_OUTPUT)/lib, \
DEST := $(MICROBENCHMARK_IMAGE_DIR)/native, \
FILES := $(filter $(MICROBENCHMARK_NATIVE_OUTPUT)/lib/%, \
$(BUILD_MICROBENCHMARK_LIBRARIES)), \
))
all: $(MICROBENCHMARK_JAR) $(BUILD_MICROBENCHMARK_LIBRARIES) $(COPY_MICROBENCHMARK_NATIVE)
################################################################################
include MakeFileEnd.gmk
|