Merge
This commit is contained in:
commit
173ca7d953
1
.hgtags
1
.hgtags
@ -478,3 +478,4 @@ e59941f7247d451fa7df9eaef3fce0f492f8420c jdk-11+4
|
||||
d5c43e9f08fb9a7c74aae0d48daf17f2ad2afaef jdk-11+5
|
||||
3acb379b86725c47e7f33358cb22efa8752ae532 jdk-11+6
|
||||
f7363de371c9a1f668bd0a01b7df3d1ddb9cc58b jdk-11+7
|
||||
755e1b55a4dff510f9639cdb5c5e82549a7e09b3 jdk-11+8
|
||||
|
@ -80,10 +80,15 @@ ifneq ($(MAN_DIR), )
|
||||
DEPS += $(call CacheFind, $(MAN_DIR))
|
||||
endif
|
||||
|
||||
# If a specific modules_legal dir exists for this module, only pick up files
|
||||
# from there. These files were explicitly filtered or modified in <module>-copy
|
||||
# targets. For the rest, just pick up everything from the source legal dirs.
|
||||
LEGAL_NOTICES := \
|
||||
$(call uniq, $(SUPPORT_OUTPUTDIR)/modules_legal/java.base \
|
||||
$(call FindModuleLegalDirs, $(MODULE))) \
|
||||
#
|
||||
$(SUPPORT_OUTPUTDIR)/modules_legal/common \
|
||||
$(if $(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(wildcard $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)), \
|
||||
$(call FindModuleLegalSrcDirs, $(MODULE)) \
|
||||
)
|
||||
|
||||
LEGAL_NOTICES_PATH := $(call PathList, $(LEGAL_NOTICES))
|
||||
DEPS += $(call CacheFind, $(LEGAL_NOTICES))
|
||||
|
@ -81,7 +81,7 @@ AC_DEFUN([FLAGS_SETUP_LDFLAGS_HELPER],
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
BASIC_LDFLAGS_JVM_ONLY="-mno-omit-leaf-frame-pointer -mstack-alignment=16 \
|
||||
-stdlib=libstdc++ -fPIC"
|
||||
-stdlib=libc++ -fPIC"
|
||||
|
||||
elif test "x$TOOLCHAIN_TYPE" = xsolstudio; then
|
||||
BASIC_LDFLAGS="-Wl,-z,defs"
|
||||
|
@ -116,7 +116,7 @@ AC_DEFUN([FLAGS_SETUP_MACOSX_VERSION],
|
||||
# of the OS. It currently has a hard coded value. Setting this also limits
|
||||
# exposure to API changes in header files. Bumping this is likely to
|
||||
# require code changes to build.
|
||||
MACOSX_VERSION_MIN=10.7.0
|
||||
MACOSX_VERSION_MIN=10.9.0
|
||||
MACOSX_VERSION_MIN_NODOTS=${MACOSX_VERSION_MIN//\./}
|
||||
|
||||
AC_SUBST(MACOSX_VERSION_MIN)
|
||||
@ -241,7 +241,7 @@ AC_DEFUN_ONCE([FLAGS_PRE_TOOLCHAIN],
|
||||
test "x$OPENJDK_TARGET_CPU" != xmips &&
|
||||
test "x$OPENJDK_TARGET_CPU" != xmipsel &&
|
||||
test "x$OPENJDK_TARGET_CPU" != xmips64 &&
|
||||
test "x$OPENJDK_TARGET_CPU" != xmips64el; then
|
||||
test "x$OPENJDK_TARGET_CPU" != xmips64el; then
|
||||
MACHINE_FLAG="-m${OPENJDK_TARGET_CPU_BITS}"
|
||||
fi
|
||||
fi
|
||||
@ -325,22 +325,18 @@ AC_DEFUN([FLAGS_SETUP_TOOLCHAIN_CONTROL],
|
||||
|
||||
if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
|
||||
CC_OUT_OPTION=-Fo
|
||||
EXE_OUT_OPTION=-out:
|
||||
LD_OUT_OPTION=-out:
|
||||
AR_OUT_OPTION=-out:
|
||||
else
|
||||
# The option used to specify the target .o,.a or .so file.
|
||||
# When compiling, how to specify the to be created object file.
|
||||
CC_OUT_OPTION='-o$(SPACE)'
|
||||
# When linking, how to specify the to be created executable.
|
||||
EXE_OUT_OPTION='-o$(SPACE)'
|
||||
# When linking, how to specify the to be created dynamically linkable library.
|
||||
# When linking, how to specify the output
|
||||
LD_OUT_OPTION='-o$(SPACE)'
|
||||
# When archiving, how to specify the to be create static archive for object files.
|
||||
AR_OUT_OPTION='rcs$(SPACE)'
|
||||
fi
|
||||
AC_SUBST(CC_OUT_OPTION)
|
||||
AC_SUBST(EXE_OUT_OPTION)
|
||||
AC_SUBST(LD_OUT_OPTION)
|
||||
AC_SUBST(AR_OUT_OPTION)
|
||||
|
||||
|
@ -395,7 +395,6 @@ COMPILER_COMMAND_FILE_FLAG:=@COMPILER_COMMAND_FILE_FLAG@
|
||||
COMPILER_BINDCMD_FILE_FLAG:=@COMPILER_BINDCMD_FILE_FLAG@
|
||||
|
||||
CC_OUT_OPTION:=@CC_OUT_OPTION@
|
||||
EXE_OUT_OPTION:=@EXE_OUT_OPTION@
|
||||
LD_OUT_OPTION:=@LD_OUT_OPTION@
|
||||
AR_OUT_OPTION:=@AR_OUT_OPTION@
|
||||
|
||||
@ -460,11 +459,6 @@ LD:=@FIXPATH@ @LD@
|
||||
# Xcode SDK path
|
||||
SDKROOT:=@SDKROOT@
|
||||
|
||||
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
USING_BROKEN_SUSE_LD:=@USING_BROKEN_SUSE_LD@
|
||||
|
||||
# LDFLAGS used to link the jdk native libraries (C-code)
|
||||
LDFLAGS_JDKLIB:=@LDFLAGS_JDKLIB@
|
||||
JDKLIB_LIBS:=@JDKLIB_LIBS@
|
||||
|
@ -1022,24 +1022,6 @@ AC_DEFUN_ONCE([TOOLCHAIN_MISC_CHECKS],
|
||||
# This is later checked when setting flags.
|
||||
fi
|
||||
|
||||
# Check for broken SuSE 'ld' for which 'Only anonymous version tag is allowed
|
||||
# in executable.'
|
||||
USING_BROKEN_SUSE_LD=no
|
||||
if test "x$OPENJDK_TARGET_OS" = xlinux && test "x$TOOLCHAIN_TYPE" = xgcc; then
|
||||
AC_MSG_CHECKING([for broken SuSE 'ld' which only understands anonymous version tags in executables])
|
||||
$ECHO "SUNWprivate_1.1 { local: *; };" > version-script.map
|
||||
$ECHO "int main() { }" > main.c
|
||||
if $CXX -Wl,-version-script=version-script.map main.c 2>&AS_MESSAGE_LOG_FD >&AS_MESSAGE_LOG_FD; then
|
||||
AC_MSG_RESULT(no)
|
||||
USING_BROKEN_SUSE_LD=no
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
USING_BROKEN_SUSE_LD=yes
|
||||
fi
|
||||
$RM version-script.map main.c a.out
|
||||
fi
|
||||
AC_SUBST(USING_BROKEN_SUSE_LD)
|
||||
|
||||
# Setup hotspot lecagy names for toolchains
|
||||
HOTSPOT_TOOLCHAIN_TYPE=$TOOLCHAIN_TYPE
|
||||
if test "x$TOOLCHAIN_TYPE" = xclang; then
|
||||
|
@ -394,12 +394,11 @@ ifneq ($(OPENJDK_TARGET_OS), $(OPENJDK_TARGET_OS_TYPE))
|
||||
endif
|
||||
LEGAL_SUBDIRS += share/legal
|
||||
|
||||
# Find all legal dirs for a particular module
|
||||
# Find all legal src dirs for a particular module
|
||||
# $1 - Module to find legal dirs for
|
||||
FindModuleLegalDirs = \
|
||||
FindModuleLegalSrcDirs = \
|
||||
$(strip $(wildcard \
|
||||
$(addsuffix /$(strip $1), $(SUPPORT_OUTPUTDIR)/modules_legal \
|
||||
$(IMPORT_MODULES_LEGAL)) \
|
||||
$(addsuffix /$(strip $1), $(IMPORT_MODULES_LEGAL)) \
|
||||
$(foreach sub, $(LEGAL_SUBDIRS), $(addsuffix /$(strip $1)/$(sub), $(TOP_SRC_DIRS))) \
|
||||
))
|
||||
|
||||
|
@ -860,10 +860,48 @@ define SetupNativeCompilationBody
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TYPE), LIBRARY)
|
||||
# Generating a dynamic library.
|
||||
$1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
|
||||
ifeq ($$($1_TYPE), STATIC_LIBRARY)
|
||||
$1_VARDEPS := $$($1_AR) $$($1_ARFLAGS) $$($1_LIBS) \
|
||||
$$($1_EXTRA_LIBS)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
|
||||
|
||||
# Generating a static library, ie object file archive.
|
||||
ifeq ($(STATIC_BUILD), true)
|
||||
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
|
||||
STATIC_MAPFILE_DEP := $$($1_MAPFILE)
|
||||
endif
|
||||
endif
|
||||
|
||||
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
|
||||
$$(call LogInfo, Building static library $$($1_BASENAME))
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
|
||||
$$($1_RES))
|
||||
ifeq ($(STATIC_BUILD), true)
|
||||
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
|
||||
$(CP) $$($1_MAPFILE) $$(@D)/$$(basename $$(@F)).symbols
|
||||
else
|
||||
$(GetSymbols)
|
||||
endif
|
||||
endif
|
||||
else
|
||||
# A shared dynamic library or an executable binary has been specified
|
||||
ifeq ($$($1_TYPE), LIBRARY)
|
||||
# Generating a dynamic library.
|
||||
$1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
|
||||
|
||||
# Create loadmap on AIX. Helps in diagnosing some problems.
|
||||
ifneq ($(COMPILER_BINDCMD_FILE_FLAG), )
|
||||
$1_EXTRA_LDFLAGS += $(COMPILER_BINDCMD_FILE_FLAG)$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).loadmap
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
ifeq ($$($1_EMBED_MANIFEST), true)
|
||||
$1_EXTRA_LDFLAGS += -manifest:embed
|
||||
endif
|
||||
|
||||
$1_IMPORT_LIBRARY := $$($1_OBJECT_DIR)/$$($1_NAME).lib
|
||||
$1_EXTRA_LDFLAGS += "-implib:$$($1_IMPORT_LIBRARY)"
|
||||
# To properly trigger downstream dependants of the import library, just as
|
||||
@ -882,13 +920,9 @@ define SetupNativeCompilationBody
|
||||
$(TOUCH) $$@
|
||||
endif
|
||||
|
||||
# Create loadmap on AIX. Helps in diagnosing some problems.
|
||||
ifneq ($(COMPILER_BINDCMD_FILE_FLAG), )
|
||||
$1_EXTRA_LDFLAGS += $(COMPILER_BINDCMD_FILE_FLAG)$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).loadmap
|
||||
endif
|
||||
|
||||
$1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \
|
||||
$$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_CREATE_DEBUGINFO_CMDS) \
|
||||
$$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \
|
||||
$$($1_CODESIGN) $$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \
|
||||
$$($1_STRIP_CMD)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
|
||||
@ -927,8 +961,8 @@ define SetupNativeCompilationBody
|
||||
endif
|
||||
endif
|
||||
|
||||
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
|
||||
$$($1_VARDEPS_FILE)
|
||||
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
|
||||
$$($1_REAL_MAPFILE) $$($1_VARDEPS_FILE)
|
||||
ifneq ($$($1_OBJ_FILE_LIST), )
|
||||
ifeq ($$($1_LINK_OBJS_RELATIVE), true)
|
||||
$$(eval $$(call ListPathsSafely, $1_ALL_OBJS_RELATIVE, $$($1_OBJ_FILE_LIST)))
|
||||
@ -942,74 +976,21 @@ define SetupNativeCompilationBody
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
|
||||
$(LD_OUT_OPTION)$$@ $$($1_LD_OBJ_ARG) $$($1_RES) $$(GLOBAL_LIBS) \
|
||||
$$($1_LIBS) $$($1_EXTRA_LIBS)) \
|
||||
$(LD_OUT_OPTION)$$($1_TARGET) $$($1_LD_OBJ_ARG) $$($1_RES) $$(GLOBAL_LIBS) \
|
||||
$$($1_LIBS) $$($1_EXTRA_LIBS)) \
|
||||
| $(GREP) -v "^ Creating library .*\.lib and object .*\.exp" || \
|
||||
test "$$$$?" = "1" ; \
|
||||
test "$$$$?" = "1" ; \
|
||||
$$($1_CREATE_DEBUGINFO_CMDS)
|
||||
$$($1_STRIP_CMD)
|
||||
else
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$(if $$($1_LINK_OBJS_RELATIVE), $$(CD) $$(OUTPUTDIR) ; ) \
|
||||
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
|
||||
$(LD_OUT_OPTION)$$@ $$($1_LD_OBJ_ARG) $$($1_RES) $$(GLOBAL_LIBS) \
|
||||
$$($1_LIBS) $$($1_EXTRA_LIBS)) ; \
|
||||
$(LD_OUT_OPTION)$$($1_TARGET) $$($1_LD_OBJ_ARG) $$($1_RES) $$(GLOBAL_LIBS) \
|
||||
$$($1_LIBS) $$($1_EXTRA_LIBS)) ; \
|
||||
$$($1_CREATE_DEBUGINFO_CMDS)
|
||||
$$($1_STRIP_CMD)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TYPE), STATIC_LIBRARY)
|
||||
$1_VARDEPS := $$($1_AR) $$($1_ARFLAGS) $$($1_LIBS) \
|
||||
$$($1_EXTRA_LIBS)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
|
||||
|
||||
# Generating a static library, ie object file archive.
|
||||
ifeq ($(STATIC_BUILD), true)
|
||||
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
|
||||
STATIC_MAPFILE_DEP := $$($1_MAPFILE)
|
||||
endif
|
||||
endif
|
||||
|
||||
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_VARDEPS_FILE) $$(STATIC_MAPFILE_DEP)
|
||||
$$(call LogInfo, Building static library $$($1_BASENAME))
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$($1_AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_ALL_OBJS) \
|
||||
$$($1_RES))
|
||||
ifeq ($(STATIC_BUILD), true)
|
||||
ifeq ($$($1_USE_MAPFILE_FOR_SYMBOLS), true)
|
||||
$(CP) $$($1_MAPFILE) $$(@D)/$$(basename $$(@F)).symbols
|
||||
else
|
||||
$(GetSymbols)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($$($1_TYPE), EXECUTABLE)
|
||||
# A executable binary has been specified, setup the target for it.
|
||||
$1_VARDEPS := $$($1_LD) $$($1_SYSROOT_LDFLAGS) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) \
|
||||
$$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS) $$($1_MT) \
|
||||
$$($1_CODESIGN) $$($1_CREATE_DEBUGINFO_CMDS) $$($1_MANIFEST_VERSION) \
|
||||
$$($1_STRIP_CMD)
|
||||
$1_VARDEPS_FILE := $$(call DependOnVariable, $1_VARDEPS, \
|
||||
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
ifeq ($$($1_EMBED_MANIFEST), true)
|
||||
$1_EXTRA_LDFLAGS += -manifest:embed
|
||||
endif
|
||||
endif
|
||||
|
||||
$$($1_TARGET): $$($1_ALL_OBJS) $$($1_RES) $$($1_MANIFEST) \
|
||||
$$($1_VARDEPS_FILE)
|
||||
$$(call LogInfo, Linking executable $$($1_BASENAME))
|
||||
$$(call ExecuteWithLog, $$($1_OBJECT_DIR)/$$($1_SAFE_NAME)_link, \
|
||||
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
|
||||
$(EXE_OUT_OPTION)$$($1_TARGET) \
|
||||
$$($1_ALL_OBJS) $$($1_RES) \
|
||||
$$(GLOBAL_LIBS) $$($1_LIBS) $$($1_EXTRA_LIBS))
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
ifneq ($$($1_MANIFEST), )
|
||||
$$($1_MT) -nologo -manifest $$($1_MANIFEST) -identity:"$$($1_NAME).exe, version=$$($1_MANIFEST_VERSION)" -outputresource:$$@;#1
|
||||
@ -1022,9 +1003,6 @@ define SetupNativeCompilationBody
|
||||
$(CODESIGN) -s openjdk_codesign $$@
|
||||
endif
|
||||
endif
|
||||
$$($1_CREATE_DEBUGINFO_CMDS)
|
||||
$$($1_STRIP_CMD)
|
||||
|
||||
endif
|
||||
endef
|
||||
|
||||
|
@ -432,7 +432,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
target_cpu: "x64",
|
||||
dependencies: ["devkit", "autoconf"],
|
||||
configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
|
||||
"--with-macosx-version-max=10.7.0"),
|
||||
"--with-macosx-version-max=10.9.0"),
|
||||
},
|
||||
|
||||
"solaris-x64": {
|
||||
@ -472,7 +472,7 @@ var getJibProfilesProfiles = function (input, common, data) {
|
||||
build_cpu: "x64",
|
||||
dependencies: ["devkit", "autoconf", "build_devkit", "cups"],
|
||||
configure_args: [
|
||||
"--openjdk-target=aarch64-linux-gnu"
|
||||
"--openjdk-target=aarch64-linux-gnu", "--with-freetype=bundled",
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#
|
||||
|
||||
include CopyCommon.gmk
|
||||
include Modules.gmk
|
||||
include TextFileProcessing.gmk
|
||||
|
||||
$(eval $(call IncludeCustomExtension, copy/Copy-java.base.gmk))
|
||||
@ -224,12 +225,27 @@ JDK_ADDITIONAL_LICENSE_INFO ?= $(wildcard $(TOPDIR)/ADDITIONAL_LICENSE_INFO)
|
||||
|
||||
$(eval $(call SetupCopyFiles, COPY_JDK_NOTICES, \
|
||||
FILES := $(JDK_LICENSE) $(JDK_NOTICE) $(JDK_ADDITIONAL_LICENSE_INFO), \
|
||||
DEST := $(LEGAL_DST_DIR), \
|
||||
DEST := $(COMMON_LEGAL_DST_DIR), \
|
||||
FLATTEN := true, \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_JDK_NOTICES)
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Copy and filter the legal files depending on what 3rd party components are
|
||||
# bundled or linked from the OS.
|
||||
#
|
||||
ifeq ($(USE_EXTERNAL_LIBZ), true)
|
||||
LEGAL_EXCLUDES += zlib.md
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
EXCLUDES := $(LEGAL_EXCLUDES), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_LEGAL)
|
||||
|
||||
################################################################################
|
||||
# Optionally copy libffi.so.? into the the image
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#
|
||||
|
||||
include CopyCommon.gmk
|
||||
include Modules.gmk
|
||||
|
||||
$(eval $(call IncludeCustomExtension, copy/Copy-java.desktop.gmk))
|
||||
|
||||
@ -48,3 +49,34 @@ $(LIB_DST_DIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
|
||||
TARGETS += $(PSFONTPROPFILE_TARGET_FILES)
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Copy and filter the legal files depending on what 3rd party components are
|
||||
# bundled or linked from the OS.
|
||||
#
|
||||
ifeq ($(USE_EXTERNAL_LIBJPEG), true)
|
||||
LEGAL_EXCLUDES += jpeg.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LIBGIF), true)
|
||||
LEGAL_EXCLUDES += giflib.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LIBPNG), true)
|
||||
LEGAL_EXCLUDES += libpng.md
|
||||
endif
|
||||
|
||||
ifeq ($(USE_EXTERNAL_LCMS), true)
|
||||
LEGAL_EXCLUDES += lcms.md
|
||||
endif
|
||||
|
||||
ifeq ($(FREETYPE_TO_USE), system)
|
||||
LEGAL_EXCLUDES += freetype.md
|
||||
endif
|
||||
|
||||
$(eval $(call SetupCopyLegalFiles, COPY_LEGAL, \
|
||||
EXCLUDES := $(LEGAL_EXCLUDES), \
|
||||
))
|
||||
|
||||
TARGETS += $(COPY_LEGAL)
|
||||
|
||||
################################################################################
|
||||
|
@ -26,6 +26,7 @@
|
||||
LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
|
||||
CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
|
||||
LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/$(MODULE)
|
||||
COMMON_LEGAL_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_legal/common
|
||||
|
||||
################################################################################
|
||||
#
|
||||
@ -60,3 +61,24 @@ ifneq ($(wildcard $(INCLUDE_SOURCE_OS_DIR)/*), )
|
||||
|
||||
TARGETS += $(COPY_EXPORTED_INCLUDE_OS)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Setup make rules for copying legal files. This is only needed if the files
|
||||
# need to be filtered due to optional components being enabled/disabled.
|
||||
# Otherwise CreateJmods.gmk will find the legal files in the original src dirs.
|
||||
#
|
||||
# Parameter 1 is the name of the rule.
|
||||
#
|
||||
# Remaining parameters are named arguments. These include:
|
||||
# EXCLUDES : List of filenames to exclude from copy
|
||||
SetupCopyLegalFiles = $(NamedParamsMacroTemplate)
|
||||
define SetupCopyLegalFilesBody
|
||||
$$(foreach f, $$(filter-out $$(addprefix %/, $$($1_EXCLUDES)), \
|
||||
$$(wildcard $$(addsuffix /*, $$(call FindModuleLegalSrcDirs, $$(MODULE))))), \
|
||||
$$(eval $$(call SetupCopyFiles, $1_$$(notdir $$f), \
|
||||
DEST := $$(LEGAL_DST_DIR), \
|
||||
FILES := $$f, \
|
||||
)) \
|
||||
$$(eval $1 += $$($1_$$(notdir $$f))) \
|
||||
)
|
||||
endef
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -34,8 +34,7 @@ includes=\
|
||||
javax/management/ \
|
||||
org/omg/stub/javax/management/
|
||||
|
||||
excludes=\
|
||||
com/sun/jmx/snmp/
|
||||
excludes=
|
||||
|
||||
jtreg.tests=\
|
||||
com/sun/jmx/ \
|
||||
|
@ -34,6 +34,25 @@ $(eval $(call SetupBuildLauncher, pack200, \
|
||||
# The order of the object files on the link command line affects the size of the resulting
|
||||
# binary (at least on linux) which causes the size to differ between old and new build.
|
||||
|
||||
# Tell the compiler not to export any functions unless declared so in
|
||||
# the source code. On Windows, this is the default and cannot be changed.
|
||||
# On Mac, we have always exported all symbols, probably due to oversight
|
||||
# and/or misunderstanding. To emulate this, don't hide any symbols
|
||||
# by default.
|
||||
# Also provide an override for non-conformant libraries.
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
CXXFLAGS_JDKEXE += -fvisibility=hidden
|
||||
LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
|
||||
else ifeq ($(TOOLCHAIN_TYPE), clang)
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
CXXFLAGS_JDKEXE += -fvisibility=hidden
|
||||
endif
|
||||
else ifeq ($(TOOLCHAIN_TYPE), solstudio)
|
||||
CXXFLAGS_JDKEXE += -xldscope=hidden
|
||||
else ifeq ($(TOOLCHAIN_TYPE), xlc)
|
||||
CXXFLAGS_JDKEXE += -qvisibility=hidden
|
||||
endif
|
||||
|
||||
UNPACKEXE_SRC := $(TOPDIR)/src/jdk.pack/share/native/common-unpack \
|
||||
$(TOPDIR)/src/jdk.pack/share/native/unpack200
|
||||
UNPACKEXE_CFLAGS := -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
|
||||
@ -58,21 +77,6 @@ else
|
||||
|
||||
endif
|
||||
|
||||
UNPACK_MAPFILE_DIR := $(TOPDIR)/make/mapfiles/libunpack
|
||||
UNPACK_MAPFILE_PLATFORM_FILE := \
|
||||
$(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH)
|
||||
|
||||
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
ifeq ($(USING_BROKEN_SUSE_LD), yes)
|
||||
UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200.anonymous
|
||||
else ifneq ($(wildcard $(UNPACK_MAPFILE_PLATFORM_FILE)), )
|
||||
UNPACK_MAPFILE := $(UNPACK_MAPFILE_PLATFORM_FILE)
|
||||
else
|
||||
UNPACK_MAPFILE := $(UNPACK_MAPFILE_DIR)/mapfile-vers-unpack200
|
||||
endif
|
||||
|
||||
$(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
|
||||
NAME := unpack200, \
|
||||
SRC := $(UNPACKEXE_SRC), \
|
||||
@ -84,7 +88,6 @@ $(eval $(call SetupJdkExecutable, BUILD_UNPACKEXE, \
|
||||
CFLAGS_solaris := -KPIC, \
|
||||
CFLAGS_macosx := -fPIC, \
|
||||
DISABLED_WARNINGS_gcc := unused-result implicit-fallthrough, \
|
||||
MAPFILE := $(UNPACK_MAPFILE),\
|
||||
LDFLAGS := $(UNPACKEXE_ZIPOBJS) \
|
||||
$(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
|
@ -26,11 +26,9 @@
|
||||
include JdkNativeCompilation.gmk
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
DISABLE_MAPFILES := true
|
||||
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
|
||||
else
|
||||
ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
DISABLE_MAPFILES := true
|
||||
endif
|
||||
ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib/jli)
|
||||
|
||||
@ -42,8 +40,27 @@ else
|
||||
endif
|
||||
endif
|
||||
|
||||
# Tell the compiler not to export any functions unless declared so in
|
||||
# the source code. On Windows, this is the default and cannot be changed.
|
||||
# On Mac, we have always exported all symbols, probably due to oversight
|
||||
# and/or misunderstanding. To emulate this, don't hide any symbols
|
||||
# by default.
|
||||
# Also provide an override for non-conformant libraries.
|
||||
ifeq ($(TOOLCHAIN_TYPE), gcc)
|
||||
LAUNCHER_CFLAGS += -fvisibility=hidden
|
||||
LDFLAGS_JDKEXE += -Wl,--exclude-libs,ALL
|
||||
else ifeq ($(TOOLCHAIN_TYPE), clang)
|
||||
ifneq ($(OPENJDK_TARGET_OS), macosx)
|
||||
LAUNCHER_CFLAGS += -fvisibility=hidden
|
||||
endif
|
||||
else ifeq ($(TOOLCHAIN_TYPE), solstudio)
|
||||
LAUNCHER_CFLAGS += -xldscope=hidden
|
||||
else ifeq ($(TOOLCHAIN_TYPE), xlc)
|
||||
LAUNCHER_CFLAGS += -qvisibility=hidden
|
||||
endif
|
||||
|
||||
LAUNCHER_SRC := $(TOPDIR)/src/java.base/share/native/launcher
|
||||
LAUNCHER_CFLAGS := -I$(TOPDIR)/src/java.base/share/native/launcher \
|
||||
LAUNCHER_CFLAGS += -I$(TOPDIR)/src/java.base/share/native/launcher \
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjli \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
|
||||
@ -157,23 +174,6 @@ define SetupBuildLauncherBody
|
||||
$1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
|
||||
endif
|
||||
|
||||
# The linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
ifeq ($(USING_BROKEN_SUSE_LD),yes)
|
||||
ifneq ($(wildcard $(TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous), )
|
||||
$1_MAPFILE := $(TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU).anonymous
|
||||
else
|
||||
$1_MAPFILE :=
|
||||
endif
|
||||
else
|
||||
ifneq ($(wildcard $(TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)), )
|
||||
$1_MAPFILE := $(TOPDIR)/make/mapfiles/launchers/mapfile-$(OPENJDK_TARGET_CPU)
|
||||
else
|
||||
$1_MAPFILE :=
|
||||
endif
|
||||
endif
|
||||
|
||||
$$(eval $$(call SetupJdkExecutable, BUILD_LAUNCHER_$1, \
|
||||
NAME := $1, \
|
||||
EXTRA_FILES := $(LAUNCHER_SRC)/main.c, \
|
||||
@ -194,7 +194,6 @@ define SetupBuildLauncherBody
|
||||
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
|
||||
LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
|
||||
-L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
|
||||
MAPFILE := $$($1_MAPFILE), \
|
||||
LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
|
||||
LIBS_unix := $$($1_LIBS_unix), \
|
||||
LIBS_linux := -lpthread -ljli $(LIBDL), \
|
||||
|
@ -647,10 +647,11 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
|
||||
LDFLAGS := $(subst -Wl$(COMMA)-z$(COMMA)defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
|
||||
LDFLAGS_macosx := -undefined dynamic_lookup, \
|
||||
LIBS := $(BUILD_LIBFONTMANAGER_FONTLIB), \
|
||||
LIBS_unix := -lawt -ljava -ljvm $(LIBM) $(LIBCXX), \
|
||||
LIBS_aix := -lawt_headless,\
|
||||
LIBS_aix := -lawt_headless, \
|
||||
LIBS_macosx := -lawt_lwawt -framework CoreText -framework CoreFoundation \
|
||||
-framework CoreGraphics, \
|
||||
LIBS_windows := $(WIN_JAVA_LIB) advapi32.lib user32.lib gdi32.lib \
|
||||
$(WIN_AWT_LIB), \
|
||||
))
|
||||
@ -661,6 +662,10 @@ ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_HEADLESS)
|
||||
endif
|
||||
|
||||
ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
$(BUILD_LIBFONTMANAGER): $(call FindLib, java.desktop, awt_lwawt)
|
||||
endif
|
||||
|
||||
ifeq ($(FREETYPE_TO_USE), bundled)
|
||||
$(BUILD_LIBFONTMANAGER): $(BUILD_LIBFREETYPE)
|
||||
endif
|
||||
@ -989,6 +994,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
-I$(TOPDIR)/src/java.base/share/native/libjava \
|
||||
-I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
|
||||
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
|
||||
DISABLED_WARNINGS_clang := deprecated-declarations, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN) \
|
||||
-Wl$(COMMA)-rpath$(COMMA)@loader_path \
|
||||
|
@ -105,7 +105,8 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
|
||||
CFLAGS := $(CFLAGS_JDKLIB) \
|
||||
$(addprefix -I, $(LIBOSXAPP_SRC)) \
|
||||
-I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
|
||||
DISABLED_WARNINGS_clang := objc-method-access objc-root-class, \
|
||||
DISABLED_WARNINGS_clang := objc-method-access objc-root-class \
|
||||
deprecated-declarations, \
|
||||
LDFLAGS := $(LDFLAGS_JDKLIB) \
|
||||
$(call SET_SHARED_LIBRARY_ORIGIN), \
|
||||
LIBS := \
|
||||
|
@ -1,39 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2012, 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.
|
||||
#
|
||||
#
|
||||
# Specify what global symbols we export. Note that we're not really
|
||||
# interested in declaring a version, simply scoping the file is sufficient.
|
||||
#
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,40 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2012, 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.
|
||||
#
|
||||
#
|
||||
# Define anonymous library interface (i.e. without a version tag) for broken SuSE ld because
|
||||
# the linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
|
||||
{
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2013, 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.
|
||||
#
|
||||
# Specify what global symbols we export. Note that we're not really
|
||||
# interested in declaring a version, simply scoping the file is sufficient.
|
||||
#
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv; # The following are private, but as they are
|
||||
_start; # exported from ctr1/crtn, the clever hacker
|
||||
_init; # might know about them. However note, that
|
||||
_fini; # their use is strictly not supported.
|
||||
_lib_version;
|
||||
__cg92_used;
|
||||
__xargc;
|
||||
__xargv;
|
||||
__fsr_init_value;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,48 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2013, 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.
|
||||
#
|
||||
|
||||
#
|
||||
# Specify what global symbols we export. Note that we're not really
|
||||
# interested in declaring a version, simply scoping the file is sufficient.
|
||||
#
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv; # The following are private, but as they are
|
||||
_start; # exported from ctr1/crtn, the clever hacker
|
||||
_init; # might know about them. However note, that
|
||||
_fini; # their use is strictly not supported.
|
||||
_lib_version;
|
||||
__xargc;
|
||||
__xargv;
|
||||
__fsr_init_value;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,48 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2013, 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.
|
||||
#
|
||||
#
|
||||
# Specify what global symbols we export. Note that we're not really
|
||||
# interested in declaring a version, simply scoping the file is sufficient.
|
||||
#
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv; # The following are private, but as they are
|
||||
_start; # exported from ctr1/crtn, the clever hacker
|
||||
_init; # might know about them. However note, that
|
||||
_fini; # their use is strictly not supported.
|
||||
_lib_version;
|
||||
# _mcount;
|
||||
__fsr;
|
||||
__fsr_init_value;
|
||||
__longdouble_used;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,49 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2012, 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.
|
||||
#
|
||||
#
|
||||
# Define anonymous library interface (i.e. without a version tag) for broken SuSE ld because
|
||||
# the linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
|
||||
{
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv; # The following are private, but as they are
|
||||
_start; # exported from ctr1/crtn, the clever hacker
|
||||
_init; # might know about them. However note, that
|
||||
_fini; # their use is strictly not supported.
|
||||
_lib_version;
|
||||
# _mcount;
|
||||
__fsr;
|
||||
__fsr_init_value;
|
||||
__longdouble_used;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,47 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2013, 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.
|
||||
#
|
||||
#
|
||||
# Specify what global symbols we export. Note that we're not really
|
||||
# interested in declaring a version, simply scoping the file is sufficient.
|
||||
#
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
|
||||
# These are needed by the c runtime in SS12u4
|
||||
___Argv;
|
||||
__xargv;
|
||||
__xargc;
|
||||
_start;
|
||||
__longdouble_used;
|
||||
_lib_version;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,40 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2004, 2012, 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.
|
||||
#
|
||||
#
|
||||
# Define anonymous library interface (i.e. without a version tag) for broken SuSE ld because
|
||||
# the linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
|
||||
{
|
||||
global:
|
||||
main; # Provides basic adb symbol offsets
|
||||
environ; # Public symbols and required by Java run time
|
||||
_environ;
|
||||
__environ_lock;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,31 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2013, 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.
|
||||
#
|
||||
|
||||
# Define library interface.
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,42 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2013, 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.
|
||||
#
|
||||
|
||||
# Define library interface.
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
# These are needed by the c runtime in SS12u4
|
||||
environ;
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv;
|
||||
__xargv;
|
||||
__xargc;
|
||||
_start;
|
||||
_lib_version;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,43 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011, 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.
|
||||
#
|
||||
|
||||
# Define library interface.
|
||||
|
||||
SUNWprivate_1.1 {
|
||||
global:
|
||||
# These are needed by the c runtime in SS12u4
|
||||
environ;
|
||||
_environ;
|
||||
__environ_lock;
|
||||
___Argv;
|
||||
__xargv;
|
||||
__xargc;
|
||||
_start;
|
||||
__longdouble_used;
|
||||
_lib_version;
|
||||
|
||||
local:
|
||||
*;
|
||||
};
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2011, 2012, 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.
|
||||
#
|
||||
|
||||
# Define anonymous library interface (i.e. without a version tag) for broken SuSE ld because
|
||||
# the linker on older SuSE distros (e.g. on SLES 10) complains with:
|
||||
# "Invalid version tag `SUNWprivate_1.1'. Only anonymous version tag is allowed in executable."
|
||||
# if feeded with a version script which contains named tags.
|
||||
|
||||
{
|
||||
local:
|
||||
*;
|
||||
};
|
@ -63,20 +63,14 @@ class EPollSelectorImpl extends SelectorImpl {
|
||||
// maps file descriptor to selection key, synchronize on selector
|
||||
private final Map<Integer, SelectionKeyImpl> fdToKey = new HashMap<>();
|
||||
|
||||
// pending new registrations/updates, queued by implRegister and putEventOpos
|
||||
// pending new registrations/updates, queued by setEventOps
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> newKeys = new ArrayDeque<>();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
// interrupt triggering and clearing
|
||||
private final Object interruptLock = new Object();
|
||||
private boolean interruptTriggered;
|
||||
|
||||
/**
|
||||
* Package private constructor called by factory method in
|
||||
* the abstract superclass Selector.
|
||||
*/
|
||||
EPollSelectorImpl(SelectorProvider sp) throws IOException {
|
||||
super(sp);
|
||||
|
||||
@ -140,30 +134,21 @@ class EPollSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process new registrations and changes to the interest ops.
|
||||
* Process changes to the interest ops.
|
||||
*/
|
||||
private void processUpdateQueue() {
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
synchronized (updateLock) {
|
||||
SelectionKeyImpl ski;
|
||||
|
||||
// new registrations
|
||||
while ((ski = newKeys.pollFirst()) != null) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.channel.getFDVal();
|
||||
SelectionKeyImpl previous = fdToKey.put(fd, ski);
|
||||
assert previous == null;
|
||||
assert ski.registeredEvents() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// changes to interest ops
|
||||
assert updateKeys.size() == updateEvents.size();
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int newEvents = updateEvents.pollFirst();
|
||||
int fd = ski.channel.getFDVal();
|
||||
if (ski.isValid() && fdToKey.containsKey(fd)) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.getFDVal();
|
||||
// add to fdToKey if needed
|
||||
SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
|
||||
assert (previous == null) || (previous == ski);
|
||||
|
||||
int newEvents = ski.translateInterestOps();
|
||||
int registeredEvents = ski.registeredEvents();
|
||||
if (newEvents != registeredEvents) {
|
||||
if (newEvents == 0) {
|
||||
@ -206,11 +191,11 @@ class EPollSelectorImpl extends SelectorImpl {
|
||||
if (ski != null) {
|
||||
int rOps = EPoll.getEvents(event);
|
||||
if (selectedKeys.contains(ski)) {
|
||||
if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
|
||||
if (ski.translateAndUpdateReadyOps(rOps)) {
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else {
|
||||
ski.channel.translateAndSetReadyOps(rOps, ski);
|
||||
ski.translateAndSetReadyOps(rOps);
|
||||
if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(ski);
|
||||
numKeysUpdated++;
|
||||
@ -243,20 +228,12 @@ class EPollSelectorImpl extends SelectorImpl {
|
||||
FileDispatcherImpl.closeIntFD(fd1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implRegister(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
newKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implDereg(SelectionKeyImpl ski) throws IOException {
|
||||
assert !ski.isValid();
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
int fd = ski.channel.getFDVal();
|
||||
int fd = ski.getFDVal();
|
||||
if (fdToKey.remove(fd) != null) {
|
||||
if (ski.registeredEvents() != 0) {
|
||||
EPoll.ctl(epfd, EPOLL_CTL_DEL, fd, 0);
|
||||
@ -268,10 +245,9 @@ class EPollSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
@ -62,11 +62,9 @@ class KQueueSelectorImpl extends SelectorImpl {
|
||||
// maps file descriptor to selection key, synchronize on selector
|
||||
private final Map<Integer, SelectionKeyImpl> fdToKey = new HashMap<>();
|
||||
|
||||
// pending new registrations/updates, queued by implRegister and putEventOps
|
||||
// pending new registrations/updates, queued by setEventOps
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> newKeys = new ArrayDeque<>();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
// interrupt triggering and clearing
|
||||
private final Object interruptLock = new Object();
|
||||
@ -138,30 +136,21 @@ class KQueueSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process new registrations and changes to the interest ops.
|
||||
* Process changes to the interest ops.
|
||||
*/
|
||||
private void processUpdateQueue() {
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
synchronized (updateLock) {
|
||||
SelectionKeyImpl ski;
|
||||
|
||||
// new registrations
|
||||
while ((ski = newKeys.pollFirst()) != null) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.channel.getFDVal();
|
||||
SelectionKeyImpl previous = fdToKey.put(fd, ski);
|
||||
assert previous == null;
|
||||
assert ski.registeredEvents() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// changes to interest ops
|
||||
assert updateKeys.size() == updateKeys.size();
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int newEvents = updateEvents.pollFirst();
|
||||
int fd = ski.channel.getFDVal();
|
||||
if (ski.isValid() && fdToKey.containsKey(fd)) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.getFDVal();
|
||||
// add to fdToKey if needed
|
||||
SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
|
||||
assert (previous == null) || (previous == ski);
|
||||
|
||||
int newEvents = ski.translateInterestOps();
|
||||
int registeredEvents = ski.registeredEvents();
|
||||
if (newEvents != registeredEvents) {
|
||||
|
||||
@ -227,18 +216,15 @@ class KQueueSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
if (selectedKeys.contains(ski)) {
|
||||
// file descriptor may be polled more than once per poll
|
||||
if (ski.lastPolled != pollCount) {
|
||||
if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
|
||||
if (ski.translateAndUpdateReadyOps(rOps)) {
|
||||
// file descriptor may be polled more than once per poll
|
||||
if (ski.lastPolled != pollCount) {
|
||||
numKeysUpdated++;
|
||||
ski.lastPolled = pollCount;
|
||||
}
|
||||
} else {
|
||||
// ready ops have already been set on this update
|
||||
ski.channel.translateAndUpdateReadyOps(rOps, ski);
|
||||
}
|
||||
} else {
|
||||
ski.channel.translateAndSetReadyOps(rOps, ski);
|
||||
ski.translateAndSetReadyOps(rOps);
|
||||
if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(ski);
|
||||
numKeysUpdated++;
|
||||
@ -272,20 +258,12 @@ class KQueueSelectorImpl extends SelectorImpl {
|
||||
FileDispatcherImpl.closeIntFD(fd1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implRegister(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
newKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implDereg(SelectionKeyImpl ski) throws IOException {
|
||||
assert !ski.isValid();
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
int fd = ski.channel.getFDVal();
|
||||
int fd = ski.getFDVal();
|
||||
int registeredEvents = ski.registeredEvents();
|
||||
if (fdToKey.remove(fd) != null) {
|
||||
if (registeredEvents != 0) {
|
||||
@ -301,10 +279,9 @@ class KQueueSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -3529,7 +3529,7 @@ public final class Class<T> implements java.io.Serializable,
|
||||
if (universe == null)
|
||||
throw new IllegalArgumentException(
|
||||
getName() + " is not an enum type");
|
||||
directory = new HashMap<>(2 * universe.length);
|
||||
directory = new HashMap<>((int)(universe.length / 0.75f) + 1);
|
||||
for (T constant : universe) {
|
||||
directory.put(((Enum<?>)constant).name(), constant);
|
||||
}
|
||||
|
@ -699,7 +699,7 @@ public abstract class ClassLoader {
|
||||
/**
|
||||
* Finds the class with the given <a href="#binary-name">binary name</a>
|
||||
* in a module defined to this class loader.
|
||||
* Class loader implementations that support the loading from modules
|
||||
* Class loader implementations that support loading from modules
|
||||
* should override this method.
|
||||
*
|
||||
* @apiNote This method returns {@code null} rather than throwing
|
||||
@ -1281,7 +1281,7 @@ public abstract class ClassLoader {
|
||||
|
||||
/**
|
||||
* Returns a URL to a resource in a module defined to this class loader.
|
||||
* Class loader implementations that support the loading from modules
|
||||
* Class loader implementations that support loading from modules
|
||||
* should override this method.
|
||||
*
|
||||
* @apiNote This method is the basis for the {@link
|
||||
@ -1417,12 +1417,12 @@ public abstract class ClassLoader {
|
||||
* @param name
|
||||
* The resource name
|
||||
*
|
||||
* @return An enumeration of {@link java.net.URL URL} objects for
|
||||
* the resource. If no resources could be found, the enumeration
|
||||
* will be empty. Resources for which a {@code URL} cannot be
|
||||
* constructed, are in package that is not opened unconditionally,
|
||||
* or access to the resource is denied by the security manager,
|
||||
* are not returned in the enumeration.
|
||||
* @return An enumeration of {@link java.net.URL URL} objects for the
|
||||
* resource. If no resources could be found, the enumeration will
|
||||
* be empty. Resources for which a {@code URL} cannot be
|
||||
* constructed, are in a package that is not opened
|
||||
* unconditionally, or access to the resource is denied by the
|
||||
* security manager, are not returned in the enumeration.
|
||||
*
|
||||
* @throws IOException
|
||||
* If I/O errors occur
|
||||
|
@ -152,7 +152,7 @@ public final class ModuleLayer {
|
||||
private static final ModuleLayer EMPTY_LAYER
|
||||
= new ModuleLayer(Configuration.empty(), List.of(), null);
|
||||
|
||||
// the configuration from which this ;ayer was created
|
||||
// the configuration from which this layer was created
|
||||
private final Configuration cf;
|
||||
|
||||
// parent layers, empty in the case of the empty layer
|
||||
@ -498,7 +498,7 @@ public final class ModuleLayer {
|
||||
try {
|
||||
Loader loader = new Loader(cf.modules(), parentLoader);
|
||||
loader.initRemotePackageMap(cf, parents);
|
||||
ModuleLayer layer = new ModuleLayer(cf, parents, mn -> loader);
|
||||
ModuleLayer layer = new ModuleLayer(cf, parents, mn -> loader);
|
||||
return new Controller(layer);
|
||||
} catch (IllegalArgumentException | IllegalStateException e) {
|
||||
throw new LayerInstantiationException(e.getMessage());
|
||||
|
@ -1742,7 +1742,7 @@ public class ModuleDescriptor
|
||||
throw new IllegalArgumentException("Empty target set");
|
||||
if (strict) {
|
||||
requirePackageName(e.source());
|
||||
targets.stream().forEach(Checks::requireModuleName);
|
||||
targets.forEach(Checks::requireModuleName);
|
||||
}
|
||||
return exports(e);
|
||||
}
|
||||
@ -1878,7 +1878,7 @@ public class ModuleDescriptor
|
||||
throw new IllegalArgumentException("Empty target set");
|
||||
if (strict) {
|
||||
requirePackageName(opens.source());
|
||||
targets.stream().forEach(Checks::requireModuleName);
|
||||
targets.forEach(Checks::requireModuleName);
|
||||
}
|
||||
return opens(opens);
|
||||
}
|
||||
|
@ -593,8 +593,7 @@ public class Proxy implements java.io.Serializable {
|
||||
module.getName(), cn, loader);
|
||||
}
|
||||
if (isDebug("debug")) {
|
||||
interfaces.stream()
|
||||
.forEach(c -> System.out.println(toDetails(c)));
|
||||
interfaces.forEach(c -> System.out.println(toDetails(c)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,10 @@ class InetAddress implements java.io.Serializable {
|
||||
/* Used to store the name service provider */
|
||||
private static transient NameService nameService = null;
|
||||
|
||||
/* Used to store the best available hostname */
|
||||
/**
|
||||
* Used to store the best available hostname.
|
||||
* Lazily initialized via a data race; safe because Strings are immutable.
|
||||
*/
|
||||
private transient String canonicalHostName = null;
|
||||
|
||||
/** use serialVersionUID from JDK 1.0.2 for interoperability */
|
||||
@ -622,11 +625,11 @@ class InetAddress implements java.io.Serializable {
|
||||
* @since 1.4
|
||||
*/
|
||||
public String getCanonicalHostName() {
|
||||
if (canonicalHostName == null) {
|
||||
canonicalHostName =
|
||||
String value = canonicalHostName;
|
||||
if (value == null)
|
||||
canonicalHostName = value =
|
||||
InetAddress.getHostFromNameService(this, true);
|
||||
}
|
||||
return canonicalHostName;
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1411,7 +1411,7 @@ public final class URL implements java.io.Serializable {
|
||||
// Check with factory if another thread set a
|
||||
// factory since our last check
|
||||
if (!checkedWithFactory && (fac = factory) != null) {
|
||||
handler2 = fac.createURLStreamHandler(protocol);
|
||||
handler2 = fac.createURLStreamHandler(protocol);
|
||||
}
|
||||
|
||||
if (handler2 != null) {
|
||||
|
@ -764,7 +764,7 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
|
||||
path = ParseUtil.decode(path);
|
||||
if (path.endsWith(File.separator))
|
||||
path += "-";
|
||||
p = new FilePermission(path, SecurityConstants.FILE_READ_ACTION);
|
||||
p = new FilePermission(path, SecurityConstants.FILE_READ_ACTION);
|
||||
} else {
|
||||
/**
|
||||
* Not loading from a 'file:' URL so we want to give the class
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE HTML>
|
||||
<!--
|
||||
Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1998, 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,7 +35,7 @@ alter the mechanisms and behavior of the various classes of the
|
||||
java.net package. Some are checked only once at startup of the VM,
|
||||
and therefore are best set using the -D option of the java command,
|
||||
while others have a more dynamic nature and can also be changed using
|
||||
the <a href="../../lang/System.html#setProperty-java.lang.String-java.lang.String-">System.setProperty()</a> API.
|
||||
the <a href="../../lang/System.html#setProperty(java.lang.String,java.lang.String)">System.setProperty()</a> API.
|
||||
The purpose of this document is to list
|
||||
and detail all of these properties.</P>
|
||||
<P>If there is no special note, a property value is checked every time it is used.</P>
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 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
|
||||
@ -312,7 +312,7 @@ public class ChoiceFormat extends NumberFormat {
|
||||
* Constructs with limits and corresponding formats based on the pattern.
|
||||
*
|
||||
* @param newPattern the new pattern string
|
||||
* @exception NullPointerExcpetion if {@code newPattern} is
|
||||
* @exception NullPointerException if {@code newPattern} is
|
||||
* {@code null}
|
||||
* @see #applyPattern
|
||||
*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1998, 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
|
||||
@ -371,7 +371,7 @@ of common operations like making a Collection out of an array, and
|
||||
would do away with many useful facilities (like synchronizing
|
||||
wrappers). One view that we see as being particularly useful is
|
||||
<a href=
|
||||
"../List.html#subList-int-int-">List.subList</a>.
|
||||
"../List.html#subList(int,int)">List.subList</a>.
|
||||
The existence of this method means that people who write methods
|
||||
taking List on input do not have to write secondary forms taking an
|
||||
offset and a length (as they do for arrays).</p>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1998, 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
|
||||
@ -258,7 +258,7 @@ table:</p>
|
||||
restrictions on the elements they may contain. They are
|
||||
unsynchronized, but the <code>Collections</code> class contains static
|
||||
factories called <a href=
|
||||
"../Collections.html#synchronizedCollection-java.util.Collection-">
|
||||
"../Collections.html#synchronizedCollection(java.util.Collection)">
|
||||
<em>synchronization wrappers</em></a> that can be used to add
|
||||
synchronization to many unsynchronized collections. All of the new
|
||||
implementations have <i>fail-fast iterators</i>, which detect
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1998, 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
|
||||
@ -177,7 +177,7 @@ interface.</li>
|
||||
interface. An insertion-ordered <code>Map</code> implementation that
|
||||
runs nearly as fast as <code>HashMap</code>. Also useful for building
|
||||
caches (see <a href=
|
||||
"../LinkedHashMap.html#removeEldestEntry-java.util.Map.Entry-">
|
||||
"../LinkedHashMap.html#removeEldestEntry(java.util.Map.Entry)">
|
||||
removeEldestEntry(Map.Entry)</a> ).</li>
|
||||
</ul>
|
||||
</li>
|
||||
@ -186,13 +186,13 @@ Functionality-enhancing implementations for use with other
|
||||
implementations. Accessed solely through static factory methods.
|
||||
<ul>
|
||||
<li><a href=
|
||||
"../Collections.html#unmodifiableCollection-java.util.Collection-">
|
||||
"../Collections.html#unmodifiableCollection(java.util.Collection)">
|
||||
<strong>Collections.unmodifiable<i>Interface</i></strong></a> -
|
||||
Returns an unmodifiable view of a specified collection that throws
|
||||
an <code>UnsupportedOperationException</code> if the user attempts to
|
||||
modify it.</li>
|
||||
<li><a href=
|
||||
"../Collections.html#synchronizedCollection-java.util.Collection-"
|
||||
"../Collections.html#synchronizedCollection(java.util.Collection)"
|
||||
id=
|
||||
"synchWrappers"><strong>Collections.synchronized<i>Interface</i></strong></a>
|
||||
- Returns a synchronized collection that is backed by the specified
|
||||
@ -200,7 +200,7 @@ id=
|
||||
the backing collection are through the returned collection, thread
|
||||
safety is guaranteed.</li>
|
||||
<li><a href=
|
||||
"../Collections.html#checkedCollection-java.util.Collection-java.lang.Class-">
|
||||
"../Collections.html#checkedCollection(java.util.Collection,java.lang.Class)">
|
||||
<strong>Collections.checked<i>Interface</i></strong></a> - Returns
|
||||
a dynamically type-safe view of the specified collection, which
|
||||
throws a <code>ClassCastException</code> if a client attempts to add an
|
||||
@ -214,12 +214,12 @@ possibility.</li>
|
||||
adapt one collections interface to another:
|
||||
<ul>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#newSetFromMap-java.util.Map-">
|
||||
"../Collections.html#newSetFromMap(java.util.Map)">
|
||||
newSetFromMap(Map)</a></strong> - Creates a general-purpose
|
||||
<code>Set</code> implementation from a general-purpose <code>Map</code>
|
||||
implementation.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#asLifoQueue-java.util.Deque-">
|
||||
"../Collections.html#asLifoQueue(java.util.Deque)">
|
||||
asLifoQueue(Deque)</a></strong> - Returns a view of a
|
||||
<code>Deque</code> as a Last In First Out (LIFO) <code>Queue</code>.</li>
|
||||
</ul>
|
||||
@ -228,25 +228,25 @@ asLifoQueue(Deque)</a></strong> - Returns a view of a
|
||||
"mini-implementations" of the collection interfaces.
|
||||
<ul>
|
||||
<li><a href=
|
||||
"../Arrays.html#asList-T...-"><strong>Arrays.asList</strong></a>
|
||||
"../Arrays.html#asList(T...)"><strong>Arrays.asList</strong></a>
|
||||
- Enables an array to be viewed as a list.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#emptySet--">emptySet</a>,
|
||||
"../Collections.html#emptySet()">emptySet</a>,
|
||||
<a href=
|
||||
"../Collections.html#emptyList--">emptyList</a>
|
||||
"../Collections.html#emptyList()">emptyList</a>
|
||||
and <a href=
|
||||
"../Collections.html#emptyMap--">emptyMap</a></strong>
|
||||
"../Collections.html#emptyMap()">emptyMap</a></strong>
|
||||
- Return an immutable empty set, list, or map.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#singleton-java.lang.Object-">
|
||||
"../Collections.html#singleton(java.lang.Object)">
|
||||
singleton</a>, <a href=
|
||||
"../Collections.html#singletonList-java.lang.Object-">
|
||||
"../Collections.html#singletonList(java.lang.Object)">
|
||||
singletonList</a>, and <a href=
|
||||
"../Collections.html#singletonMap-K-V-">singletonMap</a></strong>
|
||||
"../Collections.html#singletonMap(K,V)">singletonMap</a></strong>
|
||||
- Return an immutable singleton set, list, or map, containing only
|
||||
the specified object (or key-value mapping).</li>
|
||||
<li><a href=
|
||||
"../Collections.html#nCopies-int-T-"><strong>
|
||||
"../Collections.html#nCopies(int,T)"><strong>
|
||||
nCopies</strong></a> - Returns an immutable list consisting of n
|
||||
copies of a specified object.</li>
|
||||
</ul>
|
||||
@ -410,71 +410,71 @@ access data store (such as a linked list).</li>
|
||||
class contains these useful static methods.
|
||||
<ul>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#sort-java.util.List-">sort(List)</a></strong>
|
||||
"../Collections.html#sort(java.util.List)">sort(List)</a></strong>
|
||||
- Sorts a list using a merge sort algorithm, which provides average
|
||||
case performance comparable to a high quality quicksort, guaranteed
|
||||
O(n*log n) performance (unlike quicksort), and <em>stability</em>
|
||||
(unlike quicksort). A stable sort is one that does not reorder
|
||||
equal elements.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#binarySearch-java.util.List-T-">
|
||||
"../Collections.html#binarySearch(java.util.List,T)">
|
||||
binarySearch(List, Object)</a></strong> - Searches for an element
|
||||
in an ordered list using the binary search algorithm.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#reverse-java.util.List-">reverse(List)</a></strong>
|
||||
"../Collections.html#reverse(java.util.List)">reverse(List)</a></strong>
|
||||
- Reverses the order of the elements in a list.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#shuffle-java.util.List-">shuffle(List)</a></strong>
|
||||
"../Collections.html#shuffle(java.util.List)">shuffle(List)</a></strong>
|
||||
- Randomly changes the order of the elements in a list.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#fill-java.util.List-T-">
|
||||
"../Collections.html#fill(java.util.List,T)">
|
||||
fill(List, Object)</a></strong> - Overwrites every element in a
|
||||
list with the specified value.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#copy-java.util.List-java.util.List-">
|
||||
"../Collections.html#copy-java.util.List(java.util.List)">
|
||||
copy(List dest, List src)</a></strong> - Copies the source list
|
||||
into the destination list.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#min-java.util.Collection-">
|
||||
"../Collections.html#min(java.util.Collection)">
|
||||
min(Collection)</a></strong> - Returns the minimum element in a
|
||||
collection.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#max-java.util.Collection-">
|
||||
"../Collections.html#max(java.util.Collection)">
|
||||
max(Collection)</a></strong> - Returns the maximum element in a
|
||||
collection.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#rotate-java.util.List-int-">
|
||||
"../Collections.html#rotate(java.util.List,int)">
|
||||
rotate(List list, int distance)</a></strong> - Rotates all of the
|
||||
elements in the list by the specified distance.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#replaceAll-java.util.List-T-T-">
|
||||
"../Collections.html#replaceAll(java.util.List,T,T)">
|
||||
replaceAll(List list, Object oldVal, Object newVal)</a></strong> -
|
||||
Replaces all occurrences of one specified value with another.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#indexOfSubList-java.util.List-java.util.List-">
|
||||
"../Collections.html#indexOfSubList(java.util.List,java.util.List)">
|
||||
indexOfSubList(List source, List target)</a></strong> - Returns the
|
||||
index of the first sublist of source that is equal to target.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#lastIndexOfSubList-java.util.List-java.util.List-">
|
||||
"../Collections.html#lastIndexOfSubList(java.util.List,java.util.List)">
|
||||
lastIndexOfSubList(List source, List target)</a></strong> - Returns
|
||||
the index of the last sublist of source that is equal to
|
||||
target.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#swap-java.util.List-int-int-">
|
||||
"../Collections.html#swap(java.util.List,int,int)">
|
||||
swap(List, int, int)</a></strong> - Swaps the elements at the
|
||||
specified positions in the specified list.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#frequency-java.util.Collection-java.lang.Object-">
|
||||
"../Collections.html#frequency(java.util.Collection,java.lang.Object)">
|
||||
frequency(Collection, Object)</a></strong> - Counts the number of
|
||||
times the specified element occurs in the specified
|
||||
collection.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#disjoint-java.util.Collection-java.util.Collection-">
|
||||
"../Collections.html#disjoint(java.util.Collection,java.util.Collection)">
|
||||
disjoint(Collection, Collection)</a></strong> - Determines whether
|
||||
two collections are disjoint, in other words, whether they contain
|
||||
no elements in common.</li>
|
||||
<li><strong><a href=
|
||||
"../Collections.html#addAll-java.util.Collection-T...-">
|
||||
"../Collections.html#addAll(java.util.Collection,T...)">
|
||||
addAll(Collection<? super T>, T...)</a></strong> - Adds all
|
||||
of the elements in the specified array to the specified
|
||||
collection.</li>
|
||||
|
@ -100,8 +100,8 @@ public class BootLoader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a module with this class loader so that its classes (and
|
||||
* resources) become visible via this class loader.
|
||||
* Registers a module with this class loader so that its classes
|
||||
* (and resources) become visible via this class loader.
|
||||
*/
|
||||
public static void loadModule(ModuleReference mref) {
|
||||
ClassLoaders.bootLoader().loadModule(mref);
|
||||
|
@ -584,7 +584,7 @@ public class BuiltinClassLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* A variation of {@code loadCass} to load a class with the specified
|
||||
* A variation of {@code loadClass} to load a class with the specified
|
||||
* binary name. This method returns {@code null} when the class is not
|
||||
* found.
|
||||
*/
|
||||
@ -633,16 +633,16 @@ public class BuiltinClassLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* A variation of {@code loadCass} to load a class with the specified
|
||||
* A variation of {@code loadClass} to load a class with the specified
|
||||
* binary name. This method returns {@code null} when the class is not
|
||||
* found.
|
||||
*/
|
||||
protected Class<?> loadClassOrNull(String cn) {
|
||||
protected Class<?> loadClassOrNull(String cn) {
|
||||
return loadClassOrNull(cn, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the candidate loaded module for the given class name.
|
||||
* Finds the candidate loaded module for the given class name.
|
||||
* Returns {@code null} if none of the modules defined to this
|
||||
* class loader contain the API package for the class.
|
||||
*/
|
||||
@ -656,7 +656,7 @@ public class BuiltinClassLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the candidate loaded module for the given class name
|
||||
* Finds the candidate loaded module for the given class name
|
||||
* in the named module. Returns {@code null} if the named module
|
||||
* is not defined to this class loader or does not contain
|
||||
* the API package for the class.
|
||||
@ -832,8 +832,8 @@ public class BuiltinClassLoader
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Package with the specified package name. If defined
|
||||
* then verify that it against the manifest and code source.
|
||||
* Gets the Package with the specified package name. If defined
|
||||
* then verifies it against the manifest and code source.
|
||||
*
|
||||
* @throws SecurityException if there is a sealing violation (JAR spec)
|
||||
*/
|
||||
@ -859,7 +859,7 @@ public class BuiltinClassLoader
|
||||
|
||||
/**
|
||||
* Defines a new package in this ClassLoader. The attributes in the specified
|
||||
* Manifest are use to get the package version and sealing information.
|
||||
* Manifest are used to get the package version and sealing information.
|
||||
*
|
||||
* @throws IllegalArgumentException if the package name duplicates an
|
||||
* existing package either in this class loader or one of its ancestors
|
||||
@ -976,7 +976,7 @@ public class BuiltinClassLoader
|
||||
// -- miscellaneous supporting methods
|
||||
|
||||
/**
|
||||
* Returns the ModuleReader for the given module, creating it if needed
|
||||
* Returns the ModuleReader for the given module, creating it if needed.
|
||||
*/
|
||||
private ModuleReader moduleReaderFor(ModuleReference mref) {
|
||||
ModuleReader reader = moduleToReader.get(mref);
|
||||
|
@ -90,7 +90,7 @@ public final class Loader extends SecureClassLoader {
|
||||
ClassLoader.registerAsParallelCapable();
|
||||
}
|
||||
|
||||
// the loader pool is in a pool, can be null
|
||||
// the pool this loader is a member of; can be null
|
||||
private final LoaderPool pool;
|
||||
|
||||
// parent ClassLoader, can be null
|
||||
@ -487,7 +487,7 @@ public final class Loader extends SecureClassLoader {
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the class with the specified binary name in a given module.
|
||||
* Finds the class with the specified binary name in the given module.
|
||||
* This method returns {@code null} if the class cannot be found.
|
||||
*/
|
||||
@Override
|
||||
|
@ -35,7 +35,6 @@ import java.util.Collections;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Consumer;
|
||||
@ -76,16 +75,15 @@ public class ModuleHashesBuilder {
|
||||
// build a graph containing the packaged modules and
|
||||
// its transitive dependences matching --hash-modules
|
||||
Graph.Builder<String> builder = new Graph.Builder<>();
|
||||
Deque<ResolvedModule> deque = new ArrayDeque<>(configuration.modules());
|
||||
Deque<ResolvedModule> todo = new ArrayDeque<>(configuration.modules());
|
||||
Set<ResolvedModule> visited = new HashSet<>();
|
||||
while (!deque.isEmpty()) {
|
||||
ResolvedModule rm = deque.pop();
|
||||
if (!visited.contains(rm)) {
|
||||
visited.add(rm);
|
||||
ResolvedModule rm;
|
||||
while ((rm = todo.poll()) != null) {
|
||||
if (visited.add(rm)) {
|
||||
builder.addNode(rm.name());
|
||||
for (ResolvedModule dm : rm.reads()) {
|
||||
if (!visited.contains(dm)) {
|
||||
deque.push(dm);
|
||||
todo.push(dm);
|
||||
}
|
||||
builder.addEdge(rm.name(), dm.name());
|
||||
}
|
||||
@ -173,7 +171,7 @@ public class ModuleHashesBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverse this graph and performs the given action in topological order
|
||||
* Traverses this graph and performs the given action in topological order.
|
||||
*/
|
||||
public void ordered(Consumer<T> action) {
|
||||
TopoSorter<T> sorter = new TopoSorter<>(this);
|
||||
@ -181,7 +179,7 @@ public class ModuleHashesBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Traverses this graph and performs the given action in reverse topological order
|
||||
* Traverses this graph and performs the given action in reverse topological order.
|
||||
*/
|
||||
public void reverse(Consumer<T> action) {
|
||||
TopoSorter<T> sorter = new TopoSorter<>(this);
|
||||
@ -189,15 +187,14 @@ public class ModuleHashesBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a transposed graph from this graph
|
||||
* Returns a transposed graph from this graph.
|
||||
*/
|
||||
public Graph<T> transpose() {
|
||||
Builder<T> builder = new Builder<>();
|
||||
nodes.stream().forEach(builder::addNode);
|
||||
nodes.forEach(builder::addNode);
|
||||
// reverse edges
|
||||
edges.keySet().forEach(u -> {
|
||||
edges.get(u).stream()
|
||||
.forEach(v -> builder.addEdge(v, u));
|
||||
edges.get(u).forEach(v -> builder.addEdge(v, u));
|
||||
});
|
||||
return builder.build();
|
||||
}
|
||||
@ -213,17 +210,14 @@ public class ModuleHashesBuilder {
|
||||
* Returns all nodes reachable from the given set of roots.
|
||||
*/
|
||||
public Set<T> dfs(Set<T> roots) {
|
||||
Deque<T> deque = new LinkedList<>(roots);
|
||||
ArrayDeque<T> todo = new ArrayDeque<>(roots);
|
||||
Set<T> visited = new HashSet<>();
|
||||
while (!deque.isEmpty()) {
|
||||
T u = deque.pop();
|
||||
if (!visited.contains(u)) {
|
||||
visited.add(u);
|
||||
if (contains(u)) {
|
||||
adjacentNodes(u).stream()
|
||||
.filter(v -> !visited.contains(v))
|
||||
.forEach(deque::push);
|
||||
}
|
||||
T u;
|
||||
while ((u = todo.poll()) != null) {
|
||||
if (visited.add(u) && contains(u)) {
|
||||
adjacentNodes(u).stream()
|
||||
.filter(v -> !visited.contains(v))
|
||||
.forEach(todo::push);
|
||||
}
|
||||
}
|
||||
return visited;
|
||||
@ -231,8 +225,8 @@ public class ModuleHashesBuilder {
|
||||
|
||||
public void printGraph(PrintStream out) {
|
||||
out.println("graph for " + nodes);
|
||||
nodes.stream()
|
||||
.forEach(u -> adjacentNodes(u).stream()
|
||||
nodes
|
||||
.forEach(u -> adjacentNodes(u)
|
||||
.forEach(v -> out.format(" %s -> %s%n", u, v)));
|
||||
}
|
||||
|
||||
@ -241,11 +235,9 @@ public class ModuleHashesBuilder {
|
||||
final Map<T, Set<T>> edges = new HashMap<>();
|
||||
|
||||
public void addNode(T node) {
|
||||
if (nodes.contains(node)) {
|
||||
return;
|
||||
if (nodes.add(node)) {
|
||||
edges.computeIfAbsent(node, _e -> new HashSet<>());
|
||||
}
|
||||
nodes.add(node);
|
||||
edges.computeIfAbsent(node, _e -> new HashSet<>());
|
||||
}
|
||||
|
||||
public void addEdge(T u, T v) {
|
||||
@ -264,18 +256,16 @@ public class ModuleHashesBuilder {
|
||||
* Topological sort
|
||||
*/
|
||||
private static class TopoSorter<T> {
|
||||
final Deque<T> result = new LinkedList<>();
|
||||
final Deque<T> nodes;
|
||||
final Deque<T> result = new ArrayDeque<>();
|
||||
final Graph<T> graph;
|
||||
|
||||
TopoSorter(Graph<T> graph) {
|
||||
this.graph = graph;
|
||||
this.nodes = new LinkedList<>(graph.nodes);
|
||||
sort();
|
||||
}
|
||||
|
||||
public void ordered(Consumer<T> action) {
|
||||
result.iterator().forEachRemaining(action);
|
||||
result.forEach(action);
|
||||
}
|
||||
|
||||
public void reverse(Consumer<T> action) {
|
||||
@ -283,29 +273,26 @@ public class ModuleHashesBuilder {
|
||||
}
|
||||
|
||||
private void sort() {
|
||||
Deque<T> visited = new LinkedList<>();
|
||||
Deque<T> done = new LinkedList<>();
|
||||
T node;
|
||||
while ((node = nodes.poll()) != null) {
|
||||
if (!visited.contains(node)) {
|
||||
visit(node, visited, done);
|
||||
}
|
||||
}
|
||||
Set<T> visited = new HashSet<>();
|
||||
Deque<T> stack = new ArrayDeque<>();
|
||||
graph.nodes.forEach(node -> visit(node, visited, stack));
|
||||
}
|
||||
|
||||
private void visit(T node, Deque<T> visited, Deque<T> done) {
|
||||
if (visited.contains(node)) {
|
||||
if (!done.contains(node)) {
|
||||
throw new IllegalArgumentException("Cyclic detected: " +
|
||||
node + " " + graph.edges().get(node));
|
||||
}
|
||||
return;
|
||||
private Set<T> children(T node) {
|
||||
return graph.edges().get(node);
|
||||
}
|
||||
|
||||
private void visit(T node, Set<T> visited, Deque<T> stack) {
|
||||
if (visited.add(node)) {
|
||||
stack.push(node);
|
||||
children(node).forEach(child -> visit(child, visited, stack));
|
||||
stack.pop();
|
||||
result.addLast(node);
|
||||
}
|
||||
else if (stack.contains(node)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Cycle detected: " + node + " -> " + children(node));
|
||||
}
|
||||
visited.add(node);
|
||||
graph.edges().get(node).stream()
|
||||
.forEach(x -> visit(x, visited, done));
|
||||
done.add(node);
|
||||
result.addLast(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ import java.lang.annotation.*;
|
||||
*
|
||||
* @implNote
|
||||
* This annotation only takes effect for fields of classes loaded by the boot
|
||||
* loader. Annoations on fields of classes loaded outside of the boot loader
|
||||
* loader. Annotations on fields of classes loaded outside of the boot loader
|
||||
* are ignored.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
|
@ -388,7 +388,10 @@ class NativeObject { // package-private
|
||||
return byteOrder;
|
||||
}
|
||||
|
||||
// Cache for page size
|
||||
/**
|
||||
* Cache for page size.
|
||||
* Lazily initialized via a data race; safe because ints are atomic.
|
||||
*/
|
||||
private static int pageSize = -1;
|
||||
|
||||
/**
|
||||
@ -397,9 +400,10 @@ class NativeObject { // package-private
|
||||
* @return The page size, in bytes
|
||||
*/
|
||||
static int pageSize() {
|
||||
if (pageSize == -1)
|
||||
pageSize = unsafe.pageSize();
|
||||
return pageSize;
|
||||
int value = pageSize;
|
||||
if (value == -1)
|
||||
pageSize = value = unsafe.pageSize();
|
||||
return value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public interface SelChImpl extends Channel {
|
||||
* contains at least one bit that the previous value did not
|
||||
* contain
|
||||
*/
|
||||
boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk);
|
||||
boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl ski);
|
||||
|
||||
/**
|
||||
* Sets the specified ops if present in interestOps. The specified
|
||||
@ -59,7 +59,7 @@ public interface SelChImpl extends Channel {
|
||||
* contains at least one bit that the previous value did not
|
||||
* contain
|
||||
*/
|
||||
boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk);
|
||||
boolean translateAndSetReadyOps(int ops, SelectionKeyImpl ski);
|
||||
|
||||
/**
|
||||
* Translates an interest operation set into a native event set
|
||||
|
@ -39,7 +39,7 @@ import java.nio.channels.spi.AbstractSelectionKey;
|
||||
public final class SelectionKeyImpl
|
||||
extends AbstractSelectionKey
|
||||
{
|
||||
final SelChImpl channel; // package-private
|
||||
private final SelChImpl channel;
|
||||
private final SelectorImpl selector;
|
||||
|
||||
private volatile int interestOps;
|
||||
@ -61,6 +61,10 @@ public final class SelectionKeyImpl
|
||||
throw new CancelledKeyException();
|
||||
}
|
||||
|
||||
int getFDVal() {
|
||||
return channel.getFDVal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectableChannel channel() {
|
||||
return (SelectableChannel)channel;
|
||||
@ -103,8 +107,8 @@ public final class SelectionKeyImpl
|
||||
public SelectionKey nioInterestOps(int ops) {
|
||||
if ((ops & ~channel().validOps()) != 0)
|
||||
throw new IllegalArgumentException();
|
||||
selector.putEventOps(this, channel.translateInterestOps(ops));
|
||||
interestOps = ops;
|
||||
selector.setEventOps(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -112,6 +116,18 @@ public final class SelectionKeyImpl
|
||||
return interestOps;
|
||||
}
|
||||
|
||||
int translateInterestOps() {
|
||||
return channel.translateInterestOps(interestOps);
|
||||
}
|
||||
|
||||
boolean translateAndSetReadyOps(int ops) {
|
||||
return channel.translateAndSetReadyOps(ops, this);
|
||||
}
|
||||
|
||||
boolean translateAndUpdateReadyOps(int ops) {
|
||||
return channel.translateAndUpdateReadyOps(ops, this);
|
||||
}
|
||||
|
||||
void registeredEvents(int events) {
|
||||
// assert Thread.holdsLock(selector);
|
||||
this.registeredEvents = events;
|
||||
|
@ -64,17 +64,20 @@ public abstract class SelectorImpl
|
||||
publicSelectedKeys = Util.ungrowableSet(selectedKeys);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Set<SelectionKey> keys() {
|
||||
private void ensureOpen() {
|
||||
if (!isOpen())
|
||||
throw new ClosedSelectorException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Set<SelectionKey> keys() {
|
||||
ensureOpen();
|
||||
return publicKeys;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Set<SelectionKey> selectedKeys() {
|
||||
if (!isOpen())
|
||||
throw new ClosedSelectorException();
|
||||
ensureOpen();
|
||||
return publicSelectedKeys;
|
||||
}
|
||||
|
||||
@ -112,8 +115,7 @@ public abstract class SelectorImpl
|
||||
|
||||
private int lockAndDoSelect(long timeout) throws IOException {
|
||||
synchronized (this) {
|
||||
if (!isOpen())
|
||||
throw new ClosedSelectorException();
|
||||
ensureOpen();
|
||||
synchronized (publicKeys) {
|
||||
synchronized (publicSelectedKeys) {
|
||||
return doSelect(timeout);
|
||||
@ -176,7 +178,8 @@ public abstract class SelectorImpl
|
||||
throw new IllegalSelectorException();
|
||||
SelectionKeyImpl k = new SelectionKeyImpl((SelChImpl)ch, this);
|
||||
k.attach(attachment);
|
||||
// register before adding to key set
|
||||
|
||||
// register with selector (if needed) before adding to key set
|
||||
implRegister(k);
|
||||
synchronized (publicKeys) {
|
||||
keys.add(k);
|
||||
@ -185,7 +188,15 @@ public abstract class SelectorImpl
|
||||
return k;
|
||||
}
|
||||
|
||||
protected abstract void implRegister(SelectionKeyImpl ski);
|
||||
/**
|
||||
* Register the key in the selector.
|
||||
*
|
||||
* The default implementation checks if the selector is open. It should
|
||||
* be overridden by selector implementations as needed.
|
||||
*/
|
||||
protected void implRegister(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
}
|
||||
|
||||
protected abstract void implDereg(SelectionKeyImpl ski) throws IOException;
|
||||
|
||||
@ -222,5 +233,5 @@ public abstract class SelectorImpl
|
||||
/**
|
||||
* Change the event set in the selector
|
||||
*/
|
||||
protected abstract void putEventOps(SelectionKeyImpl ski, int events);
|
||||
protected abstract void setEventOps(SelectionKeyImpl ski);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1995, 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
|
||||
@ -32,6 +32,7 @@
|
||||
|
||||
#include "defines.h"
|
||||
#include "jli_util.h"
|
||||
#include "jni.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if _MSC_VER > 1400 && _MSC_VER < 1600
|
||||
@ -92,7 +93,7 @@ WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow)
|
||||
__initenv = _environ;
|
||||
|
||||
#else /* JAVAW */
|
||||
int
|
||||
JNIEXPORT int JNICALL
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int margc;
|
||||
|
@ -55,17 +55,14 @@ class DevPollSelectorImpl
|
||||
// maps file descriptor to selection key, synchronize on selector
|
||||
private final Map<Integer, SelectionKeyImpl> fdToKey = new HashMap<>();
|
||||
|
||||
// pending new registrations/updates, queued by implRegister and putEventOps
|
||||
// pending new registrations/updates, queued by setEventOps
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> newKeys = new ArrayDeque<>();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
// interrupt triggering and clearing
|
||||
private final Object interruptLock = new Object();
|
||||
private boolean interruptTriggered;
|
||||
|
||||
|
||||
DevPollSelectorImpl(SelectorProvider sp) throws IOException {
|
||||
super(sp);
|
||||
this.pollWrapper = new DevPollArrayWrapper();
|
||||
@ -88,18 +85,34 @@ class DevPollSelectorImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int doSelect(long timeout)
|
||||
throws IOException
|
||||
{
|
||||
protected int doSelect(long timeout) throws IOException {
|
||||
assert Thread.holdsLock(this);
|
||||
boolean blocking = (timeout != 0);
|
||||
|
||||
long to = timeout;
|
||||
boolean blocking = (to != 0);
|
||||
boolean timedPoll = (to > 0);
|
||||
|
||||
int numEntries;
|
||||
processUpdateQueue();
|
||||
processDeregisterQueue();
|
||||
try {
|
||||
begin(blocking);
|
||||
numEntries = pollWrapper.poll(timeout);
|
||||
|
||||
do {
|
||||
long startTime = timedPoll ? System.nanoTime() : 0;
|
||||
numEntries = pollWrapper.poll(to);
|
||||
if (numEntries == IOStatus.INTERRUPTED && timedPoll) {
|
||||
// timed poll interrupted so need to adjust timeout
|
||||
long adjust = System.nanoTime() - startTime;
|
||||
to -= TimeUnit.MILLISECONDS.convert(adjust, TimeUnit.NANOSECONDS);
|
||||
if (to <= 0) {
|
||||
// timeout expired so no retry
|
||||
numEntries = 0;
|
||||
}
|
||||
}
|
||||
} while (numEntries == IOStatus.INTERRUPTED);
|
||||
assert IOStatus.check(numEntries);
|
||||
|
||||
} finally {
|
||||
end(blocking);
|
||||
}
|
||||
@ -108,7 +121,7 @@ class DevPollSelectorImpl
|
||||
}
|
||||
|
||||
/**
|
||||
* Process new registrations and changes to the interest ops.
|
||||
* Process changes to the interest ops.
|
||||
*/
|
||||
private void processUpdateQueue() throws IOException {
|
||||
assert Thread.holdsLock(this);
|
||||
@ -116,25 +129,18 @@ class DevPollSelectorImpl
|
||||
synchronized (updateLock) {
|
||||
SelectionKeyImpl ski;
|
||||
|
||||
// new registrations
|
||||
while ((ski = newKeys.pollFirst()) != null) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.channel.getFDVal();
|
||||
SelectionKeyImpl previous = fdToKey.put(fd, ski);
|
||||
assert previous == null;
|
||||
assert ski.registeredEvents() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Translate the queued updates to changes to the set of monitored
|
||||
// file descriptors. The changes are written to the /dev/poll driver
|
||||
// in bulk.
|
||||
assert updateKeys.size() == updateEvents.size();
|
||||
int index = 0;
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int newEvents = updateEvents.pollFirst();
|
||||
int fd = ski.channel.getFDVal();
|
||||
if (ski.isValid() && fdToKey.containsKey(fd)) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.getFDVal();
|
||||
// add to fdToKey if needed
|
||||
SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
|
||||
assert (previous == null) || (previous == ski);
|
||||
|
||||
int newEvents = ski.translateInterestOps();
|
||||
int registeredEvents = ski.registeredEvents();
|
||||
if (newEvents != registeredEvents) {
|
||||
if (registeredEvents != 0)
|
||||
@ -178,11 +184,11 @@ class DevPollSelectorImpl
|
||||
if (ski != null) {
|
||||
int rOps = pollWrapper.getReventOps(i);
|
||||
if (selectedKeys.contains(ski)) {
|
||||
if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
|
||||
if (ski.translateAndUpdateReadyOps(rOps)) {
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else {
|
||||
ski.channel.translateAndSetReadyOps(rOps, ski);
|
||||
ski.translateAndSetReadyOps(rOps);
|
||||
if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(ski);
|
||||
numKeysUpdated++;
|
||||
@ -214,20 +220,13 @@ class DevPollSelectorImpl
|
||||
FileDispatcherImpl.closeIntFD(fd1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implRegister(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
newKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implDereg(SelectionKeyImpl ski) throws IOException {
|
||||
assert !ski.isValid();
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
int fd = ski.channel.getFDVal();
|
||||
int fd = ski.getFDVal();
|
||||
if (fdToKey.remove(fd) != null) {
|
||||
if (ski.registeredEvents() != 0) {
|
||||
pollWrapper.register(fd, POLLREMOVE);
|
||||
@ -239,10 +238,9 @@ class DevPollSelectorImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
@ -72,12 +72,10 @@ class EventPortSelectorImpl
|
||||
// the last update operation, incremented by processUpdateQueue
|
||||
private int lastUpdate;
|
||||
|
||||
// pending new registrations/updates, queued by implRegister, putEventOps,
|
||||
// and updateSelectedKeys
|
||||
// pending new registrations/updates, queued by setEventOps and
|
||||
// updateSelectedKeys
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> newKeys = new ArrayDeque<>();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
// interrupt triggering and clearing
|
||||
private final Object interruptLock = new Object();
|
||||
@ -146,23 +144,14 @@ class EventPortSelectorImpl
|
||||
|
||||
synchronized (updateLock) {
|
||||
SelectionKeyImpl ski;
|
||||
|
||||
// new registrations
|
||||
while ((ski = newKeys.pollFirst()) != null) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.channel.getFDVal();
|
||||
SelectionKeyImpl previous = fdToKey.put(fd, ski);
|
||||
assert previous == null;
|
||||
assert ski.registeredEvents() == 0;
|
||||
}
|
||||
}
|
||||
|
||||
// changes to interest ops
|
||||
assert updateKeys.size() == updateEvents.size();
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int newEvents = updateEvents.pollFirst();
|
||||
int fd = ski.channel.getFDVal();
|
||||
if (ski.isValid() && fdToKey.containsKey(fd)) {
|
||||
if (ski.isValid()) {
|
||||
int fd = ski.getFDVal();
|
||||
// add to fdToKey if needed
|
||||
SelectionKeyImpl previous = fdToKey.putIfAbsent(fd, ski);
|
||||
assert (previous == null) || (previous == ski);
|
||||
|
||||
int newEvents = ski.translateInterestOps();
|
||||
if (newEvents != ski.registeredEvents()) {
|
||||
if (newEvents == 0) {
|
||||
port_dissociate(pfd, PORT_SOURCE_FD, fd);
|
||||
@ -199,22 +188,20 @@ class EventPortSelectorImpl
|
||||
if (ski != null) {
|
||||
int rOps = getEventOps(i);
|
||||
if (selectedKeys.contains(ski)) {
|
||||
if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
|
||||
if (ski.translateAndUpdateReadyOps(rOps)) {
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else {
|
||||
ski.channel.translateAndSetReadyOps(rOps, ski);
|
||||
ski.translateAndSetReadyOps(rOps);
|
||||
if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(ski);
|
||||
numKeysUpdated++;
|
||||
}
|
||||
}
|
||||
|
||||
// re-queue key to head so that it is re-associated at
|
||||
// next select (and before other changes)
|
||||
updateEvents.addFirst(ski.registeredEvents());
|
||||
updateKeys.addFirst(ski);
|
||||
// re-queue key so it re-associated at next select
|
||||
ski.registeredEvents(0);
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
} else if (source == PORT_SOURCE_USER) {
|
||||
interrupted = true;
|
||||
@ -244,20 +231,12 @@ class EventPortSelectorImpl
|
||||
pollArray.free();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implRegister(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
newKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void implDereg(SelectionKeyImpl ski) throws IOException {
|
||||
assert !ski.isValid();
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
int fd = ski.channel.getFDVal();
|
||||
int fd = ski.getFDVal();
|
||||
if (fdToKey.remove(fd) != null) {
|
||||
if (ski.registeredEvents() != 0) {
|
||||
port_dissociate(pfd, PORT_SOURCE_FD, fd);
|
||||
@ -269,10 +248,9 @@ class EventPortSelectorImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
@ -23,84 +23,20 @@
|
||||
* questions.
|
||||
*/
|
||||
|
||||
#include <sys/devpoll.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
#include "jvm.h"
|
||||
#include "jlong.h"
|
||||
#include "nio.h"
|
||||
#include "nio_util.h"
|
||||
|
||||
#include "sun_nio_ch_DevPollArrayWrapper.h"
|
||||
#include <poll.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef uint32_t caddr32_t;
|
||||
|
||||
/* /dev/poll ioctl */
|
||||
#define DPIOC (0xD0 << 8)
|
||||
#define DP_POLL (DPIOC | 1) /* poll on fds in cached in /dev/poll */
|
||||
#define DP_ISPOLLED (DPIOC | 2) /* is this fd cached in /dev/poll */
|
||||
#define DEVPOLLSIZE 1000 /* /dev/poll table size increment */
|
||||
#define POLLREMOVE 0x0800 /* Removes fd from monitored set */
|
||||
|
||||
/*
|
||||
* /dev/poll DP_POLL ioctl format
|
||||
*/
|
||||
typedef struct dvpoll {
|
||||
pollfd_t *dp_fds; /* pollfd array */
|
||||
nfds_t dp_nfds; /* num of pollfd's in dp_fds[] */
|
||||
int dp_timeout; /* time out in millisec */
|
||||
} dvpoll_t;
|
||||
|
||||
typedef struct dvpoll32 {
|
||||
caddr32_t dp_fds; /* pollfd array */
|
||||
uint32_t dp_nfds; /* num of pollfd's in dp_fds[] */
|
||||
int32_t dp_timeout; /* time out in millisec */
|
||||
} dvpoll32_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define RESTARTABLE(_cmd, _result) do { \
|
||||
do { \
|
||||
_result = _cmd; \
|
||||
} while((_result == -1) && (errno == EINTR)); \
|
||||
} while(0)
|
||||
|
||||
static int
|
||||
idevpoll(jint wfd, int dpctl, struct dvpoll a)
|
||||
{
|
||||
jlong start, now;
|
||||
int remaining = a.dp_timeout;
|
||||
struct timeval t;
|
||||
int diff;
|
||||
|
||||
gettimeofday(&t, NULL);
|
||||
start = t.tv_sec * 1000 + t.tv_usec / 1000;
|
||||
|
||||
for (;;) {
|
||||
/* poll(7d) ioctl does not return remaining count */
|
||||
int res = ioctl(wfd, dpctl, &a);
|
||||
if (res < 0 && errno == EINTR) {
|
||||
if (remaining >= 0) {
|
||||
gettimeofday(&t, NULL);
|
||||
now = t.tv_sec * 1000 + t.tv_usec / 1000;
|
||||
diff = now - start;
|
||||
remaining -= diff;
|
||||
if (diff < 0 || remaining <= 0) {
|
||||
return 0;
|
||||
}
|
||||
start = now;
|
||||
a.dp_timeout = remaining;
|
||||
}
|
||||
} else {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_DevPollArrayWrapper_init(JNIEnv *env, jobject this)
|
||||
@ -153,26 +89,24 @@ Java_sun_nio_ch_DevPollArrayWrapper_registerMultiple(JNIEnv *env, jobject this,
|
||||
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_sun_nio_ch_DevPollArrayWrapper_poll0(JNIEnv *env, jobject this,
|
||||
jlong address, jint numfds,
|
||||
jlong timeout, jint wfd)
|
||||
jlong address, jint numfds,
|
||||
jlong timeout, jint wfd)
|
||||
{
|
||||
struct dvpoll a;
|
||||
void *pfd = (void *) jlong_to_ptr(address);
|
||||
int result = 0;
|
||||
int result;
|
||||
|
||||
a.dp_fds = pfd;
|
||||
a.dp_nfds = numfds;
|
||||
a.dp_timeout = (int)timeout;
|
||||
|
||||
if (timeout <= 0) { /* Indefinite or no wait */
|
||||
RESTARTABLE (ioctl(wfd, DP_POLL, &a), result);
|
||||
} else { /* Bounded wait; bounded restarts */
|
||||
result = idevpoll(wfd, DP_POLL, a);
|
||||
}
|
||||
|
||||
result = ioctl(wfd, DP_POLL, &a);
|
||||
if (result < 0) {
|
||||
JNU_ThrowIOExceptionWithLastError(env, "Error reading driver");
|
||||
return -1;
|
||||
if (errno == EINTR) {
|
||||
return IOS_INTERRUPTED;
|
||||
} else {
|
||||
JNU_ThrowIOExceptionWithLastError(env, "Error reading driver");
|
||||
return IOS_THROWN;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -60,7 +60,6 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
// pending updates, queued by putEventOps
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
// interrupt triggering and clearing
|
||||
private final Object interruptLock = new Object();
|
||||
@ -136,10 +135,9 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
assert Thread.holdsLock(this);
|
||||
|
||||
synchronized (updateLock) {
|
||||
assert updateKeys.size() == updateEvents.size();
|
||||
SelectionKeyImpl ski;
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int newEvents = updateEvents.pollFirst();
|
||||
int newEvents = ski.translateInterestOps();
|
||||
if (ski.isValid()) {
|
||||
int index = ski.getIndex();
|
||||
assert index >= 0 && index < pollArraySize;
|
||||
@ -173,14 +171,14 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
int rOps = getReventOps(i);
|
||||
if (rOps != 0) {
|
||||
SelectionKeyImpl ski = pollKeys.get(i);
|
||||
assert ski.channel.getFDVal() == getDescriptor(i);
|
||||
assert ski.getFDVal() == getDescriptor(i);
|
||||
if (ski.isValid()) {
|
||||
if (selectedKeys.contains(ski)) {
|
||||
if (ski.channel.translateAndSetReadyOps(rOps, ski)) {
|
||||
if (ski.translateAndUpdateReadyOps(rOps)) {
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else {
|
||||
ski.channel.translateAndSetReadyOps(rOps, ski);
|
||||
ski.translateAndSetReadyOps(rOps);
|
||||
if ((ski.nioReadyOps() & ski.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(ski);
|
||||
numKeysUpdated++;
|
||||
@ -233,10 +231,9 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
@ -285,7 +282,7 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
|
||||
int index = pollArraySize;
|
||||
assert index > 0;
|
||||
putDescriptor(index, ski.channel.getFDVal());
|
||||
putDescriptor(index, ski.getFDVal());
|
||||
putEventOps(index, ops);
|
||||
putReventOps(index, 0);
|
||||
ski.setIndex(index);
|
||||
@ -301,7 +298,7 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
private void update(SelectionKeyImpl ski, int ops) {
|
||||
int index = ski.getIndex();
|
||||
assert index > 0 && index < pollArraySize;
|
||||
assert getDescriptor(index) == ski.channel.getFDVal();
|
||||
assert getDescriptor(index) == ski.getFDVal();
|
||||
putEventOps(index, ops);
|
||||
}
|
||||
|
||||
@ -311,7 +308,7 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
private void remove(SelectionKeyImpl ski) {
|
||||
int index = ski.getIndex();
|
||||
assert index > 0 && index < pollArraySize;
|
||||
assert getDescriptor(index) == ski.channel.getFDVal();
|
||||
assert getDescriptor(index) == ski.getFDVal();
|
||||
|
||||
// replace pollfd at index with the last pollfd in array
|
||||
int lastIndex = pollArraySize - 1;
|
||||
@ -321,7 +318,7 @@ class PollSelectorImpl extends SelectorImpl {
|
||||
int lastFd = getDescriptor(lastIndex);
|
||||
int lastOps = getEventOps(lastIndex);
|
||||
int lastRevents = getReventOps(lastIndex);
|
||||
assert lastKey.channel.getFDVal() == lastFd;
|
||||
assert lastKey.getFDVal() == lastFd;
|
||||
putDescriptor(index, lastFd);
|
||||
putEventOps(index, lastOps);
|
||||
putReventOps(index, lastRevents);
|
||||
|
@ -64,7 +64,7 @@ class PollArrayWrapper {
|
||||
|
||||
// Prepare another pollfd struct for use.
|
||||
void putEntry(int index, SelectionKeyImpl ski) {
|
||||
putDescriptor(index, ski.channel.getFDVal());
|
||||
putDescriptor(index, ski.getFDVal());
|
||||
putEventOps(index, 0);
|
||||
}
|
||||
|
||||
|
@ -83,12 +83,12 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
return get(Integer.valueOf(desc));
|
||||
}
|
||||
private MapEntry put(SelectionKeyImpl ski) {
|
||||
return put(Integer.valueOf(ski.channel.getFDVal()), new MapEntry(ski));
|
||||
return put(Integer.valueOf(ski.getFDVal()), new MapEntry(ski));
|
||||
}
|
||||
private MapEntry remove(SelectionKeyImpl ski) {
|
||||
Integer fd = Integer.valueOf(ski.channel.getFDVal());
|
||||
Integer fd = Integer.valueOf(ski.getFDVal());
|
||||
MapEntry x = get(fd);
|
||||
if ((x != null) && (x.ski.channel == ski.channel))
|
||||
if ((x != null) && (x.ski.channel() == ski.channel()))
|
||||
return remove(fd);
|
||||
return null;
|
||||
}
|
||||
@ -98,7 +98,6 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
private static final class MapEntry {
|
||||
final SelectionKeyImpl ski;
|
||||
long updateCount = 0;
|
||||
long clearedCount = 0;
|
||||
MapEntry(SelectionKeyImpl ski) {
|
||||
this.ski = ski;
|
||||
}
|
||||
@ -114,11 +113,10 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
private final Object interruptLock = new Object();
|
||||
private volatile boolean interruptTriggered;
|
||||
|
||||
// pending new registrations/updates, queued by implRegister and putEventOps
|
||||
// pending new registrations/updates, queued by implRegister and setEventOps
|
||||
private final Object updateLock = new Object();
|
||||
private final Deque<SelectionKeyImpl> newKeys = new ArrayDeque<>();
|
||||
private final Deque<SelectionKeyImpl> updateKeys = new ArrayDeque<>();
|
||||
private final Deque<Integer> updateEvents = new ArrayDeque<>();
|
||||
|
||||
|
||||
WindowsSelectorImpl(SelectorProvider sp) throws IOException {
|
||||
@ -204,10 +202,9 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
// changes to interest ops
|
||||
assert updateKeys.size() == updateEvents.size();
|
||||
while ((ski = updateKeys.pollFirst()) != null) {
|
||||
int events = updateEvents.pollFirst();
|
||||
int fd = ski.channel.getFDVal();
|
||||
int events = ski.translateInterestOps();
|
||||
int fd = ski.getFDVal();
|
||||
if (ski.isValid() && fdMap.containsKey(fd)) {
|
||||
int index = ski.getIndex();
|
||||
assert index >= 0 && index < totalChannels;
|
||||
@ -370,12 +367,10 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
/**
|
||||
* Note, clearedCount is used to determine if the readyOps have
|
||||
* been reset in this select operation. updateCount is used to
|
||||
* tell if a key has been counted as updated in this select
|
||||
* operation.
|
||||
* updateCount is used to tell if a key has been counted as updated
|
||||
* in this select operation.
|
||||
*
|
||||
* me.updateCount <= me.clearedCount <= updateCount
|
||||
* me.updateCount <= updateCount
|
||||
*/
|
||||
private int processFDSet(long updateCount, int[] fds, int rOps,
|
||||
boolean isExceptFds)
|
||||
@ -407,37 +402,19 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
if (selectedKeys.contains(sk)) { // Key in selected set
|
||||
if (me.clearedCount != updateCount) {
|
||||
if (sk.channel.translateAndSetReadyOps(rOps, sk) &&
|
||||
(me.updateCount != updateCount)) {
|
||||
me.updateCount = updateCount;
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else { // The readyOps have been set; now add
|
||||
if (sk.channel.translateAndUpdateReadyOps(rOps, sk) &&
|
||||
(me.updateCount != updateCount)) {
|
||||
if (sk.translateAndUpdateReadyOps(rOps)) {
|
||||
if (me.updateCount != updateCount) {
|
||||
me.updateCount = updateCount;
|
||||
numKeysUpdated++;
|
||||
}
|
||||
}
|
||||
me.clearedCount = updateCount;
|
||||
} else { // Key is not in selected set yet
|
||||
if (me.clearedCount != updateCount) {
|
||||
sk.channel.translateAndSetReadyOps(rOps, sk);
|
||||
if ((sk.nioReadyOps() & sk.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(sk);
|
||||
me.updateCount = updateCount;
|
||||
numKeysUpdated++;
|
||||
}
|
||||
} else { // The readyOps have been set; now add
|
||||
sk.channel.translateAndUpdateReadyOps(rOps, sk);
|
||||
if ((sk.nioReadyOps() & sk.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(sk);
|
||||
me.updateCount = updateCount;
|
||||
numKeysUpdated++;
|
||||
}
|
||||
sk.translateAndSetReadyOps(rOps);
|
||||
if ((sk.nioReadyOps() & sk.nioInterestOps()) != 0) {
|
||||
selectedKeys.add(sk);
|
||||
me.updateCount = updateCount;
|
||||
numKeysUpdated++;
|
||||
}
|
||||
me.clearedCount = updateCount;
|
||||
}
|
||||
}
|
||||
return numKeysUpdated;
|
||||
@ -613,10 +590,9 @@ class WindowsSelectorImpl extends SelectorImpl {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putEventOps(SelectionKeyImpl ski, int events) {
|
||||
public void setEventOps(SelectionKeyImpl ski) {
|
||||
ensureOpen();
|
||||
synchronized (updateLock) {
|
||||
updateEvents.addLast(events); // events first in case adding key fails
|
||||
updateKeys.addLast(ski);
|
||||
}
|
||||
}
|
||||
|
@ -183,15 +183,7 @@ public class LambdaToMethod extends TreeTranslator {
|
||||
public int hashCode() {
|
||||
int hashCode = this.hashCode;
|
||||
if (hashCode == 0) {
|
||||
this.hashCode = hashCode = TreeHasher.hash(tree, sym -> {
|
||||
if (sym.owner == symbol) {
|
||||
int idx = symbol.params().indexOf(sym);
|
||||
if (idx != -1) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
this.hashCode = hashCode = TreeHasher.hash(tree, symbol.params());
|
||||
}
|
||||
return hashCode;
|
||||
}
|
||||
@ -203,17 +195,7 @@ public class LambdaToMethod extends TreeTranslator {
|
||||
}
|
||||
DedupedLambda that = (DedupedLambda) o;
|
||||
return types.isSameType(symbol.asType(), that.symbol.asType())
|
||||
&& new TreeDiffer((lhs, rhs) -> {
|
||||
if (lhs.owner == symbol) {
|
||||
int idx = symbol.params().indexOf(lhs);
|
||||
if (idx != -1) {
|
||||
if (Objects.equals(idx, that.symbol.params().indexOf(rhs))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}).scan(tree, that.tree);
|
||||
&& new TreeDiffer(symbol.params(), that.symbol.params()).scan(tree, that.tree);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,24 +89,34 @@ import com.sun.tools.javac.tree.JCTree.TypeBoundKind;
|
||||
import com.sun.tools.javac.tree.TreeInfo;
|
||||
import com.sun.tools.javac.tree.TreeScanner;
|
||||
import com.sun.tools.javac.util.List;
|
||||
|
||||
import javax.lang.model.element.ElementKind;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/** A visitor that compares two lambda bodies for structural equality. */
|
||||
public class TreeDiffer extends TreeScanner {
|
||||
|
||||
private BiFunction<Symbol, Symbol, Boolean> symbolDiffer;
|
||||
public TreeDiffer(
|
||||
Collection<? extends Symbol> symbols, Collection<? extends Symbol> otherSymbols) {
|
||||
this.equiv = equiv(symbols, otherSymbols);
|
||||
}
|
||||
|
||||
public TreeDiffer(BiFunction<Symbol, Symbol, Boolean> symbolDiffer) {
|
||||
this.symbolDiffer = Objects.requireNonNull(symbolDiffer);
|
||||
private static Map<Symbol, Symbol> equiv(
|
||||
Collection<? extends Symbol> symbols, Collection<? extends Symbol> otherSymbols) {
|
||||
Map<Symbol, Symbol> result = new HashMap<>();
|
||||
Iterator<? extends Symbol> it = otherSymbols.iterator();
|
||||
for (Symbol symbol : symbols) {
|
||||
if (!it.hasNext()) break;
|
||||
result.put(symbol, it.next());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private JCTree parameter;
|
||||
private boolean result;
|
||||
private Map<Symbol, Symbol> equiv = new HashMap<>();
|
||||
|
||||
public boolean scan(JCTree tree, JCTree parameter) {
|
||||
if (tree == null || parameter == null) {
|
||||
@ -172,9 +182,8 @@ public class TreeDiffer extends TreeScanner {
|
||||
Symbol symbol = tree.sym;
|
||||
Symbol otherSymbol = that.sym;
|
||||
if (symbol != null && otherSymbol != null) {
|
||||
Boolean tmp = symbolDiffer.apply(symbol, otherSymbol);
|
||||
if (tmp != null) {
|
||||
result = tmp;
|
||||
if (Objects.equals(equiv.get(symbol), otherSymbol)) {
|
||||
result = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -598,6 +607,10 @@ public class TreeDiffer extends TreeScanner {
|
||||
&& scan(tree.nameexpr, that.nameexpr)
|
||||
&& scan(tree.vartype, that.vartype)
|
||||
&& scan(tree.init, that.init);
|
||||
if (!result) {
|
||||
return;
|
||||
}
|
||||
equiv.put(tree.sym, that.sym);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,26 +30,31 @@ import com.sun.tools.javac.tree.JCTree;
|
||||
import com.sun.tools.javac.tree.JCTree.JCFieldAccess;
|
||||
import com.sun.tools.javac.tree.JCTree.JCIdent;
|
||||
import com.sun.tools.javac.tree.JCTree.JCLiteral;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.tree.TreeInfo;
|
||||
import com.sun.tools.javac.tree.TreeScanner;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.function.Function;
|
||||
|
||||
/** A tree visitor that computes a hash code. */
|
||||
public class TreeHasher extends TreeScanner {
|
||||
|
||||
private final Function<Symbol, Integer> symbolHasher;
|
||||
private final Map<Symbol, Integer> symbolHashes;
|
||||
private int result = 17;
|
||||
|
||||
public TreeHasher(Function<Symbol, Integer> symbolHasher) {
|
||||
this.symbolHasher = Objects.requireNonNull(symbolHasher);
|
||||
public TreeHasher(Map<Symbol, Integer> symbolHashes) {
|
||||
this.symbolHashes = Objects.requireNonNull(symbolHashes);
|
||||
}
|
||||
|
||||
public static int hash(JCTree tree, Function<Symbol, Integer> symbolHasher) {
|
||||
public static int hash(JCTree tree, Collection<? extends Symbol> symbols) {
|
||||
if (tree == null) {
|
||||
return 0;
|
||||
}
|
||||
TreeHasher hasher = new TreeHasher(symbolHasher);
|
||||
Map<Symbol, Integer> symbolHashes = new HashMap<>();
|
||||
symbols.forEach(s -> symbolHashes.put(s, symbolHashes.size()));
|
||||
TreeHasher hasher = new TreeHasher(symbolHashes);
|
||||
tree.accept(hasher);
|
||||
return hasher.result;
|
||||
}
|
||||
@ -85,7 +90,7 @@ public class TreeHasher extends TreeScanner {
|
||||
public void visitIdent(JCIdent tree) {
|
||||
Symbol sym = tree.sym;
|
||||
if (sym != null) {
|
||||
Integer hash = symbolHasher.apply(sym);
|
||||
Integer hash = symbolHashes.get(sym);
|
||||
if (hash != null) {
|
||||
hash(hash);
|
||||
return;
|
||||
@ -99,4 +104,10 @@ public class TreeHasher extends TreeScanner {
|
||||
hash(tree.sym);
|
||||
super.visitSelect(tree);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitVarDef(JCVariableDecl tree) {
|
||||
symbolHashes.computeIfAbsent(tree.sym, k -> symbolHashes.size());
|
||||
super.visitVarDef(tree);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2017, 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
|
||||
@ -58,9 +58,11 @@ import sun.management.jdp.JdpException;
|
||||
import sun.management.jmxremote.ConnectorBootstrap;
|
||||
|
||||
/**
|
||||
* This Agent is started by the VM when -Dcom.sun.management.snmp or
|
||||
* -Dcom.sun.management.jmxremote is set. This class will be loaded by the
|
||||
* system class loader. Also jmx framework could be started by jcmd
|
||||
* This class provides the methods to start the management agent.
|
||||
* 1. {@link #startAgent} method is invoked by the VM if {@code -Dcom.sun.management.*} is set
|
||||
* 2. {@link #startLocalManagementAgent} or {@link #startRemoteManagementAgent}
|
||||
* is invoked to start the management agent after the VM starts
|
||||
* via jcmd ManagementAgent.start and start_local command.
|
||||
*/
|
||||
public class Agent {
|
||||
/**
|
||||
@ -239,8 +241,6 @@ public class Agent {
|
||||
private static ResourceBundle messageRB;
|
||||
private static final String CONFIG_FILE =
|
||||
"com.sun.management.config.file";
|
||||
private static final String SNMP_PORT =
|
||||
"com.sun.management.snmp.port";
|
||||
private static final String JMXREMOTE =
|
||||
"com.sun.management.jmxremote";
|
||||
private static final String JMXREMOTE_PORT =
|
||||
@ -251,8 +251,6 @@ public class Agent {
|
||||
"com.sun.management.enableThreadContentionMonitoring";
|
||||
private static final String LOCAL_CONNECTOR_ADDRESS_PROP =
|
||||
"com.sun.management.jmxremote.localConnectorAddress";
|
||||
private static final String SNMP_AGENT_NAME =
|
||||
"SnmpAgent";
|
||||
|
||||
private static final String JDP_DEFAULT_ADDRESS = "224.0.23.178";
|
||||
private static final int JDP_DEFAULT_PORT = 7095;
|
||||
@ -307,8 +305,11 @@ public class Agent {
|
||||
startAgent(config_props);
|
||||
}
|
||||
|
||||
// jcmd ManagementAgent.start_local entry point
|
||||
// Also called due to command-line via startAgent()
|
||||
/*
|
||||
* Starts the local management agent.
|
||||
* This method is invoked by either startAgent method or
|
||||
* by the VM directly via jcmd ManagementAgent.start_local command.
|
||||
*/
|
||||
private static synchronized void startLocalManagementAgent() {
|
||||
Properties agentProps = VMSupport.getAgentProperties();
|
||||
|
||||
@ -330,10 +331,10 @@ public class Agent {
|
||||
}
|
||||
}
|
||||
|
||||
// jcmd ManagementAgent.start entry point
|
||||
// This method starts the remote JMX agent and starts neither
|
||||
// the local JMX agent nor the SNMP agent
|
||||
// @see #startLocalManagementAgent and also @see #startAgent.
|
||||
/*
|
||||
* This method is invoked by the VM to start the remote management agent
|
||||
* via jcmd ManagementAgent.start command.
|
||||
*/
|
||||
private static synchronized void startRemoteManagementAgent(String args) throws Exception {
|
||||
if (jmxServer != null) {
|
||||
throw new RuntimeException(getText(INVALID_STATE, "Agent already started"));
|
||||
@ -418,7 +419,6 @@ public class Agent {
|
||||
}
|
||||
|
||||
private static void startAgent(Properties props) throws Exception {
|
||||
String snmpPort = props.getProperty(SNMP_PORT);
|
||||
String jmxremote = props.getProperty(JMXREMOTE);
|
||||
String jmxremotePort = props.getProperty(JMXREMOTE_PORT);
|
||||
|
||||
@ -431,9 +431,6 @@ public class Agent {
|
||||
}
|
||||
|
||||
try {
|
||||
if (snmpPort != null) {
|
||||
loadSnmpAgent(props);
|
||||
}
|
||||
|
||||
/*
|
||||
* If the jmxremote.port property is set then we start the
|
||||
@ -533,12 +530,10 @@ public class Agent {
|
||||
public static synchronized Properties getManagementProperties() {
|
||||
if (mgmtProps == null) {
|
||||
String configFile = System.getProperty(CONFIG_FILE);
|
||||
String snmpPort = System.getProperty(SNMP_PORT);
|
||||
String jmxremote = System.getProperty(JMXREMOTE);
|
||||
String jmxremotePort = System.getProperty(JMXREMOTE_PORT);
|
||||
|
||||
if (configFile == null && snmpPort == null
|
||||
&& jmxremote == null && jmxremotePort == null) {
|
||||
if (configFile == null && jmxremote == null && jmxremotePort == null) {
|
||||
// return if out-of-the-management option is not specified
|
||||
return null;
|
||||
}
|
||||
@ -547,27 +542,6 @@ public class Agent {
|
||||
return mgmtProps;
|
||||
}
|
||||
|
||||
private static void loadSnmpAgent(Properties props) {
|
||||
/*
|
||||
* Load the jdk.snmp service
|
||||
*/
|
||||
AgentProvider provider = AccessController.doPrivileged(
|
||||
(PrivilegedAction<AgentProvider>) () -> {
|
||||
for (AgentProvider aProvider : ServiceLoader.loadInstalled(AgentProvider.class)) {
|
||||
if (aProvider.getName().equals(SNMP_AGENT_NAME))
|
||||
return aProvider;
|
||||
}
|
||||
return null;
|
||||
}, null
|
||||
);
|
||||
|
||||
if (provider != null) {
|
||||
provider.startAgent(props);
|
||||
} else { // snmp runtime doesn't exist - initialization fails
|
||||
throw new UnsupportedOperationException("Unsupported management property: " + SNMP_PORT);
|
||||
}
|
||||
}
|
||||
|
||||
// read config file and initialize the properties
|
||||
private static void readConfiguration(String fname, Properties p) {
|
||||
if (fname == null) {
|
||||
@ -609,6 +583,10 @@ public class Agent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is invoked by the VM to start the management agent
|
||||
* when -Dcom.sun.management.* is set during startup.
|
||||
*/
|
||||
public static void startAgent() throws Exception {
|
||||
String prop = System.getProperty("com.sun.management.agent.class");
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
# The Management Configuration file (in java.util.Properties format)
|
||||
# will be read if one of the following system properties is set:
|
||||
# -Dcom.sun.management.jmxremote.port=<port-number>
|
||||
# or -Dcom.sun.management.snmp.port=<port-number>
|
||||
# or -Dcom.sun.management.config.file=<this-file>
|
||||
#
|
||||
# The default Management Configuration file is:
|
||||
@ -26,8 +25,6 @@
|
||||
# For setting the JMX RMI agent port use the following line
|
||||
# com.sun.management.jmxremote.port=<port-number>
|
||||
#
|
||||
# For setting the SNMP agent port use the following line
|
||||
# com.sun.management.snmp.port=<port-number>
|
||||
|
||||
#####################################################################
|
||||
# Optional Instrumentation
|
||||
@ -49,82 +46,6 @@
|
||||
# To enable thread contention monitoring, uncomment the following line
|
||||
# com.sun.management.enableThreadContentionMonitoring
|
||||
|
||||
#####################################################################
|
||||
# SNMP Management Properties
|
||||
#####################################################################
|
||||
#
|
||||
# If the system property -Dcom.sun.management.snmp.port=<port-number>
|
||||
# is set then
|
||||
# - The SNMP agent (with the Java virtual machine MIB) is started
|
||||
# that listens on the specified port for incoming SNMP requests.
|
||||
# - the following properties for read for SNMP management.
|
||||
#
|
||||
# The configuration can be specified only at startup time.
|
||||
# Later changes to the above system property (e.g. via setProperty method), this
|
||||
# config file, or the ACL file has no effect to the running SNMP agent.
|
||||
#
|
||||
|
||||
#
|
||||
# ##################### SNMP Trap Port #########################
|
||||
#
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
# Specifies the remote port number at which managers are expected
|
||||
# to listen for trap. For each host defined in the ACL file,
|
||||
# the SNMP agent will send traps at <host>:<trap-destination-port-number>
|
||||
# Default for this property is 162.
|
||||
#
|
||||
|
||||
# To set port for sending traps to a different port use the following line
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
|
||||
#
|
||||
# ################ SNMP listen interface #########################
|
||||
#
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
# Specifies the local interface on which the SNMP agent will bind.
|
||||
# This is useful when running on machines which have several
|
||||
# interfaces defined. It makes it possible to listen to a specific
|
||||
# subnet accessible through that interface.
|
||||
# Default for this property is "localhost".
|
||||
#
|
||||
# The format of the value for that property is any string accepted
|
||||
# by java.net.InetAddress.getByName(String).
|
||||
#
|
||||
|
||||
# For restricting the port on which SNMP agent listens use the following line
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
|
||||
#
|
||||
# #################### SNMP ACL file #########################
|
||||
#
|
||||
# com.sun.management.snmp.acl=true|false
|
||||
# Default for this property is true. (Case for true/false ignored)
|
||||
# If this property is specified as false then the ACL file
|
||||
# is not checked: all manager hosts are allowed all access.
|
||||
#
|
||||
|
||||
# For SNMP without checking ACL file uncomment the following line
|
||||
# com.sun.management.snmp.acl=false
|
||||
|
||||
#
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
# Specifies location for ACL file
|
||||
# This is optional - default location is
|
||||
# $JRE/conf/management/snmp.acl
|
||||
#
|
||||
# If the property "com.sun.management.snmp.acl" is set to false,
|
||||
# then this property and the ACL file are ignored.
|
||||
# Otherwise the ACL file must exist and be in the valid format.
|
||||
# If the ACL file is empty or non existent then no access is allowed.
|
||||
#
|
||||
# The SNMP agent will read the ACL file at startup time.
|
||||
# Modification to the ACL file has no effect to any running SNMP
|
||||
# agents which read that ACL file at startup.
|
||||
#
|
||||
|
||||
# For a non-default acl file location use the following line
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
|
||||
#####################################################################
|
||||
# RMI Management Properties
|
||||
#####################################################################
|
||||
|
@ -45,6 +45,7 @@
|
||||
#define THREAD_SELF ((THRTYPE)pthread_self())
|
||||
#endif
|
||||
|
||||
#include "jni.h"
|
||||
#include "defines.h"
|
||||
#include "bytes.h"
|
||||
#include "utils.h"
|
||||
@ -58,7 +59,8 @@
|
||||
#include "unpack.h"
|
||||
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
JNIEXPORT int JNICALL
|
||||
main(int argc, char **argv) {
|
||||
return unpacker::run(argc, argv);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ public class IsAnnotationType {
|
||||
failures += test(String.class, false);
|
||||
failures += test(Enum.class, false);
|
||||
failures += test(java.math.RoundingMode.class, false);
|
||||
// Classes in java.lang.annoation
|
||||
// Classes in java.lang.annotation
|
||||
failures += test(Annotation.class, false);
|
||||
failures += test(Retention.class, true);
|
||||
failures += test(RetentionPolicy.class, false);
|
||||
@ -57,7 +57,7 @@ public class IsAnnotationType {
|
||||
failures += test(AnnotationPoseur.class, false);
|
||||
|
||||
if (failures > 0) {
|
||||
throw new RuntimeException("Unexepcted annotation " +
|
||||
throw new RuntimeException("Unexpected annotation " +
|
||||
"status detected.");
|
||||
}
|
||||
}
|
||||
|
113
test/jdk/java/lang/Enum/ConstantDirectoryOptimalCapacity.java
Normal file
113
test/jdk/java/lang/Enum/ConstantDirectoryOptimalCapacity.java
Normal file
@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @bug 8200696
|
||||
* @summary Initial capacity of Class.enumConstantDirectory is not optimal
|
||||
* @library /lib/testlibrary
|
||||
* @modules java.base/java.lang:open
|
||||
* @build jdk.testlibrary.OptimalCapacity
|
||||
* @run main ConstantDirectoryOptimalCapacity
|
||||
*/
|
||||
|
||||
import jdk.testlibrary.OptimalCapacity;
|
||||
|
||||
public class ConstantDirectoryOptimalCapacity {
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
test(E1.class);
|
||||
test(E2.class);
|
||||
test(E3.class);
|
||||
test(E4.class);
|
||||
test(E5.class);
|
||||
test(E6.class);
|
||||
test(E7.class);
|
||||
test(E8.class);
|
||||
test(E9.class);
|
||||
test(E10.class);
|
||||
test(E11.class);
|
||||
test(E12.class);
|
||||
test(E13.class);
|
||||
test(E14.class);
|
||||
test(E15.class);
|
||||
test(E16.class);
|
||||
test(E17.class);
|
||||
test(E18.class);
|
||||
test(E19.class);
|
||||
test(E20.class);
|
||||
test(E21.class);
|
||||
test(E22.class);
|
||||
test(E23.class);
|
||||
test(E24.class);
|
||||
test(E25.class);
|
||||
test(E26.class);
|
||||
}
|
||||
|
||||
private static void test(Class<? extends Enum> e) {
|
||||
Enum.valueOf(e, "V0"); // trigger init of enumConstantDirectory
|
||||
|
||||
int initialCapacity = (int)(e.getEnumConstants().length / 0.75f) + 1;
|
||||
OptimalCapacity.ofHashMap(e.getClass(), e, "enumConstantDirectory",
|
||||
initialCapacity);
|
||||
}
|
||||
|
||||
enum E1 { V0 }
|
||||
enum E2 { V0, V1 }
|
||||
enum E3 { V0, V1, V2 }
|
||||
enum E4 { V0, V1, V2, V3 }
|
||||
enum E5 { V0, V1, V2, V3, V4 }
|
||||
enum E6 { V0, V1, V2, V3, V4, V5 }
|
||||
enum E7 { V0, V1, V2, V3, V4, V5, V6 }
|
||||
enum E8 { V0, V1, V2, V3, V4, V5, V6, V7 }
|
||||
enum E9 { V0, V1, V2, V3, V4, V5, V6, V7, V8 }
|
||||
enum E10 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9 }
|
||||
enum E11 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10 }
|
||||
enum E12 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11 }
|
||||
enum E13 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12 }
|
||||
enum E14 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13 }
|
||||
enum E15 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14 }
|
||||
enum E16 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15 }
|
||||
enum E17 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16 }
|
||||
enum E18 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17 }
|
||||
enum E19 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18 }
|
||||
enum E20 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19 }
|
||||
enum E21 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20 }
|
||||
enum E22 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20, V21 }
|
||||
enum E23 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20, V21, V22 }
|
||||
enum E24 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20, V21, V22, V23 }
|
||||
enum E25 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24 }
|
||||
enum E26 { V0, V1, V2, V3, V4, V5, V6, V7, V8, V9, V10, V11, V12, V13,
|
||||
V14, V15, V16, V17, V18, V19, V20, V21, V22, V23, V24, V25 }
|
||||
}
|
@ -38,8 +38,8 @@ import jdk.internal.org.objectweb.asm.*;
|
||||
public class ClassFileGenerator {
|
||||
|
||||
public static void main(String... args) throws Exception {
|
||||
classFileWriter("AnnotationWithVoidReturn.class", AnnoationWithVoidReturnDump.dump());
|
||||
classFileWriter("AnnotationWithParameter.class", AnnoationWithParameterDump.dump());
|
||||
classFileWriter("AnnotationWithVoidReturn.class", AnnotationWithVoidReturnDump.dump());
|
||||
classFileWriter("AnnotationWithParameter.class", AnnotationWithParameterDump.dump());
|
||||
classFileWriter("AnnotationWithExtraInterface.class", AnnotationWithExtraInterfaceDump.dump());
|
||||
classFileWriter("AnnotationWithException.class", AnnotationWithExceptionDump.dump());
|
||||
classFileWriter("AnnotationWithHashCode.class", AnnotationWithHashCodeDump.dump());
|
||||
@ -65,7 +65,7 @@ public class ClassFileGenerator {
|
||||
|
||||
*/
|
||||
|
||||
private static class AnnoationWithVoidReturnDump implements Opcodes {
|
||||
private static class AnnotationWithVoidReturnDump implements Opcodes {
|
||||
public static byte[] dump() throws Exception {
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
MethodVisitor mv;
|
||||
@ -106,7 +106,7 @@ public class ClassFileGenerator {
|
||||
|
||||
*/
|
||||
|
||||
private static class AnnoationWithParameterDump implements Opcodes {
|
||||
private static class AnnotationWithParameterDump implements Opcodes {
|
||||
public static byte[] dump() throws Exception {
|
||||
|
||||
ClassWriter cw = new ClassWriter(0);
|
||||
|
176
test/jdk/java/nio/channels/Selector/UpdateReadyOps.java
Normal file
176
test/jdk/java/nio/channels/Selector/UpdateReadyOps.java
Normal file
@ -0,0 +1,176 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @run testng UpdateReadyOps
|
||||
* @summary Test that the ready set from a selection operation is bitwise-disjoined
|
||||
* into a key's ready set when the key is already in the selected-key set
|
||||
*/
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.SelectionKey;
|
||||
import java.nio.channels.Selector;
|
||||
import java.nio.channels.ServerSocketChannel;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
@Test
|
||||
public class UpdateReadyOps {
|
||||
|
||||
/**
|
||||
* Test that OP_WRITE is preserved when updating the ready set of a key in
|
||||
* the selected-key set to add OP_READ.
|
||||
*/
|
||||
public void testOpWritePreserved() throws Exception {
|
||||
try (ConnectionPair pair = new ConnectionPair();
|
||||
Selector sel = Selector.open()) {
|
||||
|
||||
SocketChannel sc1 = pair.channel1();
|
||||
SocketChannel sc2 = pair.channel2();
|
||||
|
||||
sc1.configureBlocking(false);
|
||||
SelectionKey key = sc1.register(sel, SelectionKey.OP_WRITE);
|
||||
|
||||
int updated = sel.select();
|
||||
assertTrue(updated == 1);
|
||||
assertTrue(sel.selectedKeys().contains(key));
|
||||
assertFalse(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
|
||||
// select again, should be no updates
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 0);
|
||||
assertTrue(sel.selectedKeys().contains(key));
|
||||
assertFalse(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
|
||||
// write some bytes
|
||||
sc2.write(helloMessage());
|
||||
|
||||
// change interest ops to OP_READ, do a selection operation, and
|
||||
// check that the ready set becomes OP_READ|OP_WRITE.
|
||||
|
||||
key.interestOps(SelectionKey.OP_READ);
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 1);
|
||||
assertTrue(sel.selectedKeys().size() == 1);
|
||||
assertTrue(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
assertTrue(key.readyOps() == (SelectionKey.OP_READ|SelectionKey.OP_WRITE));
|
||||
|
||||
// select again, should be no updates
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 0);
|
||||
assertTrue(sel.selectedKeys().size() == 1);
|
||||
assertTrue(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that OP_READ is preserved when updating the ready set of a key in
|
||||
* the selected-key set to add OP_WRITE.
|
||||
*/
|
||||
public void testOpReadPreserved() throws Exception {
|
||||
try (ConnectionPair pair = new ConnectionPair();
|
||||
Selector sel = Selector.open()) {
|
||||
|
||||
SocketChannel sc1 = pair.channel1();
|
||||
SocketChannel sc2 = pair.channel2();
|
||||
|
||||
sc1.configureBlocking(false);
|
||||
SelectionKey key = sc1.register(sel, SelectionKey.OP_READ);
|
||||
|
||||
// write some bytes
|
||||
sc2.write(helloMessage());
|
||||
|
||||
int updated = sel.select();
|
||||
assertTrue(updated == 1);
|
||||
assertTrue(sel.selectedKeys().size() == 1);
|
||||
assertTrue(sel.selectedKeys().contains(key));
|
||||
assertTrue(key.isReadable());
|
||||
assertFalse(key.isWritable());
|
||||
|
||||
// select again, should be no updates
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 0);
|
||||
assertTrue(sel.selectedKeys().contains(key));
|
||||
assertTrue(key.isReadable());
|
||||
assertFalse(key.isWritable());
|
||||
|
||||
key.interestOps(SelectionKey.OP_WRITE);
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 1);
|
||||
assertTrue(sel.selectedKeys().size() == 1);
|
||||
assertTrue(sel.selectedKeys().contains(key));
|
||||
assertTrue(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
assertTrue(key.readyOps() == (SelectionKey.OP_READ|SelectionKey.OP_WRITE));
|
||||
|
||||
// select again, should be no updates
|
||||
updated = sel.select();
|
||||
assertTrue(updated == 0);
|
||||
assertTrue(sel.selectedKeys().size() == 1);
|
||||
assertTrue(key.isReadable());
|
||||
assertTrue(key.isWritable());
|
||||
}
|
||||
}
|
||||
|
||||
static class ConnectionPair implements Closeable {
|
||||
|
||||
private final SocketChannel sc1;
|
||||
private final SocketChannel sc2;
|
||||
|
||||
ConnectionPair() throws IOException {
|
||||
InetAddress lb = InetAddress.getLoopbackAddress();
|
||||
try (ServerSocketChannel ssc = ServerSocketChannel.open()) {
|
||||
ssc.bind(new InetSocketAddress(lb, 0));
|
||||
this.sc1 = SocketChannel.open(ssc.getLocalAddress());
|
||||
this.sc2 = ssc.accept();
|
||||
}
|
||||
}
|
||||
|
||||
SocketChannel channel1() {
|
||||
return sc1;
|
||||
}
|
||||
|
||||
SocketChannel channel2() {
|
||||
return sc2;
|
||||
}
|
||||
|
||||
public void close() throws IOException {
|
||||
sc1.close();
|
||||
sc2.close();
|
||||
}
|
||||
}
|
||||
|
||||
static ByteBuffer helloMessage() throws Exception {
|
||||
return ByteBuffer.wrap("hello".getBytes("UTF-8"));
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 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.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/* @test
|
||||
* @bug 4737146 4750573
|
||||
* @summary Test if isConnectable returns true after connected
|
||||
* @library .. /test/lib
|
||||
* @build jdk.test.lib.Utils TestServers
|
||||
* @run main IsConnectable
|
||||
*/
|
||||
|
||||
import java.net.*;
|
||||
import java.nio.channels.*;
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
import java.util.*;
|
||||
|
||||
public class IsConnectable {
|
||||
|
||||
static void test(TestServers.DayTimeServer daytimeServer) throws Exception {
|
||||
InetSocketAddress isa
|
||||
= new InetSocketAddress(daytimeServer.getAddress(),
|
||||
daytimeServer.getPort());
|
||||
SocketChannel sc = SocketChannel.open();
|
||||
sc.configureBlocking(false);
|
||||
final boolean immediatelyConnected = sc.connect(isa);
|
||||
|
||||
Selector selector = SelectorProvider.provider().openSelector();
|
||||
try {
|
||||
SelectionKey key = sc.register(selector, SelectionKey.OP_CONNECT);
|
||||
int keysAdded = selector.select();
|
||||
if (keysAdded > 0) {
|
||||
boolean result = sc.finishConnect();
|
||||
if (result) {
|
||||
keysAdded = selector.select(5000);
|
||||
// 4750573: keysAdded should not be incremented when op is dropped
|
||||
// from a key already in the selected key set
|
||||
if (keysAdded > 0)
|
||||
throw new Exception("Test failed: 4750573 detected");
|
||||
Set<SelectionKey> sel = selector.selectedKeys();
|
||||
Iterator<SelectionKey> i = sel.iterator();
|
||||
SelectionKey sk = i.next();
|
||||
// 4737146: isConnectable should be false while connected
|
||||
if (sk.isConnectable())
|
||||
throw new Exception("Test failed: 4737146 detected");
|
||||
}
|
||||
} else {
|
||||
if (!immediatelyConnected) {
|
||||
throw new Exception("Select failed");
|
||||
} else {
|
||||
System.out.println("IsConnectable couldn't be fully tested for "
|
||||
+ System.getProperty("os.name"));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
sc.close();
|
||||
selector.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
try (TestServers.DayTimeServer daytimeServer
|
||||
= TestServers.DayTimeServer.startNewServer(100)) {
|
||||
test(daytimeServer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, 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
|
||||
@ -101,11 +101,35 @@ public final class OptimalCapacity {
|
||||
*/
|
||||
public static void ofHashMap(Class<?> clazz, String fieldName,
|
||||
int initialCapacity)
|
||||
{
|
||||
ofHashMap(clazz, null, fieldName, initialCapacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks adequacy of the initial capacity of a non-static field
|
||||
* of type {@code HashMap}.
|
||||
*
|
||||
* Having
|
||||
* <pre>
|
||||
* class XClass {
|
||||
* HashMap theMap = new HashMap(N);
|
||||
* }
|
||||
* XClass instance = ...
|
||||
* </pre>
|
||||
*
|
||||
* you should call from the test
|
||||
*
|
||||
* <pre>
|
||||
* OptimalCapacity.ofHashMap(XClass.class, instance, "theMap", N);
|
||||
* </pre>
|
||||
*/
|
||||
public static void ofHashMap(Class<?> clazz, Object instance,
|
||||
String fieldName, int initialCapacity)
|
||||
{
|
||||
try {
|
||||
Field field = clazz.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
Object obj = field.get(null);
|
||||
Object obj = field.get(instance);
|
||||
if (!HashMap.class.equals(obj.getClass())) {
|
||||
throw new RuntimeException(field +
|
||||
" expected to be of type HashMap");
|
||||
|
@ -5,7 +5,6 @@
|
||||
# The Management Configuration file (in java.util.Properties format)
|
||||
# will be read if one of the following system properties is set:
|
||||
# -Dcom.sun.management.jmxremote.port=<port-number>
|
||||
# or -Dcom.sun.management.snmp.port=<port-number>
|
||||
# or -Dcom.sun.management.config.file=<this-file>
|
||||
#
|
||||
# The default Management Configuration file is:
|
||||
@ -26,8 +25,6 @@
|
||||
# For setting the JMX RMI agent port use the following line
|
||||
com.sun.management.jmxremote.port=${getFreePort}
|
||||
#
|
||||
# For setting the SNMP agent port use the following line
|
||||
# com.sun.management.snmp.port=<port-number>
|
||||
|
||||
#####################################################################
|
||||
# Optional Instrumentation
|
||||
@ -49,82 +46,6 @@ com.sun.management.jmxremote.port=${getFreePort}
|
||||
# To enable thread contention monitoring, uncomment the following line
|
||||
# com.sun.management.enableThreadContentionMonitoring
|
||||
|
||||
#####################################################################
|
||||
# SNMP Management Properties
|
||||
#####################################################################
|
||||
#
|
||||
# If the system property -Dcom.sun.management.snmp.port=<port-number>
|
||||
# is set then
|
||||
# - The SNMP agent (with the Java virtual machine MIB) is started
|
||||
# that listens on the specified port for incoming SNMP requests.
|
||||
# - the following properties for read for SNMP management.
|
||||
#
|
||||
# The configuration can be specified only at startup time.
|
||||
# Later changes to the above system property (e.g. via setProperty method), this
|
||||
# config file, or the ACL file has no effect to the running SNMP agent.
|
||||
#
|
||||
|
||||
#
|
||||
# ##################### SNMP Trap Port #########################
|
||||
#
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
# Specifies the remote port number at which managers are expected
|
||||
# to listen for trap. For each host defined in the ACL file,
|
||||
# the SNMP agent will send traps at <host>:<trap-destination-port-number>
|
||||
# Default for this property is 162.
|
||||
#
|
||||
|
||||
# To set port for sending traps to a different port use following line
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
|
||||
#
|
||||
# ################ SNMP listen interface #########################
|
||||
#
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
# Specifies the local interface on which the SNMP agent will bind.
|
||||
# This is usefull when running on machines which have several
|
||||
# interfaces defined. It makes it possible to listen to a specific
|
||||
# subnet accessible through that interface.
|
||||
# Default for this property is "localhost".
|
||||
#
|
||||
# The format of the value for that property is any string accepted
|
||||
# by java.net.InetAddress.getByName(String).
|
||||
#
|
||||
|
||||
# For restricting the port on which SNMP agent listens use following line
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
|
||||
#
|
||||
# #################### SNMP ACL file #########################
|
||||
#
|
||||
# com.sun.management.snmp.acl=true|false
|
||||
# Default for this property is true. (Case for true/false ignored)
|
||||
# If this property is specified as false then the ACL file
|
||||
# is not checked: all manager hosts are allowed all access.
|
||||
#
|
||||
|
||||
# For SNMP without checking ACL file uncomment the following line
|
||||
# com.sun.management.snmp.acl=false
|
||||
|
||||
#
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
# Specifies location for ACL file
|
||||
# This is optional - default location is
|
||||
# $JRE/conf/management/snmp.acl
|
||||
#
|
||||
# If the property "com.sun.management.snmp.acl" is set to false,
|
||||
# then this property and the ACL file are ignored.
|
||||
# Otherwise the ACL file must exist and be in the valid format.
|
||||
# If the ACL file is empty or non existent then no access is allowed.
|
||||
#
|
||||
# The SNMP agent will read the ACL file at startup time.
|
||||
# Modification to the ACL file has no effect to any running SNMP
|
||||
# agents which read that ACL file at startup.
|
||||
#
|
||||
|
||||
# For a non-default acl file location use following line
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
|
||||
#####################################################################
|
||||
# RMI Management Properties
|
||||
#####################################################################
|
||||
|
@ -5,7 +5,6 @@
|
||||
# The Management Configuration file (in java.util.Properties format)
|
||||
# will be read if one of the following system properties is set:
|
||||
# -Dcom.sun.management.jmxremote.port=<port-number>
|
||||
# or -Dcom.sun.management.snmp.port=<port-number>
|
||||
# or -Dcom.sun.management.config.file=<this-file>
|
||||
#
|
||||
# The default Management Configuration file is:
|
||||
@ -26,8 +25,6 @@
|
||||
# For setting the JMX RMI agent port use the following line
|
||||
com.sun.management.jmxremote.port=${getFreePort}
|
||||
#
|
||||
# For setting the SNMP agent port use the following line
|
||||
# com.sun.management.snmp.port=<port-number>
|
||||
|
||||
#####################################################################
|
||||
# Optional Instrumentation
|
||||
@ -49,82 +46,6 @@ com.sun.management.jmxremote.port=${getFreePort}
|
||||
# To enable thread contention monitoring, uncomment the following line
|
||||
# com.sun.management.enableThreadContentionMonitoring
|
||||
|
||||
#####################################################################
|
||||
# SNMP Management Properties
|
||||
#####################################################################
|
||||
#
|
||||
# If the system property -Dcom.sun.management.snmp.port=<port-number>
|
||||
# is set then
|
||||
# - The SNMP agent (with the Java virtual machine MIB) is started
|
||||
# that listens on the specified port for incoming SNMP requests.
|
||||
# - the following properties for read for SNMP management.
|
||||
#
|
||||
# The configuration can be specified only at startup time.
|
||||
# Later changes to the above system property (e.g. via setProperty method), this
|
||||
# config file, or the ACL file has no effect to the running SNMP agent.
|
||||
#
|
||||
|
||||
#
|
||||
# ##################### SNMP Trap Port #########################
|
||||
#
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
# Specifies the remote port number at which managers are expected
|
||||
# to listen for trap. For each host defined in the ACL file,
|
||||
# the SNMP agent will send traps at <host>:<trap-destination-port-number>
|
||||
# Default for this property is 162.
|
||||
#
|
||||
|
||||
# To set port for sending traps to a different port use following line
|
||||
# com.sun.management.snmp.trap=<trap-destination-port-number>
|
||||
|
||||
#
|
||||
# ################ SNMP listen interface #########################
|
||||
#
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
# Specifies the local interface on which the SNMP agent will bind.
|
||||
# This is usefull when running on machines which have several
|
||||
# interfaces defined. It makes it possible to listen to a specific
|
||||
# subnet accessible through that interface.
|
||||
# Default for this property is "localhost".
|
||||
#
|
||||
# The format of the value for that property is any string accepted
|
||||
# by java.net.InetAddress.getByName(String).
|
||||
#
|
||||
|
||||
# For restricting the port on which SNMP agent listens use following line
|
||||
# com.sun.management.snmp.interface=<InetAddress>
|
||||
|
||||
#
|
||||
# #################### SNMP ACL file #########################
|
||||
#
|
||||
# com.sun.management.snmp.acl=true|false
|
||||
# Default for this property is true. (Case for true/false ignored)
|
||||
# If this property is specified as false then the ACL file
|
||||
# is not checked: all manager hosts are allowed all access.
|
||||
#
|
||||
|
||||
# For SNMP without checking ACL file uncomment the following line
|
||||
# com.sun.management.snmp.acl=false
|
||||
|
||||
#
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
# Specifies location for ACL file
|
||||
# This is optional - default location is
|
||||
# $JRE/conf/management/snmp.acl
|
||||
#
|
||||
# If the property "com.sun.management.snmp.acl" is set to false,
|
||||
# then this property and the ACL file are ignored.
|
||||
# Otherwise the ACL file must exist and be in the valid format.
|
||||
# If the ACL file is empty or non existent then no access is allowed.
|
||||
#
|
||||
# The SNMP agent will read the ACL file at startup time.
|
||||
# Modification to the ACL file has no effect to any running SNMP
|
||||
# agents which read that ACL file at startup.
|
||||
#
|
||||
|
||||
# For a non-default acl file location use following line
|
||||
# com.sun.management.snmp.acl.file=filepath
|
||||
|
||||
#####################################################################
|
||||
# RMI Management Properties
|
||||
#####################################################################
|
||||
|
@ -5,7 +5,6 @@ utility to remove all non-owner Access Control Entries from a given file.
|
||||
The tool is used by regression tests in the following directories :-
|
||||
|
||||
test/sun/management/jmxremote/bootstrap
|
||||
test/sun/management/snmp/bootstrap
|
||||
|
||||
The tests in these directories create password or ACL files that need to
|
||||
be "secured" (meaning that only the owner should have access to the
|
||||
|
@ -52,27 +52,33 @@ public class InfoStreams {
|
||||
|
||||
String classPath = System.getProperty("java.class.path");
|
||||
|
||||
run("-help").stderrShouldMatch(USAGE).stdoutShouldNotMatch(".");
|
||||
run("--help").stdoutShouldMatch(USAGE).stderrShouldNotMatch(".");
|
||||
run("-help").stderrShouldMatch(USAGE).stdoutShouldNotMatch(USAGE);
|
||||
run("--help").stdoutShouldMatch(USAGE).stderrShouldNotMatch(USAGE);
|
||||
|
||||
run("-version").stderrShouldMatch(VERSION_ERR).stdoutShouldNotMatch(".");
|
||||
run("--version").stdoutShouldMatch(VERSION_OUT).stderrShouldNotMatch(".");
|
||||
run("-version").stderrShouldMatch(VERSION_ERR)
|
||||
.stdoutShouldNotMatch(VERSION_ERR)
|
||||
.stdoutShouldNotMatch(VERSION_OUT);
|
||||
run("--version").stdoutShouldMatch(VERSION_OUT)
|
||||
.stderrShouldNotMatch(VERSION_OUT)
|
||||
.stderrShouldNotMatch(VERSION_ERR);
|
||||
|
||||
run("-showversion", "--dry-run", "-cp", classPath, "InfoStreams")
|
||||
.stderrShouldMatch(VERSION_ERR)
|
||||
.stdoutShouldNotMatch(".");
|
||||
.stdoutShouldNotMatch(VERSION_ERR)
|
||||
.stdoutShouldNotMatch(VERSION_OUT);
|
||||
run("--show-version", "--dry-run", "-cp", classPath, "InfoStreams")
|
||||
.stdoutShouldMatch(VERSION_OUT)
|
||||
.stderrShouldNotMatch(".");
|
||||
.stderrShouldNotMatch(VERSION_OUT)
|
||||
.stderrShouldNotMatch(VERSION_ERR);
|
||||
|
||||
run("-fullversion").stderrShouldMatch(FULLVERSION_ERR)
|
||||
.stdoutShouldNotMatch(".");
|
||||
.stdoutShouldNotMatch(FULLVERSION_ERR)
|
||||
.stdoutShouldNotMatch(FULLVERSION_OUT);
|
||||
run("--full-version").stdoutShouldMatch(FULLVERSION_OUT)
|
||||
.stderrShouldNotMatch(".");
|
||||
|
||||
run("-X").stderrShouldMatch(NONSTD).stdoutShouldNotMatch(".");
|
||||
run("--help-extra").stdoutShouldMatch(NONSTD).stderrShouldNotMatch(".");
|
||||
.stderrShouldNotMatch(FULLVERSION_OUT)
|
||||
.stderrShouldNotMatch(FULLVERSION_ERR);
|
||||
|
||||
run("-X").stderrShouldMatch(NONSTD).stdoutShouldNotMatch(NONSTD);
|
||||
run("--help-extra").stdoutShouldMatch(NONSTD).stderrShouldNotMatch(NONSTD);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -184,7 +184,6 @@ public class ToolsOpts extends TestHelper {
|
||||
break;
|
||||
}
|
||||
|
||||
String[] output = tr.testOutput.toArray(new String[tr.testOutput.size()]);
|
||||
//-Joptions should not be passed to tool
|
||||
if (jpos > -1) {
|
||||
checkJoptionOutput(tr, arg);
|
||||
@ -194,14 +193,23 @@ public class ToolsOpts extends TestHelper {
|
||||
+ "CMD: " + cmdString);
|
||||
}
|
||||
} else {
|
||||
//check that each non -J option was passed to tool.
|
||||
// check that each non -J option was passed to tool. It looks for each arg in the output.
|
||||
// Irrelevant lines in the output are skipped. Arguments order is checked as well.
|
||||
int j = 0;
|
||||
List<String> output = tr.testOutput;
|
||||
for (int i = 0; i < arg.length; i++) {
|
||||
if (output[i].compareTo(arg[i]) != 0) {
|
||||
boolean found = false;
|
||||
for (; j < output.size(); j++) {
|
||||
if (output.get(j).equals(arg[i])) {
|
||||
pass("check " + output.get(j) + " == " + arg[i]);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
throw new RuntimeException(
|
||||
"failed! CMD: " + cmdString + "\n case:" +
|
||||
output[i] + " != " + arg[i]);
|
||||
} else {
|
||||
pass("check " + output[i] + " == " + arg[i]);
|
||||
"failed! Should have passed non -J option [" + arg[i] + "] to tool.\n"
|
||||
+ "CMD: " + cmdString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,7 +332,6 @@ com.sun.security.auth.login
|
||||
com.sun.security.auth.module
|
||||
module:jdk.security.jgss
|
||||
com.sun.security.jgss
|
||||
module:jdk.snmp
|
||||
module:jdk.xml.dom
|
||||
org.w3c.dom.css
|
||||
org.w3c.dom.html
|
||||
|
@ -72,7 +72,7 @@ public class BasicRepeatingAnnotations {
|
||||
}
|
||||
a = BasicNonRepeatingAnno.class.getAnnotation(Foo.class);
|
||||
if (a == null) {
|
||||
throw new RuntimeException("Repeated annoation not directly present");
|
||||
throw new RuntimeException("Repeated annotation not directly present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ public class ExceptionParameters {
|
||||
}
|
||||
|
||||
@TADescription(annotation = "RTAs", type = EXCEPTION_PARAMETER, exceptionIndex = 0)
|
||||
public String exceptionRepeatableAnnoation() {
|
||||
public String exceptionRepeatableAnnotation() {
|
||||
return "void exception() { try { new Object(); } catch(@RTA @RTA Exception e) { } }";
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ public class MethodParameters {
|
||||
genericLocation = { 0, 0 }, paramIndex = 1)
|
||||
@TADescription(annotation = "RTCs", type = METHOD_FORMAL_PARAMETER,
|
||||
genericLocation = { 0, 0, 0, 0 }, paramIndex = 1)
|
||||
public String methodParamAsVarargRepeatableAnnoattion() {
|
||||
public String methodParamAsVarargRepeatableAnnotation() {
|
||||
return "void test(Object b, @RTC @RTC String @RTA @RTA [] @RTB @RTB ... a) { }";
|
||||
}
|
||||
|
||||
|
@ -77,18 +77,45 @@ public class Deduplication {
|
||||
group((Function<Integer, Integer>) y -> j);
|
||||
|
||||
group(
|
||||
(Function<Integer, Integer>) y -> {
|
||||
while (true) {
|
||||
break;
|
||||
}
|
||||
return 42;
|
||||
},
|
||||
(Function<Integer, Integer>) y -> {
|
||||
while (true) {
|
||||
break;
|
||||
}
|
||||
return 42;
|
||||
});
|
||||
(Function<Integer, Integer>)
|
||||
y -> {
|
||||
while (true) {
|
||||
break;
|
||||
}
|
||||
return 42;
|
||||
},
|
||||
(Function<Integer, Integer>)
|
||||
y -> {
|
||||
while (true) {
|
||||
break;
|
||||
}
|
||||
return 42;
|
||||
});
|
||||
|
||||
group(
|
||||
(Function<Integer, Integer>)
|
||||
x -> {
|
||||
int y = x;
|
||||
return y;
|
||||
},
|
||||
(Function<Integer, Integer>)
|
||||
x -> {
|
||||
int y = x;
|
||||
return y;
|
||||
});
|
||||
|
||||
group(
|
||||
(Function<Integer, Integer>)
|
||||
x -> {
|
||||
int y = 0, z = x;
|
||||
return y;
|
||||
});
|
||||
group(
|
||||
(Function<Integer, Integer>)
|
||||
x -> {
|
||||
int y = 0, z = x;
|
||||
return z;
|
||||
});
|
||||
|
||||
class Local {
|
||||
int i;
|
||||
|
@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test 8200301
|
||||
* @test 8200301 8201194
|
||||
* @summary deduplicate lambda methods with the same body, target type, and captured state
|
||||
* @modules jdk.jdeps/com.sun.tools.classfile jdk.compiler/com.sun.tools.javac.api
|
||||
* jdk.compiler/com.sun.tools.javac.code jdk.compiler/com.sun.tools.javac.comp
|
||||
@ -32,6 +32,7 @@
|
||||
*/
|
||||
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||
import static java.util.stream.Collectors.joining;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static java.util.stream.Collectors.toMap;
|
||||
import static java.util.stream.Collectors.toSet;
|
||||
|
||||
@ -57,7 +58,6 @@ import com.sun.tools.javac.tree.JCTree.JCIdent;
|
||||
import com.sun.tools.javac.tree.JCTree.JCLambda;
|
||||
import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
|
||||
import com.sun.tools.javac.tree.JCTree.JCTypeCast;
|
||||
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
|
||||
import com.sun.tools.javac.tree.JCTree.Tag;
|
||||
import com.sun.tools.javac.tree.TreeScanner;
|
||||
import com.sun.tools.javac.util.Context;
|
||||
@ -70,10 +70,8 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.function.BiFunction;
|
||||
import javax.tools.Diagnostic;
|
||||
import javax.tools.DiagnosticListener;
|
||||
import javax.tools.JavaFileObject;
|
||||
@ -160,36 +158,9 @@ public class DeduplicationTest {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a symbol comparator that treats symbols that correspond to the same parameter of each
|
||||
* of the given lambdas as equal.
|
||||
*/
|
||||
private static BiFunction<Symbol, Symbol, Boolean> paramsEqual(JCLambda lhs, JCLambda rhs) {
|
||||
return (x, y) -> {
|
||||
Integer idx = paramIndex(lhs, x);
|
||||
if (idx != null && idx != -1) {
|
||||
if (Objects.equals(idx, paramIndex(rhs, y))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the index of the given symbol as a parameter of the given lambda, or else {@code -1}
|
||||
* if is not a parameter.
|
||||
*/
|
||||
private static Integer paramIndex(JCLambda lambda, Symbol sym) {
|
||||
if (sym != null) {
|
||||
int idx = 0;
|
||||
for (JCVariableDecl param : lambda.params) {
|
||||
if (sym == param.sym) {
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
/** Returns the parameter symbols of the given lambda. */
|
||||
private static List<Symbol> paramSymbols(JCLambda lambda) {
|
||||
return lambda.params.stream().map(x -> x.sym).collect(toList());
|
||||
}
|
||||
|
||||
/** A diagnostic listener that records debug messages related to lambda desugaring. */
|
||||
@ -310,13 +281,14 @@ public class DeduplicationTest {
|
||||
dedupedLambdas.put(lhs, first);
|
||||
}
|
||||
for (JCLambda rhs : curr) {
|
||||
if (!new TreeDiffer(paramsEqual(lhs, rhs)).scan(lhs.body, rhs.body)) {
|
||||
if (!new TreeDiffer(paramSymbols(lhs), paramSymbols(rhs))
|
||||
.scan(lhs.body, rhs.body)) {
|
||||
throw new AssertionError(
|
||||
String.format(
|
||||
"expected lambdas to be equal\n%s\n%s", lhs, rhs));
|
||||
}
|
||||
if (TreeHasher.hash(lhs, sym -> paramIndex(lhs, sym))
|
||||
!= TreeHasher.hash(rhs, sym -> paramIndex(rhs, sym))) {
|
||||
if (TreeHasher.hash(lhs, paramSymbols(lhs))
|
||||
!= TreeHasher.hash(rhs, paramSymbols(rhs))) {
|
||||
throw new AssertionError(
|
||||
String.format(
|
||||
"expected lambdas to hash to the same value\n%s\n%s",
|
||||
@ -334,14 +306,15 @@ public class DeduplicationTest {
|
||||
}
|
||||
for (JCLambda lhs : curr) {
|
||||
for (JCLambda rhs : lambdaGroups.get(j)) {
|
||||
if (new TreeDiffer(paramsEqual(lhs, rhs)).scan(lhs.body, rhs.body)) {
|
||||
if (new TreeDiffer(paramSymbols(lhs), paramSymbols(rhs))
|
||||
.scan(lhs.body, rhs.body)) {
|
||||
throw new AssertionError(
|
||||
String.format(
|
||||
"expected lambdas to not be equal\n%s\n%s",
|
||||
lhs, rhs));
|
||||
}
|
||||
if (TreeHasher.hash(lhs, sym -> paramIndex(lhs, sym))
|
||||
== TreeHasher.hash(rhs, sym -> paramIndex(rhs, sym))) {
|
||||
if (TreeHasher.hash(lhs, paramSymbols(lhs))
|
||||
== TreeHasher.hash(rhs, paramSymbols(rhs))) {
|
||||
throw new AssertionError(
|
||||
String.format(
|
||||
"expected lambdas to hash to different values\n%s\n%s",
|
||||
|
Loading…
Reference in New Issue
Block a user