Merge
This commit is contained in:
commit
f3f7c9878c
1
.hgtags
1
.hgtags
@ -487,3 +487,4 @@ e1e60f75cd39312a7f59d2a4f91d624e5aecc95e jdk-11+11
|
||||
758deedaae8406ae60147486107a54e9864aa7b0 jdk-11+13
|
||||
3595bd343b65f8c37818ebe6a4c343ddeb1a5f88 jdk-11+14
|
||||
a11c1cb542bbd1671d25b85efe7d09b983c48525 jdk-11+15
|
||||
02934b0d661b82b7fe1052a04998d2091352e08d jdk-11+16
|
||||
|
@ -1,115 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2010, 2017, 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.
|
||||
#
|
||||
|
||||
# This must be the first rule
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include JarArchive.gmk
|
||||
include JavaCompilation.gmk
|
||||
include SetupJavaCompilers.gmk
|
||||
include TextFileProcessing.gmk
|
||||
include Modules.gmk
|
||||
|
||||
JDK_CLASSES := $(call PathList, $(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
|
||||
java.base java.logging java.scripting jdk.dynalink)))
|
||||
|
||||
# Need to use source and target 8 for nasgen to work.
|
||||
$(eval $(call SetupJavaCompiler, GENERATE_NEWBYTECODE_DEBUG, \
|
||||
JVM := $(JAVA_JAVAC), \
|
||||
JAVAC := $(NEW_JAVAC), \
|
||||
FLAGS := -g -source 10 -target 10 --upgrade-module-path "$(JDK_OUTPUTDIR)/modules/" \
|
||||
--system none --module-source-path $(call GetModuleSrcPath), \
|
||||
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
|
||||
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
|
||||
|
||||
# Build nashorn into intermediate directory
|
||||
# Name the compilation setup the same as the module, as is done in the global
|
||||
# CompileJavaModules.gmk, to make dependency checking with other modules work
|
||||
# seamlessly.
|
||||
$(eval $(call SetupJavaCompilation, jdk.scripting.nashorn, \
|
||||
SETUP := GENERATE_NEWBYTECODE_DEBUG, \
|
||||
MODULE := jdk.scripting.nashorn, \
|
||||
SRC := $(TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
|
||||
COPY := .properties .js, \
|
||||
BIN := $(SUPPORT_OUTPUTDIR)/special_classes, \
|
||||
CREATE_API_DIGEST := true, \
|
||||
))
|
||||
|
||||
# Declare dependencies between java compilations of different modules.
|
||||
# Since the other modules are declared in different invocations of this file,
|
||||
# use the macro to find the correct target file to depend on.
|
||||
# Only the javac compilation actually depends on other modules so limit
|
||||
# dependency declaration to that by using the *_COMPILE_TARGET variable.
|
||||
$(jdk.scripting.nashorn_COMPILE_TARGET): $(foreach d, $(call FindDepsForModule, jdk.scripting.nashorn), \
|
||||
$(call SetupJavaCompilationApiTarget, $d, \
|
||||
$(if $($d_BIN), $($d_BIN), $(JDK_OUTPUTDIR)/modules/$d)))
|
||||
|
||||
NASGEN_SRC := $(TOPDIR)/make/nashorn/buildtools/nasgen/src
|
||||
ASM_SRC := $(TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
|
||||
|
||||
# Build nasgen
|
||||
$(eval $(call SetupJavaCompilation, BUILD_NASGEN, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := $(NASGEN_SRC) $(ASM_SRC), \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes))
|
||||
|
||||
NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn
|
||||
NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
|
||||
|
||||
NASGEN_OPTIONS := \
|
||||
-cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
|
||||
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
|
||||
#
|
||||
|
||||
# Copy classes to final classes dir and run nasgen to modify classes in jdk.nashorn.internal.objects package
|
||||
$(NASGEN_RUN_FILE): $(BUILD_NASGEN) $(jdk.scripting.nashorn)
|
||||
$(ECHO) Running nasgen
|
||||
$(MKDIR) -p $(@D)
|
||||
$(RM) -rf $(@D)/jdk $(@D)/netscape
|
||||
$(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/* $(@D)/
|
||||
$(JAVA_SMALL) $(NASGEN_OPTIONS) \
|
||||
jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
|
||||
$(TOUCH) $@
|
||||
|
||||
# Version file needs to be processed with version numbers
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/version.properties.template, \
|
||||
OUTPUT_FILE := $(JDK_OUTPUTDIR)/modules/jdk.scripting.nashorn/jdk/nashorn/internal/runtime/resources/version.properties, \
|
||||
REPLACEMENTS := \
|
||||
@@VERSION_STRING@@ => $(VERSION_STRING) ; \
|
||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) , \
|
||||
))
|
||||
|
||||
# Version processing needs to happen after nasgen run since nasgen run deletes it
|
||||
$(BUILD_VERSION_FILE): $(NASGEN_RUN_FILE)
|
||||
|
||||
compile: $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE)
|
||||
all: compile
|
||||
|
||||
.PHONY: compile all
|
@ -341,6 +341,10 @@ jdk.jartool_ADD_JAVAC_FLAGS += -XDstringConcat=inline
|
||||
|
||||
################################################################################
|
||||
|
||||
jdk.scripting.nashorn_COPY := .properties .js
|
||||
|
||||
################################################################################
|
||||
|
||||
jdk.scripting.nashorn.shell_COPY += .js .properties
|
||||
|
||||
################################################################################
|
||||
@ -440,11 +444,13 @@ jdk.internal.vm.compiler_ADD_JAVAC_FLAGS += -parameters -XDstringConcat=inline \
|
||||
|
||||
jdk.internal.vm.compiler_EXCLUDES += \
|
||||
jdk.internal.vm.compiler.collections.test \
|
||||
org.graalvm.compiler.processor \
|
||||
org.graalvm.compiler.core.match.processor \
|
||||
org.graalvm.compiler.nodeinfo.processor \
|
||||
org.graalvm.compiler.options.processor \
|
||||
org.graalvm.compiler.serviceprovider.processor \
|
||||
org.graalvm.compiler.replacements.verifier \
|
||||
org.graalvm.compiler.replacements.processor \
|
||||
org.graalvm.compiler.replacements.jdk9.test \
|
||||
org.graalvm.compiler.api.directives.test \
|
||||
org.graalvm.compiler.api.test \
|
||||
org.graalvm.compiler.asm.aarch64.test \
|
||||
@ -642,6 +648,12 @@ endif
|
||||
|
||||
################################################################################
|
||||
|
||||
ifeq ($(MODULE), jdk.scripting.nashorn)
|
||||
include CompileJavaModulesNashorn.gmk
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
$(eval $(call IncludeCustomExtension, CompileJavaModules-post.gmk))
|
||||
|
||||
################################################################################
|
||||
|
54
make/CompileJavaModulesNashorn.gmk
Normal file
54
make/CompileJavaModulesNashorn.gmk
Normal file
@ -0,0 +1,54 @@
|
||||
#
|
||||
# Copyright (c) 2010, 2018, 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.
|
||||
#
|
||||
|
||||
NASGEN_SRC := $(TOPDIR)/make/nashorn/buildtools/nasgen/src
|
||||
ASM_SRC := $(TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
|
||||
|
||||
# Build nasgen
|
||||
$(eval $(call SetupJavaCompilation, BUILD_NASGEN, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := $(NASGEN_SRC) $(ASM_SRC), \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
|
||||
))
|
||||
|
||||
NASHORN_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules/$(MODULE)
|
||||
NASGEN_RUN_FILE := $(NASHORN_CLASSES_DIR)/_the.nasgen.run
|
||||
|
||||
NASGEN_OPTIONS := \
|
||||
-cp $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
|
||||
--patch-module java.base=$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED \
|
||||
--add-exports java.base/jdk.internal.org.objectweb.asm.util=ALL-UNNAMED \
|
||||
#
|
||||
|
||||
# Run nasgen to modify classes in jdk.nashorn.internal.objects package
|
||||
$(NASGEN_RUN_FILE): $(BUILD_NASGEN) $($(MODULE))
|
||||
$(ECHO) Running nasgen
|
||||
$(JAVA_SMALL) $(NASGEN_OPTIONS) \
|
||||
jdk.nashorn.internal.tools.nasgen.Main $(@D) \
|
||||
jdk.nashorn.internal.objects $(@D)
|
||||
$(TOUCH) $@
|
||||
|
||||
TARGETS += $(NASGEN_RUN_FILE)
|
@ -47,34 +47,8 @@ ifeq ($(INCLUDE_GRAAL), true)
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_MATCH_PROCESSOR, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := \
|
||||
$(SRC_DIR)/jdk.internal.vm.compiler.word/src \
|
||||
$(SRC_DIR)/jdk.internal.vm.compiler.collections/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.core/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.core.common/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.core.match.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.api.replacements/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.asm/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.bytecode/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.code/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.debug/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.graph/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.lir/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.loop/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.loop.phases/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodeinfo/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodes/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.options/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.phases/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.phases.common/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.serviceprovider/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.virtual/src \
|
||||
$(SRC_DIR)/org.graalvm.graphio/src \
|
||||
$(SRC_DIR)/org.graalvm.util/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.code/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.common/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.meta/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.runtime/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \
|
||||
, \
|
||||
EXCLUDE_FILES := $(EXCLUDE_FILES), \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.match.processor, \
|
||||
@ -88,7 +62,7 @@ ifeq ($(INCLUDE_GRAAL), true)
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_NODEINFO_PROCESSOR, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := \
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodeinfo/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodeinfo.processor/src \
|
||||
, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.nodeinfo.processor, \
|
||||
@ -102,10 +76,8 @@ ifeq ($(INCLUDE_GRAAL), true)
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_OPTIONS_PROCESSOR, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := \
|
||||
$(SRC_DIR)/jdk.internal.vm.compiler.collections/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.options/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.options.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.util/src \
|
||||
, \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor, \
|
||||
JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.options.processor.jar, \
|
||||
@ -115,44 +87,26 @@ ifeq ($(INCLUDE_GRAAL), true)
|
||||
|
||||
##############################################################################
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER, \
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_REPLACEMENTS_PROCESSOR, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := \
|
||||
$(SRC_DIR)/jdk.internal.vm.compiler.word/src \
|
||||
$(SRC_DIR)/jdk.internal.vm.compiler.collections/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.bytecode/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.verifier/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.api.replacements/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.code/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.core.common/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.debug/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.graph/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.nodeinfo/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.options/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.serviceprovider/src \
|
||||
$(SRC_DIR)/org.graalvm.graphio/src \
|
||||
$(SRC_DIR)/org.graalvm.util/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.code/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.common/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.meta/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.runtime/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.replacements.processor/src \
|
||||
, \
|
||||
EXCLUDE_FILES := $(EXCLUDE_FILES), \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier, \
|
||||
JAR := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar, \
|
||||
))
|
||||
|
||||
TARGETS += $(BUILD_VM_COMPILER_REPLACEMENTS_VERIFIER)
|
||||
TARGETS += $(BUILD_VM_COMPILER_REPLACEMENTS_PROCESSOR)
|
||||
|
||||
##############################################################################
|
||||
|
||||
$(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_SERVICEPROVIDER_PROCESSOR, \
|
||||
SETUP := GENERATE_OLDBYTECODE, \
|
||||
SRC := \
|
||||
$(SRC_DIR)/org.graalvm.compiler.serviceprovider/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.processor/src \
|
||||
$(SRC_DIR)/org.graalvm.compiler.serviceprovider.processor/src \
|
||||
$(VM_CI_SRC_DIR)/jdk.vm.ci.services/src \
|
||||
, \
|
||||
EXCLUDE_FILES := $(EXCLUDE_FILES), \
|
||||
BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.serviceprovider.processor, \
|
||||
|
@ -98,13 +98,10 @@ ALL_TARGETS += buildtools-langtools interim-langtools \
|
||||
################################################################################
|
||||
# Special targets for certain modules
|
||||
|
||||
unpack-sec:
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
|
||||
|
||||
generate-exported-symbols:
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildStatic.gmk)
|
||||
|
||||
ALL_TARGETS += unpack-sec generate-exported-symbols
|
||||
ALL_TARGETS += generate-exported-symbols
|
||||
|
||||
################################################################################
|
||||
# Gensrc targets, generating source before java compilation can be done
|
||||
@ -189,7 +186,7 @@ $(foreach m, $(IMPORT_COPY_MODULES), $(eval $(call DeclareImportCopyRecipe,$m)))
|
||||
ALL_TARGETS += $(ALL_COPY_TARGETS)
|
||||
|
||||
################################################################################
|
||||
# Targets for compiling all java modules. Nashorn is treated separately.
|
||||
# Targets for compiling all java modules.
|
||||
JAVA_MODULES := $(ALL_MODULES)
|
||||
JAVA_TARGETS := $(addsuffix -java, $(JAVA_MODULES))
|
||||
|
||||
@ -199,14 +196,7 @@ define DeclareCompileJavaRecipe
|
||||
-f CompileJavaModules.gmk MODULE=$1)
|
||||
endef
|
||||
|
||||
$(foreach m, $(filter-out jdk.scripting.nashorn, $(JAVA_MODULES)), \
|
||||
$(eval $(call DeclareCompileJavaRecipe,$m)))
|
||||
|
||||
# Build nashorn. Needs to be compiled separately from the rest of the modules
|
||||
# due to nasgen.
|
||||
jdk.scripting.nashorn-java:
|
||||
+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) \
|
||||
-f BuildNashorn.gmk compile)
|
||||
$(foreach m, $(JAVA_MODULES), $(eval $(call DeclareCompileJavaRecipe,$m)))
|
||||
|
||||
ALL_TARGETS += $(JAVA_TARGETS)
|
||||
|
||||
@ -700,9 +690,6 @@ else
|
||||
# file to be processed by the gensrc-moduleinfo target.
|
||||
jdk.internal.vm.compiler-gensrc-moduleinfo: jdk.internal.vm.compiler-gensrc-src
|
||||
|
||||
# Explicitly add dependencies for special targets
|
||||
java.base-java: unpack-sec
|
||||
|
||||
jdk.jdeps-gendata: java rmic
|
||||
|
||||
# The ct.sym generation uses all the moduleinfos as input
|
||||
|
@ -1,88 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2012, 2014, 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.
|
||||
#
|
||||
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
|
||||
################################################################################
|
||||
# Unpack the binary distributions of the crypto classes if they exist.
|
||||
SEC_FILES_ZIP := $(TOPDIR)/make/tools/crypto/sec-bin.zip
|
||||
SEC_FILES_WIN_ZIP := $(TOPDIR)/make/tools/crypto/sec-windows-bin.zip
|
||||
JGSS_WIN32_FILES_ZIP := $(TOPDIR)/make/tools/crypto/jgss-windows-i586-bin.zip
|
||||
JGSS_WIN64_FILES_ZIP := $(TOPDIR)/make/tools/crypto/jgss-windows-x64-bin.zip
|
||||
|
||||
define unzip-sec-file
|
||||
$(ECHO) Unzipping $(<F)
|
||||
$(MKDIR) -p $(@D) $(JDK_OUTPUTDIR)
|
||||
$(RM) $@
|
||||
($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
|
||||
$(MV) $@.tmp $@
|
||||
endef
|
||||
|
||||
define unzip-native-sec-file
|
||||
$(ECHO) Unzipping $(<F)
|
||||
$(MKDIR) -p $(@D)
|
||||
$(RM) $@
|
||||
($(CD) $(SUPPORT_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
|
||||
$(MV) $@.tmp $@
|
||||
endef
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
|
||||
$(call unzip-sec-file)
|
||||
|
||||
# Trying to unzip both of the sec files at the same time may cause a race
|
||||
# when creating directories common to both files.
|
||||
$(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP) \
|
||||
| $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
|
||||
$(call unzip-sec-file)
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
|
||||
$(call unzip-native-sec-file)
|
||||
|
||||
$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
|
||||
$(call unzip-native-sec-file)
|
||||
|
||||
ifneq ($(wildcard $(SEC_FILES_ZIP)), )
|
||||
IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped
|
||||
ifeq ($(OPENJDK_TARGET_CPU), x86)
|
||||
IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped
|
||||
endif
|
||||
ifeq ($(OPENJDK_TARGET_CPU), x86_64)
|
||||
IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
||||
sec: $(IMPORT_TARGET_FILES)
|
||||
|
||||
all: sec
|
||||
|
||||
.PHONY: sec all
|
11
make/autoconf/build-aux/config.guess
vendored
11
make/autoconf/build-aux/config.guess
vendored
@ -86,6 +86,17 @@ if [ "x$OUT" = x ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test and fix little endian MIPS.
|
||||
if [ "x$OUT" = x ]; then
|
||||
if [ `uname -s` = Linux ]; then
|
||||
if [ `uname -m` = mipsel ]; then
|
||||
OUT=mipsel-unknown-linux-gnu
|
||||
elif [ `uname -m` = mips64el ]; then
|
||||
OUT=mips64el-unknown-linux-gnu
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Test and fix cpu on Macosx when C preprocessor is not on the path
|
||||
echo $OUT | grep i386-apple-darwin > /dev/null 2> /dev/null
|
||||
if test $? = 0; then
|
||||
|
@ -21,4 +21,4 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
tzdata2018d
|
||||
tzdata2018e
|
||||
|
@ -29,7 +29,7 @@
|
||||
# tz@iana.org for general use in the future). For more, please see
|
||||
# the file CONTRIBUTING in the tz distribution.
|
||||
|
||||
# From Paul Eggert (2017-02-20):
|
||||
# From Paul Eggert (2017-04-09):
|
||||
#
|
||||
# Unless otherwise specified, the source for data through 1990 is:
|
||||
# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
|
||||
@ -75,7 +75,7 @@
|
||||
# cannot now come up with solid citations.
|
||||
#
|
||||
# I invented the following abbreviations; corrections are welcome!
|
||||
# +02 WAST West Africa Summer Time
|
||||
# +02 WAST West Africa Summer Time (no longer used)
|
||||
# +03 CAST Central Africa Summer Time (no longer used)
|
||||
# +03 SAST South Africa Summer Time (no longer used)
|
||||
# +03 EAT East Africa Time
|
||||
@ -990,6 +990,10 @@ Link Africa/Maputo Africa/Lusaka # Zambia
|
||||
# commence at OOhOO on Monday 21 March 1994 and shall end at 02h00 on
|
||||
# Sunday 4 September 1994.
|
||||
|
||||
# From Michael Deckers (2017-04-06):
|
||||
# ... both summer and winter time are called "standard"
|
||||
# (which differs from the use in Ireland) ...
|
||||
|
||||
# From Petronella Sibeene (2007-03-30):
|
||||
# http://allafrica.com/stories/200703300178.html
|
||||
# While the entire country changes its time, Katima Mulilo and other
|
||||
@ -1015,19 +1019,42 @@ Link Africa/Maputo Africa/Lusaka # Zambia
|
||||
# the same time they would normally start DST, the first Sunday in September:
|
||||
# https://www.timeanddate.com/news/time/namibia-new-time-zone.html
|
||||
|
||||
# From Paul Eggert (2017-04-09):
|
||||
# Before the change, summer and winter time were both standard time legally.
|
||||
# However in common parlance, winter time was considered to be DST. See, e.g.:
|
||||
# http://www.nbc.na/news/namibias-winter-time-could-be-scrapped.2706
|
||||
# https://zone.my.na/news/times-are-changing-in-namibia
|
||||
# https://www.newera.com.na/2017/02/23/namibias-winter-time-might-be-repealed/
|
||||
# Use plain "WAT" and "CAT" for the time zone abbreviations, to be compatible
|
||||
# with Namibia's neighbors.
|
||||
|
||||
# RULE NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Namibia 1994 only - Mar 21 0:00 0 -
|
||||
Rule Namibia 1994 2016 - Sep Sun>=1 2:00 1:00 S
|
||||
Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 -
|
||||
# Vanguard section, for zic and other parsers that support negative DST.
|
||||
#Rule Namibia 1994 only - Mar 21 0:00 -1:00 WAT
|
||||
#Rule Namibia 1994 2017 - Sep Sun>=1 2:00 0 CAT
|
||||
#Rule Namibia 1995 2017 - Apr Sun>=1 2:00 -1:00 WAT
|
||||
# Rearguard section, for parsers that do not support negative DST.
|
||||
Rule Namibia 1994 only - Mar 21 0:00 0 WAT
|
||||
Rule Namibia 1994 2017 - Sep Sun>=1 2:00 1:00 CAT
|
||||
Rule Namibia 1995 2017 - Apr Sun>=1 2:00 0 WAT
|
||||
# End of rearguard section.
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Africa/Windhoek 1:08:24 - LMT 1892 Feb 8
|
||||
1:30 - +0130 1903 Mar
|
||||
2:00 - SAST 1942 Sep 20 2:00
|
||||
2:00 1:00 SAST 1943 Mar 21 2:00
|
||||
2:00 - SAST 1990 Mar 21 # independence
|
||||
# Vanguard section, for zic and other parsers that support negative DST.
|
||||
# 2:00 Namibia %s
|
||||
# Rearguard section, for parsers that do not support negative DST.
|
||||
2:00 - CAT 1994 Mar 21 0:00
|
||||
1:00 Namibia WA%sT 2017 Sep 3 2:00
|
||||
# From Paul Eggert (2017-04-07):
|
||||
# The official date of the 2017 rule change was 2017-10-24. See:
|
||||
# http://www.lac.org.na/laws/annoSTAT/Namibian%20Time%20Act%209%20of%202017.pdf
|
||||
1:00 Namibia %s 2017 Oct 24
|
||||
2:00 - CAT
|
||||
# End of rearguard section.
|
||||
|
||||
# Niger
|
||||
# See Africa/Lagos.
|
||||
|
@ -2006,6 +2006,19 @@ Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S
|
||||
# There is no common English-language abbreviation for this time zone.
|
||||
# Use KST, as that's what we already use for 1954-1961 in ROK.
|
||||
|
||||
# From Kang Seonghoon (2018-04-29):
|
||||
# North Korea will revert its time zone from UTC+8:30 (PYT; Pyongyang
|
||||
# Time) back to UTC+9 (KST; Korea Standard Time).
|
||||
#
|
||||
# From Seo Sanghyeon (2018-04-30):
|
||||
# Rodong Sinmun 2018-04-30 announced Pyongyang Time transition plan.
|
||||
# https://www.nknews.org/kcna/wp-content/uploads/sites/5/2018/04/rodong-2018-04-30.pdf
|
||||
# ... the transition date is 2018-05-05 ... Citation should be Decree
|
||||
# No. 2232 of April 30, 2018, of the Presidium of the Supreme People's
|
||||
# Assembly, as published in Rodong Sinmun.
|
||||
# From Tim Parenti (2018-04-29):
|
||||
# It appears to be the front page story at the top in the right-most column.
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1
|
||||
8:30 - KST 1912 Jan 1
|
||||
@ -2017,7 +2030,8 @@ Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1
|
||||
8:30 - KST 1912 Jan 1
|
||||
9:00 - JST 1945 Aug 24
|
||||
9:00 - KST 2015 Aug 15 00:00
|
||||
8:30 - KST
|
||||
8:30 - KST 2018 May 5
|
||||
9:00 - KST
|
||||
|
||||
###############################################################################
|
||||
|
||||
@ -2681,7 +2695,7 @@ Zone Asia/Karachi 4:28:12 - LMT 1907
|
||||
# From Sharef Mustafa (2018-03-16):
|
||||
# Palestine summer time will start on Mar 24th 2018 by advancing the
|
||||
# clock by 60 minutes as per Palestinian cabinet decision published on
|
||||
# the offical website, though the decree did not specify the exact
|
||||
# the official website, though the decree did not specify the exact
|
||||
# time of the time shift.
|
||||
# http://www.palestinecabinet.gov.ps/Website/AR/NDecrees/ViewFile.ashx?ID=e7a42ab7-ee23-435a-b9c8-a4f7e81f3817
|
||||
#
|
||||
|
@ -1108,6 +1108,15 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901
|
||||
# (1999-09-27) writes that Giles Meteorological Station uses
|
||||
# South Australian time even though it's located in Western Australia.
|
||||
|
||||
# From Paul Eggert (2018-04-01):
|
||||
# The Guardian Express of Perth, Australia reported today that the
|
||||
# government decided to advance the clocks permanently on January 1,
|
||||
# 2019, from UT +08 to UT +09. The article noted that an exemption
|
||||
# would be made for people aged 61 and over, who "can apply in writing
|
||||
# to have the extra hour of sunshine removed from their area." See:
|
||||
# Daylight saving coming to WA in 2019. Guardian Express. 2018-04-01.
|
||||
# https://www.communitynews.com.au/guardian-express/news/exclusive-daylight-savings-coming-wa-summer-2018/
|
||||
|
||||
# Queensland
|
||||
|
||||
# From Paul Eggert (2018-02-26):
|
||||
|
@ -551,13 +551,13 @@ Link Europe/London Europe/Isle_of_Man
|
||||
# summer and negative daylight saving time in winter. It is for when
|
||||
# negative SAVE values are used.
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
#Rule Eire 1971 only - Oct 31 2:00u -1:00 GMT
|
||||
#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 IST
|
||||
#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 GMT
|
||||
#Rule Eire 1981 max - Mar lastSun 1:00u 0 IST
|
||||
#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 GMT
|
||||
#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 GMT
|
||||
#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 GMT
|
||||
#Rule Eire 1971 only - Oct 31 2:00u -1:00 -
|
||||
#Rule Eire 1972 1980 - Mar Sun>=16 2:00u 0 -
|
||||
#Rule Eire 1972 1980 - Oct Sun>=23 2:00u -1:00 -
|
||||
#Rule Eire 1981 max - Mar lastSun 1:00u 0 -
|
||||
#Rule Eire 1981 1989 - Oct Sun>=23 1:00u -1:00 -
|
||||
#Rule Eire 1990 1995 - Oct Sun>=22 1:00u -1:00 -
|
||||
#Rule Eire 1996 max - Oct lastSun 1:00u -1:00 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Europe/Dublin -0:25:00 - LMT 1880 Aug 2
|
||||
@ -993,18 +993,30 @@ Zone Europe/Sofia 1:33:16 - LMT 1880
|
||||
# Please see the 'asia' file for Asia/Nicosia.
|
||||
|
||||
# Czech Republic / Czechia
|
||||
#
|
||||
# From Paul Eggert (2018-04-15):
|
||||
# The source for Czech data is: Kdy začíná a končí letní čas. 2018-04-15.
|
||||
# https://kalendar.beda.cz/kdy-zacina-a-konci-letni-cas
|
||||
# We know of no English-language name for historical Czech winter time;
|
||||
# abbreviate it as "GMT", as it happened to be GMT.
|
||||
#
|
||||
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
|
||||
Rule Czech 1945 only - Apr 8 2:00s 1:00 S
|
||||
Rule Czech 1945 only - Nov 18 2:00s 0 -
|
||||
Rule Czech 1945 only - Apr Mon>=1 2:00s 1:00 S
|
||||
Rule Czech 1945 only - Oct 1 2:00s 0 -
|
||||
Rule Czech 1946 only - May 6 2:00s 1:00 S
|
||||
Rule Czech 1946 1949 - Oct Sun>=1 2:00s 0 -
|
||||
Rule Czech 1947 only - Apr 20 2:00s 1:00 S
|
||||
Rule Czech 1948 only - Apr 18 2:00s 1:00 S
|
||||
Rule Czech 1947 1948 - Apr Sun>=15 2:00s 1:00 S
|
||||
Rule Czech 1949 only - Apr 9 2:00s 1:00 S
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Europe/Prague 0:57:44 - LMT 1850
|
||||
0:57:44 - PMT 1891 Oct # Prague Mean Time
|
||||
1:00 C-Eur CE%sT 1944 Sep 17 2:00s
|
||||
1:00 C-Eur CE%sT 1945 May 9
|
||||
1:00 Czech CE%sT 1946 Dec 1 3:00
|
||||
# Vanguard section, for zic and other parsers that support negative DST.
|
||||
# 1:00 -1:00 GMT 1947 Feb 23 2:00
|
||||
# Rearguard section, for parsers that do not support negative DST.
|
||||
0:00 - GMT 1947 Feb 23 2:00
|
||||
# End of rearguard section.
|
||||
1:00 Czech CE%sT 1979
|
||||
1:00 EU CE%sT
|
||||
# Use Europe/Prague also for Slovakia.
|
||||
@ -2039,7 +2051,7 @@ Rule Neth 1938 1939 - May 15 2:00s 1:00 S
|
||||
Rule Neth 1945 only - Apr 2 2:00s 1:00 S
|
||||
Rule Neth 1945 only - Sep 16 2:00s 0 -
|
||||
#
|
||||
# Amsterdam Mean Time was +00:19:32.13 exactly, but the .13 is omitted
|
||||
# Amsterdam Mean Time was +00:19:32.13, but the .13 is omitted
|
||||
# below because the current format requires GMTOFF to be an integer.
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Europe/Amsterdam 0:19:32 - LMT 1835
|
||||
|
@ -108,8 +108,8 @@ if [ ! -d $DEVKIT_ROOT/VC ]; then
|
||||
|
||||
# The redist runtime libs are needed to run the compiler but may not be
|
||||
# installed on the machine where the devkit will be used.
|
||||
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/x86
|
||||
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/x86
|
||||
cp $DEVKIT_ROOT/VC/redist/x86/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/x86
|
||||
cp $DEVKIT_ROOT/VC/redist/x86/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/x86
|
||||
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCR_DLL $DEVKIT_ROOT/VC/bin/x64
|
||||
cp $DEVKIT_ROOT/VC/redist/x64/$MSVCP_DLL $DEVKIT_ROOT/VC/bin/x64
|
||||
fi
|
||||
|
51
make/gensrc/Gensrc-jdk.scripting.nashorn.gmk
Normal file
51
make/gensrc/Gensrc-jdk.scripting.nashorn.gmk
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Copyright (c) 2018, 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.
|
||||
#
|
||||
|
||||
default: all
|
||||
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
# Version file needs to be processed with version numbers
|
||||
VERSION_FILE := jdk/nashorn/internal/runtime/resources/version.properties
|
||||
|
||||
$(eval $(call SetupTextFileProcessing, BUILD_VERSION_FILE, \
|
||||
SOURCE_FILES := $(TOPDIR)/src/$(MODULE)/share/classes/$(VERSION_FILE).template, \
|
||||
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$(VERSION_FILE), \
|
||||
REPLACEMENTS := \
|
||||
@@VERSION_STRING@@ => $(VERSION_STRING) ; \
|
||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) , \
|
||||
))
|
||||
|
||||
TARGETS += $(NASGEN_RUN_FILE) $(BUILD_VERSION_FILE)
|
||||
|
||||
################################################################################
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
.PHONY: all default
|
@ -27,7 +27,7 @@ include LibCommon.gmk
|
||||
|
||||
################################################################################
|
||||
|
||||
ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux), )
|
||||
ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx), )
|
||||
|
||||
$(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
|
||||
NAME := extnet, \
|
||||
|
@ -134,6 +134,11 @@ NSK_JVMTI_AOD_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jvmti \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jvmti/aod
|
||||
|
||||
NSK_AOD_INCLUDES := \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/aod \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/native \
|
||||
-I$(VM_TESTBASE_DIR)/nsk/share/jni
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libProcessUtils := $(VM_SHARE_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libThreadController := $(NSK_MONITORING_INCLUDES)
|
||||
@ -823,6 +828,12 @@ BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libattach021Agent00 := $(NSK_JVMTI_AOD_INCL
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libattach050Agent00 := $(NSK_JVMTI_AOD_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libattach002Agent00 := $(NSK_JVMTI_AOD_INCLUDES)
|
||||
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libVirtualMachine07agent00 := $(NSK_AOD_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libVirtualMachine07agent01 := $(NSK_AOD_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libVirtualMachine07agent02 := $(NSK_AOD_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libVirtualMachine07agent03 := $(NSK_AOD_INCLUDES)
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libVirtualMachine09agent00 := $(NSK_AOD_INCLUDES)
|
||||
|
||||
################################################################################
|
||||
|
||||
# Platform specific setup
|
||||
@ -851,8 +862,6 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
BUILD_HOTSPOT_JTREG_EXECUTABLES_CFLAGS_exeFPRegs := -MT
|
||||
BUILD_HOTSPOT_JTREG_EXCLUDE += exesigtest.c
|
||||
|
||||
# Disable warning until JDK-8203802 is fixed
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_CFLAGS_libtimers += -wd4477
|
||||
else
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libbootclssearch_agent += -lpthread
|
||||
BUILD_HOTSPOT_JTREG_LIBRARIES_LIBS_libsystemclssearch_agent += -lpthread
|
||||
|
@ -783,7 +783,9 @@ class Assembler : public AbstractAssembler {
|
||||
void flush() {
|
||||
#ifdef VALIDATE_PIPELINE
|
||||
assert(_delay_state == NoDelay, "Ending code with a delay-slot.");
|
||||
#ifdef COMPILER2
|
||||
validate_no_pipeline_hazards();
|
||||
#endif
|
||||
#endif
|
||||
AbstractAssembler::flush();
|
||||
}
|
||||
|
@ -2980,6 +2980,16 @@ operand immI8()
|
||||
interface(CONST_INTER);
|
||||
%}
|
||||
|
||||
operand immU8()
|
||||
%{
|
||||
predicate((0 <= n->get_int()) && (n->get_int() <= 255));
|
||||
match(ConI);
|
||||
|
||||
op_cost(5);
|
||||
format %{ %}
|
||||
interface(CONST_INTER);
|
||||
%}
|
||||
|
||||
operand immI16()
|
||||
%{
|
||||
predicate((-32768 <= n->get_int()) && (n->get_int() <= 32767));
|
||||
@ -11597,6 +11607,46 @@ instruct testUL_reg(rFlagsRegU cr, rRegL src, immL0 zero)
|
||||
ins_pipe(ialu_cr_reg_imm);
|
||||
%}
|
||||
|
||||
instruct compUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm)
|
||||
%{
|
||||
match(Set cr (CmpI (LoadUB mem) imm));
|
||||
|
||||
ins_cost(125);
|
||||
format %{ "cmpb $mem, $imm" %}
|
||||
ins_encode %{ __ cmpb($mem$$Address, $imm$$constant); %}
|
||||
ins_pipe(ialu_cr_reg_mem);
|
||||
%}
|
||||
|
||||
instruct compB_mem_imm(rFlagsReg cr, memory mem, immI8 imm)
|
||||
%{
|
||||
match(Set cr (CmpI (LoadB mem) imm));
|
||||
|
||||
ins_cost(125);
|
||||
format %{ "cmpb $mem, $imm" %}
|
||||
ins_encode %{ __ cmpb($mem$$Address, $imm$$constant); %}
|
||||
ins_pipe(ialu_cr_reg_mem);
|
||||
%}
|
||||
|
||||
instruct testUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm, immI0 zero)
|
||||
%{
|
||||
match(Set cr (CmpI (AndI (LoadUB mem) imm) zero));
|
||||
|
||||
ins_cost(125);
|
||||
format %{ "testb $mem, $imm" %}
|
||||
ins_encode %{ __ testb($mem$$Address, $imm$$constant); %}
|
||||
ins_pipe(ialu_cr_reg_mem);
|
||||
%}
|
||||
|
||||
instruct testB_mem_imm(rFlagsReg cr, memory mem, immI8 imm, immI0 zero)
|
||||
%{
|
||||
match(Set cr (CmpI (AndI (LoadB mem) imm) zero));
|
||||
|
||||
ins_cost(125);
|
||||
format %{ "testb $mem, $imm" %}
|
||||
ins_encode %{ __ testb($mem$$Address, $imm$$constant); %}
|
||||
ins_pipe(ialu_cr_reg_mem);
|
||||
%}
|
||||
|
||||
//----------Max and Min--------------------------------------------------------
|
||||
// Min Instructions
|
||||
|
||||
|
@ -118,6 +118,11 @@ typedef struct {
|
||||
bool initialized;
|
||||
} MultiCounterQuerySetS, *MultiCounterQuerySetP;
|
||||
|
||||
typedef struct {
|
||||
MultiCounterQuerySetS set;
|
||||
int process_index;
|
||||
} ProcessQueryS, *ProcessQueryP;
|
||||
|
||||
static void pdh_cleanup(HQUERY* const query, HCOUNTER* const counter) {
|
||||
if (counter != NULL && *counter != NULL) {
|
||||
PdhDll::PdhRemoveCounter(*counter);
|
||||
@ -158,7 +163,7 @@ static void destroy_counter_query(MultiCounterQueryP counter_query) {
|
||||
}
|
||||
}
|
||||
|
||||
static void destroy_counter_query(MultiCounterQuerySetP counter_query_set) {
|
||||
static void destroy_multi_counter_query(MultiCounterQuerySetP counter_query_set) {
|
||||
for (int i = 0; i < counter_query_set->size; i++) {
|
||||
for (int j = 0; j < counter_query_set->queries[i].noOfCounters; ++j) {
|
||||
pdh_cleanup(NULL, &counter_query_set->queries[i].counters[j]);
|
||||
@ -167,9 +172,18 @@ static void destroy_counter_query(MultiCounterQuerySetP counter_query_set) {
|
||||
pdh_cleanup(&counter_query_set->queries[i].query.query, NULL);
|
||||
}
|
||||
FREE_C_HEAP_ARRAY(MultiCounterQueryS, counter_query_set->queries);
|
||||
}
|
||||
|
||||
static void destroy_counter_query(MultiCounterQuerySetP counter_query_set) {
|
||||
destroy_multi_counter_query(counter_query_set);
|
||||
FREE_C_HEAP_ARRAY(MultiCounterQuerySetS, counter_query_set);
|
||||
}
|
||||
|
||||
static void destroy_counter_query(ProcessQueryP process_query) {
|
||||
destroy_multi_counter_query(&process_query->set);
|
||||
FREE_C_HEAP_ARRAY(ProcessQueryS, process_query);
|
||||
}
|
||||
|
||||
static int open_query(HQUERY* query) {
|
||||
return PdhDll::PdhOpenQuery(NULL, 0, query);
|
||||
}
|
||||
@ -204,6 +218,11 @@ static int allocate_counters(MultiCounterQuerySetP query_set, size_t nofCounters
|
||||
return OS_OK;
|
||||
}
|
||||
|
||||
static int allocate_counters(ProcessQueryP process_query, size_t nofCounters) {
|
||||
assert(process_query != NULL, "invariant");
|
||||
return allocate_counters(&process_query->set, nofCounters);
|
||||
}
|
||||
|
||||
static void deallocate_counters(MultiCounterQueryP query) {
|
||||
if (query->counters != NULL) {
|
||||
FREE_C_HEAP_ARRAY(char, query->counters);
|
||||
@ -261,7 +280,6 @@ static OSReturn add_counter(CounterQueryP counter_query, const char* path, bool
|
||||
}
|
||||
|
||||
static OSReturn add_process_counter(MultiCounterQueryP query, int slot_index, const char* path, bool first_sample_on_init) {
|
||||
assert(query != NULL, "invariant");
|
||||
assert(query != NULL, "invariant");
|
||||
assert(slot_index < query->noOfCounters, "invariant");
|
||||
assert(query->counters[slot_index] == NULL, "invariant");
|
||||
@ -326,13 +344,15 @@ static int formatted_counter_value(HCOUNTER counter, DWORD format, PDH_FMT_COUNT
|
||||
* (in order to keep this index valid when the list resets from underneath,
|
||||
* ensure to call current_query_index_for_process() before every query involving
|
||||
* Process object instance data).
|
||||
*
|
||||
* if unable to query, returns OS_ERR(-1)
|
||||
*/
|
||||
static int current_query_index_for_process() {
|
||||
assert(process_image_name != NULL, "invariant");
|
||||
assert(pdh_IDProcess_counter_fmt != NULL, "invariant");
|
||||
HQUERY tmpQuery = NULL;
|
||||
if (open_query(&tmpQuery) != ERROR_SUCCESS) {
|
||||
return 0;
|
||||
return OS_ERR;
|
||||
}
|
||||
char counter[512];
|
||||
HCOUNTER handle_counter = NULL;
|
||||
@ -342,12 +362,12 @@ static int current_query_index_for_process() {
|
||||
assert(strlen(counter) < sizeof(counter), "invariant");
|
||||
if (PdhDll::PdhAddCounter(tmpQuery, counter, 0, &handle_counter) != ERROR_SUCCESS) {
|
||||
pdh_cleanup(&tmpQuery, &handle_counter);
|
||||
return 0;
|
||||
return OS_ERR;
|
||||
}
|
||||
const PDH_STATUS res = PdhDll::PdhCollectQueryData(tmpQuery);
|
||||
if (res == PDH_INVALID_HANDLE || res == PDH_NO_DATA) {
|
||||
pdh_cleanup(&tmpQuery, &handle_counter);
|
||||
return 0;
|
||||
return OS_ERR;
|
||||
} else {
|
||||
PDH_FMT_COUNTERVALUE counter_value;
|
||||
formatted_counter_value(handle_counter, PDH_FMT_LONG, &counter_value);
|
||||
@ -359,24 +379,28 @@ static int current_query_index_for_process() {
|
||||
}
|
||||
}
|
||||
pdh_cleanup(&tmpQuery, NULL);
|
||||
return 0;
|
||||
return OS_ERR;
|
||||
}
|
||||
|
||||
static MultiCounterQuerySetP create_process_counter_query() {
|
||||
MultiCounterQuerySetP const query = NEW_C_HEAP_ARRAY(MultiCounterQuerySetS, 1, mtInternal);
|
||||
memset(query, 0, sizeof(MultiCounterQuerySetS));
|
||||
static ProcessQueryP create_process_query() {
|
||||
const int current_process_idx = current_query_index_for_process();
|
||||
query->queries = NEW_C_HEAP_ARRAY(MultiCounterQueryS, current_process_idx + 1, mtInternal);
|
||||
memset(query->queries, 0, sizeof(MultiCounterQueryS) * (current_process_idx + 1));
|
||||
query->size = current_process_idx + 1;
|
||||
return query;
|
||||
if (OS_ERR == current_process_idx) {
|
||||
return NULL;
|
||||
}
|
||||
ProcessQueryP const process_query = NEW_C_HEAP_ARRAY(ProcessQueryS, 1, mtInternal);
|
||||
memset(process_query, 0, sizeof(ProcessQueryS));
|
||||
process_query->set.queries = NEW_C_HEAP_ARRAY(MultiCounterQueryS, current_process_idx + 1, mtInternal);
|
||||
memset(process_query->set.queries, 0, sizeof(MultiCounterQueryS) * (current_process_idx + 1));
|
||||
process_query->process_index = current_process_idx;
|
||||
process_query->set.size = current_process_idx + 1;
|
||||
assert(process_query->set.size > process_query->process_index, "invariant");
|
||||
return process_query;
|
||||
}
|
||||
|
||||
static MultiCounterQueryP current_process_counter_query(MultiCounterQuerySetP process_query_set) {
|
||||
assert(process_query_set != NULL, "invariant");
|
||||
const int current_query_index = current_query_index_for_process();
|
||||
assert(current_query_index < process_query_set->size, "invariant");
|
||||
return &process_query_set->queries[current_query_index];
|
||||
static MultiCounterQueryP current_process_counter_query(ProcessQueryP process_query) {
|
||||
assert(process_query != NULL, "invariant");
|
||||
assert(process_query->process_index < process_query->set.size, "invariant");
|
||||
return &process_query->set.queries[process_query->process_index];
|
||||
}
|
||||
|
||||
static void clear_multi_counter(MultiCounterQueryP query) {
|
||||
@ -384,19 +408,46 @@ static void clear_multi_counter(MultiCounterQueryP query) {
|
||||
pdh_cleanup(NULL, &query->counters[i]);
|
||||
}
|
||||
pdh_cleanup(&query->query.query, NULL);
|
||||
query->initialized = false;
|
||||
}
|
||||
|
||||
static int collect_process_query_data(MultiCounterQuerySetP counter_query_set) {
|
||||
const int current_process_idx = current_query_index_for_process();
|
||||
while (current_process_idx < counter_query_set->size - 1) {
|
||||
const int new_size = --counter_query_set->size;
|
||||
clear_multi_counter(&counter_query_set->queries[new_size]);
|
||||
static int ensure_valid_process_query_index(ProcessQueryP process_query) {
|
||||
assert(process_query != NULL, "invariant");
|
||||
const int previous_process_idx = process_query->process_index;
|
||||
if (previous_process_idx == 0) {
|
||||
return previous_process_idx;
|
||||
}
|
||||
return collect_query_data(&counter_query_set->queries[current_process_idx]);
|
||||
const int current_process_idx = current_query_index_for_process();
|
||||
if (current_process_idx == previous_process_idx || OS_ERR == current_process_idx ||
|
||||
current_process_idx >= process_query->set.size) {
|
||||
return previous_process_idx;
|
||||
}
|
||||
|
||||
assert(current_process_idx >= 0 && current_process_idx < process_query->set.size, "out of bounds!");
|
||||
while (current_process_idx < process_query->set.size - 1) {
|
||||
const int new_size = --process_query->set.size;
|
||||
clear_multi_counter(&process_query->set.queries[new_size]);
|
||||
}
|
||||
assert(current_process_idx < process_query->set.size, "invariant");
|
||||
process_query->process_index = current_process_idx;
|
||||
return current_process_idx;
|
||||
}
|
||||
|
||||
static int query_process_counter(MultiCounterQuerySetP process_query_set, int slot_index, DWORD format, PDH_FMT_COUNTERVALUE* const value) {
|
||||
MultiCounterQueryP const current_query = current_process_counter_query(process_query_set);
|
||||
static MultiCounterQueryP current_process_query(ProcessQueryP process_query) {
|
||||
assert(process_query != NULL, "invariant");
|
||||
const int current_process_idx = ensure_valid_process_query_index(process_query);
|
||||
assert(current_process_idx == process_query->process_index, "invariant");
|
||||
assert(current_process_idx < process_query->set.size, "invariant");
|
||||
return &process_query->set.queries[current_process_idx];
|
||||
}
|
||||
|
||||
static int collect_process_query_data(ProcessQueryP process_query) {
|
||||
assert(process_query != NULL, "invariant");
|
||||
return collect_query_data(current_process_query(process_query));
|
||||
}
|
||||
|
||||
static int query_process_counter(ProcessQueryP process_query, int slot_index, DWORD format, PDH_FMT_COUNTERVALUE* const value) {
|
||||
MultiCounterQueryP const current_query = current_process_counter_query(process_query);
|
||||
assert(current_query != NULL, "invariant");
|
||||
assert(slot_index < current_query->noOfCounters, "invariant");
|
||||
assert(current_query->counters[slot_index] != NULL, "invariant");
|
||||
@ -810,7 +861,7 @@ static int initialize_cpu_query(MultiCounterQueryP cpu_query, DWORD pdh_counter_
|
||||
return initialize_cpu_query_counters(cpu_query, pdh_counter_idx);
|
||||
}
|
||||
|
||||
static int initialize_process_counter(MultiCounterQuerySetP query_set, int slot_index, DWORD pdh_counter_index) {
|
||||
static int initialize_process_counter(ProcessQueryP process_query, int slot_index, DWORD pdh_counter_index) {
|
||||
char* localized_process_object;
|
||||
if (lookup_name_by_index(PDH_PROCESS_IDX, &localized_process_object) != OS_OK) {
|
||||
return OS_ERR;
|
||||
@ -821,7 +872,7 @@ static int initialize_process_counter(MultiCounterQuerySetP query_set, int slot_
|
||||
return OS_ERR;
|
||||
}
|
||||
assert(localized_counter_name != NULL, "invariant");
|
||||
for (int i = 0; i < query_set->size; ++i) {
|
||||
for (int i = 0; i < process_query->set.size; ++i) {
|
||||
char instanceIndexBuffer[32];
|
||||
const char* counter_path = make_fully_qualified_counter_path(localized_process_object,
|
||||
localized_counter_name,
|
||||
@ -830,7 +881,7 @@ static int initialize_process_counter(MultiCounterQuerySetP query_set, int slot_
|
||||
if (counter_path == NULL) {
|
||||
return OS_ERR;
|
||||
}
|
||||
MultiCounterQueryP const query = &query_set->queries[i];
|
||||
MultiCounterQueryP const query = &process_query->set.queries[i];
|
||||
if (add_process_counter(query, slot_index, counter_path, true)) {
|
||||
return OS_ERR;
|
||||
}
|
||||
@ -839,8 +890,9 @@ static int initialize_process_counter(MultiCounterQuerySetP query_set, int slot_
|
||||
}
|
||||
|
||||
static CounterQueryP create_counter_query(DWORD pdh_object_idx, DWORD pdh_counter_idx) {
|
||||
assert(is_valid_pdh_index(pdh_object_idx), "invariant");
|
||||
assert(is_valid_pdh_index(pdh_counter_idx), "invariant");
|
||||
if (!((is_valid_pdh_index(pdh_object_idx) && is_valid_pdh_index(pdh_counter_idx)))) {
|
||||
return NULL;
|
||||
}
|
||||
CounterQueryP const query = create_counter_query();
|
||||
const char* object = pdh_localized_artifact(pdh_object_idx);
|
||||
assert(object != NULL, "invariant");
|
||||
@ -917,7 +969,7 @@ class CPUPerformanceInterface::CPUPerformance : public CHeapObj<mtInternal> {
|
||||
friend class CPUPerformanceInterface;
|
||||
private:
|
||||
CounterQueryP _context_switches;
|
||||
MultiCounterQuerySetP _process_cpu_load;
|
||||
ProcessQueryP _process_cpu_load;
|
||||
MultiCounterQueryP _machine_cpu_load;
|
||||
|
||||
int cpu_load(int which_logical_cpu, double* cpu_load);
|
||||
@ -963,34 +1015,28 @@ CPUPerformanceInterface::CPUPerformance::CPUPerformance() : _context_switches(NU
|
||||
|
||||
bool CPUPerformanceInterface::CPUPerformance::initialize() {
|
||||
if (!pdh_acquire()) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
_context_switches = create_counter_query(PDH_SYSTEM_IDX, PDH_CONTEXT_SWITCH_RATE_IDX);
|
||||
if (_context_switches == NULL) {
|
||||
return false;
|
||||
}
|
||||
_process_cpu_load = create_process_counter_query();
|
||||
_process_cpu_load = create_process_query();
|
||||
if (_process_cpu_load == NULL) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (allocate_counters(_process_cpu_load, 2) != OS_OK) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (initialize_process_counter(_process_cpu_load, 0, PDH_PROCESSOR_TIME_IDX) != OS_OK) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
if (initialize_process_counter(_process_cpu_load, 1, PDH_PRIV_PROCESSOR_TIME_IDX) != OS_OK) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
_process_cpu_load->initialized = true;
|
||||
|
||||
_process_cpu_load->set.initialized = true;
|
||||
_machine_cpu_load = create_multi_counter_query();
|
||||
if (_machine_cpu_load == NULL) {
|
||||
return false;
|
||||
}
|
||||
if (initialize_cpu_query(_machine_cpu_load, PDH_PROCESSOR_TIME_IDX) != OS_OK) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
initialize_cpu_query(_machine_cpu_load, PDH_PROCESSOR_TIME_IDX);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1044,12 +1090,13 @@ int CPUPerformanceInterface::cpu_loads_process(double* pjvmUserLoad,
|
||||
}
|
||||
|
||||
int CPUPerformanceInterface::CPUPerformance::cpu_load(int which_logical_cpu, double* cpu_load) {
|
||||
assert(_machine_cpu_load != NULL, "invariant");
|
||||
assert(which_logical_cpu < _machine_cpu_load->noOfCounters, "invariant");
|
||||
*cpu_load = .0;
|
||||
if (!_machine_cpu_load->initialized) {
|
||||
if (_machine_cpu_load == NULL || !_machine_cpu_load->initialized) {
|
||||
return OS_ERR;
|
||||
}
|
||||
assert(_machine_cpu_load != NULL, "invariant");
|
||||
assert(which_logical_cpu < _machine_cpu_load->noOfCounters, "invariant");
|
||||
|
||||
if (collect_query_data(_machine_cpu_load)) {
|
||||
return OS_ERR;
|
||||
}
|
||||
@ -1062,11 +1109,11 @@ int CPUPerformanceInterface::CPUPerformance::cpu_load(int which_logical_cpu, dou
|
||||
}
|
||||
|
||||
int CPUPerformanceInterface::CPUPerformance::cpu_load_total_process(double* cpu_load) {
|
||||
assert(_process_cpu_load != NULL, "invariant");
|
||||
*cpu_load = .0;
|
||||
if (!_process_cpu_load->initialized) {
|
||||
if (_process_cpu_load == NULL || !_process_cpu_load->set.initialized) {
|
||||
return OS_ERR;
|
||||
}
|
||||
assert(_process_cpu_load != NULL, "invariant");
|
||||
if (collect_process_query_data(_process_cpu_load)) {
|
||||
return OS_ERR;
|
||||
}
|
||||
@ -1090,9 +1137,11 @@ int CPUPerformanceInterface::CPUPerformance::cpu_loads_process(double* pjvmUserL
|
||||
*pjvmUserLoad = .0;
|
||||
*pjvmKernelLoad = .0;
|
||||
*psystemTotalLoad = .0;
|
||||
if (!_process_cpu_load->initialized) {
|
||||
|
||||
if (_process_cpu_load == NULL || !_process_cpu_load->set.initialized) {
|
||||
return OS_ERR;
|
||||
}
|
||||
assert(_process_cpu_load != NULL, "invariant");
|
||||
if (collect_process_query_data(_process_cpu_load)) {
|
||||
return OS_ERR;
|
||||
}
|
||||
@ -1138,9 +1187,10 @@ int CPUPerformanceInterface::CPUPerformance::cpu_loads_process(double* pjvmUserL
|
||||
int CPUPerformanceInterface::CPUPerformance::context_switch_rate(double* rate) {
|
||||
assert(rate != NULL, "invariant");
|
||||
*rate = .0;
|
||||
if (!_context_switches->initialized) {
|
||||
if (_context_switches == NULL || !_context_switches->initialized) {
|
||||
return OS_ERR;
|
||||
}
|
||||
assert(_context_switches != NULL, "invariant");
|
||||
if (collect_query_data(_context_switches) != OS_OK) {
|
||||
return OS_ERR;
|
||||
}
|
||||
|
@ -400,9 +400,16 @@ class ClassLoaderData : public CHeapObj<mtClass> {
|
||||
static ClassLoaderData* class_loader_data_or_null(oop loader);
|
||||
static ClassLoaderData* anonymous_class_loader_data(Handle loader);
|
||||
|
||||
|
||||
// Returns Klass* of associated class loader, or NULL if associated loader is <bootstrap>.
|
||||
// Also works if unloading.
|
||||
Klass* class_loader_klass() const { return _class_loader_klass; }
|
||||
|
||||
// Returns Name of associated class loader.
|
||||
// Returns NULL if associated class loader is <bootstrap> or if no name has been set for
|
||||
// this loader.
|
||||
// Also works if unloading.
|
||||
Symbol* class_loader_name() const { return _class_loader_name; }
|
||||
|
||||
JFR_ONLY(DEFINE_TRACE_ID_METHODS;)
|
||||
};
|
||||
|
||||
|
@ -55,8 +55,10 @@ bool ClassLoaderExt::_has_platform_classes = false;
|
||||
|
||||
void ClassLoaderExt::append_boot_classpath(ClassPathEntry* new_entry) {
|
||||
#if INCLUDE_CDS
|
||||
warning("Sharing is only supported for boot loader classes because bootstrap classpath has been appended");
|
||||
FileMapInfo::current_info()->header()->set_has_platform_or_app_classes(false);
|
||||
if (UseSharedSpaces) {
|
||||
warning("Sharing is only supported for boot loader classes because bootstrap classpath has been appended");
|
||||
FileMapInfo::current_info()->header()->set_has_platform_or_app_classes(false);
|
||||
}
|
||||
#endif
|
||||
ClassLoader::add_to_boot_append_entries(new_entry);
|
||||
}
|
||||
|
@ -1817,22 +1817,11 @@ void SystemDictionary::add_to_hierarchy(InstanceKlass* k, TRAPS) {
|
||||
// ----------------------------------------------------------------------------
|
||||
// GC support
|
||||
|
||||
void SystemDictionary::always_strong_oops_do(OopClosure* blk) {
|
||||
roots_oops_do(blk, NULL);
|
||||
}
|
||||
|
||||
|
||||
// Assumes classes in the SystemDictionary are only unloaded at a safepoint
|
||||
// Note: anonymous classes are not in the SD.
|
||||
bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive,
|
||||
GCTimer* gc_timer,
|
||||
bool SystemDictionary::do_unloading(GCTimer* gc_timer,
|
||||
bool do_cleaning) {
|
||||
|
||||
{
|
||||
GCTraceTime(Debug, gc, phases) t("SystemDictionary WeakHandle cleaning", gc_timer);
|
||||
vm_weak_oop_storage()->weak_oops_do(is_alive, &do_nothing_cl);
|
||||
}
|
||||
|
||||
bool unloading_occurred;
|
||||
{
|
||||
GCTraceTime(Debug, gc, phases) t("ClassLoaderData", gc_timer);
|
||||
@ -1863,27 +1852,6 @@ bool SystemDictionary::do_unloading(BoolObjectClosure* is_alive,
|
||||
return unloading_occurred;
|
||||
}
|
||||
|
||||
void SystemDictionary::roots_oops_do(OopClosure* strong, OopClosure* weak) {
|
||||
strong->do_oop(&_java_system_loader);
|
||||
strong->do_oop(&_java_platform_loader);
|
||||
strong->do_oop(&_system_loader_lock_obj);
|
||||
CDS_ONLY(SystemDictionaryShared::roots_oops_do(strong);)
|
||||
|
||||
// Do strong roots marking if the closures are the same.
|
||||
if (strong == weak || !ClassUnloading) {
|
||||
// Only the protection domain oops contain references into the heap. Iterate
|
||||
// over all of them.
|
||||
vm_weak_oop_storage()->oops_do(strong);
|
||||
} else {
|
||||
if (weak != NULL) {
|
||||
vm_weak_oop_storage()->oops_do(weak);
|
||||
}
|
||||
}
|
||||
|
||||
// Visit extra methods
|
||||
invoke_method_table()->oops_do(strong);
|
||||
}
|
||||
|
||||
void SystemDictionary::oops_do(OopClosure* f) {
|
||||
f->do_oop(&_java_system_loader);
|
||||
f->do_oop(&_java_platform_loader);
|
||||
@ -1892,8 +1860,6 @@ void SystemDictionary::oops_do(OopClosure* f) {
|
||||
|
||||
// Visit extra methods
|
||||
invoke_method_table()->oops_do(f);
|
||||
|
||||
vm_weak_oop_storage()->oops_do(f);
|
||||
}
|
||||
|
||||
// CDS: scan and relocate all classes in the system dictionary.
|
||||
|
@ -357,14 +357,9 @@ public:
|
||||
|
||||
// Garbage collection support
|
||||
|
||||
// This method applies "blk->do_oop" to all the pointers to "system"
|
||||
// classes and loaders.
|
||||
static void always_strong_oops_do(OopClosure* blk);
|
||||
|
||||
// Unload (that is, break root links to) all unmarked classes and
|
||||
// loaders. Returns "true" iff something was unloaded.
|
||||
static bool do_unloading(BoolObjectClosure* is_alive,
|
||||
GCTimer* gc_timer,
|
||||
static bool do_unloading(GCTimer* gc_timer,
|
||||
bool do_cleaning = true);
|
||||
|
||||
// Used by DumpSharedSpaces only to remove classes that failed verification
|
||||
@ -374,7 +369,6 @@ public:
|
||||
|
||||
// Applies "f->do_oop" to all root oops in the system dictionary.
|
||||
static void oops_do(OopClosure* f);
|
||||
static void roots_oops_do(OopClosure* strong, OopClosure* weak);
|
||||
|
||||
// System loader lock
|
||||
static oop system_loader_lock() { return _system_loader_lock_obj; }
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2017, 2018, 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
|
||||
@ -222,10 +222,9 @@ void CMSHeap::cms_process_roots(StrongRootsScope* scope,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure) {
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);
|
||||
OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
|
||||
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
|
||||
|
||||
process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
process_roots(scope, so, root_closure, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
if (!only_strong_roots) {
|
||||
process_string_table_roots(scope, root_closure);
|
||||
}
|
||||
|
@ -5201,7 +5201,7 @@ void CMSCollector::refProcessingWork() {
|
||||
GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer_cm);
|
||||
|
||||
// Unload classes and purge the SystemDictionary.
|
||||
bool purged_class = SystemDictionary::do_unloading(&_is_alive_closure, _gc_timer_cm);
|
||||
bool purged_class = SystemDictionary::do_unloading(_gc_timer_cm);
|
||||
|
||||
// Unload nmethods.
|
||||
CodeCache::do_unloading(&_is_alive_closure, purged_class);
|
||||
|
@ -30,17 +30,16 @@
|
||||
#include "gc/shared/genCollectedHeap.hpp"
|
||||
#include "gc/shared/jvmFlagConstraintsGC.hpp"
|
||||
#include "memory/universe.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
static JVMFlag::Error ParallelGCThreadsAndCMSWorkQueueDrainThreshold(uint threads, uintx threshold, bool verbose) {
|
||||
// CMSWorkQueueDrainThreshold is verified to be less than max_juint
|
||||
if (UseConcMarkSweepGC && (threads > (uint)(max_jint / (uint)threshold))) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") or CMSWorkQueueDrainThreshold ("
|
||||
UINTX_FORMAT ") is too large\n",
|
||||
threads, threshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") or CMSWorkQueueDrainThreshold ("
|
||||
UINTX_FORMAT ") is too large\n",
|
||||
threads, threshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -49,20 +48,20 @@ static JVMFlag::Error ParallelGCThreadsAndCMSWorkQueueDrainThreshold(uint thread
|
||||
JVMFlag::Error ParallelGCThreadsConstraintFuncCMS(uint value, bool verbose) {
|
||||
// To avoid overflow at ParScanClosure::do_oop_work.
|
||||
if (UseConcMarkSweepGC && (value > (max_jint / 10))) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to " UINT32_FORMAT " for CMS GC\n",
|
||||
value, (max_jint / 10));
|
||||
JVMFlag::printError(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to " UINT32_FORMAT " for CMS GC\n",
|
||||
value, (max_jint / 10));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return ParallelGCThreadsAndCMSWorkQueueDrainThreshold(value, CMSWorkQueueDrainThreshold, verbose);
|
||||
}
|
||||
JVMFlag::Error ParGCStridesPerThreadConstraintFunc(uintx value, bool verbose) {
|
||||
if (UseConcMarkSweepGC && (value > ((uintx)max_jint / (uintx)ParallelGCThreads))) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParGCStridesPerThread (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
|
||||
value, ((uintx)max_jint / (uintx)ParallelGCThreads));
|
||||
JVMFlag::printError(verbose,
|
||||
"ParGCStridesPerThread (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
|
||||
value, ((uintx)max_jint / (uintx)ParallelGCThreads));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -76,10 +75,10 @@ JVMFlag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose)
|
||||
size_t card_table_size = ct->cards_required(heap_size) - 1; // Valid card table size
|
||||
|
||||
if ((size_t)value > card_table_size) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and "
|
||||
"must be less than or equal to card table size (" SIZE_FORMAT ")\n",
|
||||
value, card_table_size);
|
||||
JVMFlag::printError(verbose,
|
||||
"ParGCCardsPerStrideChunk (" INTX_FORMAT ") is too large for the heap size and "
|
||||
"must be less than or equal to card table size (" SIZE_FORMAT ")\n",
|
||||
value, card_table_size);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -89,10 +88,10 @@ JVMFlag::Error ParGCCardsPerStrideChunkConstraintFunc(intx value, bool verbose)
|
||||
uintx n_strides = ParallelGCThreads * ParGCStridesPerThread;
|
||||
uintx ergo_max = max_uintx / n_strides;
|
||||
if ((uintx)value > ergo_max) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
|
||||
value, ergo_max);
|
||||
JVMFlag::printError(verbose,
|
||||
"ParGCCardsPerStrideChunk (" INTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" UINTX_FORMAT ")\n",
|
||||
value, ergo_max);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -104,10 +103,10 @@ JVMFlag::Error CMSOldPLABMinConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
if (UseConcMarkSweepGC) {
|
||||
if (value > CMSOldPLABMax) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSOldPLABMin (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
|
||||
value, CMSOldPLABMax);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSOldPLABMin (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to CMSOldPLABMax (" SIZE_FORMAT ")\n",
|
||||
value, CMSOldPLABMax);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
status = MaxPLABSizeBounds("CMSOldPLABMin", value, verbose);
|
||||
@ -129,11 +128,11 @@ static JVMFlag::Error CMSReservedAreaConstraintFunc(const char* name, size_t val
|
||||
ConcurrentMarkSweepGeneration* cms = CMSHeap::heap()->old_gen();
|
||||
const size_t ergo_max = cms->cmsSpace()->max_flag_size_for_task_size();
|
||||
if (value > ergo_max) {
|
||||
CommandLineError::print(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" SIZE_FORMAT ") "
|
||||
"which is based on the maximum size of the old generation of the Java heap\n",
|
||||
name, value, ergo_max);
|
||||
JVMFlag::printError(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" SIZE_FORMAT ") "
|
||||
"which is based on the maximum size of the old generation of the Java heap\n",
|
||||
name, value, ergo_max);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -150,10 +149,10 @@ JVMFlag::Error CMSRescanMultipleConstraintFunc(size_t value, bool verbose) {
|
||||
// Note that rescan_task_size() will be aligned if CMSRescanMultiple is a multiple of 'HeapWordSize'
|
||||
// because rescan_task_size() is CardTable::card_size / HeapWordSize * BitsPerWord.
|
||||
if (value % HeapWordSize != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSRescanMultiple (" SIZE_FORMAT ") must be "
|
||||
"a multiple of " SIZE_FORMAT "\n",
|
||||
value, HeapWordSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSRescanMultiple (" SIZE_FORMAT ") must be "
|
||||
"a multiple of " SIZE_FORMAT "\n",
|
||||
value, HeapWordSize);
|
||||
status = JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -167,10 +166,10 @@ JVMFlag::Error CMSConcMarkMultipleConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
JVMFlag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
|
||||
if (UseConcMarkSweepGC && (value <= CMSPrecleanNumerator)) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
|
||||
"strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
|
||||
value, CMSPrecleanNumerator);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSPrecleanDenominator (" UINTX_FORMAT ") must be "
|
||||
"strickly greater than CMSPrecleanNumerator (" UINTX_FORMAT ")\n",
|
||||
value, CMSPrecleanNumerator);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -178,10 +177,10 @@ JVMFlag::Error CMSPrecleanDenominatorConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error CMSPrecleanNumeratorConstraintFunc(uintx value, bool verbose) {
|
||||
if (UseConcMarkSweepGC && (value >= CMSPrecleanDenominator)) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
|
||||
"less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n",
|
||||
value, CMSPrecleanDenominator);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSPrecleanNumerator (" UINTX_FORMAT ") must be "
|
||||
"less than CMSPrecleanDenominator (" UINTX_FORMAT ")\n",
|
||||
value, CMSPrecleanDenominator);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -191,10 +190,10 @@ JVMFlag::Error CMSSamplingGrainConstraintFunc(uintx value, bool verbose) {
|
||||
if (UseConcMarkSweepGC) {
|
||||
size_t max_capacity = CMSHeap::heap()->young_gen()->max_capacity();
|
||||
if (value > max_uintx - max_capacity) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSSamplingGrain (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" SIZE_FORMAT ")\n",
|
||||
value, max_uintx - max_capacity);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSSamplingGrain (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic maximum (" SIZE_FORMAT ")\n",
|
||||
value, max_uintx - max_capacity);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -216,11 +215,11 @@ JVMFlag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) {
|
||||
size_t bitmap_size = cms->collector()->markBitMap()->sizeInWords();
|
||||
|
||||
if (value > bitmap_size) {
|
||||
CommandLineError::print(verbose,
|
||||
"CMSBitMapYieldQuantum (" SIZE_FORMAT ") must "
|
||||
"be less than or equal to bitmap size (" SIZE_FORMAT ") "
|
||||
"whose size corresponds to the size of old generation of the Java heap\n",
|
||||
value, bitmap_size);
|
||||
JVMFlag::printError(verbose,
|
||||
"CMSBitMapYieldQuantum (" SIZE_FORMAT ") must "
|
||||
"be less than or equal to bitmap size (" SIZE_FORMAT ") "
|
||||
"whose size corresponds to the size of old generation of the Java heap\n",
|
||||
value, bitmap_size);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -229,9 +228,9 @@ JVMFlag::Error CMSBitMapYieldQuantumConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
JVMFlag::Error OldPLABSizeConstraintFuncCMS(size_t value, bool verbose) {
|
||||
if (value == 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"OldPLABSize (" SIZE_FORMAT ") must be greater than 0",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"OldPLABSize (" SIZE_FORMAT ") must be greater than 0",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
// For CMS, OldPLABSize is the number of free blocks of a given size that are used when
|
||||
|
@ -1611,6 +1611,9 @@ jint G1CollectedHeap::initialize() {
|
||||
const uint max_region_idx = (1U << (sizeof(RegionIdx_t)*BitsPerByte-1)) - 1;
|
||||
guarantee((max_regions() - 1) <= max_region_idx, "too many regions");
|
||||
|
||||
// The G1FromCardCache reserves card with value 0 as "invalid", so the heap must not
|
||||
// start within the first card.
|
||||
guarantee(g1_rs.base() >= (char*)G1CardTable::card_size, "Java heap must not start within the first card.");
|
||||
// Also create a G1 rem set.
|
||||
_g1_rem_set = new G1RemSet(this, _card_table, _hot_card_cache);
|
||||
_g1_rem_set->initialize(max_capacity(), max_regions());
|
||||
|
@ -1665,7 +1665,7 @@ void G1ConcurrentMark::weak_refs_work(bool clear_all_soft_refs) {
|
||||
// Unload Klasses, String, Symbols, Code Cache, etc.
|
||||
if (ClassUnloadingWithConcurrentMark) {
|
||||
GCTraceTime(Debug, gc, phases) debug("Class Unloading", _gc_timer_cm);
|
||||
bool purged_classes = SystemDictionary::do_unloading(&g1_is_alive, _gc_timer_cm, false /* Defer cleaning */);
|
||||
bool purged_classes = SystemDictionary::do_unloading(_gc_timer_cm, false /* Defer cleaning */);
|
||||
_g1h->complete_cleaning(&g1_is_alive, purged_classes);
|
||||
} else {
|
||||
GCTraceTime(Debug, gc, phases) debug("Cleanup", _gc_timer_cm);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2018, 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
|
||||
@ -47,7 +47,9 @@ void G1FromCardCache::initialize(uint num_par_rem_sets, uint max_num_regions) {
|
||||
num_par_rem_sets,
|
||||
&_static_mem_size);
|
||||
|
||||
invalidate(0, _max_regions);
|
||||
if (AlwaysPreTouch) {
|
||||
invalidate(0, _max_regions);
|
||||
}
|
||||
}
|
||||
|
||||
void G1FromCardCache::invalidate(uint start_idx, size_t new_num_regions) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -31,7 +31,7 @@
|
||||
// G1FromCardCache remembers the most recently processed card on the heap on
|
||||
// a per-region and per-thread basis.
|
||||
class G1FromCardCache : public AllStatic {
|
||||
private:
|
||||
private:
|
||||
// Array of card indices. Indexed by heap region (rows) and thread (columns) to minimize
|
||||
// thread contention.
|
||||
// This order minimizes the time to clear all entries for a given region during region
|
||||
@ -49,9 +49,12 @@ class G1FromCardCache : public AllStatic {
|
||||
}
|
||||
#endif
|
||||
|
||||
public:
|
||||
static const uintptr_t InvalidCard = UINTPTR_MAX;
|
||||
// This card index indicates "no card for that entry" yet. This allows us to use the OS
|
||||
// lazy backing of memory with zero-filled pages to avoid initial actual memory use.
|
||||
// This means that the heap must not contain card zero.
|
||||
static const uintptr_t InvalidCard = 0;
|
||||
|
||||
public:
|
||||
static void clear(uint region_idx);
|
||||
|
||||
// Returns true if the given card is in the cache at the given location, or
|
||||
|
@ -222,7 +222,7 @@ void G1FullCollector::phase1_mark_live_objects() {
|
||||
if (ClassUnloading) {
|
||||
GCTraceTime(Debug, gc, phases) debug("Phase 1: Class Unloading and Cleanup", scope()->timer());
|
||||
// Unload classes and purge the SystemDictionary.
|
||||
bool purged_class = SystemDictionary::do_unloading(&_is_alive, scope()->timer());
|
||||
bool purged_class = SystemDictionary::do_unloading(scope()->timer());
|
||||
_heap->complete_cleaning(&_is_alive, purged_class);
|
||||
} else {
|
||||
GCTraceTime(Debug, gc, phases) debug("Phase 1: String and Symbol Tables Cleanup", scope()->timer());
|
||||
|
@ -36,9 +36,6 @@ G1RegionMarkStatsCache::G1RegionMarkStatsCache(G1RegionMarkStats* target, uint m
|
||||
guarantee(is_power_of_2(num_cache_entries),
|
||||
"Number of cache entries must be power of two, but is %u", num_cache_entries);
|
||||
_cache = NEW_C_HEAP_ARRAY(G1RegionMarkStatsCacheEntry, _num_cache_entries, mtGC);
|
||||
for (uint i = 0; i < _num_cache_entries; i++) {
|
||||
_cache[i].clear();
|
||||
}
|
||||
_num_cache_entries_mask = _num_cache_entries - 1;
|
||||
}
|
||||
|
||||
|
@ -241,7 +241,6 @@ void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
|
||||
G1GCPhaseTimes* phase_times,
|
||||
uint worker_i) {
|
||||
OopClosure* strong_roots = closures->strong_oops();
|
||||
OopClosure* weak_roots = closures->weak_oops();
|
||||
|
||||
{
|
||||
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i);
|
||||
@ -290,7 +289,7 @@ void G1RootProcessor::process_vm_roots(G1RootClosures* closures,
|
||||
{
|
||||
G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
|
||||
if (!_process_strong_tasks.is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) {
|
||||
SystemDictionary::roots_oops_do(strong_roots, weak_roots);
|
||||
SystemDictionary::oops_do(strong_roots);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/g1/heapRegionBounds.inline.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "gc/g1/jvmFlagConstraintsG1.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
@ -34,10 +34,10 @@ JVMFlag::Error G1RSetRegionEntriesConstraintFunc(intx value, bool verbose) {
|
||||
// Default value of G1RSetRegionEntries=0 means will be set ergonomically.
|
||||
// Minimum value is 1.
|
||||
if (FLAG_IS_CMDLINE(G1RSetRegionEntries) && (value < 1)) {
|
||||
CommandLineError::print(verbose,
|
||||
"G1RSetRegionEntries (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"G1RSetRegionEntries (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -50,10 +50,10 @@ JVMFlag::Error G1RSetSparseRegionEntriesConstraintFunc(intx value, bool verbose)
|
||||
// Default value of G1RSetSparseRegionEntries=0 means will be set ergonomically.
|
||||
// Minimum value is 1.
|
||||
if (FLAG_IS_CMDLINE(G1RSetSparseRegionEntries) && (value < 1)) {
|
||||
CommandLineError::print(verbose,
|
||||
"G1RSetSparseRegionEntries (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"G1RSetSparseRegionEntries (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -65,10 +65,10 @@ JVMFlag::Error G1HeapRegionSizeConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
// Default value of G1HeapRegionSize=0 means will be set ergonomically.
|
||||
if (FLAG_IS_CMDLINE(G1HeapRegionSize) && (value < HeapRegionBounds::min_size())) {
|
||||
CommandLineError::print(verbose,
|
||||
"G1HeapRegionSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to ergonomic heap region minimum size\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"G1HeapRegionSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to ergonomic heap region minimum size\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -79,10 +79,10 @@ JVMFlag::Error G1NewSizePercentConstraintFunc(uintx value, bool verbose) {
|
||||
if (!UseG1GC) return JVMFlag::SUCCESS;
|
||||
|
||||
if (value > G1MaxNewSizePercent) {
|
||||
CommandLineError::print(verbose,
|
||||
"G1NewSizePercent (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n",
|
||||
value, G1MaxNewSizePercent);
|
||||
JVMFlag::printError(verbose,
|
||||
"G1NewSizePercent (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to G1MaxNewSizePercent (" UINTX_FORMAT ")\n",
|
||||
value, G1MaxNewSizePercent);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -93,10 +93,10 @@ JVMFlag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) {
|
||||
if (!UseG1GC) return JVMFlag::SUCCESS;
|
||||
|
||||
if (value < G1NewSizePercent) {
|
||||
CommandLineError::print(verbose,
|
||||
"G1MaxNewSizePercent (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to G1NewSizePercent (" UINTX_FORMAT ")\n",
|
||||
value, G1NewSizePercent);
|
||||
JVMFlag::printError(verbose,
|
||||
"G1MaxNewSizePercent (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to G1NewSizePercent (" UINTX_FORMAT ")\n",
|
||||
value, G1NewSizePercent);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -105,10 +105,10 @@ JVMFlag::Error G1MaxNewSizePercentConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MaxGCPauseMillisConstraintFuncG1(uintx value, bool verbose) {
|
||||
if (UseG1GC && FLAG_IS_CMDLINE(MaxGCPauseMillis) && (value >= GCPauseIntervalMillis)) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxGCPauseMillis (" UINTX_FORMAT ") must be "
|
||||
"less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
|
||||
value, GCPauseIntervalMillis);
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxGCPauseMillis (" UINTX_FORMAT ") must be "
|
||||
"less than GCPauseIntervalMillis (" UINTX_FORMAT ")\n",
|
||||
value, GCPauseIntervalMillis);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -119,25 +119,25 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFuncG1(uintx value, bool verbose)
|
||||
if (UseG1GC) {
|
||||
if (FLAG_IS_CMDLINE(GCPauseIntervalMillis)) {
|
||||
if (value < 1) {
|
||||
CommandLineError::print(verbose,
|
||||
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to 1\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
if (FLAG_IS_DEFAULT(MaxGCPauseMillis)) {
|
||||
CommandLineError::print(verbose,
|
||||
"GCPauseIntervalMillis cannot be set "
|
||||
"without setting MaxGCPauseMillis\n");
|
||||
JVMFlag::printError(verbose,
|
||||
"GCPauseIntervalMillis cannot be set "
|
||||
"without setting MaxGCPauseMillis\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
if (value <= MaxGCPauseMillis) {
|
||||
CommandLineError::print(verbose,
|
||||
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
|
||||
"greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n",
|
||||
value, MaxGCPauseMillis);
|
||||
JVMFlag::printError(verbose,
|
||||
"GCPauseIntervalMillis (" UINTX_FORMAT ") must be "
|
||||
"greater than MaxGCPauseMillis (" UINTX_FORMAT ")\n",
|
||||
value, MaxGCPauseMillis);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -153,9 +153,9 @@ JVMFlag::Error NewSizeConstraintFuncG1(size_t value, bool verbose) {
|
||||
// i.e. result of '(uint)(NewSize / region size(1~32MB))'
|
||||
// So maximum of NewSize should be 'max_juint * 1M'
|
||||
if (UseG1GC && (value > (max_juint * 1 * M))) {
|
||||
CommandLineError::print(verbose,
|
||||
"NewSize (" SIZE_FORMAT ") must be less than ergonomic maximum value\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"NewSize (" SIZE_FORMAT ") must be less than ergonomic maximum value\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
#endif // _LP64
|
||||
|
@ -23,7 +23,7 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "gc/parallel/jvmFlagConstraintsParallel.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
@ -32,10 +32,10 @@ JVMFlag::Error ParallelGCThreadsConstraintFuncParallel(uint value, bool verbose)
|
||||
// So can't exceed with "max_jint"
|
||||
|
||||
if (UseParallelGC && (value > (uint)max_jint)) {
|
||||
CommandLineError::print(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to " UINT32_FORMAT " for Parallel GC\n",
|
||||
value, max_jint);
|
||||
JVMFlag::printError(verbose,
|
||||
"ParallelGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to " UINT32_FORMAT " for Parallel GC\n",
|
||||
value, max_jint);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -44,10 +44,10 @@ JVMFlag::Error ParallelGCThreadsConstraintFuncParallel(uint value, bool verbose)
|
||||
JVMFlag::Error InitialTenuringThresholdConstraintFuncParallel(uintx value, bool verbose) {
|
||||
// InitialTenuringThreshold is only used for ParallelGC.
|
||||
if (UseParallelGC && (value > MaxTenuringThreshold)) {
|
||||
CommandLineError::print(verbose,
|
||||
"InitialTenuringThreshold (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
|
||||
value, MaxTenuringThreshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"InitialTenuringThreshold (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxTenuringThreshold (" UINTX_FORMAT ")\n",
|
||||
value, MaxTenuringThreshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -57,10 +57,10 @@ JVMFlag::Error MaxTenuringThresholdConstraintFuncParallel(uintx value, bool verb
|
||||
// As only ParallelGC uses InitialTenuringThreshold,
|
||||
// we don't need to compare InitialTenuringThreshold with MaxTenuringThreshold.
|
||||
if (UseParallelGC && (value < InitialTenuringThreshold)) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxTenuringThreshold (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
|
||||
value, InitialTenuringThreshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxTenuringThreshold (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to InitialTenuringThreshold (" UINTX_FORMAT ")\n",
|
||||
value, InitialTenuringThreshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ void MarkFromRootsTask::do_it(GCTaskManager* manager, uint which) {
|
||||
break;
|
||||
|
||||
case system_dictionary:
|
||||
SystemDictionary::always_strong_oops_do(&mark_and_push_closure);
|
||||
SystemDictionary::oops_do(&mark_and_push_closure);
|
||||
break;
|
||||
|
||||
case class_loader_data:
|
||||
|
@ -200,16 +200,9 @@ static void oop_pc_follow_contents_specialized(InstanceRefKlass* klass, oop obj,
|
||||
cm->mark_and_push(referent_addr);
|
||||
}
|
||||
}
|
||||
T* next_addr = (T*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
// Treat discovered as normal oop, if ref is not "active",
|
||||
// i.e. if next is non-NULL.
|
||||
T next_oop = RawAccess<>::oop_load(next_addr);
|
||||
if (!CompressedOops::is_null(next_oop)) { // i.e. ref is not "active"
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
log_develop_trace(gc, ref)(" Process discovered as normal " PTR_FORMAT, p2i(discovered_addr));
|
||||
cm->mark_and_push(discovered_addr);
|
||||
}
|
||||
cm->mark_and_push(next_addr);
|
||||
// Treat discovered as normal oop.
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
cm->mark_and_push(discovered_addr);
|
||||
klass->InstanceKlass::oop_pc_follow_contents(obj, cm);
|
||||
}
|
||||
|
||||
|
@ -521,7 +521,7 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
ObjectSynchronizer::oops_do(mark_and_push_closure());
|
||||
Management::oops_do(mark_and_push_closure());
|
||||
JvmtiExport::oops_do(mark_and_push_closure());
|
||||
SystemDictionary::always_strong_oops_do(mark_and_push_closure());
|
||||
SystemDictionary::oops_do(mark_and_push_closure());
|
||||
ClassLoaderDataGraph::always_strong_cld_do(follow_cld_closure());
|
||||
// Do not treat nmethods as strong roots for mark/sweep, since we can unload them.
|
||||
//CodeCache::scavenge_root_nmethods_do(CodeBlobToOopClosure(mark_and_push_closure()));
|
||||
@ -556,7 +556,7 @@ void PSMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
GCTraceTime(Debug, gc, phases) t("Class Unloading", _gc_timer);
|
||||
|
||||
// Unload classes and purge the SystemDictionary.
|
||||
bool purged_class = SystemDictionary::do_unloading(is_alive_closure(), _gc_timer);
|
||||
bool purged_class = SystemDictionary::do_unloading(_gc_timer);
|
||||
|
||||
// Unload nmethods.
|
||||
CodeCache::do_unloading(is_alive_closure(), purged_class);
|
||||
|
@ -2139,7 +2139,7 @@ void PSParallelCompact::marking_phase(ParCompactionManager* cm,
|
||||
GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", &_gc_timer);
|
||||
|
||||
// Follow system dictionary roots and unload classes.
|
||||
bool purged_class = SystemDictionary::do_unloading(is_alive_closure(), &_gc_timer);
|
||||
bool purged_class = SystemDictionary::do_unloading(&_gc_timer);
|
||||
|
||||
// Unload nmethods.
|
||||
CodeCache::do_unloading(is_alive_closure(), purged_class);
|
||||
@ -3081,13 +3081,10 @@ void InstanceClassLoaderKlass::oop_pc_update_pointers(oop obj, ParCompactionMana
|
||||
#ifdef ASSERT
|
||||
template <class T> static void trace_reference_gc(const char *s, oop obj,
|
||||
T* referent_addr,
|
||||
T* next_addr,
|
||||
T* discovered_addr) {
|
||||
log_develop_trace(gc, ref)("%s obj " PTR_FORMAT, s, p2i(obj));
|
||||
log_develop_trace(gc, ref)(" referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(referent_addr), referent_addr ? p2i((oop)RawAccess<>::oop_load(referent_addr)) : NULL);
|
||||
log_develop_trace(gc, ref)(" next_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(next_addr), next_addr ? p2i((oop)RawAccess<>::oop_load(next_addr)) : NULL);
|
||||
log_develop_trace(gc, ref)(" discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(discovered_addr), discovered_addr ? p2i((oop)RawAccess<>::oop_load(discovered_addr)) : NULL);
|
||||
}
|
||||
@ -3097,12 +3094,10 @@ template <class T>
|
||||
static void oop_pc_update_pointers_specialized(oop obj, ParCompactionManager* cm) {
|
||||
T* referent_addr = (T*)java_lang_ref_Reference::referent_addr_raw(obj);
|
||||
PSParallelCompact::adjust_pointer(referent_addr, cm);
|
||||
T* next_addr = (T*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
PSParallelCompact::adjust_pointer(next_addr, cm);
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
PSParallelCompact::adjust_pointer(discovered_addr, cm);
|
||||
debug_only(trace_reference_gc("InstanceRefKlass::oop_update_ptrs", obj,
|
||||
referent_addr, next_addr, discovered_addr);)
|
||||
referent_addr, discovered_addr);)
|
||||
}
|
||||
|
||||
void InstanceRefKlass::oop_pc_update_pointers(oop obj, ParCompactionManager* cm) {
|
||||
|
@ -442,7 +442,7 @@ static void oop_ps_push_contents_specialized(oop obj, InstanceRefKlass *klass, P
|
||||
if (PSScavenge::should_scavenge(referent_addr)) {
|
||||
ReferenceProcessor* rp = PSScavenge::reference_processor();
|
||||
if (rp->discover_reference(obj, klass->reference_type())) {
|
||||
// reference already enqueued, referent and next will be traversed later
|
||||
// reference discovered, referent will be traversed later.
|
||||
klass->InstanceKlass::oop_ps_push_contents(obj, pm);
|
||||
return;
|
||||
} else {
|
||||
@ -450,20 +450,10 @@ static void oop_ps_push_contents_specialized(oop obj, InstanceRefKlass *klass, P
|
||||
pm->claim_or_forward_depth(referent_addr);
|
||||
}
|
||||
}
|
||||
// Treat discovered as normal oop, if ref is not "active",
|
||||
// i.e. if next is non-NULL.
|
||||
T* next_addr = (T*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
T next_oop = RawAccess<>::oop_load(next_addr);
|
||||
if (!CompressedOops::is_null(next_oop)) { // i.e. ref is not "active"
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
log_develop_trace(gc, ref)(" Process discovered as normal " PTR_FORMAT, p2i(discovered_addr));
|
||||
if (PSScavenge::should_scavenge(discovered_addr)) {
|
||||
pm->claim_or_forward_depth(discovered_addr);
|
||||
}
|
||||
}
|
||||
// Treat next as normal oop; next is a link in the reference queue.
|
||||
if (PSScavenge::should_scavenge(next_addr)) {
|
||||
pm->claim_or_forward_depth(next_addr);
|
||||
// Treat discovered as normal oop
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
if (PSScavenge::should_scavenge(discovered_addr)) {
|
||||
pm->claim_or_forward_depth(discovered_addr);
|
||||
}
|
||||
klass->InstanceKlass::oop_ps_push_contents(obj, pm);
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
GCTraceTime(Debug, gc, phases) tm_m("Class Unloading", gc_timer());
|
||||
|
||||
// Unload classes and purge the SystemDictionary.
|
||||
bool purged_class = SystemDictionary::do_unloading(&is_alive, gc_timer());
|
||||
bool purged_class = SystemDictionary::do_unloading(gc_timer());
|
||||
|
||||
// Unload nmethods.
|
||||
CodeCache::do_unloading(&is_alive, purged_class);
|
||||
|
@ -783,7 +783,6 @@ static AssertNonScavengableClosure assert_is_non_scavengable_closure;
|
||||
void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
ScanningOption so,
|
||||
OopClosure* strong_roots,
|
||||
OopClosure* weak_roots,
|
||||
CLDClosure* strong_cld_closure,
|
||||
CLDClosure* weak_cld_closure,
|
||||
CodeBlobToOopClosure* code_roots) {
|
||||
@ -827,7 +826,7 @@ void GenCollectedHeap::process_roots(StrongRootsScope* scope,
|
||||
}
|
||||
|
||||
if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
|
||||
SystemDictionary::roots_oops_do(strong_roots, weak_roots);
|
||||
SystemDictionary::oops_do(strong_roots);
|
||||
}
|
||||
|
||||
if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
|
||||
@ -869,7 +868,7 @@ void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
|
||||
CLDClosure* cld_closure) {
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
|
||||
|
||||
process_roots(scope, SO_ScavengeCodeCache, root_closure, root_closure,
|
||||
process_roots(scope, SO_ScavengeCodeCache, root_closure,
|
||||
cld_closure, cld_closure, &mark_code_closure);
|
||||
process_string_table_roots(scope, root_closure);
|
||||
|
||||
@ -893,10 +892,9 @@ void GenCollectedHeap::full_process_roots(StrongRootsScope* scope,
|
||||
OopsInGenClosure* root_closure,
|
||||
CLDClosure* cld_closure) {
|
||||
MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
|
||||
OopsInGenClosure* weak_roots = only_strong_roots ? NULL : root_closure;
|
||||
CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
|
||||
|
||||
process_roots(scope, so, root_closure, weak_roots, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
process_roots(scope, so, root_closure, cld_closure, weak_cld_closure, &mark_code_closure);
|
||||
if (is_adjust_phase) {
|
||||
// We never treat the string table as roots during marking
|
||||
// for the full gc, so we only need to process it during
|
||||
|
@ -396,7 +396,6 @@ public:
|
||||
void process_roots(StrongRootsScope* scope,
|
||||
ScanningOption so,
|
||||
OopClosure* strong_roots,
|
||||
OopClosure* weak_roots,
|
||||
CLDClosure* strong_cld_closure,
|
||||
CLDClosure* weak_cld_closure,
|
||||
CodeBlobToOopClosure* code_roots);
|
||||
|
@ -30,12 +30,10 @@
|
||||
#include "gc/shared/plab.hpp"
|
||||
#include "gc/shared/threadLocalAllocBuffer.hpp"
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "runtime/thread.inline.hpp"
|
||||
#include "utilities/align.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#if INCLUDE_CMSGC
|
||||
#include "gc/cms/jvmFlagConstraintsCMS.hpp"
|
||||
@ -88,10 +86,10 @@ JVMFlag::Error ConcGCThreadsConstraintFunc(uint value, bool verbose) {
|
||||
// CMS and G1 GCs use ConcGCThreads.
|
||||
if ((GCConfig::is_gc_selected(CollectedHeap::CMS) ||
|
||||
GCConfig::is_gc_selected(CollectedHeap::G1)) && (value > ParallelGCThreads)) {
|
||||
CommandLineError::print(verbose,
|
||||
"ConcGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to ParallelGCThreads (" UINT32_FORMAT ")\n",
|
||||
value, ParallelGCThreads);
|
||||
JVMFlag::printError(verbose,
|
||||
"ConcGCThreads (" UINT32_FORMAT ") must be "
|
||||
"less than or equal to ParallelGCThreads (" UINT32_FORMAT ")\n",
|
||||
value, ParallelGCThreads);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -102,10 +100,10 @@ static JVMFlag::Error MinPLABSizeBounds(const char* name, size_t value, bool ver
|
||||
if ((GCConfig::is_gc_selected(CollectedHeap::CMS) ||
|
||||
GCConfig::is_gc_selected(CollectedHeap::G1) ||
|
||||
GCConfig::is_gc_selected(CollectedHeap::Parallel)) && (value < PLAB::min_size())) {
|
||||
CommandLineError::print(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
|
||||
name, value, PLAB::min_size());
|
||||
JVMFlag::printError(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to ergonomic PLAB minimum size (" SIZE_FORMAT ")\n",
|
||||
name, value, PLAB::min_size());
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -116,10 +114,10 @@ JVMFlag::Error MaxPLABSizeBounds(const char* name, size_t value, bool verbose) {
|
||||
if ((GCConfig::is_gc_selected(CollectedHeap::CMS) ||
|
||||
GCConfig::is_gc_selected(CollectedHeap::G1) ||
|
||||
GCConfig::is_gc_selected(CollectedHeap::Parallel)) && (value > PLAB::max_size())) {
|
||||
CommandLineError::print(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
|
||||
name, value, PLAB::max_size());
|
||||
JVMFlag::printError(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic PLAB maximum size (" SIZE_FORMAT ")\n",
|
||||
name, value, PLAB::max_size());
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -156,10 +154,10 @@ JVMFlag::Error OldPLABSizeConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
if (value > MaxHeapFreeRatio) {
|
||||
CommandLineError::print(verbose,
|
||||
"MinHeapFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MaxHeapFreeRatio);
|
||||
JVMFlag::printError(verbose,
|
||||
"MinHeapFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxHeapFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MaxHeapFreeRatio);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -168,10 +166,10 @@ JVMFlag::Error MinHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
if (value < MinHeapFreeRatio) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxHeapFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MinHeapFreeRatio);
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxHeapFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to MinHeapFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MinHeapFreeRatio);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -180,11 +178,11 @@ JVMFlag::Error MaxHeapFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
static JVMFlag::Error CheckMaxHeapSizeAndSoftRefLRUPolicyMSPerMB(size_t maxHeap, intx softRef, bool verbose) {
|
||||
if ((softRef > 0) && ((maxHeap / M) > (max_uintx / softRef))) {
|
||||
CommandLineError::print(verbose,
|
||||
"Desired lifetime of SoftReferences cannot be expressed correctly. "
|
||||
"MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB "
|
||||
"(" INTX_FORMAT ") is too large\n",
|
||||
maxHeap, softRef);
|
||||
JVMFlag::printError(verbose,
|
||||
"Desired lifetime of SoftReferences cannot be expressed correctly. "
|
||||
"MaxHeapSize (" SIZE_FORMAT ") or SoftRefLRUPolicyMSPerMB "
|
||||
"(" INTX_FORMAT ") is too large\n",
|
||||
maxHeap, softRef);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -197,10 +195,10 @@ JVMFlag::Error SoftRefLRUPolicyMSPerMBConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
|
||||
if (value > MarkStackSizeMax) {
|
||||
CommandLineError::print(verbose,
|
||||
"MarkStackSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n",
|
||||
value, MarkStackSizeMax);
|
||||
JVMFlag::printError(verbose,
|
||||
"MarkStackSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to MarkStackSizeMax (" SIZE_FORMAT ")\n",
|
||||
value, MarkStackSizeMax);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -209,10 +207,10 @@ JVMFlag::Error MarkStackSizeConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
if (value > MaxMetaspaceFreeRatio) {
|
||||
CommandLineError::print(verbose,
|
||||
"MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MaxMetaspaceFreeRatio);
|
||||
JVMFlag::printError(verbose,
|
||||
"MinMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to MaxMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MaxMetaspaceFreeRatio);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -221,10 +219,10 @@ JVMFlag::Error MinMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MaxMetaspaceFreeRatioConstraintFunc(uintx value, bool verbose) {
|
||||
if (value < MinMetaspaceFreeRatio) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MinMetaspaceFreeRatio);
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxMetaspaceFreeRatio (" UINTX_FORMAT ") must be "
|
||||
"greater than or equal to MinMetaspaceFreeRatio (" UINTX_FORMAT ")\n",
|
||||
value, MinMetaspaceFreeRatio);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -252,12 +250,12 @@ JVMFlag::Error MaxTenuringThresholdConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
// MaxTenuringThreshold=0 means NeverTenure=false && AlwaysTenure=true
|
||||
if ((value == 0) && (NeverTenure || !AlwaysTenure)) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxTenuringThreshold (0) should match to NeverTenure=false "
|
||||
"&& AlwaysTenure=true. But we have NeverTenure=%s "
|
||||
"AlwaysTenure=%s\n",
|
||||
NeverTenure ? "true" : "false",
|
||||
AlwaysTenure ? "true" : "false");
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxTenuringThreshold (0) should match to NeverTenure=false "
|
||||
"&& AlwaysTenure=true. But we have NeverTenure=%s "
|
||||
"AlwaysTenure=%s\n",
|
||||
NeverTenure ? "true" : "false",
|
||||
AlwaysTenure ? "true" : "false");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -288,10 +286,10 @@ JVMFlag::Error GCPauseIntervalMillisConstraintFunc(uintx value, bool verbose) {
|
||||
JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
|
||||
size_t aligned_max = align_down(max_uintx/2, Metaspace::reserve_alignment_words());
|
||||
if (value > aligned_max) {
|
||||
CommandLineError::print(verbose,
|
||||
"InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
|
||||
value, aligned_max);
|
||||
JVMFlag::printError(verbose,
|
||||
"InitialBootClassLoaderMetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
|
||||
value, aligned_max);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -301,10 +299,10 @@ JVMFlag::Error InitialBootClassLoaderMetaspaceSizeConstraintFunc(size_t value, b
|
||||
static JVMFlag::Error MaxSizeForAlignment(const char* name, size_t value, size_t alignment, bool verbose) {
|
||||
size_t aligned_max = ((max_uintx - alignment) & ~(alignment-1));
|
||||
if (value > aligned_max) {
|
||||
CommandLineError::print(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
|
||||
name, value, aligned_max);
|
||||
JVMFlag::printError(verbose,
|
||||
"%s (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to aligned maximum value (" SIZE_FORMAT ")\n",
|
||||
name, value, aligned_max);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -343,10 +341,10 @@ JVMFlag::Error HeapBaseMinAddressConstraintFunc(size_t value, bool verbose) {
|
||||
// If an overflow happened in Arguments::set_heap_size(), MaxHeapSize will have too large a value.
|
||||
// Check for this by ensuring that MaxHeapSize plus the requested min base address still fit within max_uintx.
|
||||
if (UseCompressedOops && FLAG_IS_ERGO(MaxHeapSize) && (value > (max_uintx - MaxHeapSize))) {
|
||||
CommandLineError::print(verbose,
|
||||
"HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
|
||||
"Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",
|
||||
value, MaxHeapSize, max_uintx);
|
||||
JVMFlag::printError(verbose,
|
||||
"HeapBaseMinAddress (" SIZE_FORMAT ") or MaxHeapSize (" SIZE_FORMAT ") is too large. "
|
||||
"Sum of them must be less than or equal to maximum of size_t (" SIZE_FORMAT ")\n",
|
||||
value, MaxHeapSize, max_uintx);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -367,17 +365,17 @@ JVMFlag::Error NewSizeConstraintFunc(size_t value, bool verbose) {
|
||||
JVMFlag::Error MinTLABSizeConstraintFunc(size_t value, bool verbose) {
|
||||
// At least, alignment reserve area is needed.
|
||||
if (value < ThreadLocalAllocBuffer::alignment_reserve_in_bytes()) {
|
||||
CommandLineError::print(verbose,
|
||||
"MinTLABSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n",
|
||||
value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes());
|
||||
JVMFlag::printError(verbose,
|
||||
"MinTLABSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to reserved area in TLAB (" SIZE_FORMAT ")\n",
|
||||
value, ThreadLocalAllocBuffer::alignment_reserve_in_bytes());
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
|
||||
CommandLineError::print(verbose,
|
||||
"MinTLABSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB maximum (" SIZE_FORMAT ")\n",
|
||||
value, ThreadLocalAllocBuffer::max_size() * HeapWordSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"MinTLABSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB maximum (" SIZE_FORMAT ")\n",
|
||||
value, ThreadLocalAllocBuffer::max_size() * HeapWordSize);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -387,17 +385,17 @@ JVMFlag::Error TLABSizeConstraintFunc(size_t value, bool verbose) {
|
||||
// Skip for default value of zero which means set ergonomically.
|
||||
if (FLAG_IS_CMDLINE(TLABSize)) {
|
||||
if (value < MinTLABSize) {
|
||||
CommandLineError::print(verbose,
|
||||
"TLABSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n",
|
||||
value, MinTLABSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"TLABSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to MinTLABSize (" SIZE_FORMAT ")\n",
|
||||
value, MinTLABSize);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
if (value > (ThreadLocalAllocBuffer::max_size() * HeapWordSize)) {
|
||||
CommandLineError::print(verbose,
|
||||
"TLABSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n",
|
||||
value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize));
|
||||
JVMFlag::printError(verbose,
|
||||
"TLABSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB maximum size (" SIZE_FORMAT ")\n",
|
||||
value, (ThreadLocalAllocBuffer::max_size() * HeapWordSize));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -412,10 +410,10 @@ JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
// Compare with 'max_uintx' as ThreadLocalAllocBuffer::_refill_waste_limit is 'size_t'.
|
||||
if (refill_waste_limit > (max_uintx - value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"TLABWasteIncrement (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n",
|
||||
value, (max_uintx - refill_waste_limit));
|
||||
JVMFlag::printError(verbose,
|
||||
"TLABWasteIncrement (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic TLAB waste increment maximum size(" SIZE_FORMAT ")\n",
|
||||
value, (max_uintx - refill_waste_limit));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -425,11 +423,11 @@ JVMFlag::Error TLABWasteIncrementConstraintFunc(uintx value, bool verbose) {
|
||||
JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
|
||||
if (FLAG_IS_CMDLINE(SurvivorRatio) &&
|
||||
(value > (MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()))) {
|
||||
CommandLineError::print(verbose,
|
||||
"SurvivorRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
|
||||
value,
|
||||
(MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()));
|
||||
JVMFlag::printError(verbose,
|
||||
"SurvivorRatio (" UINTX_FORMAT ") must be "
|
||||
"less than or equal to ergonomic SurvivorRatio maximum (" SIZE_FORMAT ")\n",
|
||||
value,
|
||||
(MaxHeapSize / Universe::heap()->collector_policy()->space_alignment()));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -438,10 +436,10 @@ JVMFlag::Error SurvivorRatioConstraintFunc(uintx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
|
||||
if (value > MaxMetaspaceSize) {
|
||||
CommandLineError::print(verbose,
|
||||
"MetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
|
||||
value, MaxMetaspaceSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"MetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"less than or equal to MaxMetaspaceSize (" SIZE_FORMAT ")\n",
|
||||
value, MaxMetaspaceSize);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -450,10 +448,10 @@ JVMFlag::Error MetaspaceSizeConstraintFunc(size_t value, bool verbose) {
|
||||
|
||||
JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
|
||||
if (value < MetaspaceSize) {
|
||||
CommandLineError::print(verbose,
|
||||
"MaxMetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
|
||||
value, MaxMetaspaceSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"MaxMetaspaceSize (" SIZE_FORMAT ") must be "
|
||||
"greater than or equal to MetaspaceSize (" SIZE_FORMAT ")\n",
|
||||
value, MaxMetaspaceSize);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -463,17 +461,17 @@ JVMFlag::Error MaxMetaspaceSizeConstraintFunc(size_t value, bool verbose) {
|
||||
JVMFlag::Error SurvivorAlignmentInBytesConstraintFunc(intx value, bool verbose) {
|
||||
if (value != 0) {
|
||||
if (!is_power_of_2(value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"power of 2\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"power of 2\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
if (value < ObjectAlignmentInBytes) {
|
||||
CommandLineError::print(verbose,
|
||||
"SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
|
||||
value, ObjectAlignmentInBytes);
|
||||
JVMFlag::printError(verbose,
|
||||
"SurvivorAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to ObjectAlignmentInBytes (" INTX_FORMAT ")\n",
|
||||
value, ObjectAlignmentInBytes);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
|
@ -907,7 +907,8 @@ size_t OopStorage::total_memory_usage() const {
|
||||
// Parallel iteration support
|
||||
|
||||
uint OopStorage::BasicParState::default_estimated_thread_count(bool concurrent) {
|
||||
return concurrent ? ConcGCThreads : ParallelGCThreads;
|
||||
uint configured = concurrent ? ConcGCThreads : ParallelGCThreads;
|
||||
return MAX2(1u, configured); // Never estimate zero threads.
|
||||
}
|
||||
|
||||
OopStorage::BasicParState::BasicParState(const OopStorage* storage,
|
||||
|
@ -303,9 +303,6 @@ void DiscoveredListIterator::clear_referent() {
|
||||
}
|
||||
|
||||
void DiscoveredListIterator::enqueue() {
|
||||
// Self-loop next, so as to make Ref not active.
|
||||
java_lang_ref_Reference::set_next_raw(_current_discovered, _current_discovered);
|
||||
|
||||
HeapAccess<AS_NO_KEEPALIVE>::oop_store_at(_current_discovered,
|
||||
java_lang_ref_Reference::discovered_offset,
|
||||
_next_discovered);
|
||||
@ -364,38 +361,35 @@ ReferenceProcessor::process_phase1(DiscoveredList& refs_list,
|
||||
iter.removed(), iter.processed(), p2i(&refs_list));
|
||||
}
|
||||
|
||||
inline void log_dropped_ref(const DiscoveredListIterator& iter, const char* reason) {
|
||||
log_develop_trace(gc, ref)("Dropping %s reference " PTR_FORMAT ": %s",
|
||||
reason, p2i(iter.obj()),
|
||||
iter.obj()->klass()->internal_name());
|
||||
}
|
||||
|
||||
// Traverse the list and remove any Refs whose referents are alive,
|
||||
// or NULL if discovery is not atomic.
|
||||
void ReferenceProcessor::process_phase2(DiscoveredList& refs_list,
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc) {
|
||||
if (discovery_is_atomic()) {
|
||||
// complete_gc is ignored in this case for this phase
|
||||
pp2_work(refs_list, is_alive, keep_alive);
|
||||
} else {
|
||||
assert(complete_gc != NULL, "Error");
|
||||
pp2_work_concurrent_discovery(refs_list, is_alive,
|
||||
keep_alive, complete_gc);
|
||||
}
|
||||
}
|
||||
// Traverse the list and remove any Refs that are not active, or
|
||||
// whose referents are either alive or NULL.
|
||||
void
|
||||
ReferenceProcessor::pp2_work(DiscoveredList& refs_list,
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive) {
|
||||
assert(discovery_is_atomic(), "Error");
|
||||
// complete_gc is unused.
|
||||
DiscoveredListIterator iter(refs_list, keep_alive, is_alive);
|
||||
while (iter.has_next()) {
|
||||
iter.load_ptrs(DEBUG_ONLY(false /* allow_null_referent */));
|
||||
DEBUG_ONLY(oop next = java_lang_ref_Reference::next(iter.obj());)
|
||||
assert(next == NULL, "Should not discover inactive Reference");
|
||||
if (iter.is_referent_alive()) {
|
||||
log_develop_trace(gc, ref)("Dropping strongly reachable reference (" INTPTR_FORMAT ": %s)",
|
||||
p2i(iter.obj()), iter.obj()->klass()->internal_name());
|
||||
// The referent is reachable after all.
|
||||
// Remove Reference object from list.
|
||||
iter.load_ptrs(DEBUG_ONLY(!discovery_is_atomic() /* allow_null_referent */));
|
||||
if (iter.referent() == NULL) {
|
||||
// Reference has been cleared since discovery; only possible if
|
||||
// discovery is not atomic (checked by load_ptrs). Remove
|
||||
// reference from list.
|
||||
log_dropped_ref(iter, "cleared");
|
||||
iter.remove();
|
||||
// Update the referent pointer as necessary: Note that this
|
||||
iter.move_to_next();
|
||||
} else if (iter.is_referent_alive()) {
|
||||
// The referent is reachable after all.
|
||||
// Remove reference from list.
|
||||
log_dropped_ref(iter, "reachable");
|
||||
iter.remove();
|
||||
// Update the referent pointer as necessary. Note that this
|
||||
// should not entail any recursive marking because the
|
||||
// referent must already have been traversed.
|
||||
iter.make_referent_alive();
|
||||
@ -413,45 +407,6 @@ ReferenceProcessor::pp2_work(DiscoveredList& refs_list,
|
||||
)
|
||||
}
|
||||
|
||||
void
|
||||
ReferenceProcessor::pp2_work_concurrent_discovery(DiscoveredList& refs_list,
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc) {
|
||||
assert(!discovery_is_atomic(), "Error");
|
||||
DiscoveredListIterator iter(refs_list, keep_alive, is_alive);
|
||||
while (iter.has_next()) {
|
||||
iter.load_ptrs(DEBUG_ONLY(true /* allow_null_referent */));
|
||||
HeapWord* next_addr = java_lang_ref_Reference::next_addr_raw(iter.obj());
|
||||
oop next = java_lang_ref_Reference::next(iter.obj());
|
||||
if ((iter.referent() == NULL || iter.is_referent_alive() ||
|
||||
next != NULL)) {
|
||||
assert(oopDesc::is_oop_or_null(next), "Expected an oop or NULL for next field at " PTR_FORMAT, p2i(next));
|
||||
// Remove Reference object from list
|
||||
iter.remove();
|
||||
// Trace the cohorts
|
||||
iter.make_referent_alive();
|
||||
if (UseCompressedOops) {
|
||||
keep_alive->do_oop((narrowOop*)next_addr);
|
||||
} else {
|
||||
keep_alive->do_oop((oop*)next_addr);
|
||||
}
|
||||
iter.move_to_next();
|
||||
} else {
|
||||
iter.next();
|
||||
}
|
||||
}
|
||||
// Now close the newly reachable set
|
||||
complete_gc->do_void();
|
||||
NOT_PRODUCT(
|
||||
if (iter.processed() > 0) {
|
||||
log_develop_trace(gc, ref)(" Dropped " SIZE_FORMAT " active Refs out of " SIZE_FORMAT
|
||||
" Refs in discovered list " INTPTR_FORMAT,
|
||||
iter.removed(), iter.processed(), p2i(&refs_list));
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
void ReferenceProcessor::process_phase3(DiscoveredList& refs_list,
|
||||
bool clear_referent,
|
||||
BoolObjectClosure* is_alive,
|
||||
@ -465,8 +420,12 @@ void ReferenceProcessor::process_phase3(DiscoveredList& refs_list,
|
||||
// NULL out referent pointer
|
||||
iter.clear_referent();
|
||||
} else {
|
||||
// keep the referent around
|
||||
// Current reference is a FinalReference; that's the only kind we
|
||||
// don't clear the referent, instead keeping it for calling finalize.
|
||||
iter.make_referent_alive();
|
||||
// Self-loop next, to mark it not active.
|
||||
assert(java_lang_ref_Reference::next(iter.obj()) == NULL, "enqueued FinalReference");
|
||||
java_lang_ref_Reference::set_next_raw(iter.obj(), iter.obj());
|
||||
}
|
||||
iter.enqueue();
|
||||
log_develop_trace(gc, ref)("Adding %sreference (" INTPTR_FORMAT ": %s) as pending",
|
||||
@ -913,9 +872,9 @@ bool ReferenceProcessor::discover_reference(oop obj, ReferenceType rt) {
|
||||
if (!_discovering_refs || !RegisterReferences) {
|
||||
return false;
|
||||
}
|
||||
// We only discover active references.
|
||||
oop next = java_lang_ref_Reference::next(obj);
|
||||
if (next != NULL) { // Ref is no longer active
|
||||
|
||||
if ((rt == REF_FINAL) && (java_lang_ref_Reference::next(obj) != NULL)) {
|
||||
// Don't rediscover non-active FinalReferences.
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1121,24 +1080,15 @@ bool ReferenceProcessor::preclean_discovered_reflist(DiscoveredList& refs_lis
|
||||
return true;
|
||||
}
|
||||
iter.load_ptrs(DEBUG_ONLY(true /* allow_null_referent */));
|
||||
oop obj = iter.obj();
|
||||
oop next = java_lang_ref_Reference::next(obj);
|
||||
if (iter.referent() == NULL || iter.is_referent_alive() || next != NULL) {
|
||||
// The referent has been cleared, or is alive, or the Reference is not
|
||||
// active; we need to trace and mark its cohort.
|
||||
if (iter.referent() == NULL || iter.is_referent_alive()) {
|
||||
// The referent has been cleared, or is alive; we need to trace
|
||||
// and mark its cohort.
|
||||
log_develop_trace(gc, ref)("Precleaning Reference (" INTPTR_FORMAT ": %s)",
|
||||
p2i(iter.obj()), iter.obj()->klass()->internal_name());
|
||||
// Remove Reference object from list
|
||||
iter.remove();
|
||||
// Keep alive its cohort.
|
||||
iter.make_referent_alive();
|
||||
if (UseCompressedOops) {
|
||||
narrowOop* next_addr = (narrowOop*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
keep_alive->do_oop(next_addr);
|
||||
} else {
|
||||
oop* next_addr = (oop*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
keep_alive->do_oop(next_addr);
|
||||
}
|
||||
iter.move_to_next();
|
||||
} else {
|
||||
iter.next();
|
||||
|
@ -262,15 +262,6 @@ class ReferenceProcessor : public ReferenceDiscoverer {
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc);
|
||||
// Work methods in support of process_phase2
|
||||
void pp2_work(DiscoveredList& refs_list,
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive);
|
||||
void pp2_work_concurrent_discovery(
|
||||
DiscoveredList& refs_list,
|
||||
BoolObjectClosure* is_alive,
|
||||
OopClosure* keep_alive,
|
||||
VoidClosure* complete_gc);
|
||||
// Phase3: process the referents by either clearing them
|
||||
// or keeping them alive (and their closure), and enqueuing them.
|
||||
void process_phase3(DiscoveredList& refs_list,
|
||||
|
@ -23,6 +23,8 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "gc/shared/oopStorage.inline.hpp"
|
||||
#include "gc/shared/weakProcessor.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "runtime/jniHandles.hpp"
|
||||
@ -34,6 +36,7 @@
|
||||
void WeakProcessor::weak_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive) {
|
||||
JNIHandles::weak_oops_do(is_alive, keep_alive);
|
||||
JvmtiExport::weak_oops_do(is_alive, keep_alive);
|
||||
SystemDictionary::vm_weak_oop_storage()->weak_oops_do(is_alive, keep_alive);
|
||||
JFR_ONLY(Jfr::weak_oops_do(is_alive, keep_alive);)
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2014 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -30,25 +30,10 @@
|
||||
#ifndef SHARE_VM_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
|
||||
#define SHARE_VM_INTERPRETER_BYTECODEINTERPRETERPROFILING_HPP
|
||||
|
||||
|
||||
// Global settings /////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
// Enables profiling support.
|
||||
#if defined(COMPILER2)
|
||||
#define CC_INTERP_PROFILE
|
||||
#endif
|
||||
|
||||
// Enables assertions for profiling code (also works in product-builds).
|
||||
// #define CC_INTERP_PROFILE_WITH_ASSERTIONS
|
||||
|
||||
|
||||
#ifdef CC_INTERP
|
||||
|
||||
// Empty dummy implementations if profiling code is switched off. //////////////
|
||||
|
||||
#ifndef CC_INTERP_PROFILE
|
||||
|
||||
#define SET_MDX(mdx)
|
||||
|
||||
#define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler) \
|
||||
@ -69,240 +54,6 @@
|
||||
#define BI_PROFILE_UPDATE_VIRTUALCALL(receiver)
|
||||
#define BI_PROFILE_UPDATE_SWITCH(switch_index)
|
||||
|
||||
|
||||
#else
|
||||
|
||||
|
||||
// Non-dummy implementations ///////////////////////////////////////////////////
|
||||
|
||||
// Accessors for the current method data pointer 'mdx'.
|
||||
#define MDX() (istate->mdx())
|
||||
#define SET_MDX(mdx) \
|
||||
if (TraceProfileInterpreter) { \
|
||||
/* Let it look like TraceBytecodes' format. */ \
|
||||
tty->print_cr("[%d] %4d " \
|
||||
"mdx " PTR_FORMAT "(%d)" \
|
||||
" " \
|
||||
" \t-> " PTR_FORMAT "(%d)", \
|
||||
(int) THREAD->osthread()->thread_id(), \
|
||||
BCI(), \
|
||||
p2i(MDX()), \
|
||||
(MDX() == NULL \
|
||||
? 0 \
|
||||
: istate->method()->method_data()->dp_to_di((address)MDX())), \
|
||||
p2i(mdx), \
|
||||
istate->method()->method_data()->dp_to_di((address)mdx) \
|
||||
); \
|
||||
}; \
|
||||
istate->set_mdx(mdx);
|
||||
|
||||
|
||||
// Dumps the profiling method data for the current method.
|
||||
#ifdef PRODUCT
|
||||
#define BI_PROFILE_PRINT_METHOD_DATA()
|
||||
#else // PRODUCT
|
||||
#define BI_PROFILE_PRINT_METHOD_DATA() \
|
||||
{ \
|
||||
ttyLocker ttyl; \
|
||||
MethodData *md = istate->method()->method_data(); \
|
||||
tty->cr(); \
|
||||
tty->print("method data at mdx " PTR_FORMAT "(0) for", \
|
||||
p2i(md->data_layout_at(md->bci_to_di(0)))); \
|
||||
istate->method()->print_short_name(tty); \
|
||||
tty->cr(); \
|
||||
if (md != NULL) { \
|
||||
md->print_data_on(tty); \
|
||||
address mdx = (address) MDX(); \
|
||||
if (mdx != NULL) { \
|
||||
tty->print_cr("current mdx " PTR_FORMAT "(%d)", \
|
||||
p2i(mdx), \
|
||||
istate->method()->method_data()->dp_to_di(mdx)); \
|
||||
} \
|
||||
} else { \
|
||||
tty->print_cr("no method data"); \
|
||||
} \
|
||||
}
|
||||
#endif // PRODUCT
|
||||
|
||||
|
||||
// Gets or creates the profiling method data and initializes mdx.
|
||||
#define BI_PROFILE_GET_OR_CREATE_METHOD_DATA(exception_handler) \
|
||||
if (ProfileInterpreter && MDX() == NULL) { \
|
||||
/* Mdx is not yet initialized for this activation. */ \
|
||||
MethodData *md = istate->method()->method_data(); \
|
||||
if (md == NULL) { \
|
||||
MethodCounters* mcs; \
|
||||
GET_METHOD_COUNTERS(mcs); \
|
||||
/* The profiling method data doesn't exist for this method, */ \
|
||||
/* create it if the counters have overflowed. */ \
|
||||
if (mcs->invocation_counter() \
|
||||
->reached_ProfileLimit(mcs->backedge_counter())) { \
|
||||
/* Must use CALL_VM, because an async exception may be pending. */ \
|
||||
CALL_VM((InterpreterRuntime::profile_method(THREAD)), \
|
||||
exception_handler); \
|
||||
md = istate->method()->method_data(); \
|
||||
if (md != NULL) { \
|
||||
if (TraceProfileInterpreter) { \
|
||||
BI_PROFILE_PRINT_METHOD_DATA(); \
|
||||
} \
|
||||
Method *m = istate->method(); \
|
||||
int bci = m->bci_from(pc); \
|
||||
jint di = md->bci_to_di(bci); \
|
||||
SET_MDX(md->data_layout_at(di)); \
|
||||
} \
|
||||
} \
|
||||
} else { \
|
||||
/* The profiling method data exists, align the method data pointer */ \
|
||||
/* mdx to the current bytecode index. */ \
|
||||
if (TraceProfileInterpreter) { \
|
||||
BI_PROFILE_PRINT_METHOD_DATA(); \
|
||||
} \
|
||||
SET_MDX(md->data_layout_at(md->bci_to_di(BCI()))); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Asserts that the current method data pointer mdx corresponds
|
||||
// to the current bytecode.
|
||||
#if defined(CC_INTERP_PROFILE_WITH_ASSERTIONS)
|
||||
#define BI_PROFILE_CHECK_MDX() \
|
||||
{ \
|
||||
MethodData *md = istate->method()->method_data(); \
|
||||
address mdx = (address) MDX(); \
|
||||
address mdx2 = (address) md->data_layout_at(md->bci_to_di(BCI())); \
|
||||
guarantee(md != NULL, "1"); \
|
||||
guarantee(mdx != NULL, "2"); \
|
||||
guarantee(mdx2 != NULL, "3"); \
|
||||
if (mdx != mdx2) { \
|
||||
BI_PROFILE_PRINT_METHOD_DATA(); \
|
||||
fatal3("invalid mdx at bci %d:" \
|
||||
" was " PTR_FORMAT \
|
||||
" but expected " PTR_FORMAT, \
|
||||
BCI(), \
|
||||
mdx, \
|
||||
mdx2); \
|
||||
} \
|
||||
}
|
||||
#else
|
||||
#define BI_PROFILE_CHECK_MDX()
|
||||
#endif
|
||||
|
||||
|
||||
// Aligns the method data pointer mdx to the current bytecode index.
|
||||
#define BI_PROFILE_ALIGN_TO_CURRENT_BCI() \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
MethodData *md = istate->method()->method_data(); \
|
||||
SET_MDX(md->data_layout_at(md->bci_to_di(BCI()))); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a jump.
|
||||
#define BI_PROFILE_UPDATE_JUMP() \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
JumpData::increment_taken_count_no_overflow(MDX()); \
|
||||
/* Remember last branch taken count. */ \
|
||||
mdo_last_branch_taken_count = JumpData::taken_count(MDX()); \
|
||||
SET_MDX(JumpData::advance_taken(MDX())); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a taken/not taken branch.
|
||||
#define BI_PROFILE_UPDATE_BRANCH(is_taken) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
if (is_taken) { \
|
||||
BranchData::increment_taken_count_no_overflow(MDX()); \
|
||||
/* Remember last branch taken count. */ \
|
||||
mdo_last_branch_taken_count = BranchData::taken_count(MDX()); \
|
||||
SET_MDX(BranchData::advance_taken(MDX())); \
|
||||
} else { \
|
||||
BranchData::increment_not_taken_count_no_overflow(MDX()); \
|
||||
SET_MDX(BranchData::advance_not_taken(MDX())); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a ret with given bci.
|
||||
#define BI_PROFILE_UPDATE_RET(bci) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
MethodData *md = istate->method()->method_data(); \
|
||||
/* FIXME: there is more to do here than increment and advance(mdx)! */ \
|
||||
CounterData::increment_count_no_overflow(MDX()); \
|
||||
SET_MDX(RetData::advance(md, bci)); \
|
||||
}
|
||||
|
||||
// Decrement counter at checkcast if the subtype check fails (as template
|
||||
// interpreter does!).
|
||||
#define BI_PROFILE_SUBTYPECHECK_FAILED(receiver) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
ReceiverTypeData::increment_receiver_count_no_overflow(MDX(), receiver); \
|
||||
ReceiverTypeData::decrement_count(MDX()); \
|
||||
}
|
||||
|
||||
// Updates profiling data for a checkcast (was a null seen? which receiver?).
|
||||
#define BI_PROFILE_UPDATE_CHECKCAST(null_seen, receiver) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
if (null_seen) { \
|
||||
ReceiverTypeData::set_null_seen(MDX()); \
|
||||
} else { \
|
||||
/* Template interpreter doesn't increment count. */ \
|
||||
/* ReceiverTypeData::increment_count_no_overflow(MDX()); */ \
|
||||
ReceiverTypeData::increment_receiver_count_no_overflow(MDX(), receiver); \
|
||||
} \
|
||||
SET_MDX(ReceiverTypeData::advance(MDX())); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for an instanceof (was a null seen? which receiver?).
|
||||
#define BI_PROFILE_UPDATE_INSTANCEOF(null_seen, receiver) \
|
||||
BI_PROFILE_UPDATE_CHECKCAST(null_seen, receiver)
|
||||
|
||||
|
||||
// Updates profiling data for a call.
|
||||
#define BI_PROFILE_UPDATE_CALL() \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
CounterData::increment_count_no_overflow(MDX()); \
|
||||
SET_MDX(CounterData::advance(MDX())); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a final call.
|
||||
#define BI_PROFILE_UPDATE_FINALCALL() \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
VirtualCallData::increment_count_no_overflow(MDX()); \
|
||||
SET_MDX(VirtualCallData::advance(MDX())); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a virtual call with given receiver Klass.
|
||||
#define BI_PROFILE_UPDATE_VIRTUALCALL(receiver) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
VirtualCallData::increment_receiver_count_no_overflow(MDX(), receiver); \
|
||||
SET_MDX(VirtualCallData::advance(MDX())); \
|
||||
}
|
||||
|
||||
|
||||
// Updates profiling data for a switch (tabelswitch or lookupswitch) with
|
||||
// given taken index (-1 means default case was taken).
|
||||
#define BI_PROFILE_UPDATE_SWITCH(switch_index) \
|
||||
if (ProfileInterpreter && MDX() != NULL) { \
|
||||
BI_PROFILE_CHECK_MDX(); \
|
||||
MultiBranchData::increment_count_no_overflow(MDX(), switch_index); \
|
||||
SET_MDX(MultiBranchData::advance(MDX(), switch_index)); \
|
||||
}
|
||||
|
||||
|
||||
// The end /////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif // CC_INTERP_PROFILE
|
||||
|
||||
#endif // CC_INTERP
|
||||
|
||||
#endif // SHARE_VM_INTERPRETER_BYTECODECINTERPRETERPROFILING_HPP
|
||||
|
@ -688,19 +688,21 @@ void LinkResolver::check_field_loader_constraints(Symbol* field, Symbol* sig,
|
||||
CHECK);
|
||||
if (failed_type_symbol != NULL) {
|
||||
const char* msg = "loader constraint violation: when resolving field"
|
||||
" \"%s\" the class loader %s of the referring class, "
|
||||
"%s, and the class loader %s for the field's resolved "
|
||||
"type, %s, have different Class objects for that type";
|
||||
char* field_name = field->as_C_string();
|
||||
" \"%s\" of type %s, the class loader %s of the current class, "
|
||||
"%s, and the class loader %s for the field's defining "
|
||||
"type, %s, have different Class objects for type %s";
|
||||
const char* field_name = field->as_C_string();
|
||||
const char* loader1_name = java_lang_ClassLoader::describe_external(ref_loader());
|
||||
char* sel = sel_klass->name()->as_C_string();
|
||||
const char* sel = sel_klass->external_name();
|
||||
const char* loader2_name = java_lang_ClassLoader::describe_external(sel_loader());
|
||||
char* failed_type_name = failed_type_symbol->as_C_string();
|
||||
size_t buflen = strlen(msg) + strlen(field_name) + strlen(loader1_name) +
|
||||
strlen(sel) + strlen(loader2_name) + strlen(failed_type_name) + 1;
|
||||
const char* failed_type_name = failed_type_symbol->as_klass_external_name();
|
||||
const char* curr_klass_name = current_klass->external_name();
|
||||
size_t buflen = strlen(msg) + strlen(field_name) + 2 * strlen(failed_type_name) +
|
||||
strlen(loader1_name) + strlen(curr_klass_name) +
|
||||
strlen(loader2_name) + strlen(sel) + 1;
|
||||
char* buf = NEW_RESOURCE_ARRAY_IN_THREAD(THREAD, char, buflen);
|
||||
jio_snprintf(buf, buflen, msg, field_name, loader1_name, sel, loader2_name,
|
||||
failed_type_name);
|
||||
jio_snprintf(buf, buflen, msg, field_name, failed_type_name, loader1_name,
|
||||
curr_klass_name, loader2_name, sel, failed_type_name);
|
||||
THROW_MSG(vmSymbols::java_lang_LinkageError(), buf);
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ void RootSetClosure::process_roots(OopClosure* closure) {
|
||||
Universe::oops_do(closure);
|
||||
JNIHandles::oops_do(closure);
|
||||
JvmtiExport::oops_do(closure);
|
||||
SystemDictionary::always_strong_oops_do(closure);
|
||||
SystemDictionary::oops_do(closure);
|
||||
Management::oops_do(closure);
|
||||
StringTable::oops_do(closure);
|
||||
AOTLoader::oops_do(closure);
|
||||
|
@ -132,18 +132,17 @@ size_t MetaspaceGC::capacity_until_GC() {
|
||||
bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size_t* old_cap_until_GC) {
|
||||
assert_is_aligned(v, Metaspace::commit_alignment());
|
||||
|
||||
size_t capacity_until_GC = _capacity_until_GC;
|
||||
size_t new_value = capacity_until_GC + v;
|
||||
size_t old_capacity_until_GC = _capacity_until_GC;
|
||||
size_t new_value = old_capacity_until_GC + v;
|
||||
|
||||
if (new_value < capacity_until_GC) {
|
||||
if (new_value < old_capacity_until_GC) {
|
||||
// The addition wrapped around, set new_value to aligned max value.
|
||||
new_value = align_down(max_uintx, Metaspace::commit_alignment());
|
||||
}
|
||||
|
||||
size_t expected = _capacity_until_GC;
|
||||
size_t actual = Atomic::cmpxchg(new_value, &_capacity_until_GC, expected);
|
||||
size_t prev_value = Atomic::cmpxchg(new_value, &_capacity_until_GC, old_capacity_until_GC);
|
||||
|
||||
if (expected != actual) {
|
||||
if (old_capacity_until_GC != prev_value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -151,7 +150,7 @@ bool MetaspaceGC::inc_capacity_until_GC(size_t v, size_t* new_cap_until_GC, size
|
||||
*new_cap_until_GC = new_value;
|
||||
}
|
||||
if (old_cap_until_GC != NULL) {
|
||||
*old_cap_until_GC = capacity_until_GC;
|
||||
*old_cap_until_GC = old_capacity_until_GC;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -602,11 +601,12 @@ void MetaspaceUtils::print_basic_report(outputStream* out, size_t scale) {
|
||||
void MetaspaceUtils::print_report(outputStream* out, size_t scale, int flags) {
|
||||
|
||||
const bool print_loaders = (flags & rf_show_loaders) > 0;
|
||||
const bool print_classes = (flags & rf_show_classes) > 0;
|
||||
const bool print_by_chunktype = (flags & rf_break_down_by_chunktype) > 0;
|
||||
const bool print_by_spacetype = (flags & rf_break_down_by_spacetype) > 0;
|
||||
|
||||
// Some report options require walking the class loader data graph.
|
||||
PrintCLDMetaspaceInfoClosure cl(out, scale, print_loaders, print_by_chunktype);
|
||||
PrintCLDMetaspaceInfoClosure cl(out, scale, print_loaders, print_classes, print_by_chunktype);
|
||||
if (print_loaders) {
|
||||
out->cr();
|
||||
out->print_cr("Usage per loader:");
|
||||
|
@ -389,7 +389,9 @@ public:
|
||||
// Print details about the underlying virtual spaces.
|
||||
rf_show_vslist = (1 << 3),
|
||||
// Print metaspace map.
|
||||
rf_show_vsmap = (1 << 4)
|
||||
rf_show_vsmap = (1 << 4),
|
||||
// If show_loaders: show loaded classes for each loader.
|
||||
rf_show_classes = (1 << 5)
|
||||
};
|
||||
|
||||
// This will print out a basic metaspace usage report but
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, SAP and/or its affiliates.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -34,6 +35,7 @@ MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap)
|
||||
: DCmdWithParser(output, heap)
|
||||
, _basic("basic", "Prints a basic summary (does not need a safepoint).", "BOOLEAN", false, "false")
|
||||
, _show_loaders("show-loaders", "Shows usage by class loader.", "BOOLEAN", false, "false")
|
||||
, _show_classes("show-classes", "If show-loaders is set, shows loaded classes for each loader.", "BOOLEAN", false, "false")
|
||||
, _by_chunktype("by-chunktype", "Break down numbers by chunk type.", "BOOLEAN", false, "false")
|
||||
, _by_spacetype("by-spacetype", "Break down numbers by loader type.", "BOOLEAN", false, "false")
|
||||
, _show_vslist("vslist", "Shows details about the underlying virtual space.", "BOOLEAN", false, "false")
|
||||
@ -44,6 +46,7 @@ MetaspaceDCmd::MetaspaceDCmd(outputStream* output, bool heap)
|
||||
{
|
||||
_dcmdparser.add_dcmd_option(&_basic);
|
||||
_dcmdparser.add_dcmd_option(&_show_loaders);
|
||||
_dcmdparser.add_dcmd_option(&_show_classes);
|
||||
_dcmdparser.add_dcmd_option(&_by_chunktype);
|
||||
_dcmdparser.add_dcmd_option(&_by_spacetype);
|
||||
_dcmdparser.add_dcmd_option(&_show_vslist);
|
||||
@ -87,6 +90,7 @@ void MetaspaceDCmd::execute(DCmdSource source, TRAPS) {
|
||||
// Full mode. Requires safepoint.
|
||||
int flags = 0;
|
||||
if (_show_loaders.value()) flags |= MetaspaceUtils::rf_show_loaders;
|
||||
if (_show_classes.value()) flags |= MetaspaceUtils::rf_show_classes;
|
||||
if (_by_chunktype.value()) flags |= MetaspaceUtils::rf_break_down_by_chunktype;
|
||||
if (_by_spacetype.value()) flags |= MetaspaceUtils::rf_break_down_by_spacetype;
|
||||
if (_show_vslist.value()) flags |= MetaspaceUtils::rf_show_vslist;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, SAP and/or its affiliates.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,6 +40,7 @@ class MetaspaceDCmd : public DCmdWithParser {
|
||||
DCmdArgument<bool> _show_vslist;
|
||||
DCmdArgument<bool> _show_vsmap;
|
||||
DCmdArgument<char*> _scale;
|
||||
DCmdArgument<bool> _show_classes;
|
||||
public:
|
||||
MetaspaceDCmd(outputStream* output, bool heap);
|
||||
static const char* name() {
|
||||
|
@ -22,8 +22,10 @@
|
||||
*
|
||||
*/
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderData.hpp"
|
||||
#include "classfile/classLoaderData.inline.hpp"
|
||||
#include "classfile/javaClasses.hpp"
|
||||
#include "memory/metaspace/printCLDMetaspaceInfoClosure.hpp"
|
||||
#include "memory/metaspace/printMetaspaceInfoKlassClosure.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "runtime/safepoint.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
@ -32,19 +34,31 @@
|
||||
|
||||
namespace metaspace {
|
||||
|
||||
PrintCLDMetaspaceInfoClosure::PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print, bool break_down_by_chunktype)
|
||||
: _out(out), _scale(scale), _do_print(do_print), _break_down_by_chunktype(break_down_by_chunktype)
|
||||
, _num_loaders(0)
|
||||
PrintCLDMetaspaceInfoClosure::PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print,
|
||||
bool do_print_classes, bool break_down_by_chunktype)
|
||||
: _out(out), _scale(scale), _do_print(do_print), _do_print_classes(do_print_classes)
|
||||
, _break_down_by_chunktype(break_down_by_chunktype)
|
||||
, _num_loaders(0), _num_loaders_unloading(0), _num_loaders_without_metaspace(0)
|
||||
{
|
||||
memset(_num_loaders_by_spacetype, 0, sizeof(_num_loaders_by_spacetype));
|
||||
}
|
||||
|
||||
static const char* classes_plural(uintx num) {
|
||||
return num == 1 ? "" : "es";
|
||||
}
|
||||
|
||||
void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) {
|
||||
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint");
|
||||
|
||||
if (cld->is_unloading()) {
|
||||
_num_loaders_unloading ++;
|
||||
return;
|
||||
}
|
||||
|
||||
ClassLoaderMetaspace* msp = cld->metaspace_or_null();
|
||||
if (msp == NULL) {
|
||||
_num_loaders_without_metaspace ++;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -63,17 +77,73 @@ void PrintCLDMetaspaceInfoClosure::do_cld(ClassLoaderData* cld) {
|
||||
|
||||
_out->print(UINTX_FORMAT_W(4) ": ", _num_loaders);
|
||||
|
||||
if (cld->is_anonymous()) {
|
||||
_out->print("ClassLoaderData " PTR_FORMAT " for anonymous class", p2i(cld));
|
||||
// Print "CLD for [<loader name>,] instance of <loader class name>"
|
||||
// or "CLD for <anonymous class>, loaded by [<loader name>,] instance of <loader class name>"
|
||||
|
||||
ResourceMark rm;
|
||||
const char* name = NULL;
|
||||
const char* class_name = NULL;
|
||||
|
||||
// Note: this should also work if unloading:
|
||||
Klass* k = cld->class_loader_klass();
|
||||
if (k != NULL) {
|
||||
class_name = k->external_name();
|
||||
Symbol* s = cld->class_loader_name();
|
||||
if (s != NULL) {
|
||||
name = s->as_C_string();
|
||||
}
|
||||
} else {
|
||||
ResourceMark rm;
|
||||
_out->print("ClassLoaderData " PTR_FORMAT " for %s", p2i(cld), cld->loader_name());
|
||||
name = "<bootstrap>";
|
||||
}
|
||||
|
||||
// Print
|
||||
_out->print("CLD " PTR_FORMAT, p2i(cld));
|
||||
if (cld->is_unloading()) {
|
||||
_out->print(" (unloading)");
|
||||
}
|
||||
_out->print(":");
|
||||
if (cld->is_anonymous()) {
|
||||
_out->print(" <anonymous class>, loaded by");
|
||||
}
|
||||
if (name != NULL) {
|
||||
_out->print(" \"%s\"", name);
|
||||
}
|
||||
if (class_name != NULL) {
|
||||
_out->print(" instance of %s", class_name);
|
||||
}
|
||||
|
||||
if (_do_print_classes) {
|
||||
streamIndentor sti(_out, 6);
|
||||
_out->cr_indent();
|
||||
_out->print("Loaded classes: ");
|
||||
PrintMetaspaceInfoKlassClosure pkic(_out, true);
|
||||
cld->classes_do(&pkic);
|
||||
_out->cr_indent();
|
||||
_out->print("-total-: ");
|
||||
_out->print(UINTX_FORMAT " class%s", pkic._num_classes, classes_plural(pkic._num_classes));
|
||||
if (pkic._num_instance_classes > 0 || pkic._num_array_classes > 0) {
|
||||
_out->print(" (");
|
||||
if (pkic._num_instance_classes > 0) {
|
||||
_out->print(UINTX_FORMAT " instance class%s", pkic._num_instance_classes,
|
||||
classes_plural(pkic._num_instance_classes));
|
||||
}
|
||||
if (pkic._num_array_classes > 0) {
|
||||
if (pkic._num_instance_classes > 0) {
|
||||
_out->print(", ");
|
||||
}
|
||||
_out->print(UINTX_FORMAT " array class%s", pkic._num_array_classes,
|
||||
classes_plural(pkic._num_array_classes));
|
||||
}
|
||||
_out->print(").");
|
||||
}
|
||||
}
|
||||
|
||||
_out->cr();
|
||||
|
||||
|
||||
_out->cr();
|
||||
|
||||
// Print statistics
|
||||
this_cld_stat.print_on(_out, _scale, _break_down_by_chunktype);
|
||||
_out->cr();
|
||||
|
||||
|
@ -39,17 +39,21 @@ private:
|
||||
outputStream* const _out;
|
||||
const size_t _scale;
|
||||
const bool _do_print;
|
||||
const bool _do_print_classes;
|
||||
const bool _break_down_by_chunktype;
|
||||
|
||||
public:
|
||||
|
||||
uintx _num_loaders;
|
||||
uintx _num_loaders_without_metaspace;
|
||||
uintx _num_loaders_unloading;
|
||||
ClassLoaderMetaspaceStatistics _stats_total;
|
||||
|
||||
uintx _num_loaders_by_spacetype [Metaspace::MetaspaceTypeCount];
|
||||
ClassLoaderMetaspaceStatistics _stats_by_spacetype [Metaspace::MetaspaceTypeCount];
|
||||
|
||||
PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print, bool break_down_by_chunktype);
|
||||
PrintCLDMetaspaceInfoClosure(outputStream* out, size_t scale, bool do_print,
|
||||
bool do_print_classes, bool break_down_by_chunktype);
|
||||
void do_cld(ClassLoaderData* cld);
|
||||
|
||||
};
|
||||
|
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, SAP and/or its affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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 "precompiled.hpp"
|
||||
|
||||
#include "classfile/systemDictionary.hpp"
|
||||
#include "memory/metaspace/printMetaspaceInfoKlassClosure.hpp"
|
||||
#include "memory/resourceArea.hpp"
|
||||
#include "oops/constantPool.inline.hpp"
|
||||
#include "oops/instanceKlass.hpp"
|
||||
#include "oops/klass.hpp"
|
||||
#include "utilities/constantTag.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
#include "utilities/ostream.hpp"
|
||||
|
||||
|
||||
namespace metaspace {
|
||||
|
||||
PrintMetaspaceInfoKlassClosure::PrintMetaspaceInfoKlassClosure(outputStream* out, bool do_print)
|
||||
: _out(out), _do_print(do_print)
|
||||
, _num_classes(0), _num_instance_classes(0), _num_array_classes(0) {
|
||||
}
|
||||
|
||||
void PrintMetaspaceInfoKlassClosure::do_klass(Klass* k) {
|
||||
_num_classes ++;
|
||||
if (k->is_instance_klass()) {
|
||||
_num_instance_classes ++;
|
||||
} else if (k->is_array_klass()) {
|
||||
_num_array_classes ++;
|
||||
}
|
||||
if (_do_print) {
|
||||
_out->cr_indent();
|
||||
_out->print(UINTX_FORMAT_W(4) ": ", _num_classes);
|
||||
ResourceMark rm;
|
||||
_out->print("%s", k->external_name());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace metaspace
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2018, SAP and/or its affiliates.
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef SHARE_MEMORY_METASPACE_PRINTMETASPACEINFOKLASSCLOSURE_HPP_
|
||||
#define SHARE_MEMORY_METASPACE_PRINTMETASPACEINFOKLASSCLOSURE_HPP_
|
||||
|
||||
#include "memory/iterator.hpp"
|
||||
#include "utilities/globalDefinitions.hpp"
|
||||
|
||||
class outputStream;
|
||||
class InstanceKlass;
|
||||
|
||||
namespace metaspace {
|
||||
|
||||
// Helper class for MetaspaceUtils::print_report()
|
||||
class PrintMetaspaceInfoKlassClosure : public KlassClosure {
|
||||
private:
|
||||
outputStream* const _out;
|
||||
const bool _do_print;
|
||||
|
||||
public:
|
||||
uintx _num_classes;
|
||||
uintx _num_instance_classes;
|
||||
uintx _num_array_classes;
|
||||
|
||||
PrintMetaspaceInfoKlassClosure(outputStream* out, bool do_print);
|
||||
void do_klass(Klass* k);
|
||||
|
||||
}; // end: PrintKlassInfoClosure
|
||||
|
||||
} // namespace metaspace
|
||||
|
||||
#endif /* SHARE_MEMORY_METASPACE_PRINTMETASPACEINFOKLASSCLOSURE_HPP_ */
|
@ -521,16 +521,6 @@ bool VirtualSpaceNode::initialize() {
|
||||
"Checking that the pre-committed memory was registered by the VirtualSpace");
|
||||
|
||||
set_top((MetaWord*)virtual_space()->low());
|
||||
set_reserved(MemRegion((HeapWord*)_rs.base(),
|
||||
(HeapWord*)(_rs.base() + _rs.size())));
|
||||
|
||||
assert(reserved()->start() == (HeapWord*) _rs.base(),
|
||||
"Reserved start was not set properly " PTR_FORMAT
|
||||
" != " PTR_FORMAT, p2i(reserved()->start()), p2i(_rs.base()));
|
||||
assert(reserved()->word_size() == _rs.size() / BytesPerWord,
|
||||
"Reserved size was not set properly " SIZE_FORMAT
|
||||
" != " SIZE_FORMAT, reserved()->word_size(),
|
||||
_rs.size() / BytesPerWord);
|
||||
}
|
||||
|
||||
// Initialize Occupancy Map.
|
||||
|
@ -49,7 +49,6 @@ class VirtualSpaceNode : public CHeapObj<mtClass> {
|
||||
const bool _is_class;
|
||||
|
||||
// total in the VirtualSpace
|
||||
MemRegion _reserved;
|
||||
ReservedSpace _rs;
|
||||
VirtualSpace _virtual_space;
|
||||
MetaWord* _top;
|
||||
@ -102,11 +101,9 @@ class VirtualSpaceNode : public CHeapObj<mtClass> {
|
||||
VirtualSpaceNode* next() { return _next; }
|
||||
void set_next(VirtualSpaceNode* v) { _next = v; }
|
||||
|
||||
void set_reserved(MemRegion const v) { _reserved = v; }
|
||||
void set_top(MetaWord* v) { _top = v; }
|
||||
|
||||
// Accessors
|
||||
MemRegion* reserved() { return &_reserved; }
|
||||
VirtualSpace* virtual_space() const { return (VirtualSpace*) &_virtual_space; }
|
||||
|
||||
// Returns true if "word_size" is available in the VirtualSpace
|
||||
@ -135,8 +132,7 @@ class VirtualSpaceNode : public CHeapObj<mtClass> {
|
||||
// Allocate a chunk from the virtual space and return it.
|
||||
Metachunk* get_chunk_vs(size_t chunk_word_size);
|
||||
|
||||
// Expands/shrinks the committed space in a virtual space. Delegates
|
||||
// to Virtualspace
|
||||
// Expands the committed space by at least min_words words.
|
||||
bool expand_by(size_t min_words, size_t preferred_words);
|
||||
|
||||
// In preparation for deleting this node, remove all the chunks
|
||||
|
@ -104,6 +104,8 @@ class Padded2DArray {
|
||||
public:
|
||||
// Creates an aligned padded 2D array.
|
||||
// The memory cannot be deleted since the raw memory chunk is not returned.
|
||||
// Always uses mmap to reserve memory. Only the first few pages with the index to
|
||||
// the rows are touched. Allocation size should be "large" to cover page overhead.
|
||||
static T** create_unfreeable(uint rows, uint columns, size_t* allocation_size = NULL);
|
||||
};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2018, 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
|
||||
@ -62,9 +62,8 @@ T** Padded2DArray<T, flags, alignment>::create_unfreeable(uint rows, uint column
|
||||
size_t total_size = table_size + rows * row_size + alignment;
|
||||
|
||||
// Allocate a chunk of memory large enough to allow alignment of the chunk.
|
||||
void* chunk = AllocateHeap(total_size, flags);
|
||||
void* chunk = MmapArrayAllocator<uint8_t>::allocate(total_size, flags);
|
||||
// Clear the allocated memory.
|
||||
memset(chunk, 0, total_size);
|
||||
// Align the chunk of memory.
|
||||
T** result = (T**)align_up(chunk, alignment);
|
||||
void* data_start = (void*)((uintptr_t)result + table_size);
|
||||
|
@ -130,7 +130,7 @@ bool ArrayKlass::compute_is_subtype_of(Klass* k) {
|
||||
|
||||
objArrayOop ArrayKlass::allocate_arrayArray(int n, int length, TRAPS) {
|
||||
if (length < 0) {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
|
||||
}
|
||||
if (length > arrayOopDesc::max_array_length(T_ARRAY)) {
|
||||
report_java_out_of_memory("Requested array size exceeds VM limit");
|
||||
|
@ -975,7 +975,9 @@ bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
|
||||
}
|
||||
|
||||
objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
|
||||
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
if (length < 0) {
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
|
||||
}
|
||||
if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
|
||||
report_java_out_of_memory("Requested array size exceeds VM limit");
|
||||
JvmtiExport::post_array_size_exhausted();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
@ -30,10 +30,8 @@
|
||||
|
||||
void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
|
||||
// Clear the nonstatic oop-map entries corresponding to referent
|
||||
// and nextPending field. They are treated specially by the
|
||||
// and discovered fields. They are treated specially by the
|
||||
// garbage collector.
|
||||
// The discovered field is used only by the garbage collector
|
||||
// and is also treated specially.
|
||||
InstanceKlass* ik = InstanceKlass::cast(k);
|
||||
|
||||
// Check that we have the right class
|
||||
@ -45,22 +43,33 @@ void InstanceRefKlass::update_nonstatic_oop_maps(Klass* k) {
|
||||
|
||||
OopMapBlock* map = ik->start_of_nonstatic_oop_maps();
|
||||
|
||||
// Check that the current map is (2,4) - currently points at field with
|
||||
// offset 2 (words) and has 4 map entries.
|
||||
debug_only(int offset = java_lang_ref_Reference::referent_offset);
|
||||
debug_only(unsigned int count = ((java_lang_ref_Reference::discovered_offset -
|
||||
java_lang_ref_Reference::referent_offset)/heapOopSize) + 1);
|
||||
#ifdef ASSERT
|
||||
// Verify fields are in the expected places.
|
||||
int referent_offset = java_lang_ref_Reference::referent_offset;
|
||||
int queue_offset = java_lang_ref_Reference::queue_offset;
|
||||
int next_offset = java_lang_ref_Reference::next_offset;
|
||||
int discovered_offset = java_lang_ref_Reference::discovered_offset;
|
||||
assert(referent_offset < queue_offset, "just checking");
|
||||
assert(queue_offset < next_offset, "just checking");
|
||||
assert(next_offset < discovered_offset, "just checking");
|
||||
const unsigned int count =
|
||||
1 + ((discovered_offset - referent_offset) / heapOopSize);
|
||||
assert(count == 4, "just checking");
|
||||
#endif // ASSERT
|
||||
|
||||
// Updated map starts at "queue", covers "queue" and "next".
|
||||
const int new_offset = java_lang_ref_Reference::queue_offset;
|
||||
const unsigned int new_count = 2; // queue and next
|
||||
|
||||
// Verify existing map is as expected, and update if needed.
|
||||
if (UseSharedSpaces) {
|
||||
assert(map->offset() == java_lang_ref_Reference::queue_offset &&
|
||||
map->count() == 1, "just checking");
|
||||
assert(map->offset() == new_offset, "just checking");
|
||||
assert(map->count() == new_count, "just checking");
|
||||
} else {
|
||||
assert(map->offset() == offset && map->count() == count,
|
||||
"just checking");
|
||||
|
||||
// Update map to (3,1) - point to offset of 3 (words) with 1 map entry.
|
||||
map->set_offset(java_lang_ref_Reference::queue_offset);
|
||||
map->set_count(1);
|
||||
assert(map->offset() == referent_offset, "just checking");
|
||||
assert(map->count() == count, "just checking");
|
||||
map->set_offset(new_offset);
|
||||
map->set_count(new_count);
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,7 +83,7 @@ void InstanceRefKlass::oop_verify_on(oop obj, outputStream* st) {
|
||||
if (referent != NULL) {
|
||||
guarantee(oopDesc::is_oop(referent), "referent field heap failed");
|
||||
}
|
||||
// Verify next field
|
||||
// Additional verification for next field, which must be a Reference or null
|
||||
oop next = java_lang_ref_Reference::next(obj);
|
||||
if (next != NULL) {
|
||||
guarantee(oopDesc::is_oop(next), "next field should be an oop");
|
||||
|
@ -45,14 +45,6 @@ void InstanceRefKlass::do_referent(oop obj, OopClosureType* closure, Contains& c
|
||||
}
|
||||
}
|
||||
|
||||
template <bool nv, typename T, class OopClosureType, class Contains>
|
||||
void InstanceRefKlass::do_next(oop obj, OopClosureType* closure, Contains& contains) {
|
||||
T* next_addr = (T*)java_lang_ref_Reference::next_addr_raw(obj);
|
||||
if (contains(next_addr)) {
|
||||
Devirtualizer<nv>::do_oop(closure, next_addr);
|
||||
}
|
||||
}
|
||||
|
||||
template <bool nv, typename T, class OopClosureType, class Contains>
|
||||
void InstanceRefKlass::do_discovered(oop obj, OopClosureType* closure, Contains& contains) {
|
||||
T* discovered_addr = (T*)java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
@ -84,24 +76,15 @@ void InstanceRefKlass::oop_oop_iterate_discovery(oop obj, ReferenceType type, Oo
|
||||
return;
|
||||
}
|
||||
|
||||
// Treat referent as normal oop.
|
||||
// Treat referent and discovered as normal oops.
|
||||
do_referent<nv, T>(obj, closure, contains);
|
||||
|
||||
// Treat discovered as normal oop, if ref is not "active" (next non-NULL).
|
||||
T next_oop = RawAccess<>::oop_load((T*)java_lang_ref_Reference::next_addr_raw(obj));
|
||||
if (!CompressedOops::is_null(next_oop)) {
|
||||
do_discovered<nv, T>(obj, closure, contains);
|
||||
}
|
||||
|
||||
// Treat next as normal oop.
|
||||
do_next<nv, T>(obj, closure, contains);
|
||||
do_discovered<nv, T>(obj, closure, contains);
|
||||
}
|
||||
|
||||
template <bool nv, typename T, class OopClosureType, class Contains>
|
||||
void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains) {
|
||||
do_referent<nv, T>(obj, closure, contains);
|
||||
do_discovered<nv, T>(obj, closure, contains);
|
||||
do_next<nv, T>(obj, closure, contains);
|
||||
}
|
||||
|
||||
template <bool nv, typename T, class OopClosureType, class Contains>
|
||||
@ -192,14 +175,11 @@ void InstanceRefKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure,
|
||||
template <typename T>
|
||||
void InstanceRefKlass::trace_reference_gc(const char *s, oop obj) {
|
||||
T* referent_addr = (T*) java_lang_ref_Reference::referent_addr_raw(obj);
|
||||
T* next_addr = (T*) java_lang_ref_Reference::next_addr_raw(obj);
|
||||
T* discovered_addr = (T*) java_lang_ref_Reference::discovered_addr_raw(obj);
|
||||
|
||||
log_develop_trace(gc, ref)("InstanceRefKlass %s for obj " PTR_FORMAT, s, p2i(obj));
|
||||
log_develop_trace(gc, ref)(" referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(referent_addr), p2i(referent_addr ? RawAccess<>::oop_load(referent_addr) : (oop)NULL));
|
||||
log_develop_trace(gc, ref)(" next_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(next_addr), p2i(next_addr ? RawAccess<>::oop_load(next_addr) : (oop)NULL));
|
||||
log_develop_trace(gc, ref)(" discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
|
||||
p2i(discovered_addr), p2i(discovered_addr ? RawAccess<>::oop_load(discovered_addr) : (oop)NULL));
|
||||
}
|
||||
|
@ -541,12 +541,6 @@ address RetData::fixup_ret(int return_bci, MethodData* h_mdo) {
|
||||
return mdp;
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
DataLayout* RetData::advance(MethodData *md, int bci) {
|
||||
return (DataLayout*) md->bci_to_dp(bci);
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
void RetData::print_data_on(outputStream* st, const char* extra) const {
|
||||
print_shared(st, "RetData", extra);
|
||||
uint row;
|
||||
|
@ -232,11 +232,6 @@ public:
|
||||
static ByteSize cell_offset(int index) {
|
||||
return byte_offset_of(DataLayout, _cells) + in_ByteSize(index * cell_size);
|
||||
}
|
||||
#ifdef CC_INTERP
|
||||
static int cell_offset_in_bytes(int index) {
|
||||
return (int)offset_of(DataLayout, _cells[index]);
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
// Return a value which, when or-ed as a byte into _flags, sets the flag.
|
||||
static int flag_number_to_byte_constant(int flag_number) {
|
||||
assert(0 <= flag_number && flag_number < flag_limit, "oob");
|
||||
@ -372,41 +367,6 @@ protected:
|
||||
_data = data;
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
// Static low level accessors for DataLayout with ProfileData's semantics.
|
||||
|
||||
static int cell_offset_in_bytes(int index) {
|
||||
return DataLayout::cell_offset_in_bytes(index);
|
||||
}
|
||||
|
||||
static void increment_uint_at_no_overflow(DataLayout* layout, int index,
|
||||
int inc = DataLayout::counter_increment) {
|
||||
uint count = ((uint)layout->cell_at(index)) + inc;
|
||||
if (count == 0) return;
|
||||
layout->set_cell_at(index, (intptr_t) count);
|
||||
}
|
||||
|
||||
static int int_at(DataLayout* layout, int index) {
|
||||
return (int)layout->cell_at(index);
|
||||
}
|
||||
|
||||
static int uint_at(DataLayout* layout, int index) {
|
||||
return (uint)layout->cell_at(index);
|
||||
}
|
||||
|
||||
static oop oop_at(DataLayout* layout, int index) {
|
||||
return cast_to_oop(layout->cell_at(index));
|
||||
}
|
||||
|
||||
static void set_intptr_at(DataLayout* layout, int index, intptr_t value) {
|
||||
layout->set_cell_at(index, (intptr_t) value);
|
||||
}
|
||||
|
||||
static void set_flag_at(DataLayout* layout, int flag_number) {
|
||||
layout->set_flag_at(flag_number);
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
public:
|
||||
// Constructor for invalid ProfileData.
|
||||
ProfileData();
|
||||
@ -581,20 +541,6 @@ public:
|
||||
return cell_offset(bit_cell_count);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static int bit_data_size_in_bytes() {
|
||||
return cell_offset_in_bytes(bit_cell_count);
|
||||
}
|
||||
|
||||
static void set_null_seen(DataLayout* layout) {
|
||||
set_flag_at(layout, null_seen_flag);
|
||||
}
|
||||
|
||||
static DataLayout* advance(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)BitData::bit_data_size_in_bytes());
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
void print_data_on(outputStream* st, const char* extra = NULL) const;
|
||||
};
|
||||
|
||||
@ -639,25 +585,6 @@ public:
|
||||
set_uint_at(count_off, count);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static int counter_data_size_in_bytes() {
|
||||
return cell_offset_in_bytes(counter_cell_count);
|
||||
}
|
||||
|
||||
static void increment_count_no_overflow(DataLayout* layout) {
|
||||
increment_uint_at_no_overflow(layout, count_off);
|
||||
}
|
||||
|
||||
// Support counter decrementation at checkcast / subtype check failed.
|
||||
static void decrement_count(DataLayout* layout) {
|
||||
increment_uint_at_no_overflow(layout, count_off, -1);
|
||||
}
|
||||
|
||||
static DataLayout* advance(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)CounterData::counter_data_size_in_bytes());
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
void print_data_on(outputStream* st, const char* extra = NULL) const;
|
||||
};
|
||||
|
||||
@ -728,20 +655,6 @@ public:
|
||||
return cell_offset(displacement_off_set);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static void increment_taken_count_no_overflow(DataLayout* layout) {
|
||||
increment_uint_at_no_overflow(layout, taken_off_set);
|
||||
}
|
||||
|
||||
static DataLayout* advance_taken(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)int_at(layout, displacement_off_set));
|
||||
}
|
||||
|
||||
static uint taken_count(DataLayout* layout) {
|
||||
return (uint) uint_at(layout, taken_off_set);
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
// Specific initialization.
|
||||
void post_initialize(BytecodeStream* stream, MethodData* mdo);
|
||||
|
||||
@ -1302,43 +1215,6 @@ public:
|
||||
// GC support
|
||||
virtual void clean_weak_klass_links(bool always_clean);
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static int receiver_type_data_size_in_bytes() {
|
||||
return cell_offset_in_bytes(static_cell_count());
|
||||
}
|
||||
|
||||
static Klass *receiver_unchecked(DataLayout* layout, uint row) {
|
||||
Klass* recv = (Klass*)layout->cell_at(receiver_cell_index(row));
|
||||
return recv;
|
||||
}
|
||||
|
||||
static void increment_receiver_count_no_overflow(DataLayout* layout, Klass *rcvr) {
|
||||
const int num_rows = row_limit();
|
||||
// Receiver already exists?
|
||||
for (int row = 0; row < num_rows; row++) {
|
||||
if (receiver_unchecked(layout, row) == rcvr) {
|
||||
increment_uint_at_no_overflow(layout, receiver_count_cell_index(row));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// New receiver, find a free slot.
|
||||
for (int row = 0; row < num_rows; row++) {
|
||||
if (receiver_unchecked(layout, row) == NULL) {
|
||||
set_intptr_at(layout, receiver_cell_index(row), (intptr_t)rcvr);
|
||||
increment_uint_at_no_overflow(layout, receiver_count_cell_index(row));
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Receiver did not match any saved receiver and there is no empty row for it.
|
||||
// Increment total counter to indicate polymorphic case.
|
||||
increment_count_no_overflow(layout);
|
||||
}
|
||||
|
||||
static DataLayout* advance(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)ReceiverTypeData::receiver_type_data_size_in_bytes());
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
void print_receiver_data_on(outputStream* st) const;
|
||||
void print_data_on(outputStream* st, const char* extra = NULL) const;
|
||||
};
|
||||
@ -1371,16 +1247,6 @@ public:
|
||||
return cell_offset(static_cell_count());
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static int virtual_call_data_size_in_bytes() {
|
||||
return cell_offset_in_bytes(static_cell_count());
|
||||
}
|
||||
|
||||
static DataLayout* advance(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)VirtualCallData::virtual_call_data_size_in_bytes());
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
static ByteSize method_offset(uint row) {
|
||||
return cell_offset(method_cell_index(row));
|
||||
@ -1658,10 +1524,6 @@ public:
|
||||
return cell_offset(bci_displacement_cell_index(row));
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static DataLayout* advance(MethodData *md, int bci);
|
||||
#endif // CC_INTERP
|
||||
|
||||
// Specific initialization.
|
||||
void post_initialize(BytecodeStream* stream, MethodData* mdo);
|
||||
|
||||
@ -1726,20 +1588,6 @@ public:
|
||||
return cell_offset(branch_cell_count);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static int branch_data_size_in_bytes() {
|
||||
return cell_offset_in_bytes(branch_cell_count);
|
||||
}
|
||||
|
||||
static void increment_not_taken_count_no_overflow(DataLayout* layout) {
|
||||
increment_uint_at_no_overflow(layout, not_taken_off_set);
|
||||
}
|
||||
|
||||
static DataLayout* advance_not_taken(DataLayout* layout) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)BranchData::branch_data_size_in_bytes());
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
// Specific initialization.
|
||||
void post_initialize(BytecodeStream* stream, MethodData* mdo);
|
||||
|
||||
@ -1779,20 +1627,6 @@ protected:
|
||||
set_int_at(aindex, value);
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
// Static low level accessors for DataLayout with ArrayData's semantics.
|
||||
|
||||
static void increment_array_uint_at_no_overflow(DataLayout* layout, int index) {
|
||||
int aindex = index + array_start_off_set;
|
||||
increment_uint_at_no_overflow(layout, aindex);
|
||||
}
|
||||
|
||||
static int array_int_at(DataLayout* layout, int index) {
|
||||
int aindex = index + array_start_off_set;
|
||||
return int_at(layout, aindex);
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
// Code generation support for subclasses.
|
||||
static ByteSize array_element_offset(int index) {
|
||||
return cell_offset(array_start_off_set + index);
|
||||
@ -1913,28 +1747,6 @@ public:
|
||||
return in_ByteSize(relative_displacement_off_set) * cell_size;
|
||||
}
|
||||
|
||||
#ifdef CC_INTERP
|
||||
static void increment_count_no_overflow(DataLayout* layout, int index) {
|
||||
if (index == -1) {
|
||||
increment_array_uint_at_no_overflow(layout, default_count_off_set);
|
||||
} else {
|
||||
increment_array_uint_at_no_overflow(layout, case_array_start +
|
||||
index * per_case_cell_count +
|
||||
relative_count_off_set);
|
||||
}
|
||||
}
|
||||
|
||||
static DataLayout* advance(DataLayout* layout, int index) {
|
||||
if (index == -1) {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)array_int_at(layout, default_disaplacement_off_set));
|
||||
} else {
|
||||
return (DataLayout*) (((address)layout) + (ssize_t)array_int_at(layout, case_array_start +
|
||||
index * per_case_cell_count +
|
||||
relative_displacement_off_set));
|
||||
}
|
||||
}
|
||||
#endif // CC_INTERP
|
||||
|
||||
// Specific initialization.
|
||||
void post_initialize(BytecodeStream* stream, MethodData* mdo);
|
||||
|
||||
@ -2127,13 +1939,11 @@ public:
|
||||
// adjusted in the event of a change in control flow.
|
||||
//
|
||||
|
||||
CC_INTERP_ONLY(class BytecodeInterpreter;)
|
||||
class CleanExtraDataClosure;
|
||||
|
||||
class MethodData : public Metadata {
|
||||
friend class VMStructs;
|
||||
friend class JVMCIVMStructs;
|
||||
CC_INTERP_ONLY(friend class BytecodeInterpreter;)
|
||||
private:
|
||||
friend class ProfileData;
|
||||
friend class TypeEntriesAtCall;
|
||||
|
@ -181,7 +181,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
|
||||
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||
}
|
||||
} else {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
|
||||
}
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ oop ObjArrayKlass::multi_allocate(int rank, jint* sizes, TRAPS) {
|
||||
for (int i = 0; i < rank - 1; ++i) {
|
||||
sizes += 1;
|
||||
if (*sizes < 0) {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", *sizes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ typeArrayOop TypeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) {
|
||||
THROW_OOP_0(Universe::out_of_memory_error_array_size());
|
||||
}
|
||||
} else {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2577,7 +2577,7 @@ class SimpleRootsClosure : public OopClosure {
|
||||
|
||||
jvmtiHeapReferenceKind kind = root_kind();
|
||||
if (kind == JVMTI_HEAP_REFERENCE_SYSTEM_CLASS) {
|
||||
// SystemDictionary::always_strong_oops_do reports the application
|
||||
// SystemDictionary::oops_do reports the application
|
||||
// class loader as a root. We want this root to be reported as
|
||||
// a root kind of "OTHER" rather than "SYSTEM_CLASS".
|
||||
if (!o->is_instance() || !InstanceKlass::cast(o->klass())->is_mirror_instance_klass()) {
|
||||
@ -3003,7 +3003,7 @@ inline bool VM_HeapWalkOperation::collect_simple_roots() {
|
||||
|
||||
// Preloaded classes and loader from the system dictionary
|
||||
blk.set_kind(JVMTI_HEAP_REFERENCE_SYSTEM_CLASS);
|
||||
SystemDictionary::always_strong_oops_do(&blk);
|
||||
SystemDictionary::oops_do(&blk);
|
||||
ClassLoaderDataGraph::always_strong_oops_do(&blk, false);
|
||||
if (blk.stopped()) {
|
||||
return false;
|
||||
|
@ -98,6 +98,7 @@
|
||||
#define CHECK_JNI_EXCEPTION_(env, value) \
|
||||
do { \
|
||||
JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \
|
||||
THREAD->clear_pending_jni_exception_check(); \
|
||||
if (HAS_PENDING_EXCEPTION) { \
|
||||
return(value); \
|
||||
} \
|
||||
@ -106,6 +107,7 @@
|
||||
#define CHECK_JNI_EXCEPTION(env) \
|
||||
do { \
|
||||
JavaThread* THREAD = JavaThread::thread_from_jni_environment(env); \
|
||||
THREAD->clear_pending_jni_exception_check(); \
|
||||
if (HAS_PENDING_EXCEPTION) { \
|
||||
return; \
|
||||
} \
|
||||
|
@ -3365,6 +3365,10 @@ jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
|
||||
UNSUPPORTED_OPTION(TieredCompilation);
|
||||
#endif
|
||||
|
||||
if (!check_vm_args_consistency()) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (EnableJVMCI &&
|
||||
!create_numbered_property("jdk.module.addmods", "jdk.internal.vm.ci", addmods_count++)) {
|
||||
@ -3372,10 +3376,6 @@ jint Arguments::finalize_vm_init_args(bool patch_mod_javabase) {
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!check_vm_args_consistency()) {
|
||||
return JNI_ERR;
|
||||
}
|
||||
|
||||
#if INCLUDE_JVMCI
|
||||
if (UseJVMCICompiler) {
|
||||
Compilation_mode = CompMode_server;
|
||||
|
@ -1504,3 +1504,12 @@ void JVMFlag::printFlags(outputStream* out, bool withComments, bool printRanges,
|
||||
FREE_C_HEAP_ARRAY(JVMFlag*, array);
|
||||
}
|
||||
|
||||
void JVMFlag::printError(bool verbose, const char* msg, ...) {
|
||||
if (verbose) {
|
||||
va_list listPointer;
|
||||
va_start(listPointer, msg);
|
||||
jio_vfprintf(defaultStream::error_stream(), msg, listPointer);
|
||||
va_end(listPointer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -276,6 +276,7 @@ public:
|
||||
|
||||
// printRanges will print out flags type, name and range values as expected by -XX:+PrintFlagsRanges
|
||||
static void printFlags(outputStream* out, bool withComments, bool printRanges = false, bool skipDefaults = false);
|
||||
static void printError(bool verbose, const char* msg, ...);
|
||||
|
||||
static void verify() PRODUCT_RETURN;
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -31,17 +31,15 @@
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/flags/jvmFlag.hpp"
|
||||
#include "runtime/flags/jvmFlagConstraintsCompiler.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
|
||||
JVMFlag::Error AliasLevelConstraintFunc(intx value, bool verbose) {
|
||||
if ((value <= 1) && (Arguments::mode() == Arguments::_comp || Arguments::mode() == Arguments::_mixed)) {
|
||||
CommandLineError::print(verbose,
|
||||
"AliasLevel (" INTX_FORMAT ") is not "
|
||||
"compatible with -Xcomp or -Xmixed\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"AliasLevel (" INTX_FORMAT ") is not "
|
||||
"compatible with -Xcomp or -Xmixed\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -82,10 +80,10 @@ JVMFlag::Error CICompilerCountConstraintFunc(intx value, bool verbose) {
|
||||
min_number_of_compiler_threads = MIN2(min_number_of_compiler_threads, CI_COMPILER_COUNT);
|
||||
|
||||
if (value < (intx)min_number_of_compiler_threads) {
|
||||
CommandLineError::print(verbose,
|
||||
"CICompilerCount (" INTX_FORMAT ") must be "
|
||||
"at least %d \n",
|
||||
value, min_number_of_compiler_threads);
|
||||
JVMFlag::printError(verbose,
|
||||
"CICompilerCount (" INTX_FORMAT ") must be "
|
||||
"at least %d \n",
|
||||
value, min_number_of_compiler_threads);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -94,10 +92,10 @@ JVMFlag::Error CICompilerCountConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error AllocatePrefetchDistanceConstraintFunc(intx value, bool verbose) {
|
||||
if (value < 0 || value > 512) {
|
||||
CommandLineError::print(verbose,
|
||||
"AllocatePrefetchDistance (" INTX_FORMAT ") must be "
|
||||
"between 0 and " INTX_FORMAT "\n",
|
||||
AllocatePrefetchDistance, 512);
|
||||
JVMFlag::printError(verbose,
|
||||
"AllocatePrefetchDistance (" INTX_FORMAT ") must be "
|
||||
"between 0 and " INTX_FORMAT "\n",
|
||||
AllocatePrefetchDistance, 512);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -107,9 +105,9 @@ JVMFlag::Error AllocatePrefetchDistanceConstraintFunc(intx value, bool verbose)
|
||||
JVMFlag::Error AllocatePrefetchStepSizeConstraintFunc(intx value, bool verbose) {
|
||||
if (AllocatePrefetchStyle == 3) {
|
||||
if (value % wordSize != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"AllocatePrefetchStepSize (" INTX_FORMAT ") must be multiple of %d\n",
|
||||
value, wordSize);
|
||||
JVMFlag::printError(verbose,
|
||||
"AllocatePrefetchStepSize (" INTX_FORMAT ") must be multiple of %d\n",
|
||||
value, wordSize);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -124,9 +122,9 @@ JVMFlag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) {
|
||||
max_value = 3;
|
||||
#endif
|
||||
if (value < 0 || value > max_value) {
|
||||
CommandLineError::print(verbose,
|
||||
"AllocatePrefetchInstr (" INTX_FORMAT ") must be "
|
||||
"between 0 and " INTX_FORMAT "\n", value, max_value);
|
||||
JVMFlag::printError(verbose,
|
||||
"AllocatePrefetchInstr (" INTX_FORMAT ") must be "
|
||||
"between 0 and " INTX_FORMAT "\n", value, max_value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -135,11 +133,11 @@ JVMFlag::Error AllocatePrefetchInstrConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error CompileThresholdConstraintFunc(intx value, bool verbose) {
|
||||
if (value < 0 || value > INT_MAX >> InvocationCounter::count_shift) {
|
||||
CommandLineError::print(verbose,
|
||||
"CompileThreshold (" INTX_FORMAT ") "
|
||||
"must be between 0 and %d\n",
|
||||
value,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
JVMFlag::printError(verbose,
|
||||
"CompileThreshold (" INTX_FORMAT ") "
|
||||
"must be between 0 and %d\n",
|
||||
value,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -150,10 +148,10 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose)
|
||||
int backward_branch_limit;
|
||||
if (ProfileInterpreter) {
|
||||
if (OnStackReplacePercentage < InterpreterProfilePercentage) {
|
||||
CommandLineError::print(verbose,
|
||||
"OnStackReplacePercentage (" INTX_FORMAT ") must be "
|
||||
"larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n",
|
||||
OnStackReplacePercentage, InterpreterProfilePercentage);
|
||||
JVMFlag::printError(verbose,
|
||||
"OnStackReplacePercentage (" INTX_FORMAT ") must be "
|
||||
"larger than InterpreterProfilePercentage (" INTX_FORMAT ")\n",
|
||||
OnStackReplacePercentage, InterpreterProfilePercentage);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -161,20 +159,20 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose)
|
||||
<< InvocationCounter::count_shift;
|
||||
|
||||
if (backward_branch_limit < 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = "
|
||||
INTX_FORMAT " "
|
||||
"must be between 0 and " INTX_FORMAT ", try changing "
|
||||
"CompileThreshold, InterpreterProfilePercentage, and/or OnStackReplacePercentage\n",
|
||||
(CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
JVMFlag::printError(verbose,
|
||||
"CompileThreshold * (InterpreterProfilePercentage - OnStackReplacePercentage) / 100 = "
|
||||
INTX_FORMAT " "
|
||||
"must be between 0 and " INTX_FORMAT ", try changing "
|
||||
"CompileThreshold, InterpreterProfilePercentage, and/or OnStackReplacePercentage\n",
|
||||
(CompileThreshold * (OnStackReplacePercentage - InterpreterProfilePercentage)) / 100,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
} else {
|
||||
if (OnStackReplacePercentage < 0 ) {
|
||||
CommandLineError::print(verbose,
|
||||
"OnStackReplacePercentage (" INTX_FORMAT ") must be "
|
||||
"non-negative\n", OnStackReplacePercentage);
|
||||
JVMFlag::printError(verbose,
|
||||
"OnStackReplacePercentage (" INTX_FORMAT ") must be "
|
||||
"non-negative\n", OnStackReplacePercentage);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -182,12 +180,12 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose)
|
||||
<< InvocationCounter::count_shift;
|
||||
|
||||
if (backward_branch_limit < 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " "
|
||||
"must be between 0 and " INTX_FORMAT ", try changing "
|
||||
"CompileThreshold and/or OnStackReplacePercentage\n",
|
||||
(CompileThreshold * OnStackReplacePercentage) / 100,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
JVMFlag::printError(verbose,
|
||||
"CompileThreshold * OnStackReplacePercentage / 100 = " INTX_FORMAT " "
|
||||
"must be between 0 and " INTX_FORMAT ", try changing "
|
||||
"CompileThreshold and/or OnStackReplacePercentage\n",
|
||||
(CompileThreshold * OnStackReplacePercentage) / 100,
|
||||
INT_MAX >> InvocationCounter::count_shift);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
@ -196,29 +194,29 @@ JVMFlag::Error OnStackReplacePercentageConstraintFunc(intx value, bool verbose)
|
||||
|
||||
JVMFlag::Error CodeCacheSegmentSizeConstraintFunc(uintx value, bool verbose) {
|
||||
if (CodeCacheSegmentSize < (uintx)CodeEntryAlignment) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") "
|
||||
"to align entry points\n",
|
||||
CodeCacheSegmentSize, CodeEntryAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"larger than or equal to CodeEntryAlignment (" INTX_FORMAT ") "
|
||||
"to align entry points\n",
|
||||
CodeCacheSegmentSize, CodeEntryAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
if (CodeCacheSegmentSize < sizeof(jdouble)) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"at least " SIZE_FORMAT " to align constants\n",
|
||||
CodeCacheSegmentSize, sizeof(jdouble));
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"at least " SIZE_FORMAT " to align constants\n",
|
||||
CodeCacheSegmentSize, sizeof(jdouble));
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
#ifdef COMPILER2
|
||||
if (CodeCacheSegmentSize < (uintx)OptoLoopAlignment) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"larger than or equal to OptoLoopAlignment (" INTX_FORMAT ") "
|
||||
"to align inner loops\n",
|
||||
CodeCacheSegmentSize, OptoLoopAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeCacheSegmentSize (" UINTX_FORMAT ") must be "
|
||||
"larger than or equal to OptoLoopAlignment (" INTX_FORMAT ") "
|
||||
"to align inner loops\n",
|
||||
CodeCacheSegmentSize, OptoLoopAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
#endif
|
||||
@ -230,11 +228,11 @@ JVMFlag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose) {
|
||||
#ifdef SOLARIS
|
||||
if ((value < MinimumPriority || value > MaximumPriority) &&
|
||||
(value != -1) && (value != -FXCriticalPriority)) {
|
||||
CommandLineError::print(verbose,
|
||||
"CompileThreadPriority (" INTX_FORMAT ") must be "
|
||||
"between %d and %d inclusively or -1 (means no change) "
|
||||
"or %d (special value for critical thread class/priority)\n",
|
||||
value, MinimumPriority, MaximumPriority, -FXCriticalPriority);
|
||||
JVMFlag::printError(verbose,
|
||||
"CompileThreadPriority (" INTX_FORMAT ") must be "
|
||||
"between %d and %d inclusively or -1 (means no change) "
|
||||
"or %d (special value for critical thread class/priority)\n",
|
||||
value, MinimumPriority, MaximumPriority, -FXCriticalPriority);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
#endif
|
||||
@ -245,25 +243,25 @@ JVMFlag::Error CompilerThreadPriorityConstraintFunc(intx value, bool verbose) {
|
||||
JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
#ifdef SPARC
|
||||
if (CodeEntryAlignment % relocInfo::addr_unit() != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size\n", CodeEntryAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size\n", CodeEntryAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!is_power_of_2(value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"a power of two\n", CodeEntryAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"a power of two\n", CodeEntryAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
if (CodeEntryAlignment < 16) {
|
||||
CommandLineError::print(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to %d\n",
|
||||
CodeEntryAlignment, 16);
|
||||
JVMFlag::printError(verbose,
|
||||
"CodeEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to %d\n",
|
||||
CodeEntryAlignment, 16);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -272,20 +270,20 @@ JVMFlag::Error CodeEntryAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
if (!is_power_of_2(value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"OptoLoopAlignment (" INTX_FORMAT ") "
|
||||
"must be a power of two\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"OptoLoopAlignment (" INTX_FORMAT ") "
|
||||
"must be a power of two\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
// Relevant on ppc, s390, sparc. Will be optimized where
|
||||
// addr_unit() == 1.
|
||||
if (OptoLoopAlignment % relocInfo::addr_unit() != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"OptoLoopAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size (%d)\n",
|
||||
value, relocInfo::addr_unit());
|
||||
JVMFlag::printError(verbose,
|
||||
"OptoLoopAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size (%d)\n",
|
||||
value, relocInfo::addr_unit());
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -294,9 +292,9 @@ JVMFlag::Error OptoLoopAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
|
||||
if (value >= 4032) {
|
||||
CommandLineError::print(verbose,
|
||||
"ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be"
|
||||
"between 0 and 4031\n", value);
|
||||
JVMFlag::printError(verbose,
|
||||
"ArraycopyDstPrefetchDistance (" UINTX_FORMAT ") must be"
|
||||
"between 0 and 4031\n", value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -305,9 +303,9 @@ JVMFlag::Error ArraycopyDstPrefetchDistanceConstraintFunc(uintx value, bool verb
|
||||
|
||||
JVMFlag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verbose) {
|
||||
if (value >= 4032) {
|
||||
CommandLineError::print(verbose,
|
||||
"ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be"
|
||||
"between 0 and 4031\n", value);
|
||||
JVMFlag::printError(verbose,
|
||||
"ArraycopySrcPrefetchDistance (" UINTX_FORMAT ") must be"
|
||||
"between 0 and 4031\n", value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -317,9 +315,9 @@ JVMFlag::Error ArraycopySrcPrefetchDistanceConstraintFunc(uintx value, bool verb
|
||||
JVMFlag::Error TypeProfileLevelConstraintFunc(uintx value, bool verbose) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (value % 10 > 2) {
|
||||
CommandLineError::print(verbose,
|
||||
"Invalid value (" UINTX_FORMAT ") "
|
||||
"in TypeProfileLevel at position %d\n", value, i);
|
||||
JVMFlag::printError(verbose,
|
||||
"Invalid value (" UINTX_FORMAT ") "
|
||||
"in TypeProfileLevel at position %d\n", value, i);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
value = value / 10;
|
||||
@ -339,26 +337,26 @@ JVMFlag::Error InitArrayShortSizeConstraintFunc(intx value, bool verbose) {
|
||||
#ifdef COMPILER2
|
||||
JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
if (InteriorEntryAlignment > CodeEntryAlignment) {
|
||||
CommandLineError::print(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"less than or equal to CodeEntryAlignment (" INTX_FORMAT ")\n",
|
||||
InteriorEntryAlignment, CodeEntryAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"less than or equal to CodeEntryAlignment (" INTX_FORMAT ")\n",
|
||||
InteriorEntryAlignment, CodeEntryAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
#ifdef SPARC
|
||||
if (InteriorEntryAlignment % relocInfo::addr_unit() != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size\n");
|
||||
JVMFlag::printError(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"multiple of NOP size\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!is_power_of_2(value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"a power of two\n", InteriorEntryAlignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"a power of two\n", InteriorEntryAlignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -370,10 +368,10 @@ JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
#endif
|
||||
|
||||
if (InteriorEntryAlignment < minimum_alignment) {
|
||||
CommandLineError::print(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to %d\n",
|
||||
InteriorEntryAlignment, minimum_alignment);
|
||||
JVMFlag::printError(verbose,
|
||||
"InteriorEntryAlignment (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to %d\n",
|
||||
InteriorEntryAlignment, minimum_alignment);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -382,10 +380,10 @@ JVMFlag::Error InteriorEntryAlignmentConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) {
|
||||
if (value < MaxNodeLimit * 2 / 100 || value > MaxNodeLimit * 40 / 100) {
|
||||
CommandLineError::print(verbose,
|
||||
"NodeLimitFudgeFactor must be between 2%% and 40%% "
|
||||
"of MaxNodeLimit (" INTX_FORMAT ")\n",
|
||||
MaxNodeLimit);
|
||||
JVMFlag::printError(verbose,
|
||||
"NodeLimitFudgeFactor must be between 2%% and 40%% "
|
||||
"of MaxNodeLimit (" INTX_FORMAT ")\n",
|
||||
MaxNodeLimit);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
|
||||
@ -396,10 +394,10 @@ JVMFlag::Error NodeLimitFudgeFactorConstraintFunc(intx value, bool verbose) {
|
||||
JVMFlag::Error RTMTotalCountIncrRateConstraintFunc(int value, bool verbose) {
|
||||
#if INCLUDE_RTM_OPT
|
||||
if (UseRTMLocking && !is_power_of_2(RTMTotalCountIncrRate)) {
|
||||
CommandLineError::print(verbose,
|
||||
"RTMTotalCountIncrRate (" INTX_FORMAT
|
||||
") must be a power of 2, resetting it to 64\n",
|
||||
RTMTotalCountIncrRate);
|
||||
JVMFlag::printError(verbose,
|
||||
"RTMTotalCountIncrRate (" INTX_FORMAT
|
||||
") must be a power of 2, resetting it to 64\n",
|
||||
RTMTotalCountIncrRate);
|
||||
FLAG_SET_DEFAULT(RTMTotalCountIncrRate, 64);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -26,26 +26,24 @@
|
||||
#include "runtime/arguments.hpp"
|
||||
#include "runtime/flags/jvmFlag.hpp"
|
||||
#include "runtime/flags/jvmFlagConstraintsRuntime.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "runtime/globals.hpp"
|
||||
#include "runtime/safepointMechanism.hpp"
|
||||
#include "runtime/task.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
|
||||
JVMFlag::Error ObjectAlignmentInBytesConstraintFunc(intx value, bool verbose) {
|
||||
if (!is_power_of_2(value)) {
|
||||
CommandLineError::print(verbose,
|
||||
"ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"power of 2\n",
|
||||
value);
|
||||
JVMFlag::printError(verbose,
|
||||
"ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"power of 2\n",
|
||||
value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
// In case page size is very small.
|
||||
if (value >= (intx)os::vm_page_size()) {
|
||||
CommandLineError::print(verbose,
|
||||
"ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"less than page size (" INTX_FORMAT ")\n",
|
||||
value, (intx)os::vm_page_size());
|
||||
JVMFlag::printError(verbose,
|
||||
"ObjectAlignmentInBytes (" INTX_FORMAT ") must be "
|
||||
"less than page size (" INTX_FORMAT ")\n",
|
||||
value, (intx)os::vm_page_size());
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -55,10 +53,10 @@ JVMFlag::Error ObjectAlignmentInBytesConstraintFunc(intx value, bool verbose) {
|
||||
// It is sufficient to check against the largest type size.
|
||||
JVMFlag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose) {
|
||||
if ((value % BytesPerLong) != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"ContendedPaddingWidth (" INTX_FORMAT ") must be "
|
||||
"a multiple of %d\n",
|
||||
value, BytesPerLong);
|
||||
JVMFlag::printError(verbose,
|
||||
"ContendedPaddingWidth (" INTX_FORMAT ") must be "
|
||||
"a multiple of %d\n",
|
||||
value, BytesPerLong);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -67,10 +65,10 @@ JVMFlag::Error ContendedPaddingWidthConstraintFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose) {
|
||||
if (value > BiasedLockingBulkRevokeThreshold) {
|
||||
CommandLineError::print(verbose,
|
||||
"BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ") must be "
|
||||
"less than or equal to BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")\n",
|
||||
value, BiasedLockingBulkRevokeThreshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ") must be "
|
||||
"less than or equal to BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")\n",
|
||||
value, BiasedLockingBulkRevokeThreshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -79,10 +77,10 @@ JVMFlag::Error BiasedLockingBulkRebiasThresholdFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose) {
|
||||
if ((value % PeriodicTask::interval_gran) != 0) {
|
||||
CommandLineError::print(verbose,
|
||||
"BiasedLockingStartupDelay (" INTX_FORMAT ") must be "
|
||||
"evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
|
||||
value, PeriodicTask::interval_gran);
|
||||
JVMFlag::printError(verbose,
|
||||
"BiasedLockingStartupDelay (" INTX_FORMAT ") must be "
|
||||
"evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
|
||||
value, PeriodicTask::interval_gran);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -91,17 +89,17 @@ JVMFlag::Error BiasedLockingStartupDelayFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose) {
|
||||
if (value < BiasedLockingBulkRebiasThreshold) {
|
||||
CommandLineError::print(verbose,
|
||||
"BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")\n",
|
||||
value, BiasedLockingBulkRebiasThreshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ") must be "
|
||||
"greater than or equal to BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")\n",
|
||||
value, BiasedLockingBulkRebiasThreshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else if ((double)value/(double)BiasedLockingDecayTime > 0.1) {
|
||||
CommandLineError::print(verbose,
|
||||
"The ratio of BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")"
|
||||
" to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
|
||||
"less than or equal to 0.1\n",
|
||||
value, BiasedLockingBulkRebiasThreshold);
|
||||
JVMFlag::printError(verbose,
|
||||
"The ratio of BiasedLockingBulkRevokeThreshold (" INTX_FORMAT ")"
|
||||
" to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
|
||||
"less than or equal to 0.1\n",
|
||||
value, BiasedLockingBulkRebiasThreshold);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -110,11 +108,11 @@ JVMFlag::Error BiasedLockingBulkRevokeThresholdFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose) {
|
||||
if (BiasedLockingBulkRebiasThreshold/(double)value > 0.1) {
|
||||
CommandLineError::print(verbose,
|
||||
"The ratio of BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")"
|
||||
" to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
|
||||
"less than or equal to 0.1\n",
|
||||
BiasedLockingBulkRebiasThreshold, value);
|
||||
JVMFlag::printError(verbose,
|
||||
"The ratio of BiasedLockingBulkRebiasThreshold (" INTX_FORMAT ")"
|
||||
" to BiasedLockingDecayTime (" INTX_FORMAT ") must be "
|
||||
"less than or equal to 0.1\n",
|
||||
BiasedLockingBulkRebiasThreshold, value);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -123,10 +121,10 @@ JVMFlag::Error BiasedLockingDecayTimeFunc(intx value, bool verbose) {
|
||||
|
||||
JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
|
||||
if ((value % PeriodicTask::interval_gran != 0)) {
|
||||
CommandLineError::print(verbose,
|
||||
"PerfDataSamplingInterval (" INTX_FORMAT ") must be "
|
||||
"evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
|
||||
value, PeriodicTask::interval_gran);
|
||||
JVMFlag::printError(verbose,
|
||||
"PerfDataSamplingInterval (" INTX_FORMAT ") must be "
|
||||
"evenly divisible by PeriodicTask::interval_gran (" INTX_FORMAT ")\n",
|
||||
value, PeriodicTask::interval_gran);
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -136,7 +134,7 @@ JVMFlag::Error PerfDataSamplingIntervalFunc(intx value, bool verbose) {
|
||||
JVMFlag::Error ThreadLocalHandshakesConstraintFunc(bool value, bool verbose) {
|
||||
if (value) {
|
||||
if (!SafepointMechanism::supports_thread_local_poll()) {
|
||||
CommandLineError::print(verbose, "ThreadLocalHandshakes not yet supported on this platform\n");
|
||||
JVMFlag::printError(verbose, "ThreadLocalHandshakes not yet supported on this platform\n");
|
||||
return JVMFlag::VIOLATES_CONSTRAINT;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015, 2018, 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
|
||||
@ -35,18 +35,8 @@
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/task.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
|
||||
void CommandLineError::print(bool verbose, const char* msg, ...) {
|
||||
if (verbose) {
|
||||
va_list listPointer;
|
||||
va_start(listPointer, msg);
|
||||
jio_vfprintf(defaultStream::error_stream(), msg, listPointer);
|
||||
va_end(listPointer);
|
||||
}
|
||||
}
|
||||
|
||||
class JVMFlagRange_int : public JVMFlagRange {
|
||||
int _min;
|
||||
int _max;
|
||||
@ -63,10 +53,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_int(int value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"int %s=%d is outside the allowed range "
|
||||
"[ %d ... %d ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"int %s=%d is outside the allowed range "
|
||||
"[ %d ... %d ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -93,10 +83,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_intx(intx value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"intx %s=" INTX_FORMAT " is outside the allowed range "
|
||||
"[ " INTX_FORMAT " ... " INTX_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"intx %s=" INTX_FORMAT " is outside the allowed range "
|
||||
"[ " INTX_FORMAT " ... " INTX_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -124,10 +114,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_uint(uint value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"uint %s=%u is outside the allowed range "
|
||||
"[ %u ... %u ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"uint %s=%u is outside the allowed range "
|
||||
"[ %u ... %u ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -155,10 +145,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_uintx(uintx value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"uintx %s=" UINTX_FORMAT " is outside the allowed range "
|
||||
"[ " UINTX_FORMAT " ... " UINTX_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"uintx %s=" UINTX_FORMAT " is outside the allowed range "
|
||||
"[ " UINTX_FORMAT " ... " UINTX_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -186,10 +176,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_uint64_t(uint64_t value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"uint64_t %s=" UINT64_FORMAT " is outside the allowed range "
|
||||
"[ " UINT64_FORMAT " ... " UINT64_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"uint64_t %s=" UINT64_FORMAT " is outside the allowed range "
|
||||
"[ " UINT64_FORMAT " ... " UINT64_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -217,10 +207,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_size_t(size_t value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"size_t %s=" SIZE_FORMAT " is outside the allowed range "
|
||||
"[ " SIZE_FORMAT " ... " SIZE_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"size_t %s=" SIZE_FORMAT " is outside the allowed range "
|
||||
"[ " SIZE_FORMAT " ... " SIZE_FORMAT " ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -248,10 +238,10 @@ public:
|
||||
|
||||
JVMFlag::Error check_double(double value, bool verbose = true) {
|
||||
if ((value < _min) || (value > _max)) {
|
||||
CommandLineError::print(verbose,
|
||||
"double %s=%f is outside the allowed range "
|
||||
"[ %f ... %f ]\n",
|
||||
name(), value, _min, _max);
|
||||
JVMFlag::printError(verbose,
|
||||
"double %s=%f is outside the allowed range "
|
||||
"[ %f ... %f ]\n",
|
||||
name(), value, _min, _max);
|
||||
return JVMFlag::OUT_OF_BOUNDS;
|
||||
} else {
|
||||
return JVMFlag::SUCCESS;
|
||||
@ -432,7 +422,6 @@ void JVMFlagRangeList::print(outputStream* st, const char* name, RangeStrFunc de
|
||||
}
|
||||
|
||||
bool JVMFlagRangeList::check_ranges() {
|
||||
// Check ranges.
|
||||
bool status = true;
|
||||
for (int i=0; i<length(); i++) {
|
||||
JVMFlagRange* range = at(i);
|
||||
|
@ -39,11 +39,6 @@
|
||||
* then we need to use constraint instead.
|
||||
*/
|
||||
|
||||
class CommandLineError : public AllStatic {
|
||||
public:
|
||||
static void print(bool verbose, const char* msg, ...);
|
||||
};
|
||||
|
||||
class JVMFlagRange : public CHeapObj<mtArguments> {
|
||||
private:
|
||||
const char* _name;
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "runtime/globals_extension.hpp"
|
||||
#include "runtime/flags/jvmFlagConstraintList.hpp"
|
||||
#include "runtime/flags/jvmFlagWriteableList.hpp"
|
||||
#include "runtime/flags/jvmFlagRangeList.hpp"
|
||||
#include "runtime/os.hpp"
|
||||
#include "runtime/sharedRuntime.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
|
@ -903,7 +903,7 @@ void Monitor::lock(Thread * Self) {
|
||||
}
|
||||
#endif // CHECK_UNHANDLED_OOPS
|
||||
|
||||
debug_only(check_prelock_state(Self));
|
||||
debug_only(check_prelock_state(Self, StrictSafepointChecks));
|
||||
assert(_owner != Self, "invariant");
|
||||
assert(_OnDeck != Self->_MutexEvent, "invariant");
|
||||
|
||||
@ -971,7 +971,7 @@ void Monitor::lock_without_safepoint_check() {
|
||||
|
||||
bool Monitor::try_lock() {
|
||||
Thread * const Self = Thread::current();
|
||||
debug_only(check_prelock_state(Self));
|
||||
debug_only(check_prelock_state(Self, false));
|
||||
// assert(!thread->is_inside_signal_handler(), "don't lock inside signal handler");
|
||||
|
||||
// Special case, where all Java threads are stopped.
|
||||
@ -1381,10 +1381,10 @@ void Monitor::set_owner_implementation(Thread *new_owner) {
|
||||
|
||||
|
||||
// Factored out common sanity checks for locking mutex'es. Used by lock() and try_lock()
|
||||
void Monitor::check_prelock_state(Thread *thread) {
|
||||
assert((!thread->is_Java_thread() || ((JavaThread *)thread)->thread_state() == _thread_in_vm)
|
||||
|| rank() == Mutex::special, "wrong thread state for using locks");
|
||||
if (StrictSafepointChecks) {
|
||||
void Monitor::check_prelock_state(Thread *thread, bool safepoint_check) {
|
||||
if (safepoint_check) {
|
||||
assert((!thread->is_Java_thread() || ((JavaThread *)thread)->thread_state() == _thread_in_vm)
|
||||
|| rank() == Mutex::special, "wrong thread state for using locks");
|
||||
if (thread->is_VM_thread() && !allow_vm_block()) {
|
||||
fatal("VM thread using lock %s (not allowed to block on)", name());
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ class Monitor : public CHeapObj<mtInternal> {
|
||||
#endif
|
||||
|
||||
void set_owner_implementation(Thread* owner) PRODUCT_RETURN;
|
||||
void check_prelock_state (Thread* thread) PRODUCT_RETURN;
|
||||
void check_prelock_state (Thread* thread, bool safepoint_check) PRODUCT_RETURN;
|
||||
void check_block_state (Thread* thread) PRODUCT_RETURN;
|
||||
|
||||
// platform-dependent support code can go here (in os_<os_family>.cpp)
|
||||
|
@ -337,7 +337,7 @@ arrayOop Reflection::reflect_new_array(oop element_mirror, jint length, TRAPS) {
|
||||
THROW_0(vmSymbols::java_lang_NullPointerException());
|
||||
}
|
||||
if (length < 0) {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", length));
|
||||
}
|
||||
if (java_lang_Class::is_primitive(element_mirror)) {
|
||||
Klass* tak = basic_type_mirror_to_arrayklass(element_mirror, CHECK_NULL);
|
||||
@ -369,7 +369,7 @@ arrayOop Reflection::reflect_new_multi_array(oop element_mirror, typeArrayOop di
|
||||
for (int i = 0; i < len; i++) {
|
||||
int d = dim_array->int_at(i);
|
||||
if (d < 0) {
|
||||
THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
|
||||
THROW_MSG_0(vmSymbols::java_lang_NegativeArraySizeException(), err_msg("%d", d));
|
||||
}
|
||||
dimensions[i] = d;
|
||||
}
|
||||
|
@ -675,15 +675,15 @@ void ConcurrentLocksDump::dump_at_safepoint() {
|
||||
// dump all locked concurrent locks
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped");
|
||||
|
||||
ResourceMark rm;
|
||||
|
||||
GrowableArray<oop>* aos_objects = new GrowableArray<oop>(INITIAL_ARRAY_SIZE);
|
||||
GrowableArray<oop>* aos_objects = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<oop>(INITIAL_ARRAY_SIZE, true /* C_heap */);
|
||||
|
||||
// Find all instances of AbstractOwnableSynchronizer
|
||||
HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
|
||||
aos_objects);
|
||||
// Build a map of thread to its owned AQS locks
|
||||
build_map(aos_objects);
|
||||
|
||||
delete aos_objects;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2018, 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
|
||||
@ -319,7 +319,7 @@ class LinuxWatchService
|
||||
try {
|
||||
bytesRead = read(ifd, address, BUFFER_SIZE);
|
||||
} catch (UnixException x) {
|
||||
if (x.errno() != EAGAIN)
|
||||
if (x.errno() != EAGAIN && x.errno() != EWOULDBLOCK)
|
||||
throw x;
|
||||
bytesRead = 0;
|
||||
}
|
||||
@ -367,7 +367,7 @@ class LinuxWatchService
|
||||
if (shutdown)
|
||||
break;
|
||||
} catch (UnixException x) {
|
||||
if (x.errno() != UnixConstants.EAGAIN)
|
||||
if (x.errno() != EAGAIN && x.errno() != EWOULDBLOCK)
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,213 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.AlgorithmParametersSpi;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.security.spec.InvalidParameterSpecException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import sun.security.util.*;
|
||||
|
||||
/**
|
||||
* This class implements the parameter set used with the ChaCha20-Poly1305
|
||||
* algorithm. The parameter definition comes from
|
||||
* <a href="https://tools.ietf.org/html/rfc8103"><i>RFC 8103</i></a>
|
||||
* and is defined according to the following ASN.1:
|
||||
*
|
||||
* <pre>
|
||||
* id-alg-AEADChaCha20Poly1305 OBJECT IDENTIFIER ::=
|
||||
{ iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1)
|
||||
pkcs9(9) smime(16) alg(3) 18 }
|
||||
|
||||
* AEADChaCha20Poly1305Nonce ::= OCTET STRING (SIZE(12))
|
||||
* </pre>
|
||||
*
|
||||
* The AlgorithmParameters may be instantiated either by its name
|
||||
* ("ChaCha20-Poly1305") or via its OID (1.2.840.113549.1.9.16.3.18)
|
||||
*/
|
||||
public final class ChaCha20Poly1305Parameters extends AlgorithmParametersSpi {
|
||||
|
||||
private static final String DEFAULT_FMT = "ASN.1";
|
||||
private byte[] nonce;
|
||||
|
||||
public ChaCha20Poly1305Parameters() {}
|
||||
|
||||
/**
|
||||
* Initialize the ChaCha20Poly1305Parameters using an IvParameterSpec.
|
||||
*
|
||||
* @param paramSpec the {@code IvParameterSpec} used to configure
|
||||
* this object.
|
||||
*
|
||||
* @throws InvalidParameterSpecException if an object of a type other
|
||||
* than {@code IvParameterSpec} is used.
|
||||
*/
|
||||
@Override
|
||||
protected void engineInit(AlgorithmParameterSpec paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (!(paramSpec instanceof IvParameterSpec)) {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
}
|
||||
IvParameterSpec ivps = (IvParameterSpec)paramSpec;
|
||||
|
||||
// Obtain the nonce
|
||||
nonce = ivps.getIV();
|
||||
if (nonce.length != 12) {
|
||||
throw new InvalidParameterSpecException("ChaCha20-Poly1305 nonce" +
|
||||
" must be 12 bytes in length");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the ChaCha20Poly1305Parameters from a DER encoded
|
||||
* parameter block.
|
||||
|
||||
* @param encoded the DER encoding of the nonce as an OCTET STRING.
|
||||
*
|
||||
* @throws IOException if the encoded nonce is not 12 bytes long or a DER
|
||||
* decoding error occurs.
|
||||
*/
|
||||
@Override
|
||||
protected void engineInit(byte[] encoded) throws IOException {
|
||||
DerValue val = new DerValue(encoded);
|
||||
|
||||
// Get the nonce value
|
||||
nonce = val.getOctetString();
|
||||
if (nonce.length != 12) {
|
||||
throw new IOException(
|
||||
"ChaCha20-Poly1305 nonce must be 12 bytes in length");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the ChaCha20Poly1305Parameters from a DER encoded
|
||||
* parameter block.
|
||||
*
|
||||
* @param encoded the DER encoding of the nonce and initial block counter.
|
||||
* @param decodingMethod the decoding method. The only currently accepted
|
||||
* value is "ASN.1"
|
||||
*
|
||||
* @throws IOException if the encoded nonce is not 12 bytes long, a DER
|
||||
* decoding error occurs, or an unsupported decoding method is
|
||||
* provided.
|
||||
*/
|
||||
@Override
|
||||
protected void engineInit(byte[] encoded, String decodingMethod)
|
||||
throws IOException {
|
||||
if (decodingMethod == null ||
|
||||
decodingMethod.equalsIgnoreCase(DEFAULT_FMT)) {
|
||||
engineInit(encoded);
|
||||
} else {
|
||||
throw new IOException("Unsupported parameter format: " +
|
||||
decodingMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an IvParameterSpec with the same parameters as those
|
||||
* held in this object.
|
||||
*
|
||||
* @param paramSpec the class name of the spec. In this case it should
|
||||
* be {@code IvParameterSpec.class}.
|
||||
*
|
||||
* @return a {@code IvParameterSpec} object containing the nonce
|
||||
* value held in this object.
|
||||
*
|
||||
* @throws InvalidParameterSpecException if a class other than
|
||||
* {@code IvParameterSpec.class} was specified in the paramSpec
|
||||
* parameter.
|
||||
*/
|
||||
@Override
|
||||
protected <T extends AlgorithmParameterSpec>
|
||||
T engineGetParameterSpec(Class<T> paramSpec)
|
||||
throws InvalidParameterSpecException {
|
||||
|
||||
if (IvParameterSpec.class.isAssignableFrom(paramSpec)) {
|
||||
return paramSpec.cast(new IvParameterSpec(nonce));
|
||||
} else {
|
||||
throw new InvalidParameterSpecException
|
||||
("Inappropriate parameter specification");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the encoded parameters in ASN.1 form.
|
||||
*
|
||||
* @return a byte array containing the DER-encoding for the
|
||||
* ChaCha20-Poly1305 parameters. This will be the nonce
|
||||
* encoded as a DER OCTET STRING.
|
||||
*
|
||||
* @throws IOException if any DER encoding error occurs.
|
||||
*/
|
||||
@Override
|
||||
protected byte[] engineGetEncoded() throws IOException {
|
||||
DerOutputStream out = new DerOutputStream();
|
||||
out.write(DerValue.tag_OctetString, nonce);
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the encoded parameters in ASN.1 form.
|
||||
*
|
||||
* @param encodingMethod the encoding method to be used. This parameter
|
||||
* must be "ASN.1" as it is the only currently supported encoding
|
||||
* format. If the parameter is {@code null} then the default
|
||||
* encoding format will be used.
|
||||
*
|
||||
* @return a byte array containing the DER-encoding for the
|
||||
* ChaCha20-Poly1305 parameters.
|
||||
*
|
||||
* @throws IOException if any DER encoding error occurs or an unsupported
|
||||
* encoding method is provided.
|
||||
*/
|
||||
@Override
|
||||
protected byte[] engineGetEncoded(String encodingMethod)
|
||||
throws IOException {
|
||||
if (encodingMethod == null ||
|
||||
encodingMethod.equalsIgnoreCase(DEFAULT_FMT)) {
|
||||
return engineGetEncoded();
|
||||
} else {
|
||||
throw new IOException("Unsupported encoding format: " +
|
||||
encodingMethod);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a formatted string describing the parameters.
|
||||
*
|
||||
* @return a string representation of the ChaCha20 parameters.
|
||||
*/
|
||||
@Override
|
||||
protected String engineToString() {
|
||||
String LINE_SEP = System.lineSeparator();
|
||||
HexDumpEncoder encoder = new HexDumpEncoder();
|
||||
StringBuilder sb = new StringBuilder(LINE_SEP + "nonce:" +
|
||||
LINE_SEP + "[" + encoder.encodeBuffer(nonce) + "]");
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2018, 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
|
||||
@ -111,16 +111,20 @@ final class KeyGeneratorCore {
|
||||
protected HmacSHA2KG(String algoName, int len) {
|
||||
core = new KeyGeneratorCore(algoName, len);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(SecureRandom random) {
|
||||
core.implInit(random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(AlgorithmParameterSpec params,
|
||||
SecureRandom random) throws InvalidAlgorithmParameterException {
|
||||
core.implInit(params, random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(int keySize, SecureRandom random) {
|
||||
core.implInit(keySize, random);
|
||||
}
|
||||
@Override
|
||||
protected SecretKey engineGenerateKey() {
|
||||
return core.implGenerateKey();
|
||||
}
|
||||
@ -153,13 +157,16 @@ final class KeyGeneratorCore {
|
||||
public RC2KeyGenerator() {
|
||||
core = new KeyGeneratorCore("RC2", 128);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(SecureRandom random) {
|
||||
core.implInit(random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(AlgorithmParameterSpec params,
|
||||
SecureRandom random) throws InvalidAlgorithmParameterException {
|
||||
core.implInit(params, random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(int keySize, SecureRandom random) {
|
||||
if ((keySize < 40) || (keySize > 1024)) {
|
||||
throw new InvalidParameterException("Key length for RC2"
|
||||
@ -167,6 +174,7 @@ final class KeyGeneratorCore {
|
||||
}
|
||||
core.implInit(keySize, random);
|
||||
}
|
||||
@Override
|
||||
protected SecretKey engineGenerateKey() {
|
||||
return core.implGenerateKey();
|
||||
}
|
||||
@ -178,13 +186,16 @@ final class KeyGeneratorCore {
|
||||
public ARCFOURKeyGenerator() {
|
||||
core = new KeyGeneratorCore("ARCFOUR", 128);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(SecureRandom random) {
|
||||
core.implInit(random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(AlgorithmParameterSpec params,
|
||||
SecureRandom random) throws InvalidAlgorithmParameterException {
|
||||
core.implInit(params, random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(int keySize, SecureRandom random) {
|
||||
if ((keySize < 40) || (keySize > 1024)) {
|
||||
throw new InvalidParameterException("Key length for ARCFOUR"
|
||||
@ -192,9 +203,38 @@ final class KeyGeneratorCore {
|
||||
}
|
||||
core.implInit(keySize, random);
|
||||
}
|
||||
@Override
|
||||
protected SecretKey engineGenerateKey() {
|
||||
return core.implGenerateKey();
|
||||
}
|
||||
}
|
||||
|
||||
// nested static class for the ChaCha20 key generator
|
||||
public static final class ChaCha20KeyGenerator extends KeyGeneratorSpi {
|
||||
private final KeyGeneratorCore core;
|
||||
public ChaCha20KeyGenerator() {
|
||||
core = new KeyGeneratorCore("ChaCha20", 256);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(SecureRandom random) {
|
||||
core.implInit(random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(AlgorithmParameterSpec params,
|
||||
SecureRandom random) throws InvalidAlgorithmParameterException {
|
||||
core.implInit(params, random);
|
||||
}
|
||||
@Override
|
||||
protected void engineInit(int keySize, SecureRandom random) {
|
||||
if (keySize != 256) {
|
||||
throw new InvalidParameterException(
|
||||
"Key length for ChaCha20 must be 256 bits");
|
||||
}
|
||||
core.implInit(keySize, random);
|
||||
}
|
||||
@Override
|
||||
protected SecretKey engineGenerateKey() {
|
||||
return core.implGenerateKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,257 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
package com.sun.crypto.provider;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.Key;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import sun.security.util.math.*;
|
||||
import sun.security.util.math.intpoly.*;
|
||||
|
||||
/**
|
||||
* This class represents the Poly1305 function defined in RFC 7539.
|
||||
*
|
||||
* This function is used in the implementation of ChaCha20/Poly1305
|
||||
* AEAD mode.
|
||||
*/
|
||||
final class Poly1305 {
|
||||
|
||||
private static final int KEY_LENGTH = 32;
|
||||
private static final int RS_LENGTH = KEY_LENGTH / 2;
|
||||
private static final int BLOCK_LENGTH = 16;
|
||||
private static final int TAG_LENGTH = 16;
|
||||
|
||||
private static final IntegerFieldModuloP ipl1305 =
|
||||
new IntegerPolynomial1305();
|
||||
|
||||
private byte[] keyBytes;
|
||||
private final byte[] block = new byte[BLOCK_LENGTH];
|
||||
private int blockOffset;
|
||||
|
||||
private IntegerModuloP r;
|
||||
private IntegerModuloP s;
|
||||
private MutableIntegerModuloP a;
|
||||
private final MutableIntegerModuloP n = ipl1305.get1().mutable();
|
||||
|
||||
Poly1305() { }
|
||||
|
||||
/**
|
||||
* Initialize the Poly1305 object
|
||||
*
|
||||
* @param newKey the {@code Key} which will be used for the authentication.
|
||||
* @param params this parameter is unused.
|
||||
*
|
||||
* @throws InvalidKeyException if {@code newKey} is {@code null} or is
|
||||
* not 32 bytes in length.
|
||||
*/
|
||||
void engineInit(Key newKey, AlgorithmParameterSpec params)
|
||||
throws InvalidKeyException {
|
||||
Objects.requireNonNull(newKey, "Null key provided during init");
|
||||
keyBytes = newKey.getEncoded();
|
||||
if (keyBytes == null) {
|
||||
throw new InvalidKeyException("Key does not support encoding");
|
||||
} else if (keyBytes.length != KEY_LENGTH) {
|
||||
throw new InvalidKeyException("Incorrect length for key: " +
|
||||
keyBytes.length);
|
||||
}
|
||||
|
||||
engineReset();
|
||||
setRSVals();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the length of the MAC (authentication tag).
|
||||
*
|
||||
* @return the length of the auth tag, which is always 16 bytes.
|
||||
*/
|
||||
int engineGetMacLength() {
|
||||
return TAG_LENGTH;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset the Poly1305 object, discarding any current operation but
|
||||
* maintaining the same key.
|
||||
*/
|
||||
void engineReset() {
|
||||
// Clear the block and reset the offset
|
||||
Arrays.fill(block, (byte)0);
|
||||
blockOffset = 0;
|
||||
// Discard any previous accumulator and start at zero
|
||||
a = ipl1305.get0().mutable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the MAC with bytes from a {@code ByteBuffer}
|
||||
*
|
||||
* @param buf the {@code ByteBuffer} containing the data to be consumed.
|
||||
* Upon return the buffer's position will be equal to its limit.
|
||||
*/
|
||||
void engineUpdate(ByteBuffer buf) {
|
||||
int remaining = buf.remaining();
|
||||
while (remaining > 0) {
|
||||
int bytesToWrite = Integer.min(remaining,
|
||||
BLOCK_LENGTH - blockOffset);
|
||||
|
||||
if (bytesToWrite >= BLOCK_LENGTH) {
|
||||
// If bytes to write == BLOCK_LENGTH, then we have no
|
||||
// left-over data from previous updates and we can create
|
||||
// the IntegerModuloP directly from the input buffer.
|
||||
processBlock(buf, bytesToWrite);
|
||||
} else {
|
||||
// We have some left-over data from previous updates, so
|
||||
// copy that into the holding block until we get a full block.
|
||||
buf.get(block, blockOffset, bytesToWrite);
|
||||
blockOffset += bytesToWrite;
|
||||
|
||||
if (blockOffset >= BLOCK_LENGTH) {
|
||||
processBlock(block, 0, BLOCK_LENGTH);
|
||||
blockOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
remaining -= bytesToWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the MAC with bytes from an array.
|
||||
*
|
||||
* @param input the input bytes.
|
||||
* @param offset the starting index from which to update the MAC.
|
||||
* @param len the number of bytes to process.
|
||||
*/
|
||||
void engineUpdate(byte[] input, int offset, int len) {
|
||||
Objects.checkFromIndexSize(offset, len, input.length);
|
||||
if (blockOffset > 0) {
|
||||
// We have some left-over data from previous updates
|
||||
int blockSpaceLeft = BLOCK_LENGTH - blockOffset;
|
||||
if (len < blockSpaceLeft) {
|
||||
System.arraycopy(input, offset, block, blockOffset, len);
|
||||
blockOffset += len;
|
||||
return; // block wasn't filled
|
||||
} else {
|
||||
System.arraycopy(input, offset, block, blockOffset,
|
||||
blockSpaceLeft);
|
||||
offset += blockSpaceLeft;
|
||||
len -= blockSpaceLeft;
|
||||
processBlock(block, 0, BLOCK_LENGTH);
|
||||
blockOffset = 0;
|
||||
}
|
||||
}
|
||||
while (len >= BLOCK_LENGTH) {
|
||||
processBlock(input, offset, BLOCK_LENGTH);
|
||||
offset += BLOCK_LENGTH;
|
||||
len -= BLOCK_LENGTH;
|
||||
}
|
||||
if (len > 0) { // and len < BLOCK_LENGTH
|
||||
System.arraycopy(input, offset, block, 0, len);
|
||||
blockOffset = len;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the MAC with a single byte of input
|
||||
*
|
||||
* @param input the byte to update the MAC with.
|
||||
*/
|
||||
void engineUpdate(byte input) {
|
||||
assert (blockOffset < BLOCK_LENGTH);
|
||||
// we can't hold fully filled unprocessed block
|
||||
block[blockOffset++] = input;
|
||||
|
||||
if (blockOffset == BLOCK_LENGTH) {
|
||||
processBlock(block, 0, BLOCK_LENGTH);
|
||||
blockOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Finish the authentication operation and reset the MAC for a new
|
||||
* authentication operation.
|
||||
*
|
||||
* @return the authentication tag as a byte array.
|
||||
*/
|
||||
byte[] engineDoFinal() {
|
||||
byte[] tag = new byte[BLOCK_LENGTH];
|
||||
|
||||
// Finish up: process any remaining data < BLOCK_SIZE, then
|
||||
// create the tag from the resulting little-endian integer.
|
||||
if (blockOffset > 0) {
|
||||
processBlock(block, 0, blockOffset);
|
||||
blockOffset = 0;
|
||||
}
|
||||
|
||||
// Add in the s-half of the key to the accumulator
|
||||
a.addModPowerTwo(s, tag);
|
||||
|
||||
// Reset for the next auth
|
||||
engineReset();
|
||||
return tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process a single block of data. This should only be called
|
||||
* when the block array is complete. That may not necessarily
|
||||
* be a full 16 bytes if the last block has less than 16 bytes.
|
||||
*/
|
||||
private void processBlock(ByteBuffer buf, int len) {
|
||||
n.setValue(buf, len, (byte)0x01);
|
||||
a.setSum(n); // a += (n | 0x01)
|
||||
a.setProduct(r); // a = (a * r) % p
|
||||
}
|
||||
|
||||
private void processBlock(byte[] block, int offset, int length) {
|
||||
Objects.checkFromIndexSize(offset, length, block.length);
|
||||
n.setValue(block, offset, length, (byte)0x01);
|
||||
a.setSum(n); // a += (n | 0x01)
|
||||
a.setProduct(r); // a = (a * r) % p
|
||||
}
|
||||
|
||||
/**
|
||||
* Partition the authentication key into the R and S components, clamp
|
||||
* the R value, and instantiate IntegerModuloP objects to R and S's
|
||||
* numeric values.
|
||||
*/
|
||||
private void setRSVals() {
|
||||
// Clamp the bytes in the "r" half of the key.
|
||||
keyBytes[3] &= 15;
|
||||
keyBytes[7] &= 15;
|
||||
keyBytes[11] &= 15;
|
||||
keyBytes[15] &= 15;
|
||||
keyBytes[4] &= 252;
|
||||
keyBytes[8] &= 252;
|
||||
keyBytes[12] &= 252;
|
||||
|
||||
// Create IntegerModuloP elements from the r and s values
|
||||
r = ipl1305.getElement(keyBytes, 0, RS_LENGTH, (byte)0);
|
||||
s = ipl1305.getElement(keyBytes, RS_LENGTH, RS_LENGTH, (byte)0);
|
||||
}
|
||||
}
|
@ -57,6 +57,8 @@ import static sun.security.util.SecurityConstants.PROVIDER_VER;
|
||||
*
|
||||
* - ARCFOUR (RC4 compatible)
|
||||
*
|
||||
* - ChaCha20 (Stream cipher only and in AEAD mode with Poly1305)
|
||||
*
|
||||
* - Cipher modes ECB, CBC, CFB, OFB, PCBC, CTR, and CTS for all block ciphers
|
||||
* and mode GCM for AES cipher
|
||||
*
|
||||
@ -77,7 +79,7 @@ public final class SunJCE extends Provider {
|
||||
|
||||
private static final String info = "SunJCE Provider " +
|
||||
"(implements RSA, DES, Triple DES, AES, Blowfish, ARCFOUR, RC2, PBE, "
|
||||
+ "Diffie-Hellman, HMAC)";
|
||||
+ "Diffie-Hellman, HMAC, ChaCha20)";
|
||||
|
||||
private static final String OID_PKCS12_RC4_128 = "1.2.840.113549.1.12.1.1";
|
||||
private static final String OID_PKCS12_RC4_40 = "1.2.840.113549.1.12.1.2";
|
||||
@ -336,6 +338,15 @@ public final class SunJCE extends Provider {
|
||||
put("Cipher.ARCFOUR SupportedPaddings", "NOPADDING");
|
||||
put("Cipher.ARCFOUR SupportedKeyFormats", "RAW");
|
||||
|
||||
put("Cipher.ChaCha20",
|
||||
"com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Only");
|
||||
put("Cipher.ChaCha20 SupportedKeyFormats", "RAW");
|
||||
put("Cipher.ChaCha20-Poly1305",
|
||||
"com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Poly1305");
|
||||
put("Cipher.ChaCha20-Poly1305 SupportedKeyFormats", "RAW");
|
||||
put("Alg.Alias.Cipher.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
|
||||
put("Alg.Alias.Cipher.OID.1.2.840.113549.1.9.16.3.18", "ChaCha20-Poly1305");
|
||||
|
||||
/*
|
||||
* Key(pair) Generator engines
|
||||
*/
|
||||
@ -361,6 +372,10 @@ public final class SunJCE extends Provider {
|
||||
"ARCFOURKeyGenerator");
|
||||
put("Alg.Alias.KeyGenerator.RC4", "ARCFOUR");
|
||||
|
||||
put("KeyGenerator.ChaCha20",
|
||||
"com.sun.crypto.provider.KeyGeneratorCore$" +
|
||||
"ChaCha20KeyGenerator");
|
||||
|
||||
put("KeyGenerator.HmacMD5",
|
||||
"com.sun.crypto.provider.HmacMD5KeyGenerator");
|
||||
|
||||
@ -541,6 +556,9 @@ public final class SunJCE extends Provider {
|
||||
put("AlgorithmParameters.OAEP",
|
||||
"com.sun.crypto.provider.OAEPParameters");
|
||||
|
||||
put("AlgorithmParameters.ChaCha20-Poly1305",
|
||||
"com.sun.crypto.provider.ChaCha20Poly1305Parameters");
|
||||
|
||||
/*
|
||||
* Key factories
|
||||
*/
|
||||
|
@ -1419,7 +1419,8 @@ class Character implements java.io.Serializable, Comparable<Character> {
|
||||
"YIRADICALS");
|
||||
|
||||
/**
|
||||
* Constant for the "Cyrillic Supplementary" Unicode character block.
|
||||
* Constant for the "Cyrillic Supplement" Unicode character block.
|
||||
* This block was previously known as the "Cyrillic Supplementary" block.
|
||||
* @since 1.5
|
||||
*/
|
||||
public static final UnicodeBlock CYRILLIC_SUPPLEMENTARY =
|
||||
|
@ -134,6 +134,8 @@ final class BootstrapMethodInvoker {
|
||||
String recipe = (String)argv[0];
|
||||
Object[] shiftedArgs = Arrays.copyOfRange(argv, 1, argv.length);
|
||||
result = (CallSite)bootstrapMethod.invokeExact(caller, name, (MethodType)type, recipe, shiftedArgs);
|
||||
} else if (isLambdaMetafactoryAltMetafactoryBSM(bsmType)) {
|
||||
result = (CallSite)bootstrapMethod.invokeExact(caller, name, (MethodType)type, argv);
|
||||
} else {
|
||||
switch (argv.length) {
|
||||
case 0:
|
||||
@ -286,6 +288,9 @@ final class BootstrapMethodInvoker {
|
||||
private static final MethodType LMF_INDY_MT = MethodType.methodType(CallSite.class,
|
||||
Lookup.class, String.class, MethodType.class, MethodType.class, MethodHandle.class, MethodType.class);
|
||||
|
||||
private static final MethodType LMF_ALT_MT = MethodType.methodType(CallSite.class,
|
||||
Lookup.class, String.class, MethodType.class, Object[].class);
|
||||
|
||||
private static final MethodType LMF_CONDY_MT = MethodType.methodType(Object.class,
|
||||
Lookup.class, String.class, Class.class, MethodType.class, MethodHandle.class, MethodType.class);
|
||||
|
||||
@ -319,6 +324,15 @@ final class BootstrapMethodInvoker {
|
||||
return bsmType == LMF_INDY_MT;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true iff the BSM method type exactly matches
|
||||
* {@see java.lang.invoke.LambdaMetafactory#altMetafactory(
|
||||
* MethodHandles.Lookup,String,MethodType,Object[])}
|
||||
*/
|
||||
private static boolean isLambdaMetafactoryAltMetafactoryBSM(MethodType bsmType) {
|
||||
return bsmType == LMF_ALT_MT;
|
||||
}
|
||||
|
||||
/** The JVM produces java.lang.Integer values to box
|
||||
* CONSTANT_Integer boxes but does not intern them.
|
||||
* Let's intern them. This is slightly wrong for
|
||||
|
@ -3483,6 +3483,11 @@ assert((int)twice.invokeExact(21) == 42);
|
||||
* @return a method handle which inserts an additional argument,
|
||||
* before calling the original method handle
|
||||
* @throws NullPointerException if the target or the {@code values} array is null
|
||||
* @throws IllegalArgumentException if (@code pos) is less than {@code 0} or greater than
|
||||
* {@code N - L} where {@code N} is the arity of the target method handle and {@code L}
|
||||
* is the length of the values array.
|
||||
* @throws ClassCastException if an argument does not match the corresponding bound parameter
|
||||
* type.
|
||||
* @see MethodHandle#bindTo
|
||||
*/
|
||||
public static
|
||||
|
@ -43,71 +43,146 @@ import jdk.internal.ref.Cleaner;
|
||||
|
||||
public abstract class Reference<T> {
|
||||
|
||||
/* A Reference instance is in one of four possible internal states:
|
||||
/* The state of a Reference object is characterized by two attributes. It
|
||||
* may be either "active", "pending", or "inactive". It may also be
|
||||
* either "registered", "enqueued", "dequeued", or "unregistered".
|
||||
*
|
||||
* Active: Subject to special treatment by the garbage collector. Some
|
||||
* time after the collector detects that the reachability of the
|
||||
* referent has changed to the appropriate state, it changes the
|
||||
* instance's state to either Pending or Inactive, depending upon
|
||||
* whether or not the instance was registered with a queue when it was
|
||||
* created. In the former case it also adds the instance to the
|
||||
* pending-Reference list. Newly-created instances are Active.
|
||||
* Active: Subject to special treatment by the garbage collector. Some
|
||||
* time after the collector detects that the reachability of the
|
||||
* referent has changed to the appropriate state, the collector
|
||||
* "notifies" the reference, changing the state to either "pending" or
|
||||
* "inactive".
|
||||
* referent != null; discovered = null, or in GC discovered list.
|
||||
*
|
||||
* Pending: An element of the pending-Reference list, waiting to be
|
||||
* enqueued by the Reference-handler thread. Unregistered instances
|
||||
* are never in this state.
|
||||
* Pending: An element of the pending-Reference list, waiting to be
|
||||
* processed by the ReferenceHandler thread. The pending-Reference
|
||||
* list is linked through the discovered fields of references in the
|
||||
* list.
|
||||
* referent = null; discovered = next element in pending-Reference list.
|
||||
*
|
||||
* Enqueued: An element of the queue with which the instance was
|
||||
* registered when it was created. When an instance is removed from
|
||||
* its ReferenceQueue, it is made Inactive. Unregistered instances are
|
||||
* never in this state.
|
||||
* Inactive: Neither Active nor Pending.
|
||||
* referent = null.
|
||||
*
|
||||
* Inactive: Nothing more to do. Once an instance becomes Inactive its
|
||||
* state will never change again.
|
||||
* Registered: Associated with a queue when created, and not yet added
|
||||
* to the queue.
|
||||
* queue = the associated queue.
|
||||
*
|
||||
* The state is encoded in the queue and next fields as follows:
|
||||
* Enqueued: Added to the associated queue, and not yet removed.
|
||||
* queue = ReferenceQueue.ENQUEUE; next = next entry in list, or this to
|
||||
* indicate end of list.
|
||||
*
|
||||
* Active: queue = ReferenceQueue with which instance is registered, or
|
||||
* ReferenceQueue.NULL if it was not registered with a queue; next =
|
||||
* null.
|
||||
* Dequeued: Added to the associated queue and then removed.
|
||||
* queue = ReferenceQueue.NULL; next = this.
|
||||
*
|
||||
* Pending: queue = ReferenceQueue with which instance is registered;
|
||||
* next = this
|
||||
* Unregistered: Not associated with a queue when created.
|
||||
* queue = ReferenceQueue.NULL.
|
||||
*
|
||||
* Enqueued: queue = ReferenceQueue.ENQUEUED; next = Following instance
|
||||
* in queue, or this if at end of list.
|
||||
* The collector only needs to examine the referent field and the
|
||||
* discovered field to determine whether a (non-FinalReference) Reference
|
||||
* object needs special treatment. If the referent is non-null and not
|
||||
* known to be live, then it may need to be discovered for possible later
|
||||
* notification. But if the discovered field is non-null, then it has
|
||||
* already been discovered.
|
||||
*
|
||||
* Inactive: queue = ReferenceQueue.NULL; next = this.
|
||||
* FinalReference (which exists to support finalization) differs from
|
||||
* other references, because a FinalReference is not cleared when
|
||||
* notified. The referent being null or not cannot be used to distinguish
|
||||
* between the active state and pending or inactive states. However,
|
||||
* FinalReferences do not support enqueue(). Instead, the next field of a
|
||||
* FinalReference object is set to "this" when it is added to the
|
||||
* pending-Reference list. The use of "this" as the value of next in the
|
||||
* enqueued and dequeued states maintains the non-active state. An
|
||||
* additional check that the next field is null is required to determine
|
||||
* that a FinalReference object is active.
|
||||
*
|
||||
* With this scheme the collector need only examine the next field in order
|
||||
* to determine whether a Reference instance requires special treatment: If
|
||||
* the next field is null then the instance is active; if it is non-null,
|
||||
* then the collector should treat the instance normally.
|
||||
* Initial states:
|
||||
* [active/registered]
|
||||
* [active/unregistered] [1]
|
||||
*
|
||||
* To ensure that a concurrent collector can discover active Reference
|
||||
* objects without interfering with application threads that may apply
|
||||
* the enqueue() method to those objects, collectors should link
|
||||
* discovered objects through the discovered field. The discovered
|
||||
* field is also used for linking Reference objects in the pending list.
|
||||
* Transitions:
|
||||
* clear
|
||||
* [active/registered] -------> [inactive/registered]
|
||||
* | |
|
||||
* | | enqueue [2]
|
||||
* | GC enqueue [2] |
|
||||
* | -----------------|
|
||||
* | |
|
||||
* v |
|
||||
* [pending/registered] --- v
|
||||
* | | ReferenceHandler
|
||||
* | enqueue [2] |---> [inactive/enqueued]
|
||||
* v | |
|
||||
* [pending/enqueued] --- |
|
||||
* | | poll/remove
|
||||
* | poll/remove |
|
||||
* | |
|
||||
* v ReferenceHandler v
|
||||
* [pending/dequeued] ------> [inactive/dequeued]
|
||||
*
|
||||
*
|
||||
* clear/enqueue/GC [3]
|
||||
* [active/unregistered] ------
|
||||
* | |
|
||||
* | GC |
|
||||
* | |--> [inactive/unregistered]
|
||||
* v |
|
||||
* [pending/unregistered] ------
|
||||
* ReferenceHandler
|
||||
*
|
||||
* Terminal states:
|
||||
* [inactive/dequeued]
|
||||
* [inactive/unregistered]
|
||||
*
|
||||
* Unreachable states (because enqueue also clears):
|
||||
* [active/enqeued]
|
||||
* [active/dequeued]
|
||||
*
|
||||
* [1] Unregistered is not permitted for FinalReferences.
|
||||
*
|
||||
* [2] These transitions are not possible for FinalReferences, making
|
||||
* [pending/enqueued] and [pending/dequeued] unreachable, and
|
||||
* [inactive/registered] terminal.
|
||||
*
|
||||
* [3] The garbage collector may directly transition a Reference
|
||||
* from [active/unregistered] to [inactive/unregistered],
|
||||
* bypassing the pending-Reference list.
|
||||
*/
|
||||
|
||||
private T referent; /* Treated specially by GC */
|
||||
|
||||
/* The queue this reference gets enqueued to by GC notification or by
|
||||
* calling enqueue().
|
||||
*
|
||||
* When registered: the queue with which this reference is registered.
|
||||
* enqueued: ReferenceQueue.ENQUEUE
|
||||
* dequeued: ReferenceQueue.NULL
|
||||
* unregistered: ReferenceQueue.NULL
|
||||
*/
|
||||
volatile ReferenceQueue<? super T> queue;
|
||||
|
||||
/* When active: NULL
|
||||
* pending: this
|
||||
* Enqueued: next reference in queue (or this if last)
|
||||
* Inactive: this
|
||||
/* The link in a ReferenceQueue's list of Reference objects.
|
||||
*
|
||||
* When registered: null
|
||||
* enqueued: next element in queue (or this if last)
|
||||
* dequeued: this (marking FinalReferences as inactive)
|
||||
* unregistered: null
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
volatile Reference next;
|
||||
|
||||
/* When active: next element in a discovered reference list maintained by GC (or this if last)
|
||||
* pending: next element in the pending list (or null if last)
|
||||
* otherwise: NULL
|
||||
/* Used by the garbage collector to accumulate Reference objects that need
|
||||
* to be revisited in order to decide whether they should be notified.
|
||||
* Also used as the link in the pending-Reference list. The discovered
|
||||
* field and the next field are distinct to allow the enqueue() method to
|
||||
* be applied to a Reference object while it is either in the
|
||||
* pending-Reference list or in the garbage collector's discovered set.
|
||||
*
|
||||
* When active: null or next element in a discovered reference list
|
||||
* maintained by the GC (or this if last)
|
||||
* pending: next element in the pending-Reference list (null if last)
|
||||
* inactive: null
|
||||
*/
|
||||
private transient Reference<T> discovered; /* used by VM */
|
||||
private transient Reference<T> discovered;
|
||||
|
||||
|
||||
/* High-priority thread to enqueue pending References
|
||||
@ -141,17 +216,17 @@ public abstract class Reference<T> {
|
||||
}
|
||||
|
||||
/*
|
||||
* Atomically get and clear (set to null) the VM's pending list.
|
||||
* Atomically get and clear (set to null) the VM's pending-Reference list.
|
||||
*/
|
||||
private static native Reference<Object> getAndClearReferencePendingList();
|
||||
|
||||
/*
|
||||
* Test whether the VM's pending list contains any entries.
|
||||
* Test whether the VM's pending-Reference list contains any entries.
|
||||
*/
|
||||
private static native boolean hasReferencePendingList();
|
||||
|
||||
/*
|
||||
* Wait until the VM's pending list may be non-null.
|
||||
* Wait until the VM's pending-Reference list may be non-null.
|
||||
*/
|
||||
private static native void waitForReferencePendingList();
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2018, 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
|
||||
@ -43,17 +43,17 @@ public class ReferenceQueue<T> {
|
||||
*/
|
||||
public ReferenceQueue() { }
|
||||
|
||||
private static class Null<S> extends ReferenceQueue<S> {
|
||||
boolean enqueue(Reference<? extends S> r) {
|
||||
private static class Null extends ReferenceQueue<Object> {
|
||||
boolean enqueue(Reference<?> r) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static ReferenceQueue<Object> NULL = new Null<>();
|
||||
static ReferenceQueue<Object> ENQUEUED = new Null<>();
|
||||
static final ReferenceQueue<Object> NULL = new Null();
|
||||
static final ReferenceQueue<Object> ENQUEUED = new Null();
|
||||
|
||||
private static class Lock { };
|
||||
private Lock lock = new Lock();
|
||||
private final Lock lock = new Lock();
|
||||
private volatile Reference<? extends T> head;
|
||||
private long queueLength = 0;
|
||||
|
||||
@ -66,6 +66,7 @@ public class ReferenceQueue<T> {
|
||||
return false;
|
||||
}
|
||||
assert queue == this;
|
||||
// Self-loop end, so if a FinalReference it remains inactive.
|
||||
r.next = (head == null) ? r : head;
|
||||
head = r;
|
||||
queueLength++;
|
||||
@ -90,7 +91,10 @@ public class ReferenceQueue<T> {
|
||||
// poll(). Volatiles ensure ordering.
|
||||
@SuppressWarnings("unchecked")
|
||||
Reference<? extends T> rn = r.next;
|
||||
// Handle self-looped next as end of list designator.
|
||||
head = (rn == r) ? null : rn;
|
||||
// Self-loop next rather than setting to null, so if a
|
||||
// FinalReference it remains inactive.
|
||||
r.next = r;
|
||||
queueLength--;
|
||||
if (r instanceof FinalReference) {
|
||||
|
@ -116,4 +116,20 @@ public interface Predicate<T> {
|
||||
? Objects::isNull
|
||||
: object -> targetRef.equals(object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a predicate that is the negation of the supplied predicate.
|
||||
*
|
||||
* @param <T> the type of arguments to the specified predicate
|
||||
* @param target predicate to negate
|
||||
*
|
||||
* @return a predicate that negates the results of the supplied
|
||||
* predicate
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
static <T> Predicate<T> not(Predicate<? super T> target) {
|
||||
return (Predicate<T>)target.negate();
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ import sun.security.jca.*;
|
||||
* encryption with a given key. When IVs are repeated for GCM
|
||||
* encryption, such usages are subject to forgery attacks. Thus, after
|
||||
* each encryption operation using GCM mode, callers should re-initialize
|
||||
* the cipher objects with GCM parameters which has a different IV value.
|
||||
* the cipher objects with GCM parameters which have a different IV value.
|
||||
* <pre>
|
||||
* GCMParameterSpec s = ...;
|
||||
* cipher.init(..., s);
|
||||
@ -131,6 +131,13 @@ import sun.security.jca.*;
|
||||
* ...
|
||||
*
|
||||
* </pre>
|
||||
* The ChaCha20 and ChaCha20-Poly1305 algorithms have a similar requirement
|
||||
* for unique nonces with a given key. After each encryption or decryption
|
||||
* operation, callers should re-initialize their ChaCha20 or ChaCha20-Poly1305
|
||||
* ciphers with parameters that specify a different nonce value. Please
|
||||
* see <a href="https://tools.ietf.org/html/rfc7539">RFC 7539</a> for more
|
||||
* information on the ChaCha20 and ChaCha20-Poly1305 algorithms.
|
||||
* <p>
|
||||
* Every implementation of the Java platform is required to support
|
||||
* the following standard {@code Cipher} transformations with the keysizes
|
||||
* in parentheses:
|
||||
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (c) 2018, 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.
|
||||
*/
|
||||
|
||||
package javax.crypto.spec;
|
||||
|
||||
import java.security.spec.AlgorithmParameterSpec;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* This class specifies the parameters used with the
|
||||
* <a href="https://tools.ietf.org/html/rfc7539"><i>ChaCha20</i></a>
|
||||
* algorithm.
|
||||
*
|
||||
* <p> The parameters consist of a 12-byte nonce and an initial
|
||||
* counter value expressed as a 32-bit integer.
|
||||
*
|
||||
* <p> This class can be used to initialize a {@code Cipher} object that
|
||||
* implements the <i>ChaCha20</i> algorithm.
|
||||
*
|
||||
* @since 11
|
||||
*/
|
||||
public final class ChaCha20ParameterSpec implements AlgorithmParameterSpec {
|
||||
|
||||
// The nonce length is defined by the spec as 96 bits (12 bytes) in length.
|
||||
private static final int NONCE_LENGTH = 12;
|
||||
|
||||
private final byte[] nonce;
|
||||
private final int counter;
|
||||
|
||||
/**
|
||||
* Constructs a parameter set for ChaCha20 from the given nonce
|
||||
* and counter.
|
||||
*
|
||||
* @param nonce a 12-byte nonce value
|
||||
* @param counter the initial counter value
|
||||
*
|
||||
* @throws NullPointerException if {@code nonce} is {@code null}
|
||||
* @throws IllegalArgumentException if {@code nonce} is not 12 bytes
|
||||
* in length
|
||||
*/
|
||||
public ChaCha20ParameterSpec(byte[] nonce, int counter) {
|
||||
this.counter = counter;
|
||||
|
||||
Objects.requireNonNull(nonce, "Nonce must be non-null");
|
||||
this.nonce = nonce.clone();
|
||||
if (this.nonce.length != NONCE_LENGTH) {
|
||||
throw new IllegalArgumentException(
|
||||
"Nonce must be 12-bytes in length");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the nonce value.
|
||||
*
|
||||
* @return the nonce value. This method returns a new array each time
|
||||
* this method is called.
|
||||
*/
|
||||
public byte[] getNonce() {
|
||||
return nonce.clone();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the configured counter value.
|
||||
*
|
||||
* @return the counter value
|
||||
*/
|
||||
public int getCounter() {
|
||||
return counter;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user