This commit is contained in:
J. Duke 2017-07-05 23:26:05 +02:00
commit 9db3ece35b
523 changed files with 10749 additions and 6019 deletions

View File

@ -417,4 +417,6 @@ ba5b16c9c6d80632b61959a33d424b1c3398ce62 jdk-9+166
06373236a30801f72e2a31ee5c691c2a1e500f57 jdk-10+3
8ec175c61fc3f58328a3324f07d7ded00e060be3 jdk-10+4
111e2e7d00f45c983cdbc9c59ae40552152fcc23 jdk-10+5
03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6
03fe61bb7670644cf6e46b5cfafb6b27c0e0157e jdk-10+6
b25838a28195f4b6dab34668411eedd2d366a16c jdk-9+169

View File

@ -318,7 +318,7 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
AC_SUBST(JAVAC_FLAGS)
# Check if the boot jdk is 32 or 64 bit
if "$JAVA" -d64 -version > /dev/null 2>&1; then
if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
BOOT_JDK_BITS="64"
else
BOOT_JDK_BITS="32"

View File

@ -1,5 +1,28 @@
#!/bin/sh
echo >&2 "No suitable 'install' command found.'"
echo >&2 "If automake is installed, running 'automake -fa'"
echo >&2 "(and ignoring the errors) might produce one."
exit 1
#!/bin/bash
#
# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# This file is empty on purpose. It's a placeholder which is required by
# autoconf, but it serves no purpose for us.

View File

@ -417,10 +417,8 @@ AC_DEFUN_ONCE([BPERF_SETUP_SMART_JAVAC],
AC_SUBST(SJAVAC_SERVER_JAVA)
if test "$MEMORY_SIZE" -gt "3000"; then
ADD_JVM_ARG_IF_OK([-d64],SJAVAC_SERVER_JAVA_FLAGS,[$SJAVAC_SERVER_JAVA])
if test "$JVM_ARG_OK" = true; then
if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
JVM_64BIT=true
JVM_ARG_OK=false
fi
fi

View File

@ -996,8 +996,9 @@ OPENJDK_TARGET_CPU_OSARCH
OPENJDK_TARGET_CPU_ISADIR
OPENJDK_TARGET_CPU_LEGACY_LIB
OPENJDK_TARGET_CPU_LEGACY
OPENJDK_MODULE_TARGET_OS_ARCH
OPENJDK_MODULE_TARGET_OS_NAME
RELEASE_FILE_OS_ARCH
RELEASE_FILE_OS_NAME
OPENJDK_MODULE_TARGET_PLATFORM
COMPILE_TYPE
OPENJDK_TARGET_CPU_ENDIAN
OPENJDK_TARGET_CPU_BITS
@ -4900,6 +4901,8 @@ VALID_JVM_VARIANTS="server client minimal core zero zeroshark custom"
#%%% Build and target systems %%%
@ -5183,7 +5186,7 @@ VS_SDK_PLATFORM_NAME_2013=
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
DATE_WHEN_GENERATED=1492975963
DATE_WHEN_GENERATED=1494615666
###############################################################################
#
@ -16043,6 +16046,27 @@ $as_echo "$COMPILE_TYPE" >&6; }
OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
fi
OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
RELEASE_FILE_OS_NAME=SunOS
fi
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
RELEASE_FILE_OS_NAME=Linux
fi
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
RELEASE_FILE_OS_NAME=Windows
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
RELEASE_FILE_OS_NAME="Darwin"
fi
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
RELEASE_FILE_OS_NAME="AIX"
fi
RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
@ -31392,7 +31416,7 @@ $as_echo "no" >&6; }
# Check if the boot jdk is 32 or 64 bit
if "$JAVA" -d64 -version > /dev/null 2>&1; then
if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
BOOT_JDK_BITS="64"
else
BOOT_JDK_BITS="32"
@ -65910,24 +65934,8 @@ fi
if test "$MEMORY_SIZE" -gt "3000"; then
$ECHO "Check if jvm arg is ok: -d64" >&5
$ECHO "Command: $SJAVAC_SERVER_JAVA -d64 -version" >&5
OUTPUT=`$SJAVAC_SERVER_JAVA -d64 -version 2>&1`
FOUND_WARN=`$ECHO "$OUTPUT" | $GREP -i warn`
FOUND_VERSION=`$ECHO $OUTPUT | $GREP " version \""`
if test "x$FOUND_VERSION" != x && test "x$FOUND_WARN" = x; then
SJAVAC_SERVER_JAVA_FLAGS="$SJAVAC_SERVER_JAVA_FLAGS -d64"
JVM_ARG_OK=true
else
$ECHO "Arg failed:" >&5
$ECHO "$OUTPUT" >&5
JVM_ARG_OK=false
fi
if test "$JVM_ARG_OK" = true; then
if "$JAVA" -version 2>&1 | $GREP -q "64-Bit"; then
JVM_64BIT=true
JVM_ARG_OK=false
fi
fi

View File

@ -433,6 +433,29 @@ AC_DEFUN([PLATFORM_SETUP_LEGACY_VARS_HELPER],
])
AC_DEFUN([PLATFORM_SET_RELEASE_FILE_OS_VALUES],
[
if test "x$OPENJDK_TARGET_OS" = "xsolaris"; then
RELEASE_FILE_OS_NAME=SunOS
fi
if test "x$OPENJDK_TARGET_OS" = "xlinux"; then
RELEASE_FILE_OS_NAME=Linux
fi
if test "x$OPENJDK_TARGET_OS" = "xwindows"; then
RELEASE_FILE_OS_NAME=Windows
fi
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
RELEASE_FILE_OS_NAME="Darwin"
fi
if test "x$OPENJDK_TARGET_OS" = "xaix"; then
RELEASE_FILE_OS_NAME="AIX"
fi
RELEASE_FILE_OS_ARCH=${OPENJDK_TARGET_CPU}
AC_SUBST(RELEASE_FILE_OS_NAME)
AC_SUBST(RELEASE_FILE_OS_ARCH)
])
AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
[
if test "x$OPENJDK_TARGET_OS" = xmacosx; then
@ -447,8 +470,8 @@ AC_DEFUN([PLATFORM_SET_MODULE_TARGET_OS_VALUES],
OPENJDK_MODULE_TARGET_OS_ARCH="$OPENJDK_TARGET_CPU"
fi
AC_SUBST(OPENJDK_MODULE_TARGET_OS_NAME)
AC_SUBST(OPENJDK_MODULE_TARGET_OS_ARCH)
OPENJDK_MODULE_TARGET_PLATFORM="${OPENJDK_MODULE_TARGET_OS_NAME}-${OPENJDK_MODULE_TARGET_OS_ARCH}"
AC_SUBST(OPENJDK_MODULE_TARGET_PLATFORM)
])
#%%% Build and target systems %%%
@ -466,6 +489,7 @@ AC_DEFUN_ONCE([PLATFORM_SETUP_OPENJDK_BUILD_AND_TARGET],
PLATFORM_EXTRACT_TARGET_AND_BUILD
PLATFORM_SETUP_TARGET_CPU_BITS
PLATFORM_SET_MODULE_TARGET_OS_VALUES
PLATFORM_SET_RELEASE_FILE_OS_VALUES
PLATFORM_SETUP_LEGACY_VARS
])

View File

@ -101,9 +101,12 @@ OPENJDK_BUILD_CPU_ARCH:=@OPENJDK_BUILD_CPU_ARCH@
OPENJDK_BUILD_CPU_BITS:=@OPENJDK_BUILD_CPU_BITS@
OPENJDK_BUILD_CPU_ENDIAN:=@OPENJDK_BUILD_CPU_ENDIAN@
# OS values for use in ModuleTarget class file attribute.
OPENJDK_MODULE_TARGET_OS_NAME:=@OPENJDK_MODULE_TARGET_OS_NAME@
OPENJDK_MODULE_TARGET_OS_ARCH:=@OPENJDK_MODULE_TARGET_OS_ARCH@
# Target platform value in ModuleTarget class file attribute.
OPENJDK_MODULE_TARGET_PLATFORM:=@OPENJDK_MODULE_TARGET_PLATFORM@
# OS_* properties in release file
RELEASE_FILE_OS_NAME:=@RELEASE_FILE_OS_NAME@
RELEASE_FILE_OS_ARCH:=@RELEASE_FILE_OS_ARCH@
LIBM:=@LIBM@
LIBDL:=@LIBDL@

View File

@ -239,11 +239,8 @@ var getJibProfilesCommon = function (input, data) {
common.main_profile_base = {
dependencies: ["boot_jdk", "gnumake", "jtreg"],
default_make_targets: ["product-bundles", "test-bundles"],
configure_args: [
"--with-version-opt=" + common.build_id,
"--enable-jtreg-failure-handler",
"--with-version-build=" + common.build_number
]
configure_args: concat(["--enable-jtreg-failure-handler"],
versionArgs(input, common))
};
// Extra settings for debug profiles
common.debug_suffix = "-debug";
@ -269,10 +266,12 @@ var getJibProfilesCommon = function (input, data) {
/**
* Define common artifacts template for all main profiles
* @param pf - Name of platform in bundle names
* @param demo_ext - Type of extension for demo bundle
* @param o - Object containing data for artifacts
*/
common.main_profile_artifacts = function (pf, demo_ext) {
common.main_profile_artifacts = function (o) {
var jdk_subdir = (o.jdk_subdir != null ? o.jdk_subdir : "jdk-" + data.version);
var jre_subdir = (o.jre_subdir != null ? o.jre_subdir : "jre-" + data.version);
var pf = o.platform
return {
artifacts: {
jdk: {
@ -281,7 +280,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jdk-" + data.version,
subdir: jdk_subdir,
exploded: "images/jdk"
},
jre: {
@ -290,7 +289,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jre-" + data.version,
subdir: jre_subdir,
exploded: "images/jre"
},
test: {
@ -307,7 +306,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-symbols.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jdk-" + data.version,
subdir: jdk_subdir,
exploded: "images/jdk"
},
jre_symbols: {
@ -316,15 +315,8 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-symbols.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jre-" + data.version,
subdir: jre_subdir,
exploded: "images/jre"
},
demo: {
local: "bundles/\\(jdk.*demo." + demo_ext + "\\)",
remote: [
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_demo." + demo_ext,
"bundles/" + pf + "/\\1"
],
}
}
};
@ -333,9 +325,12 @@ var getJibProfilesCommon = function (input, data) {
/**
* Define common artifacts template for all debug profiles
* @param pf - Name of platform in bundle names
* @param o - Object containing data for artifacts
*/
common.debug_profile_artifacts = function (pf) {
common.debug_profile_artifacts = function (o) {
var jdk_subdir = "jdk-" + data.version + "/fastdebug";
var jre_subdir = "jre-" + data.version + "/fastdebug";
var pf = o.platform
return {
artifacts: {
jdk: {
@ -344,7 +339,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jdk-" + data.version,
subdir: jdk_subdir,
exploded: "images/jdk"
},
jre: {
@ -353,7 +348,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jre-" + data.version,
subdir: jre_subdir,
exploded: "images/jre"
},
test: {
@ -370,7 +365,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jdk-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jdk-" + data.version,
subdir: jdk_subdir,
exploded: "images/jdk"
},
jre_symbols: {
@ -379,7 +374,7 @@ var getJibProfilesCommon = function (input, data) {
"bundles/" + pf + "/jre-" + data.version + "_" + pf + "_bin-debug-symbols.tar.gz",
"bundles/" + pf + "/\\1"
],
subdir: "jre-" + data.version,
subdir: jre_subdir,
exploded: "images/jre"
}
}
@ -665,61 +660,53 @@ var getJibProfilesProfiles = function (input, common, data) {
//
// Define artifacts for profiles
//
// Macosx bundles are named osx and Windows demo bundles use zip instead of
// Macosx bundles are named osx
// tar.gz.
var artifactData = {
"linux-x64": {
platform: "linux-x64",
demo_ext: "tar.gz"
},
"linux-x86": {
platform: "linux-x86",
demo_ext: "tar.gz"
},
"macosx-x64": {
platform: "osx-x64",
demo_ext: "tar.gz"
jdk_subdir: "jdk-" + data.version + ".jdk/Contents/Home",
jre_subdir: "jre-" + data.version + ".jre/Contents/Home"
},
"solaris-x64": {
platform: "solaris-x64",
demo_ext: "tar.gz"
},
"solaris-sparcv9": {
platform: "solaris-sparcv9",
demo_ext: "tar.gz"
},
"windows-x64": {
platform: "windows-x64",
demo_ext: "zip"
},
"windows-x86": {
platform: "windows-x86",
demo_ext: "zip"
},
"linux-arm64": {
platform: "linux-arm64-vfp-hflt",
demo_ext: "tar.gz"
},
"linux-arm-vfp-hflt": {
platform: "linux-arm32-vfp-hflt",
demo_ext: "tar.gz"
},
"linux-arm-vfp-hflt-dyn": {
platform: "linux-arm32-vfp-hflt-dyn",
demo_ext: "tar.gz"
}
}
// Generate common artifacts for all main profiles
Object.keys(artifactData).forEach(function (name) {
profiles[name] = concatObjects(profiles[name],
common.main_profile_artifacts(artifactData[name].platform, artifactData[name].demo_ext));
common.main_profile_artifacts(artifactData[name]));
});
// Generate common artifacts for all debug profiles
Object.keys(artifactData).forEach(function (name) {
var debugName = name + common.debug_suffix;
profiles[debugName] = concatObjects(profiles[debugName],
common.debug_profile_artifacts(artifactData[name].platform));
common.debug_profile_artifacts(artifactData[name]));
});
// Extra profile specific artifacts
@ -740,7 +727,12 @@ var getJibProfilesProfiles = function (input, common, data) {
artifacts: {
jdk: {
local: "bundles/\\(jdk.*bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
remote: [
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
+ "_linux-x64_bin.tar.gz",
"bundles/openjdk/GPL/linux-x64/\\1"
],
subdir: "jdk-" + data.version
},
jre: {
local: "bundles/\\(jre.*bin.tar.gz\\)",
@ -748,20 +740,25 @@ var getJibProfilesProfiles = function (input, common, data) {
},
test: {
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
remote: [
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
+ "_linux-x64_bin-tests.tar.gz",
"bundles/openjdk/GPL/linux-x64/\\1"
]
},
jdk_symbols: {
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
remote: [
"bundles/openjdk/GPL/linux-x64/jdk-" + data.version
+ "_linux-x64_bin-symbols.tar.gz",
"bundles/openjdk/GPL/linux-x64/\\1"
],
subdir: "jdk-" + data.version
},
jre_symbols: {
local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
},
demo: {
local: "bundles/\\(jdk.*demo.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
},
doc_api_spec: {
local: "bundles/\\(jdk.*doc-api-spec.tar.gz\\)",
remote: "bundles/openjdk/GPL/linux-x64/\\1",
@ -773,11 +770,29 @@ var getJibProfilesProfiles = function (input, common, data) {
artifacts: {
jdk: {
local: "bundles/\\(jdk.*bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
remote: [
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
+ "_linux-x86_bin.tar.gz",
"bundles/openjdk/GPL/linux-x86/\\1"
],
subdir: "jdk-" + data.version
},
jdk_symbols: {
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
remote: "bundles/openjdk/GPL/profile/linux-x86/\\1",
remote: [
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
+ "_linux-x86_bin-symbols.tar.gz",
"bundles/openjdk/GPL/linux-x86/\\1"
],
subdir: "jdk-" + data.version
},
test: {
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
remote: [
"bundles/openjdk/GPL/linux-x86/jdk-" + data.version
+ "_linux-x86_bin-tests.tar.gz",
"bundles/openjdk/GPL/linux-x86/\\1"
]
},
jre: {
// This regexp needs to not match the compact* files below
@ -803,7 +818,12 @@ var getJibProfilesProfiles = function (input, common, data) {
artifacts: {
jdk: {
local: "bundles/\\(jdk.*bin.tar.gz\\)",
remote: "bundles/openjdk/GPL/windows-x86/\\1",
remote: [
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
+ "_windows-x86_bin.tar.gz",
"bundles/openjdk/GPL/windows-x86/\\1"
],
subdir: "jdk-" + data.version
},
jre: {
local: "bundles/\\(jre.*bin.tar.gz\\)",
@ -811,19 +831,24 @@ var getJibProfilesProfiles = function (input, common, data) {
},
test: {
local: "bundles/\\(jdk.*bin-tests.tar.gz\\)",
remote: "bundles/openjdk/GPL/windows-x86/\\1",
remote: [
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
+ "_windows-x86_bin-tests.tar.gz",
"bundles/openjdk/GPL/windows-x86/\\1"
]
},
jdk_symbols: {
local: "bundles/\\(jdk.*bin-symbols.tar.gz\\)",
remote: "bundles/openjdk/GPL/windows-x86/\\1"
remote: [
"bundles/openjdk/GPL/windows-x86/jdk-" + data.version
+ "_windows-x86_bin-symbols.tar.gz",
"bundles/openjdk/GPL/windows-x86/\\1"
],
subdir: "jdk-" + data.version
},
jre_symbols: {
local: "bundles/\\(jre.*bin-symbols.tar.gz\\)",
remote: "bundles/openjdk/GPL/windows-x86/\\1",
},
demo: {
local: "bundles/\\(jdk.*demo.zip\\)",
remote: "bundles/openjdk/GPL/windows-x86/\\1",
}
}
},
@ -1154,6 +1179,23 @@ var getVersion = function (major, minor, security, patch) {
return version;
};
/**
* Constructs the common version configure args based on build type and
* other version inputs
*/
var versionArgs = function(input, common) {
var args = ["--with-version-build=" + common.build_number];
if (input.build_type == "promoted") {
args = concat(args,
// This needs to be changed when we start building release candidates
"--with-version-pre=ea",
"--without-version-opt");
} else {
args = concat(args, "--with-version-opt=" + common.build_id);
}
return args;
}
// Properties representation of the common/autoconf/version-numbers file. Lazily
// initiated by the function below.
var version_numbers;

View File

@ -199,9 +199,8 @@ Additional options to the Gtest test framework.
Use `GTEST="OPTIONS=--help"` to see all available Gtest options.
---
# Override some definitions in http://openjdk.java.net/page.css that are
# unsuitable for this document.
# Override some definitions in the global css file that are not optimal for
# this document.
header-includes:
- '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>'
- '<style type="text/css">pre { font-size: 10pt; }</style>'
---

View File

@ -418,3 +418,4 @@ a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
c7358d703e1282af3dcd8af6c037dc4342de9054 jdk-10+6
43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167
03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168
b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169

View File

@ -578,3 +578,4 @@ c92c6416ca03b1464d5ed99cf6201e52b5ba0a70 jdk-9+165
762465099d938fd96cd1efda193bc1fa23d070d3 jdk-10+6
1ca7ed1b17b5776930d641d1379834f3140a74e4 jdk-9+167
fbb9c802649585d19f6d7e81b4a519d44806225a jdk-9+168
16d692be099c5c38eb48cc9aca78b0c900910d5b jdk-9+169

View File

@ -577,7 +577,7 @@ reg_class no_special_reg32_with_fp(
R26
/* R27, */ // heapbase
/* R28, */ // thread
/* R29, */ // fp
R29, // fp
/* R30, */ // lr
/* R31 */ // sp
);
@ -646,7 +646,7 @@ reg_class no_special_reg_with_fp(
R26, R26_H,
/* R27, R27_H, */ // heapbase
/* R28, R28_H, */ // thread
/* R29, R29_H, */ // fp
R29, R29_H, // fp
/* R30, R30_H, */ // lr
/* R31, R31_H */ // sp
);
@ -14021,10 +14021,12 @@ instruct clearArray_reg_reg(iRegL_R11 cnt, iRegP_R10 base, Universe dummy, rFlag
ins_pipe(pipe_class_memory);
%}
instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, iRegL_R11 tmp, Universe dummy, rFlagsReg cr)
instruct clearArray_imm_reg(immL cnt, iRegP_R10 base, Universe dummy, rFlagsReg cr)
%{
predicate((u_int64_t)n->in(2)->get_long()
< (u_int64_t)(BlockZeroingLowLimit >> LogBytesPerWord));
match(Set dummy (ClearArray cnt base));
effect(USE_KILL base, TEMP tmp);
effect(USE_KILL base);
ins_cost(4 * INSN_COST);
format %{ "ClearArray $cnt, $base" %}

View File

@ -1,8 +1,7 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights All rights reserved.
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE
* HEADER.
* 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
@ -21,7 +20,6 @@
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include <stdio.h>

View File

@ -698,6 +698,7 @@ void MacroAssembler::call_VM_helper(Register oop_result, address entry_point, in
// trampolines won't be emitted.
address MacroAssembler::trampoline_call(Address entry, CodeBuffer *cbuf) {
assert(JavaThread::current()->is_Compiler_thread(), "just checking");
assert(entry.rspec().type() == relocInfo::runtime_call_type
|| entry.rspec().type() == relocInfo::opt_virtual_call_type
|| entry.rspec().type() == relocInfo::static_call_type
@ -4944,34 +4945,67 @@ void MacroAssembler::arrays_equals(Register a1, Register a2,
}
// base: Address of a buffer to be zeroed, 8 bytes aligned.
// cnt: Count in HeapWords.
// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit.
void MacroAssembler::zero_words(Register base, Register cnt)
// The size of the blocks erased by the zero_blocks stub. We must
// handle anything smaller than this ourselves in zero_words().
const int MacroAssembler::zero_words_block_size = 8;
// zero_words() is used by C2 ClearArray patterns. It is as small as
// possible, handling small word counts locally and delegating
// anything larger to the zero_blocks stub. It is expanded many times
// in compiled code, so it is important to keep it short.
// ptr: Address of a buffer to be zeroed.
// cnt: Count in HeapWords.
//
// ptr, cnt, rscratch1, and rscratch2 are clobbered.
void MacroAssembler::zero_words(Register ptr, Register cnt)
{
if (UseBlockZeroing) {
block_zero(base, cnt);
} else {
fill_words(base, cnt, zr);
assert(is_power_of_2(zero_words_block_size), "adjust this");
assert(ptr == r10 && cnt == r11, "mismatch in register usage");
BLOCK_COMMENT("zero_words {");
cmp(cnt, zero_words_block_size);
Label around, done, done16;
br(LO, around);
{
RuntimeAddress zero_blocks = RuntimeAddress(StubRoutines::aarch64::zero_blocks());
assert(zero_blocks.target() != NULL, "zero_blocks stub has not been generated");
if (StubRoutines::aarch64::complete()) {
trampoline_call(zero_blocks);
} else {
bl(zero_blocks);
}
}
bind(around);
for (int i = zero_words_block_size >> 1; i > 1; i >>= 1) {
Label l;
tbz(cnt, exact_log2(i), l);
for (int j = 0; j < i; j += 2) {
stp(zr, zr, post(ptr, 16));
}
bind(l);
}
{
Label l;
tbz(cnt, 0, l);
str(zr, Address(ptr));
bind(l);
}
BLOCK_COMMENT("} zero_words");
}
// r10 = base: Address of a buffer to be zeroed, 8 bytes aligned.
// base: Address of a buffer to be zeroed, 8 bytes aligned.
// cnt: Immediate count in HeapWords.
// r11 = tmp: For use as cnt if we need to call out
#define ShortArraySize (18 * BytesPerLong)
#define SmallArraySize (18 * BytesPerLong)
void MacroAssembler::zero_words(Register base, u_int64_t cnt)
{
Register tmp = r11;
BLOCK_COMMENT("zero_words {");
int i = cnt & 1; // store any odd word to start
if (i) str(zr, Address(base));
if (cnt <= ShortArraySize / BytesPerLong) {
if (cnt <= SmallArraySize / BytesPerLong) {
for (; i < (int)cnt; i += 2)
stp(zr, zr, Address(base, i * wordSize));
} else if (UseBlockZeroing && cnt >= (u_int64_t)(BlockZeroingLowLimit >> LogBytesPerWord)) {
mov(tmp, cnt);
block_zero(base, tmp, true);
} else {
const int unroll = 4; // Number of stp(zr, zr) instructions we'll unroll
int remainder = cnt % (2 * unroll);
@ -4992,6 +5026,51 @@ void MacroAssembler::zero_words(Register base, u_int64_t cnt)
stp(zr, zr, Address(pre(loop_base, 2 * unroll * wordSize)));
cbnz(cnt_reg, loop);
}
BLOCK_COMMENT("} zero_words");
}
// Zero blocks of memory by using DC ZVA.
//
// Aligns the base address first sufficently for DC ZVA, then uses
// DC ZVA repeatedly for every full block. cnt is the size to be
// zeroed in HeapWords. Returns the count of words left to be zeroed
// in cnt.
//
// NOTE: This is intended to be used in the zero_blocks() stub. If
// you want to use it elsewhere, note that cnt must be >= 2*zva_length.
void MacroAssembler::zero_dcache_blocks(Register base, Register cnt) {
Register tmp = rscratch1;
Register tmp2 = rscratch2;
int zva_length = VM_Version::zva_length();
Label initial_table_end, loop_zva;
Label fini;
// Base must be 16 byte aligned. If not just return and let caller handle it
tst(base, 0x0f);
br(Assembler::NE, fini);
// Align base with ZVA length.
neg(tmp, base);
andr(tmp, tmp, zva_length - 1);
// tmp: the number of bytes to be filled to align the base with ZVA length.
add(base, base, tmp);
sub(cnt, cnt, tmp, Assembler::ASR, 3);
adr(tmp2, initial_table_end);
sub(tmp2, tmp2, tmp, Assembler::LSR, 2);
br(tmp2);
for (int i = -zva_length + 16; i < 0; i += 16)
stp(zr, zr, Address(base, i));
bind(initial_table_end);
sub(cnt, cnt, zva_length >> 3);
bind(loop_zva);
dc(Assembler::ZVA, base);
subs(cnt, cnt, zva_length >> 3);
add(base, base, zva_length);
br(Assembler::GE, loop_zva);
add(cnt, cnt, zva_length >> 3); // count not zeroed by DC ZVA
bind(fini);
}
// base: Address of a buffer to be filled, 8 bytes aligned.
@ -5052,69 +5131,6 @@ void MacroAssembler::fill_words(Register base, Register cnt, Register value)
bind(fini);
}
// Use DC ZVA to do fast zeroing.
// base: Address of a buffer to be zeroed, 8 bytes aligned.
// cnt: Count in HeapWords.
// is_large: True when 'cnt' is known to be >= BlockZeroingLowLimit.
void MacroAssembler::block_zero(Register base, Register cnt, bool is_large)
{
Label small;
Label store_pair, loop_store_pair, done;
Label base_aligned;
assert_different_registers(base, cnt, rscratch1);
guarantee(base == r10 && cnt == r11, "fix register usage");
Register tmp = rscratch1;
Register tmp2 = rscratch2;
int zva_length = VM_Version::zva_length();
// Ensure ZVA length can be divided by 16. This is required by
// the subsequent operations.
assert (zva_length % 16 == 0, "Unexpected ZVA Length");
if (!is_large) cbz(cnt, done);
tbz(base, 3, base_aligned);
str(zr, Address(post(base, 8)));
sub(cnt, cnt, 1);
bind(base_aligned);
// Ensure count >= zva_length * 2 so that it still deserves a zva after
// alignment.
if (!is_large || !(BlockZeroingLowLimit >= zva_length * 2)) {
int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit);
subs(tmp, cnt, low_limit >> 3);
br(Assembler::LT, small);
}
far_call(StubRoutines::aarch64::get_zero_longs());
bind(small);
const int unroll = 8; // Number of stp instructions we'll unroll
Label small_loop, small_table_end;
andr(tmp, cnt, (unroll-1) * 2);
sub(cnt, cnt, tmp);
add(base, base, tmp, Assembler::LSL, 3);
adr(tmp2, small_table_end);
sub(tmp2, tmp2, tmp, Assembler::LSL, 1);
br(tmp2);
bind(small_loop);
add(base, base, unroll * 16);
for (int i = -unroll; i < 0; i++)
stp(zr, zr, Address(base, i * 16));
bind(small_table_end);
subs(cnt, cnt, unroll * 2);
br(Assembler::GE, small_loop);
tbz(cnt, 0, done);
str(zr, Address(post(base, 8)));
bind(done);
}
// Intrinsic for sun/nio/cs/ISO_8859_1$Encoder.implEncodeISOArray and
// java/lang/StringUTF16.compress.
void MacroAssembler::encode_iso_array(Register src, Register dst,

View File

@ -1213,8 +1213,10 @@ public:
void fill_words(Register base, Register cnt, Register value);
void zero_words(Register base, u_int64_t cnt);
void zero_words(Register base, Register cnt);
void block_zero(Register base, Register cnt, bool is_large = false);
void zero_words(Register ptr, Register cnt);
void zero_dcache_blocks(Register base, Register cnt);
static const int zero_words_block_size;
void byte_array_inflate(Register src, Register dst, Register len,
FloatRegister vtmp1, FloatRegister vtmp2,

View File

@ -719,48 +719,74 @@ class StubGenerator: public StubCodeGenerator {
}
}
address generate_zero_longs(Register base, Register cnt) {
Register tmp = rscratch1;
Register tmp2 = rscratch2;
int zva_length = VM_Version::zva_length();
Label initial_table_end, loop_zva;
Label fini;
// The inner part of zero_words(). This is the bulk operation,
// zeroing words in blocks, possibly using DC ZVA to do it. The
// caller is responsible for zeroing the last few words.
//
// Inputs:
// r10: the HeapWord-aligned base address of an array to zero.
// r11: the count in HeapWords, r11 > 0.
//
// Returns r10 and r11, adjusted for the caller to clear.
// r10: the base address of the tail of words left to clear.
// r11: the number of words in the tail.
// r11 < MacroAssembler::zero_words_block_size.
address generate_zero_blocks() {
Label store_pair, loop_store_pair, done;
Label base_aligned;
Register base = r10, cnt = r11;
__ align(CodeEntryAlignment);
StubCodeMark mark(this, "StubRoutines", "zero_longs");
StubCodeMark mark(this, "StubRoutines", "zero_blocks");
address start = __ pc();
// Base must be 16 byte aligned. If not just return and let caller handle it
__ tst(base, 0x0f);
__ br(Assembler::NE, fini);
// Align base with ZVA length.
__ neg(tmp, base);
__ andr(tmp, tmp, zva_length - 1);
if (UseBlockZeroing) {
int zva_length = VM_Version::zva_length();
// tmp: the number of bytes to be filled to align the base with ZVA length.
__ add(base, base, tmp);
__ sub(cnt, cnt, tmp, Assembler::ASR, 3);
__ adr(tmp2, initial_table_end);
__ sub(tmp2, tmp2, tmp, Assembler::LSR, 2);
__ br(tmp2);
// Ensure ZVA length can be divided by 16. This is required by
// the subsequent operations.
assert (zva_length % 16 == 0, "Unexpected ZVA Length");
for (int i = -zva_length + 16; i < 0; i += 16)
__ stp(zr, zr, Address(base, i));
__ bind(initial_table_end);
__ tbz(base, 3, base_aligned);
__ str(zr, Address(__ post(base, 8)));
__ sub(cnt, cnt, 1);
__ bind(base_aligned);
// Ensure count >= zva_length * 2 so that it still deserves a zva after
// alignment.
Label small;
int low_limit = MAX2(zva_length * 2, (int)BlockZeroingLowLimit);
__ cmp(cnt, low_limit >> 3);
__ br(Assembler::LT, small);
__ zero_dcache_blocks(base, cnt);
__ bind(small);
}
{
// Number of stp instructions we'll unroll
const int unroll =
MacroAssembler::zero_words_block_size / 2;
// Clear the remaining blocks.
Label loop;
__ subs(cnt, cnt, unroll * 2);
__ br(Assembler::LT, done);
__ bind(loop);
for (int i = 0; i < unroll; i++)
__ stp(zr, zr, __ post(base, 16));
__ subs(cnt, cnt, unroll * 2);
__ br(Assembler::GE, loop);
__ bind(done);
__ add(cnt, cnt, unroll * 2);
}
__ sub(cnt, cnt, zva_length >> 3);
__ bind(loop_zva);
__ dc(Assembler::ZVA, base);
__ subs(cnt, cnt, zva_length >> 3);
__ add(base, base, zva_length);
__ br(Assembler::GE, loop_zva);
__ add(cnt, cnt, zva_length >> 3); // count not zeroed by DC ZVA
__ bind(fini);
__ ret(lr);
return start;
}
typedef enum {
copy_forwards = 1,
copy_backwards = -1
@ -2346,20 +2372,16 @@ class StubGenerator: public StubCodeGenerator {
__ subw(count, count, cnt_words, Assembler::LSL, 3 - shift);
if (UseBlockZeroing) {
Label non_block_zeroing, rest;
Register tmp = rscratch1;
// count >= BlockZeroingLowLimit && value == 0
__ subs(tmp, cnt_words, BlockZeroingLowLimit >> 3);
__ ccmp(value, 0 /* comparing value */, 0 /* NZCV */, Assembler::GE);
__ br(Assembler::NE, non_block_zeroing);
// If the fill value is zero we can use the fast zero_words().
__ cbnz(value, non_block_zeroing);
__ mov(bz_base, to);
__ block_zero(bz_base, cnt_words, true);
__ mov(to, bz_base);
__ add(to, to, cnt_words, Assembler::LSL, LogBytesPerWord);
__ zero_words(bz_base, cnt_words);
__ b(rest);
__ bind(non_block_zeroing);
__ fill_words(to, cnt_words, value);
__ bind(rest);
}
else {
} else {
__ fill_words(to, cnt_words, value);
}
@ -2420,7 +2442,7 @@ class StubGenerator: public StubCodeGenerator {
generate_copy_longs(copy_f, r0, r1, rscratch2, copy_forwards);
generate_copy_longs(copy_b, r0, r1, rscratch2, copy_backwards);
StubRoutines::aarch64::_zero_longs = generate_zero_longs(r10, r11);
StubRoutines::aarch64::_zero_blocks = generate_zero_blocks();
//*** jbyte
// Always need aligned and unaligned versions
@ -4769,6 +4791,7 @@ class StubGenerator: public StubCodeGenerator {
&StubRoutines::_safefetchN_fault_pc,
&StubRoutines::_safefetchN_continuation_pc);
#endif
StubRoutines::aarch64::set_completed();
}
public:

View File

@ -43,7 +43,8 @@ address StubRoutines::aarch64::_float_sign_mask = NULL;
address StubRoutines::aarch64::_float_sign_flip = NULL;
address StubRoutines::aarch64::_double_sign_mask = NULL;
address StubRoutines::aarch64::_double_sign_flip = NULL;
address StubRoutines::aarch64::_zero_longs = NULL;
address StubRoutines::aarch64::_zero_blocks = NULL;
bool StubRoutines::aarch64::_completed = false;
/**
* crc_table[] from jdk/src/share/native/java/util/zip/zlib-1.2.5/crc32.h

View File

@ -61,7 +61,8 @@ class aarch64 {
static address _double_sign_mask;
static address _double_sign_flip;
static address _zero_longs;
static address _zero_blocks;
static bool _completed;
public:
@ -115,12 +116,19 @@ class aarch64 {
return _double_sign_flip;
}
static address get_zero_longs()
{
return _zero_longs;
static address zero_blocks() {
return _zero_blocks;
}
private:
static bool complete() {
return _completed;
}
static void set_completed() {
_completed = true;
}
private:
static juint _crc_table[];
};

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 20014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -246,21 +246,21 @@ public class CheckGraalIntrinsics extends GraalTest {
"jdk/internal/misc/Unsafe.allocateUninitializedArray0(Ljava/lang/Class;I)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeByteAcquire(Ljava/lang/Object;JBB)B",
"jdk/internal/misc/Unsafe.compareAndExchangeByteRelease(Ljava/lang/Object;JBB)B",
"jdk/internal/misc/Unsafe.compareAndExchangeByteVolatile(Ljava/lang/Object;JBB)B",
"jdk/internal/misc/Unsafe.compareAndExchangeByte(Ljava/lang/Object;JBB)B",
"jdk/internal/misc/Unsafe.compareAndExchangeIntAcquire(Ljava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.compareAndExchangeIntRelease(Ljava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.compareAndExchangeIntVolatile(Ljava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.compareAndExchangeInt(Ljava/lang/Object;JII)I",
"jdk/internal/misc/Unsafe.compareAndExchangeLongAcquire(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeLongRelease(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeLongVolatile(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeLong(Ljava/lang/Object;JJJ)J",
"jdk/internal/misc/Unsafe.compareAndExchangeObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;",
"jdk/internal/misc/Unsafe.compareAndExchangeShortAcquire(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndExchangeShortRelease(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndExchangeShortVolatile(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndSwapByte(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.compareAndSwapShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.compareAndExchangeShort(Ljava/lang/Object;JSS)S",
"jdk/internal/misc/Unsafe.compareAndSetByte(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.compareAndSetShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.copyMemory0(Ljava/lang/Object;JLjava/lang/Object;JJ)V",
"jdk/internal/misc/Unsafe.getAndAddByte(Ljava/lang/Object;JB)B",
"jdk/internal/misc/Unsafe.getAndAddShort(Ljava/lang/Object;JS)S",
@ -295,26 +295,26 @@ public class CheckGraalIntrinsics extends GraalTest {
"jdk/internal/misc/Unsafe.putObjectOpaque(Ljava/lang/Object;JLjava/lang/Object;)V",
"jdk/internal/misc/Unsafe.putShortOpaque(Ljava/lang/Object;JS)V",
"jdk/internal/misc/Unsafe.unpark(Ljava/lang/Object;)V",
"jdk/internal/misc/Unsafe.weakCompareAndSwapByte(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteAcquire(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteRelease(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapByteVolatile(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapInt(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntAcquire(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntRelease(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapIntVolatile(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapLong(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongAcquire(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongRelease(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapLongVolatile(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapObjectVolatile(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortAcquire(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortRelease(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSwapShortVolatile(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetBytePlain(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetByteAcquire(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetByteRelease(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetByte(Ljava/lang/Object;JBB)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetIntPlain(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetIntAcquire(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetIntRelease(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetInt(Ljava/lang/Object;JII)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLongPlain(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLongAcquire(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLongRelease(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetLong(Ljava/lang/Object;JJJ)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectPlain(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectAcquire(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObjectRelease(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShortPlain(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShortAcquire(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShortRelease(Ljava/lang/Object;JSS)Z",
"jdk/internal/misc/Unsafe.weakCompareAndSetShort(Ljava/lang/Object;JSS)Z",
"jdk/internal/util/Preconditions.checkIndex(IILjava/util/function/BiFunction;)I",
"jdk/jfr/internal/JVM.counterTime()J",
"jdk/jfr/internal/JVM.getBufferWriter()Ljava/lang/Object;",

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -108,7 +108,7 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
}
switch (id) {
case vmIntrinsics::_compareAndSwapLong:
case vmIntrinsics::_compareAndSetLong:
if (!VM_Version::supports_cx8()) return false;
break;
case vmIntrinsics::_getAndAddInt:
@ -217,8 +217,8 @@ bool Compiler::is_intrinsic_supported(const methodHandle& method) {
case vmIntrinsics::_updateDirectByteBufferCRC32C:
#endif
case vmIntrinsics::_vectorizedMismatch:
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_compareAndSwapObject:
case vmIntrinsics::_compareAndSetInt:
case vmIntrinsics::_compareAndSetObject:
case vmIntrinsics::_getCharStringU:
case vmIntrinsics::_putCharStringU:
#ifdef TRACE_HAVE_INTRINSICS

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3500,9 +3500,9 @@ void GraphBuilder::build_graph_for_intrinsic(ciMethod* callee, bool ignore_retur
case vmIntrinsics::_putLongVolatile : append_unsafe_put_obj(callee, T_LONG, true); return;
case vmIntrinsics::_putFloatVolatile : append_unsafe_put_obj(callee, T_FLOAT, true); return;
case vmIntrinsics::_putDoubleVolatile : append_unsafe_put_obj(callee, T_DOUBLE, true); return;
case vmIntrinsics::_compareAndSwapLong:
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_compareAndSwapObject: append_unsafe_CAS(callee); return;
case vmIntrinsics::_compareAndSetLong:
case vmIntrinsics::_compareAndSetInt:
case vmIntrinsics::_compareAndSetObject: append_unsafe_CAS(callee); return;
case vmIntrinsics::_getAndAddInt:
case vmIntrinsics::_getAndAddLong : append_unsafe_get_and_set_obj(callee, true); return;
case vmIntrinsics::_getAndSetInt :

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3212,13 +3212,13 @@ void LIRGenerator::do_Intrinsic(Intrinsic* x) {
// java.nio.Buffer.checkIndex
case vmIntrinsics::_checkIndex: do_NIOCheckIndex(x); break;
case vmIntrinsics::_compareAndSwapObject:
case vmIntrinsics::_compareAndSetObject:
do_CompareAndSwap(x, objectType);
break;
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_compareAndSetInt:
do_CompareAndSwap(x, intType);
break;
case vmIntrinsics::_compareAndSwapLong:
case vmIntrinsics::_compareAndSetLong:
do_CompareAndSwap(x, longType);
break;

View File

@ -158,10 +158,10 @@ void ModuleEntry::set_read_walk_required(ClassLoaderData* m_loader_data) {
loader_data() != m_loader_data &&
!m_loader_data->is_builtin_class_loader_data()) {
_must_walk_reads = true;
if (log_is_enabled(Trace, modules)) {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
log_trace(modules)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
log_trace(module)("ModuleEntry::set_read_walk_required(): module %s reads list must be walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
}
}
}
@ -180,10 +180,10 @@ void ModuleEntry::purge_reads() {
// on the remaining live modules on the reads list.
_must_walk_reads = false;
if (log_is_enabled(Trace, modules)) {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
log_trace(modules)("ModuleEntry::purge_reads(): module %s reads list being walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
log_trace(module)("ModuleEntry::purge_reads(): module %s reads list being walked",
(name() != NULL) ? name()->as_C_string() : UNNAMED_MODULE);
}
// Go backwards because this removes entries that are dead.
@ -236,8 +236,11 @@ ModuleEntryTable::~ModuleEntryTable() {
m = m->next();
ResourceMark rm;
log_debug(modules)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ?
to_remove->name()->as_C_string() : UNNAMED_MODULE);
if (to_remove->name() != NULL) {
log_info(module, unload)("unloading module %s", to_remove->name()->as_C_string());
}
log_debug(module)("ModuleEntryTable: deleting module: %s", to_remove->name() != NULL ?
to_remove->name()->as_C_string() : UNNAMED_MODULE);
// Clean out the C heap allocated reads list first before freeing the entry
to_remove->delete_reads();
@ -315,9 +318,9 @@ ModuleEntry* ModuleEntryTable::new_entry(unsigned int hash, Handle module_handle
if (ClassLoader::is_in_patch_mod_entries(name)) {
entry->set_is_patched();
if (log_is_enabled(Trace, modules, patch)) {
if (log_is_enabled(Trace, module, patch)) {
ResourceMark rm;
log_trace(modules, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
log_trace(module, patch)("Marked module %s as patched from --patch-module", name->as_C_string());
}
}

View File

@ -237,16 +237,18 @@ static void define_javabase_module(jobject module, jstring version,
// Patch any previously loaded class's module field with java.base's java.lang.Module.
ModuleEntryTable::patch_javabase_entries(module_handle);
log_debug(modules)("define_javabase_module(): Definition of module: "
JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
module_version != NULL ? module_version : "NULL",
module_location != NULL ? module_location : "NULL",
pkg_list->length());
log_info(module, load)(JAVA_BASE_NAME " location: %s",
module_location != NULL ? module_location : "NULL");
log_debug(module)("define_javabase_module(): Definition of module: "
JAVA_BASE_NAME ", version: %s, location: %s, package #: %d",
module_version != NULL ? module_version : "NULL",
module_location != NULL ? module_location : "NULL",
pkg_list->length());
// packages defined to java.base
for (int x = 0; x < pkg_list->length(); x++) {
log_trace(modules)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
(pkg_list->at(x))->as_C_string());
log_trace(module)("define_javabase_module(): creation of package %s for module " JAVA_BASE_NAME,
(pkg_list->at(x))->as_C_string());
}
}
@ -438,23 +440,24 @@ void Modules::define_module(jobject module, jstring version,
throw_dup_pkg_exception(module_name, existing_pkg, CHECK);
}
if (log_is_enabled(Debug, modules)) {
outputStream* logst = Log(modules)::debug_stream();
log_info(module, load)("%s location: %s", module_name,
module_location != NULL ? module_location : "NULL");
if (log_is_enabled(Debug, module)) {
outputStream* logst = Log(module)::debug_stream();
logst->print("define_module(): creation of module: %s, version: %s, location: %s, ",
module_name, module_version != NULL ? module_version : "NULL",
module_location != NULL ? module_location : "NULL");
loader_data->print_value_on(logst);
logst->print_cr(", package #: %d", pkg_list->length());
for (int y = 0; y < pkg_list->length(); y++) {
log_trace(modules)("define_module(): creation of package %s for module %s",
(pkg_list->at(y))->as_C_string(), module_name);
log_trace(module)("define_module(): creation of package %s for module %s",
(pkg_list->at(y))->as_C_string(), module_name);
}
}
// If the module is defined to the boot loader and an exploded build is being
// used, prepend <java.home>/modules/modules_name, if it exists, to the system boot class path.
if (loader == NULL &&
!Universe::is_module_initialized() &&
!ClassLoader::has_jrt_entry()) {
ClassLoader::add_to_exploded_build_list(module_symbol, CHECK);
}
@ -487,7 +490,7 @@ void Modules::set_bootloader_unnamed_module(jobject module, TRAPS) {
}
Handle h_loader = Handle(THREAD, loader);
log_debug(modules)("set_bootloader_unnamed_module(): recording unnamed module for boot loader");
log_debug(module)("set_bootloader_unnamed_module(): recording unnamed module for boot loader");
// Ensure the boot loader's PackageEntryTable has been created
ModuleEntryTable* module_table = get_module_entry_table(h_loader, CHECK);
@ -545,10 +548,10 @@ void Modules::add_module_exports(jobject from_module, const char* package_name,
from_module_entry->name()->as_C_string()));
}
log_debug(modules)("add_module_exports(): package %s in module %s is exported to module %s",
package_entry->name()->as_C_string(),
from_module_entry->name()->as_C_string(),
to_module_entry == NULL ? "NULL" :
log_debug(module)("add_module_exports(): package %s in module %s is exported to module %s",
package_entry->name()->as_C_string(),
from_module_entry->name()->as_C_string(),
to_module_entry == NULL ? "NULL" :
to_module_entry->is_named() ?
to_module_entry->name()->as_C_string() : UNNAMED_MODULE);
@ -592,12 +595,12 @@ void Modules::add_reads_module(jobject from_module, jobject to_module, TRAPS) {
}
ResourceMark rm(THREAD);
log_debug(modules)("add_reads_module(): Adding read from module %s to module %s",
from_module_entry->is_named() ?
from_module_entry->name()->as_C_string() : UNNAMED_MODULE,
to_module_entry == NULL ? "all unnamed" :
(to_module_entry->is_named() ?
to_module_entry->name()->as_C_string() : UNNAMED_MODULE));
log_debug(module)("add_reads_module(): Adding read from module %s to module %s",
from_module_entry->is_named() ?
from_module_entry->name()->as_C_string() : UNNAMED_MODULE,
to_module_entry == NULL ? "all unnamed" :
(to_module_entry->is_named() ?
to_module_entry->name()->as_C_string() : UNNAMED_MODULE));
// if modules are the same or if from_module is unnamed then no need to add the read.
if (from_module_entry != to_module_entry && from_module_entry->is_named()) {
@ -616,7 +619,7 @@ jobject Modules::get_module(jclass clazz, TRAPS) {
}
oop mirror = JNIHandles::resolve_non_null(clazz);
if (mirror == NULL) {
log_debug(modules)("get_module(): no mirror, returning NULL");
log_debug(module)("get_module(): no mirror, returning NULL");
return NULL;
}
if (!java_lang_Class::is_instance(mirror)) {
@ -629,9 +632,9 @@ jobject Modules::get_module(jclass clazz, TRAPS) {
assert(module != NULL, "java.lang.Class module field not set");
assert(java_lang_Module::is_instance(module), "module is not an instance of type java.lang.Module");
if (log_is_enabled(Debug, modules)) {
if (log_is_enabled(Debug, module)) {
ResourceMark rm(THREAD);
outputStream* logst = Log(modules)::debug_stream();
outputStream* logst = Log(module)::debug_stream();
Klass* klass = java_lang_Class::as_Klass(mirror);
oop module_name = java_lang_Module::name(module);
if (module_name != NULL) {
@ -764,8 +767,8 @@ void Modules::add_module_package(jobject module, const char* package_name, TRAPS
THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), message);
}
log_debug(modules)("add_module_package(): Adding package %s to module %s",
package_name, module_entry->name()->as_C_string());
log_debug(module)("add_module_package(): Adding package %s to module %s",
package_name, module_entry->name()->as_C_string());
TempNewSymbol pkg_symbol = SymbolTable::new_symbol(package_name, CHECK);
PackageEntryTable* package_table = loader_data->packages();
@ -820,8 +823,8 @@ void Modules::add_module_exports_to_all_unnamed(jobject module, const char* pack
module_entry->name()->as_C_string()));
}
log_debug(modules)("add_module_exports_to_all_unnamed(): package %s in module"
" %s is exported to all unnamed modules",
log_debug(module)("add_module_exports_to_all_unnamed(): package %s in module"
" %s is exported to all unnamed modules",
package_entry->name()->as_C_string(),
module_entry->name()->as_C_string());

View File

@ -77,13 +77,13 @@ void PackageEntry::set_export_walk_required(ClassLoaderData* m_loader_data) {
(this_pkg_mod == NULL || this_pkg_mod->loader_data() != m_loader_data) &&
!m_loader_data->is_builtin_class_loader_data()) {
_must_walk_exports = true;
if (log_is_enabled(Trace, modules)) {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
assert(name() != NULL, "PackageEntry without a valid name");
log_trace(modules)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked",
name()->as_C_string(),
(this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ?
UNNAMED_MODULE : this_pkg_mod->name()->as_C_string());
log_trace(module)("PackageEntry::set_export_walk_required(): package %s defined in module %s, exports list must be walked",
name()->as_C_string(),
(this_pkg_mod == NULL || this_pkg_mod->name() == NULL) ?
UNNAMED_MODULE : this_pkg_mod->name()->as_C_string());
}
}
}
@ -132,13 +132,13 @@ void PackageEntry::purge_qualified_exports() {
// on the remaining live modules on the exports list.
_must_walk_exports = false;
if (log_is_enabled(Trace, modules)) {
if (log_is_enabled(Trace, module)) {
ResourceMark rm;
assert(name() != NULL, "PackageEntry without a valid name");
ModuleEntry* pkg_mod = module();
log_trace(modules)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked",
name()->as_C_string(),
(pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
log_trace(module)("PackageEntry::purge_qualified_exports(): package %s defined in module %s, exports list being walked",
name()->as_C_string(),
(pkg_mod == NULL || pkg_mod->name() == NULL) ? UNNAMED_MODULE : pkg_mod->name()->as_C_string());
}
// Go backwards because this removes entries that are dead.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -632,25 +632,28 @@ bool vmIntrinsics::is_disabled_by_flags(vmIntrinsics::ID id) {
case vmIntrinsics::_loadFence:
case vmIntrinsics::_storeFence:
case vmIntrinsics::_fullFence:
case vmIntrinsics::_compareAndSwapLong:
case vmIntrinsics::_weakCompareAndSwapLong:
case vmIntrinsics::_weakCompareAndSwapLongAcquire:
case vmIntrinsics::_weakCompareAndSwapLongRelease:
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_weakCompareAndSwapInt:
case vmIntrinsics::_weakCompareAndSwapIntAcquire:
case vmIntrinsics::_weakCompareAndSwapIntRelease:
case vmIntrinsics::_compareAndSwapObject:
case vmIntrinsics::_weakCompareAndSwapObject:
case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
case vmIntrinsics::_weakCompareAndSwapObjectRelease:
case vmIntrinsics::_compareAndExchangeIntVolatile:
case vmIntrinsics::_compareAndSetLong:
case vmIntrinsics::_weakCompareAndSetLong:
case vmIntrinsics::_weakCompareAndSetLongPlain:
case vmIntrinsics::_weakCompareAndSetLongAcquire:
case vmIntrinsics::_weakCompareAndSetLongRelease:
case vmIntrinsics::_compareAndSetInt:
case vmIntrinsics::_weakCompareAndSetInt:
case vmIntrinsics::_weakCompareAndSetIntPlain:
case vmIntrinsics::_weakCompareAndSetIntAcquire:
case vmIntrinsics::_weakCompareAndSetIntRelease:
case vmIntrinsics::_compareAndSetObject:
case vmIntrinsics::_weakCompareAndSetObject:
case vmIntrinsics::_weakCompareAndSetObjectPlain:
case vmIntrinsics::_weakCompareAndSetObjectAcquire:
case vmIntrinsics::_weakCompareAndSetObjectRelease:
case vmIntrinsics::_compareAndExchangeInt:
case vmIntrinsics::_compareAndExchangeIntAcquire:
case vmIntrinsics::_compareAndExchangeIntRelease:
case vmIntrinsics::_compareAndExchangeLongVolatile:
case vmIntrinsics::_compareAndExchangeLong:
case vmIntrinsics::_compareAndExchangeLongAcquire:
case vmIntrinsics::_compareAndExchangeLongRelease:
case vmIntrinsics::_compareAndExchangeObjectVolatile:
case vmIntrinsics::_compareAndExchangeObject:
case vmIntrinsics::_compareAndExchangeObjectAcquire:
case vmIntrinsics::_compareAndExchangeObjectRelease:
if (!InlineUnsafeOps) return true;

View File

@ -650,6 +650,8 @@
template(addUses_signature, "(Ljava/lang/Module;Ljava/lang/Class;)V") \
template(addProvides_name, "addProvides") \
template(addProvides_signature, "(Ljava/lang/Module;Ljava/lang/Class;Ljava/lang/Class;)V") \
template(loadModule_name, "loadModule") \
template(loadModule_signature, "(Ljava/lang/String;)Ljava/lang/Module;") \
template(transformedByAgent_name, "transformedByAgent") \
template(transformedByAgent_signature, "(Ljava/lang/Module;)V") \
template(appendToClassPathForInstrumentation_name, "appendToClassPathForInstrumentation") \
@ -1242,100 +1244,100 @@
do_intrinsic(_putIntUnaligned, jdk_internal_misc_Unsafe, putIntUnaligned_name, putInt_signature, F_R) \
do_intrinsic(_putLongUnaligned, jdk_internal_misc_Unsafe, putLongUnaligned_name, putLong_signature, F_R) \
\
do_signature(compareAndSwapObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
do_signature(compareAndSetObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z") \
do_signature(compareAndExchangeObject_signature, "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;") \
do_signature(compareAndSwapLong_signature, "(Ljava/lang/Object;JJJ)Z") \
do_signature(compareAndSetLong_signature, "(Ljava/lang/Object;JJJ)Z") \
do_signature(compareAndExchangeLong_signature, "(Ljava/lang/Object;JJJ)J") \
do_signature(compareAndSwapInt_signature, "(Ljava/lang/Object;JII)Z") \
do_signature(compareAndSetInt_signature, "(Ljava/lang/Object;JII)Z") \
do_signature(compareAndExchangeInt_signature, "(Ljava/lang/Object;JII)I") \
do_signature(compareAndSwapByte_signature, "(Ljava/lang/Object;JBB)Z") \
do_signature(compareAndSetByte_signature, "(Ljava/lang/Object;JBB)Z") \
do_signature(compareAndExchangeByte_signature, "(Ljava/lang/Object;JBB)B") \
do_signature(compareAndSwapShort_signature, "(Ljava/lang/Object;JSS)Z") \
do_signature(compareAndSetShort_signature, "(Ljava/lang/Object;JSS)Z") \
do_signature(compareAndExchangeShort_signature, "(Ljava/lang/Object;JSS)S") \
\
do_name(compareAndSwapObject_name, "compareAndSwapObject") \
do_name(compareAndExchangeObjectVolatile_name, "compareAndExchangeObjectVolatile") \
do_name(compareAndSetObject_name, "compareAndSetObject") \
do_name(compareAndExchangeObject_name, "compareAndExchangeObject") \
do_name(compareAndExchangeObjectAcquire_name, "compareAndExchangeObjectAcquire") \
do_name(compareAndExchangeObjectRelease_name, "compareAndExchangeObjectRelease") \
do_name(compareAndSwapLong_name, "compareAndSwapLong") \
do_name(compareAndExchangeLongVolatile_name, "compareAndExchangeLongVolatile") \
do_name(compareAndSetLong_name, "compareAndSetLong") \
do_name(compareAndExchangeLong_name, "compareAndExchangeLong") \
do_name(compareAndExchangeLongAcquire_name, "compareAndExchangeLongAcquire") \
do_name(compareAndExchangeLongRelease_name, "compareAndExchangeLongRelease") \
do_name(compareAndSwapInt_name, "compareAndSwapInt") \
do_name(compareAndExchangeIntVolatile_name, "compareAndExchangeIntVolatile") \
do_name(compareAndSetInt_name, "compareAndSetInt") \
do_name(compareAndExchangeInt_name, "compareAndExchangeInt") \
do_name(compareAndExchangeIntAcquire_name, "compareAndExchangeIntAcquire") \
do_name(compareAndExchangeIntRelease_name, "compareAndExchangeIntRelease") \
do_name(compareAndSwapByte_name, "compareAndSwapByte") \
do_name(compareAndExchangeByteVolatile_name, "compareAndExchangeByteVolatile") \
do_name(compareAndSetByte_name, "compareAndSetByte") \
do_name(compareAndExchangeByte_name, "compareAndExchangeByte") \
do_name(compareAndExchangeByteAcquire_name, "compareAndExchangeByteAcquire") \
do_name(compareAndExchangeByteRelease_name, "compareAndExchangeByteRelease") \
do_name(compareAndSwapShort_name, "compareAndSwapShort") \
do_name(compareAndExchangeShortVolatile_name, "compareAndExchangeShortVolatile") \
do_name(compareAndSetShort_name, "compareAndSetShort") \
do_name(compareAndExchangeShort_name, "compareAndExchangeShort") \
do_name(compareAndExchangeShortAcquire_name, "compareAndExchangeShortAcquire") \
do_name(compareAndExchangeShortRelease_name, "compareAndExchangeShortRelease") \
\
do_name(weakCompareAndSwapObject_name, "weakCompareAndSwapObject") \
do_name(weakCompareAndSwapObjectAcquire_name, "weakCompareAndSwapObjectAcquire") \
do_name(weakCompareAndSwapObjectRelease_name, "weakCompareAndSwapObjectRelease") \
do_name(weakCompareAndSwapObjectVolatile_name, "weakCompareAndSwapObjectVolatile") \
do_name(weakCompareAndSwapLong_name, "weakCompareAndSwapLong") \
do_name(weakCompareAndSwapLongAcquire_name, "weakCompareAndSwapLongAcquire") \
do_name(weakCompareAndSwapLongRelease_name, "weakCompareAndSwapLongRelease") \
do_name(weakCompareAndSwapLongVolatile_name, "weakCompareAndSwapLongVolatile") \
do_name(weakCompareAndSwapInt_name, "weakCompareAndSwapInt") \
do_name(weakCompareAndSwapIntAcquire_name, "weakCompareAndSwapIntAcquire") \
do_name(weakCompareAndSwapIntRelease_name, "weakCompareAndSwapIntRelease") \
do_name(weakCompareAndSwapIntVolatile_name, "weakCompareAndSwapIntVolatile") \
do_name(weakCompareAndSwapByte_name, "weakCompareAndSwapByte") \
do_name(weakCompareAndSwapByteAcquire_name, "weakCompareAndSwapByteAcquire") \
do_name(weakCompareAndSwapByteRelease_name, "weakCompareAndSwapByteRelease") \
do_name(weakCompareAndSwapByteVolatile_name, "weakCompareAndSwapByteVolatile") \
do_name(weakCompareAndSwapShort_name, "weakCompareAndSwapShort") \
do_name(weakCompareAndSwapShortAcquire_name, "weakCompareAndSwapShortAcquire") \
do_name(weakCompareAndSwapShortRelease_name, "weakCompareAndSwapShortRelease") \
do_name(weakCompareAndSwapShortVolatile_name, "weakCompareAndSwapShortVolatile") \
do_name(weakCompareAndSetObjectPlain_name, "weakCompareAndSetObjectPlain") \
do_name(weakCompareAndSetObjectAcquire_name, "weakCompareAndSetObjectAcquire") \
do_name(weakCompareAndSetObjectRelease_name, "weakCompareAndSetObjectRelease") \
do_name(weakCompareAndSetObject_name, "weakCompareAndSetObject") \
do_name(weakCompareAndSetLongPlain_name, "weakCompareAndSetLongPlain") \
do_name(weakCompareAndSetLongAcquire_name, "weakCompareAndSetLongAcquire") \
do_name(weakCompareAndSetLongRelease_name, "weakCompareAndSetLongRelease") \
do_name(weakCompareAndSetLong_name, "weakCompareAndSetLong") \
do_name(weakCompareAndSetIntPlain_name, "weakCompareAndSetIntPlain") \
do_name(weakCompareAndSetIntAcquire_name, "weakCompareAndSetIntAcquire") \
do_name(weakCompareAndSetIntRelease_name, "weakCompareAndSetIntRelease") \
do_name(weakCompareAndSetInt_name, "weakCompareAndSetInt") \
do_name(weakCompareAndSetBytePlain_name, "weakCompareAndSetBytePlain") \
do_name(weakCompareAndSetByteAcquire_name, "weakCompareAndSetByteAcquire") \
do_name(weakCompareAndSetByteRelease_name, "weakCompareAndSetByteRelease") \
do_name(weakCompareAndSetByte_name, "weakCompareAndSetByte") \
do_name(weakCompareAndSetShortPlain_name, "weakCompareAndSetShortPlain") \
do_name(weakCompareAndSetShortAcquire_name, "weakCompareAndSetShortAcquire") \
do_name(weakCompareAndSetShortRelease_name, "weakCompareAndSetShortRelease") \
do_name(weakCompareAndSetShort_name, "weakCompareAndSetShort") \
\
do_intrinsic(_compareAndSwapObject, jdk_internal_misc_Unsafe, compareAndSwapObject_name, compareAndSwapObject_signature, F_RN) \
do_intrinsic(_compareAndExchangeObjectVolatile, jdk_internal_misc_Unsafe, compareAndExchangeObjectVolatile_name, compareAndExchangeObject_signature, F_RN) \
do_intrinsic(_compareAndSetObject, jdk_internal_misc_Unsafe, compareAndSetObject_name, compareAndSetObject_signature, F_RN) \
do_intrinsic(_compareAndExchangeObject, jdk_internal_misc_Unsafe, compareAndExchangeObject_name, compareAndExchangeObject_signature, F_RN) \
do_intrinsic(_compareAndExchangeObjectAcquire, jdk_internal_misc_Unsafe, compareAndExchangeObjectAcquire_name, compareAndExchangeObject_signature, F_R) \
do_intrinsic(_compareAndExchangeObjectRelease, jdk_internal_misc_Unsafe, compareAndExchangeObjectRelease_name, compareAndExchangeObject_signature, F_R) \
do_intrinsic(_compareAndSwapLong, jdk_internal_misc_Unsafe, compareAndSwapLong_name, compareAndSwapLong_signature, F_RN) \
do_intrinsic(_compareAndExchangeLongVolatile, jdk_internal_misc_Unsafe, compareAndExchangeLongVolatile_name, compareAndExchangeLong_signature, F_RN) \
do_intrinsic(_compareAndSetLong, jdk_internal_misc_Unsafe, compareAndSetLong_name, compareAndSetLong_signature, F_RN) \
do_intrinsic(_compareAndExchangeLong, jdk_internal_misc_Unsafe, compareAndExchangeLong_name, compareAndExchangeLong_signature, F_RN) \
do_intrinsic(_compareAndExchangeLongAcquire, jdk_internal_misc_Unsafe, compareAndExchangeLongAcquire_name, compareAndExchangeLong_signature, F_R) \
do_intrinsic(_compareAndExchangeLongRelease, jdk_internal_misc_Unsafe, compareAndExchangeLongRelease_name, compareAndExchangeLong_signature, F_R) \
do_intrinsic(_compareAndSwapInt, jdk_internal_misc_Unsafe, compareAndSwapInt_name, compareAndSwapInt_signature, F_RN) \
do_intrinsic(_compareAndExchangeIntVolatile, jdk_internal_misc_Unsafe, compareAndExchangeIntVolatile_name, compareAndExchangeInt_signature, F_RN) \
do_intrinsic(_compareAndSetInt, jdk_internal_misc_Unsafe, compareAndSetInt_name, compareAndSetInt_signature, F_RN) \
do_intrinsic(_compareAndExchangeInt, jdk_internal_misc_Unsafe, compareAndExchangeInt_name, compareAndExchangeInt_signature, F_RN) \
do_intrinsic(_compareAndExchangeIntAcquire, jdk_internal_misc_Unsafe, compareAndExchangeIntAcquire_name, compareAndExchangeInt_signature, F_R) \
do_intrinsic(_compareAndExchangeIntRelease, jdk_internal_misc_Unsafe, compareAndExchangeIntRelease_name, compareAndExchangeInt_signature, F_R) \
do_intrinsic(_compareAndSwapByte, jdk_internal_misc_Unsafe, compareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
do_intrinsic(_compareAndExchangeByteVolatile, jdk_internal_misc_Unsafe, compareAndExchangeByteVolatile_name, compareAndExchangeByte_signature, F_R) \
do_intrinsic(_compareAndSetByte, jdk_internal_misc_Unsafe, compareAndSetByte_name, compareAndSetByte_signature, F_R) \
do_intrinsic(_compareAndExchangeByte, jdk_internal_misc_Unsafe, compareAndExchangeByte_name, compareAndExchangeByte_signature, F_R) \
do_intrinsic(_compareAndExchangeByteAcquire, jdk_internal_misc_Unsafe, compareAndExchangeByteAcquire_name, compareAndExchangeByte_signature, F_R) \
do_intrinsic(_compareAndExchangeByteRelease, jdk_internal_misc_Unsafe, compareAndExchangeByteRelease_name, compareAndExchangeByte_signature, F_R) \
do_intrinsic(_compareAndSwapShort, jdk_internal_misc_Unsafe, compareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
do_intrinsic(_compareAndExchangeShortVolatile, jdk_internal_misc_Unsafe, compareAndExchangeShortVolatile_name, compareAndExchangeShort_signature, F_R) \
do_intrinsic(_compareAndSetShort, jdk_internal_misc_Unsafe, compareAndSetShort_name, compareAndSetShort_signature, F_R) \
do_intrinsic(_compareAndExchangeShort, jdk_internal_misc_Unsafe, compareAndExchangeShort_name, compareAndExchangeShort_signature, F_R) \
do_intrinsic(_compareAndExchangeShortAcquire, jdk_internal_misc_Unsafe, compareAndExchangeShortAcquire_name, compareAndExchangeShort_signature, F_R) \
do_intrinsic(_compareAndExchangeShortRelease, jdk_internal_misc_Unsafe, compareAndExchangeShortRelease_name, compareAndExchangeShort_signature, F_R) \
\
do_intrinsic(_weakCompareAndSwapObject, jdk_internal_misc_Unsafe, weakCompareAndSwapObject_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectAcquire_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectRelease_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapObjectVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapObjectVolatile_name, compareAndSwapObject_signature, F_R) \
do_intrinsic(_weakCompareAndSwapLong, jdk_internal_misc_Unsafe, weakCompareAndSwapLong_name, compareAndSwapLong_signature, F_R) \
do_intrinsic(_weakCompareAndSwapLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapLongAcquire_name, compareAndSwapLong_signature, F_R) \
do_intrinsic(_weakCompareAndSwapLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapLongRelease_name, compareAndSwapLong_signature, F_R) \
do_intrinsic(_weakCompareAndSwapLongVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapLongVolatile_name, compareAndSwapLong_signature, F_R) \
do_intrinsic(_weakCompareAndSwapInt, jdk_internal_misc_Unsafe, weakCompareAndSwapInt_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapIntAcquire_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapIntRelease_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapIntVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapIntVolatile_name, compareAndSwapInt_signature, F_R) \
do_intrinsic(_weakCompareAndSwapByte, jdk_internal_misc_Unsafe, weakCompareAndSwapByte_name, compareAndSwapByte_signature, F_R) \
do_intrinsic(_weakCompareAndSwapByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapByteAcquire_name, compareAndSwapByte_signature, F_R) \
do_intrinsic(_weakCompareAndSwapByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapByteRelease_name, compareAndSwapByte_signature, F_R) \
do_intrinsic(_weakCompareAndSwapByteVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapByteVolatile_name, compareAndSwapByte_signature, F_R) \
do_intrinsic(_weakCompareAndSwapShort, jdk_internal_misc_Unsafe, weakCompareAndSwapShort_name, compareAndSwapShort_signature, F_R) \
do_intrinsic(_weakCompareAndSwapShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSwapShortAcquire_name, compareAndSwapShort_signature, F_R) \
do_intrinsic(_weakCompareAndSwapShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSwapShortRelease_name, compareAndSwapShort_signature, F_R) \
do_intrinsic(_weakCompareAndSwapShortVolatile, jdk_internal_misc_Unsafe, weakCompareAndSwapShortVolatile_name, compareAndSwapShort_signature, F_R) \
do_intrinsic(_weakCompareAndSetObjectPlain, jdk_internal_misc_Unsafe, weakCompareAndSetObjectPlain_name, compareAndSetObject_signature, F_R) \
do_intrinsic(_weakCompareAndSetObjectAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetObjectAcquire_name, compareAndSetObject_signature, F_R) \
do_intrinsic(_weakCompareAndSetObjectRelease, jdk_internal_misc_Unsafe, weakCompareAndSetObjectRelease_name, compareAndSetObject_signature, F_R) \
do_intrinsic(_weakCompareAndSetObject, jdk_internal_misc_Unsafe, weakCompareAndSetObject_name, compareAndSetObject_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongPlain, jdk_internal_misc_Unsafe, weakCompareAndSetLongPlain_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetLongAcquire_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetLongRelease, jdk_internal_misc_Unsafe, weakCompareAndSetLongRelease_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetLong, jdk_internal_misc_Unsafe, weakCompareAndSetLong_name, compareAndSetLong_signature, F_R) \
do_intrinsic(_weakCompareAndSetIntPlain, jdk_internal_misc_Unsafe, weakCompareAndSetIntPlain_name, compareAndSetInt_signature, F_R) \
do_intrinsic(_weakCompareAndSetIntAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetIntAcquire_name, compareAndSetInt_signature, F_R) \
do_intrinsic(_weakCompareAndSetIntRelease, jdk_internal_misc_Unsafe, weakCompareAndSetIntRelease_name, compareAndSetInt_signature, F_R) \
do_intrinsic(_weakCompareAndSetInt, jdk_internal_misc_Unsafe, weakCompareAndSetInt_name, compareAndSetInt_signature, F_R) \
do_intrinsic(_weakCompareAndSetBytePlain, jdk_internal_misc_Unsafe, weakCompareAndSetBytePlain_name, compareAndSetByte_signature, F_R) \
do_intrinsic(_weakCompareAndSetByteAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetByteAcquire_name, compareAndSetByte_signature, F_R) \
do_intrinsic(_weakCompareAndSetByteRelease, jdk_internal_misc_Unsafe, weakCompareAndSetByteRelease_name, compareAndSetByte_signature, F_R) \
do_intrinsic(_weakCompareAndSetByte, jdk_internal_misc_Unsafe, weakCompareAndSetByte_name, compareAndSetByte_signature, F_R) \
do_intrinsic(_weakCompareAndSetShortPlain, jdk_internal_misc_Unsafe, weakCompareAndSetShortPlain_name, compareAndSetShort_signature, F_R) \
do_intrinsic(_weakCompareAndSetShortAcquire, jdk_internal_misc_Unsafe, weakCompareAndSetShortAcquire_name, compareAndSetShort_signature, F_R) \
do_intrinsic(_weakCompareAndSetShortRelease, jdk_internal_misc_Unsafe, weakCompareAndSetShortRelease_name, compareAndSetShort_signature, F_R) \
do_intrinsic(_weakCompareAndSetShort, jdk_internal_misc_Unsafe, weakCompareAndSetShort_name, compareAndSetShort_signature, F_R) \
\
do_intrinsic(_getAndAddInt, jdk_internal_misc_Unsafe, getAndAddInt_name, getAndAddInt_signature, F_R) \
do_name( getAndAddInt_name, "getAndAddInt") \

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -82,7 +82,7 @@
LOG_TAG(metadata) \
LOG_TAG(metaspace) \
LOG_TAG(mmu) \
LOG_TAG(modules) \
LOG_TAG(module) \
LOG_TAG(monitorinflation) \
LOG_TAG(monitormismatch) \
LOG_TAG(nmethod) \

View File

@ -2331,21 +2331,21 @@ void InstanceKlass::set_package(ClassLoaderData* loader_data, TRAPS) {
name()->as_C_string(), loader_data->loader_name());
}
if (log_is_enabled(Debug, modules)) {
if (log_is_enabled(Debug, module)) {
ResourceMark rm;
ModuleEntry* m = _package_entry->module();
log_trace(modules)("Setting package: class: %s, package: %s, loader: %s, module: %s",
external_name(),
pkg_name->as_C_string(),
loader_data->loader_name(),
(m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE));
log_trace(module)("Setting package: class: %s, package: %s, loader: %s, module: %s",
external_name(),
pkg_name->as_C_string(),
loader_data->loader_name(),
(m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE));
}
} else {
ResourceMark rm;
log_trace(modules)("Setting package: class: %s, package: unnamed, loader: %s, module: %s",
external_name(),
(loader_data != NULL) ? loader_data->loader_name() : "NULL",
UNNAMED_MODULE);
log_trace(module)("Setting package: class: %s, package: unnamed, loader: %s, module: %s",
external_name(),
(loader_data != NULL) ? loader_data->loader_name() : "NULL",
UNNAMED_MODULE);
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -244,8 +244,8 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
if (!Matcher::match_rule_supported(Op_ReverseBytesL)) return false;
break;
/* CompareAndSwap, Object: */
case vmIntrinsics::_compareAndSwapObject:
/* CompareAndSet, Object: */
case vmIntrinsics::_compareAndSetObject:
#ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
@ -253,10 +253,10 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
if (!Matcher::match_rule_supported(Op_CompareAndSwapP)) return false;
#endif
break;
case vmIntrinsics::_weakCompareAndSwapObject:
case vmIntrinsics::_weakCompareAndSwapObjectAcquire:
case vmIntrinsics::_weakCompareAndSwapObjectRelease:
case vmIntrinsics::_weakCompareAndSwapObjectVolatile:
case vmIntrinsics::_weakCompareAndSetObjectPlain:
case vmIntrinsics::_weakCompareAndSetObjectAcquire:
case vmIntrinsics::_weakCompareAndSetObjectRelease:
case vmIntrinsics::_weakCompareAndSetObject:
#ifdef _LP64
if ( UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapN)) return false;
if (!UseCompressedOops && !Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
@ -264,52 +264,52 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapP)) return false;
#endif
break;
/* CompareAndSwap, Long: */
case vmIntrinsics::_compareAndSwapLong:
/* CompareAndSet, Long: */
case vmIntrinsics::_compareAndSetLong:
if (!Matcher::match_rule_supported(Op_CompareAndSwapL)) return false;
break;
case vmIntrinsics::_weakCompareAndSwapLong:
case vmIntrinsics::_weakCompareAndSwapLongAcquire:
case vmIntrinsics::_weakCompareAndSwapLongRelease:
case vmIntrinsics::_weakCompareAndSwapLongVolatile:
case vmIntrinsics::_weakCompareAndSetLongPlain:
case vmIntrinsics::_weakCompareAndSetLongAcquire:
case vmIntrinsics::_weakCompareAndSetLongRelease:
case vmIntrinsics::_weakCompareAndSetLong:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
break;
/* CompareAndSwap, Int: */
case vmIntrinsics::_compareAndSwapInt:
/* CompareAndSet, Int: */
case vmIntrinsics::_compareAndSetInt:
if (!Matcher::match_rule_supported(Op_CompareAndSwapI)) return false;
break;
case vmIntrinsics::_weakCompareAndSwapInt:
case vmIntrinsics::_weakCompareAndSwapIntAcquire:
case vmIntrinsics::_weakCompareAndSwapIntRelease:
case vmIntrinsics::_weakCompareAndSwapIntVolatile:
case vmIntrinsics::_weakCompareAndSetIntPlain:
case vmIntrinsics::_weakCompareAndSetIntAcquire:
case vmIntrinsics::_weakCompareAndSetIntRelease:
case vmIntrinsics::_weakCompareAndSetInt:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapL)) return false;
break;
/* CompareAndSwap, Byte: */
case vmIntrinsics::_compareAndSwapByte:
/* CompareAndSet, Byte: */
case vmIntrinsics::_compareAndSetByte:
if (!Matcher::match_rule_supported(Op_CompareAndSwapB)) return false;
break;
case vmIntrinsics::_weakCompareAndSwapByte:
case vmIntrinsics::_weakCompareAndSwapByteAcquire:
case vmIntrinsics::_weakCompareAndSwapByteRelease:
case vmIntrinsics::_weakCompareAndSwapByteVolatile:
case vmIntrinsics::_weakCompareAndSetBytePlain:
case vmIntrinsics::_weakCompareAndSetByteAcquire:
case vmIntrinsics::_weakCompareAndSetByteRelease:
case vmIntrinsics::_weakCompareAndSetByte:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapB)) return false;
break;
/* CompareAndSwap, Short: */
case vmIntrinsics::_compareAndSwapShort:
/* CompareAndSet, Short: */
case vmIntrinsics::_compareAndSetShort:
if (!Matcher::match_rule_supported(Op_CompareAndSwapS)) return false;
break;
case vmIntrinsics::_weakCompareAndSwapShort:
case vmIntrinsics::_weakCompareAndSwapShortAcquire:
case vmIntrinsics::_weakCompareAndSwapShortRelease:
case vmIntrinsics::_weakCompareAndSwapShortVolatile:
case vmIntrinsics::_weakCompareAndSetShortPlain:
case vmIntrinsics::_weakCompareAndSetShortAcquire:
case vmIntrinsics::_weakCompareAndSetShortRelease:
case vmIntrinsics::_weakCompareAndSetShort:
if (!Matcher::match_rule_supported(Op_WeakCompareAndSwapS)) return false;
break;
/* CompareAndExchange, Object: */
case vmIntrinsics::_compareAndExchangeObjectVolatile:
case vmIntrinsics::_compareAndExchangeObject:
case vmIntrinsics::_compareAndExchangeObjectAcquire:
case vmIntrinsics::_compareAndExchangeObjectRelease:
#ifdef _LP64
@ -321,28 +321,28 @@ bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virt
break;
/* CompareAndExchange, Long: */
case vmIntrinsics::_compareAndExchangeLongVolatile:
case vmIntrinsics::_compareAndExchangeLong:
case vmIntrinsics::_compareAndExchangeLongAcquire:
case vmIntrinsics::_compareAndExchangeLongRelease:
if (!Matcher::match_rule_supported(Op_CompareAndExchangeL)) return false;
break;
/* CompareAndExchange, Int: */
case vmIntrinsics::_compareAndExchangeIntVolatile:
case vmIntrinsics::_compareAndExchangeInt:
case vmIntrinsics::_compareAndExchangeIntAcquire:
case vmIntrinsics::_compareAndExchangeIntRelease:
if (!Matcher::match_rule_supported(Op_CompareAndExchangeI)) return false;
break;
/* CompareAndExchange, Byte: */
case vmIntrinsics::_compareAndExchangeByteVolatile:
case vmIntrinsics::_compareAndExchangeByte:
case vmIntrinsics::_compareAndExchangeByteAcquire:
case vmIntrinsics::_compareAndExchangeByteRelease:
if (!Matcher::match_rule_supported(Op_CompareAndExchangeB)) return false;
break;
/* CompareAndExchange, Short: */
case vmIntrinsics::_compareAndExchangeShortVolatile:
case vmIntrinsics::_compareAndExchangeShort:
case vmIntrinsics::_compareAndExchangeShortAcquire:
case vmIntrinsics::_compareAndExchangeShortRelease:
if (!Matcher::match_rule_supported(Op_CompareAndExchangeS)) return false;

View File

@ -649,46 +649,46 @@ bool LibraryCallKit::try_to_inline(int predicate) {
case vmIntrinsics::_putFloatOpaque: return inline_unsafe_access( is_store, T_FLOAT, Opaque, false);
case vmIntrinsics::_putDoubleOpaque: return inline_unsafe_access( is_store, T_DOUBLE, Opaque, false);
case vmIntrinsics::_compareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap, Volatile);
case vmIntrinsics::_compareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap, Volatile);
case vmIntrinsics::_weakCompareAndSwapObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSwapByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSwapShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSwapInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSwapLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSwapLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSwapLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSwapLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetObjectPlain: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetBytePlain: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetShortPlain: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetIntPlain: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetInt: return inline_unsafe_load_store(T_INT, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_weakCompareAndSetLongPlain: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Relaxed);
case vmIntrinsics::_weakCompareAndSetLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Acquire);
case vmIntrinsics::_weakCompareAndSetLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Release);
case vmIntrinsics::_weakCompareAndSetLong: return inline_unsafe_load_store(T_LONG, LS_cmp_swap_weak, Volatile);
case vmIntrinsics::_compareAndExchangeObjectVolatile: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeObject: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeObjectAcquire: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeObjectRelease: return inline_unsafe_load_store(T_OBJECT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeByteVolatile: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeByte: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeByteAcquire: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeByteRelease: return inline_unsafe_load_store(T_BYTE, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeShortVolatile: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeShort: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeShortAcquire: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeShortRelease: return inline_unsafe_load_store(T_SHORT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeIntVolatile: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeInt: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeIntAcquire: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeIntRelease: return inline_unsafe_load_store(T_INT, LS_cmp_exchange, Release);
case vmIntrinsics::_compareAndExchangeLongVolatile: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeLong: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Volatile);
case vmIntrinsics::_compareAndExchangeLongAcquire: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Acquire);
case vmIntrinsics::_compareAndExchangeLongRelease: return inline_unsafe_load_store(T_LONG, LS_cmp_exchange, Release);
@ -2587,23 +2587,26 @@ bool LibraryCallKit::inline_unsafe_access(bool is_store, const BasicType type, c
//
// LS_cmp_swap:
//
// boolean compareAndSwapObject(Object o, long offset, Object expected, Object x);
// boolean compareAndSwapInt( Object o, long offset, int expected, int x);
// boolean compareAndSwapLong( Object o, long offset, long expected, long x);
// boolean compareAndSetObject(Object o, long offset, Object expected, Object x);
// boolean compareAndSetInt( Object o, long offset, int expected, int x);
// boolean compareAndSetLong( Object o, long offset, long expected, long x);
//
// LS_cmp_swap_weak:
//
// boolean weakCompareAndSwapObject( Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSwapObjectAcquire(Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSwapObjectRelease(Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObject( Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectPlain( Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectAcquire(Object o, long offset, Object expected, Object x);
// boolean weakCompareAndSetObjectRelease(Object o, long offset, Object expected, Object x);
//
// boolean weakCompareAndSwapInt( Object o, long offset, int expected, int x);
// boolean weakCompareAndSwapIntAcquire( Object o, long offset, int expected, int x);
// boolean weakCompareAndSwapIntRelease( Object o, long offset, int expected, int x);
// boolean weakCompareAndSetInt( Object o, long offset, int expected, int x);
// boolean weakCompareAndSetIntPlain( Object o, long offset, int expected, int x);
// boolean weakCompareAndSetIntAcquire( Object o, long offset, int expected, int x);
// boolean weakCompareAndSetIntRelease( Object o, long offset, int expected, int x);
//
// boolean weakCompareAndSwapLong( Object o, long offset, long expected, long x);
// boolean weakCompareAndSwapLongAcquire( Object o, long offset, long expected, long x);
// boolean weakCompareAndSwapLongRelease( Object o, long offset, long expected, long x);
// boolean weakCompareAndSetLong( Object o, long offset, long expected, long x);
// boolean weakCompareAndSetLongPlain( Object o, long offset, long expected, long x);
// boolean weakCompareAndSetLongAcquire( Object o, long offset, long expected, long x);
// boolean weakCompareAndSetLongRelease( Object o, long offset, long expected, long x);
//
// LS_cmp_exchange:
//
@ -4965,7 +4968,7 @@ bool LibraryCallKit::inline_arraycopy() {
// See arraycopy_restore_alloc_state() comment
// if alloc == NULL we don't have to worry about a tightly coupled allocation so we can emit all needed guards
// if saved_jvms != NULL (then alloc != NULL) then we can handle guards and a tightly coupled allocation
// if saved_jvms == NULL and alloc != NULL, we cant emit any guards
// if saved_jvms == NULL and alloc != NULL, we can't emit any guards
bool can_emit_guards = (alloc == NULL || saved_jvms != NULL);
// The following tests must be performed

View File

@ -146,8 +146,16 @@ void Parse::do_field_access(bool is_get, bool is_field) {
void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
BasicType bt = field->layout_type();
// Does this field have a constant value? If so, just push the value.
if (field->is_constant()) {
if (field->is_constant() &&
// Keep consistent with types found by ciTypeFlow: for an
// unloaded field type, ciTypeFlow::StateVector::do_getstatic()
// speculates the field is null. The code in the rest of this
// method does the same. We must not bypass it and use a non
// null constant here.
(bt != T_OBJECT || field->type()->is_loaded())) {
// final or stable field
Node* con = make_constant_from_field(field, obj);
if (con != NULL) {
@ -163,7 +171,6 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
int offset = field->offset_in_bytes();
const TypePtr* adr_type = C->alias_type(field)->adr_type();
Node *adr = basic_plus_adr(obj, obj, offset);
BasicType bt = field->layout_type();
// Build the resultant type of the load
const Type *type;

View File

@ -6814,7 +6814,9 @@ class C2 extends C1 implements I2 {
<functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
<functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
then the module can not be updated with these functions.
then the module can not be updated with these functions. The result of
this function is always <code>JNI_TRUE</code> when called to determine
if an unnamed module is modifiable.
</description>
<origin>new</origin>
<capabilities>

View File

@ -54,7 +54,6 @@
#include "runtime/os.inline.hpp"
#include "runtime/thread.inline.hpp"
#include "runtime/vframe.hpp"
#include "services/attachListener.hpp"
#include "services/serviceUtil.hpp"
#include "utilities/macros.hpp"
#if INCLUDE_ALL_GCS
@ -2479,15 +2478,6 @@ extern "C" {
typedef jint (JNICALL *OnAttachEntry_t)(JavaVM*, char *, void *);
}
jint JvmtiExport::load_agent_library(AttachOperation* op, outputStream* st) {
// get agent name and options
const char* agent = op->arg(0);
const char* absParam = op->arg(1);
const char* options = op->arg(2);
return load_agent_library(agent, absParam, options, st);
}
jint JvmtiExport::load_agent_library(const char *agent, const char *absParam,
const char *options, outputStream* st) {
char ebuf[1024];

View File

@ -45,7 +45,6 @@ class JvmtiEventControllerPrivate;
class JvmtiManageCapabilities;
class JvmtiEnv;
class JvmtiThreadState;
class AttachOperation;
#define JVMTI_SUPPORT_FLAG(key) \
private: \
@ -396,7 +395,6 @@ class JvmtiExport : public AllStatic {
#if INCLUDE_SERVICES
// attach support
static jint load_agent_library(const char *agent, const char *absParam, const char *options, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
static jint load_agent_library(AttachOperation* op, outputStream* out) NOT_JVMTI_RETURN_(JNI_ERR);
#endif
// SetNativeMethodPrefix support

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -378,7 +378,7 @@ UNSAFE_ENTRY(jobject, Unsafe_GetUncompressedObject(JNIEnv *env, jobject unsafe,
// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
// values we have to use a lock-based scheme to enforce atomicity. This has to be
// applied to all Unsafe operations that set the value of a jlong field. Even so
// the compareAndSwapLong operation will not be atomic with respect to direct stores
// the compareAndSetLong operation will not be atomic with respect to direct stores
// to the field from Java code. It is important therefore that any Java code that
// utilizes these Unsafe jlong operations does not perform direct stores. To permit
// direct loads of the field from Java code we must also use Atomic::store within the
@ -1013,7 +1013,7 @@ UNSAFE_ENTRY(jlong, Unsafe_CompareAndExchangeLong(JNIEnv *env, jobject unsafe, j
#endif
} UNSAFE_END
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetObject(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jobject e_h, jobject x_h)) {
oop x = JNIHandles::resolve(x_h);
oop e = JNIHandles::resolve(e_h);
oop p = JNIHandles::resolve(obj);
@ -1028,14 +1028,14 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapObject(JNIEnv *env, jobject unsafe,
return true;
} UNSAFE_END
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetInt(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jint e, jint x)) {
oop p = JNIHandles::resolve(obj);
jint* addr = (jint *)index_oop_from_field_offset_long(p, offset);
return (jint)(Atomic::cmpxchg(x, addr, e)) == e;
} UNSAFE_END
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSetLong(JNIEnv *env, jobject unsafe, jobject obj, jlong offset, jlong e, jlong x)) {
Handle p(THREAD, JNIHandles::resolve(obj));
jlong* addr = (jlong*)index_oop_from_field_offset_long(p(), offset);
@ -1194,12 +1194,12 @@ static JNINativeMethod jdk_internal_misc_Unsafe_methods[] = {
{CC "defineClass0", CC "(" DC_Args ")" CLS, FN_PTR(Unsafe_DefineClass0)},
{CC "allocateInstance", CC "(" CLS ")" OBJ, FN_PTR(Unsafe_AllocateInstance)},
{CC "throwException", CC "(" THR ")V", FN_PTR(Unsafe_ThrowException)},
{CC "compareAndSwapObject", CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSwapObject)},
{CC "compareAndSwapInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSwapInt)},
{CC "compareAndSwapLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSwapLong)},
{CC "compareAndExchangeObjectVolatile", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
{CC "compareAndExchangeIntVolatile", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
{CC "compareAndExchangeLongVolatile", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
{CC "compareAndSetObject",CC "(" OBJ "J" OBJ "" OBJ ")Z", FN_PTR(Unsafe_CompareAndSetObject)},
{CC "compareAndSetInt", CC "(" OBJ "J""I""I"")Z", FN_PTR(Unsafe_CompareAndSetInt)},
{CC "compareAndSetLong", CC "(" OBJ "J""J""J"")Z", FN_PTR(Unsafe_CompareAndSetLong)},
{CC "compareAndExchangeObject", CC "(" OBJ "J" OBJ "" OBJ ")" OBJ, FN_PTR(Unsafe_CompareAndExchangeObject)},
{CC "compareAndExchangeInt", CC "(" OBJ "J""I""I"")I", FN_PTR(Unsafe_CompareAndExchangeInt)},
{CC "compareAndExchangeLong", CC "(" OBJ "J""J""J"")J", FN_PTR(Unsafe_CompareAndExchangeLong)},
{CC "park", CC "(ZJ)V", FN_PTR(Unsafe_Park)},
{CC "unpark", CC "(" OBJ ")V", FN_PTR(Unsafe_Unpark)},

View File

@ -2762,11 +2762,14 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
build_jvm_args(option->optionString);
}
// -verbose:[class/gc/jni]
// -verbose:[class/module/gc/jni]
if (match_option(option, "-verbose", &tail)) {
if (!strcmp(tail, ":class") || !strcmp(tail, "")) {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, load));
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(class, unload));
} else if (!strcmp(tail, ":module")) {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, load));
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(module, unload));
} else if (!strcmp(tail, ":gc")) {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
} else if (!strcmp(tail, ":jni")) {

View File

@ -3848,6 +3848,9 @@ public:
product(bool, StartAttachListener, false, \
"Always start Attach Listener at VM startup") \
\
product(bool, EnableDynamicAgentLoading, true, \
"Allow tools to load agents with the attach mechanism") \
\
manageable(bool, PrintConcurrentLocks, false, \
"Print java.util.concurrent locks in thread dump") \
\

View File

@ -3404,7 +3404,7 @@ static void call_initPhase1(TRAPS) {
//
// After phase 2, The VM will begin search classes from -Xbootclasspath/a.
static void call_initPhase2(TRAPS) {
TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, modules, startuptime));
TraceTime timer("Phase2 initialization", TRACETIME_LOG(Info, module, startuptime));
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
instanceKlassHandle klass (THREAD, k);

View File

@ -100,6 +100,36 @@ static jint get_properties(AttachOperation* op, outputStream* out, Symbol* seria
return JNI_OK;
}
// Implementation of "load" command.
static jint load_agent(AttachOperation* op, outputStream* out) {
// get agent name and options
const char* agent = op->arg(0);
const char* absParam = op->arg(1);
const char* options = op->arg(2);
// If loading a java agent then need to ensure that the java.instrument module is loaded
if (strcmp(agent, "instrument") == 0) {
Thread* THREAD = Thread::current();
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
JavaValue result(T_OBJECT);
Handle h_module_name = java_lang_String::create_from_str("java.instrument", THREAD);
JavaCalls::call_static(&result,
SystemDictionary::module_Modules_klass(),
vmSymbols::loadModule_name(),
vmSymbols::loadModule_signature(),
h_module_name,
THREAD);
if (HAS_PENDING_EXCEPTION) {
java_lang_Throwable::print(PENDING_EXCEPTION, out);
CLEAR_PENDING_EXCEPTION;
return JNI_ERR;
}
}
return JvmtiExport::load_agent_library(agent, absParam, options, out);
}
// Implementation of "properties" command.
// See also: PrintSystemPropertiesDCmd class
static jint get_system_properties(AttachOperation* op, outputStream* out) {
@ -282,7 +312,7 @@ static AttachOperationFunctionInfo funcs[] = {
{ "agentProperties", get_agent_properties },
{ "datadump", data_dump },
{ "dumpheap", dump_heap },
{ "load", JvmtiExport::load_agent_library },
{ "load", load_agent },
{ "properties", get_system_properties },
{ "threaddump", thread_dump },
{ "inspectheap", heap_inspection },
@ -321,6 +351,10 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) {
// handle special detachall operation
if (strcmp(op->name(), AttachOperation::detachall_operation_name()) == 0) {
AttachListener::detachall();
} else if (!EnableDynamicAgentLoading && strcmp(op->name(), "load") == 0) {
st.print("Dynamic agent loading is not enabled. "
"Use -XX:+EnableDynamicAgentLoading to launch target VM.");
res = JNI_ERR;
} else {
// find the function to dispatch too
AttachOperationFunctionInfo* info = NULL;

View File

@ -42,6 +42,21 @@
#include "utilities/macros.hpp"
#include "oops/objArrayOop.inline.hpp"
static void loadAgentModule(TRAPS) {
ResourceMark rm(THREAD);
HandleMark hm(THREAD);
JavaValue result(T_OBJECT);
Handle h_module_name = java_lang_String::create_from_str("jdk.management.agent", CHECK);
JavaCalls::call_static(&result,
SystemDictionary::module_Modules_klass(),
vmSymbols::loadModule_name(),
vmSymbols::loadModule_signature(),
h_module_name,
THREAD);
}
void DCmdRegistrant::register_dcmds(){
// Registration of the diagnostic commands
// First argument specifies which interfaces will export the command
@ -753,6 +768,7 @@ void JMXStartRemoteDCmd::execute(DCmdSource source, TRAPS) {
// the remote management server.
// throw java.lang.NoSuchMethodError if the method doesn't exist
loadAgentModule(CHECK);
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
instanceKlassHandle ik (THREAD, k);
@ -826,6 +842,7 @@ void JMXStartLocalDCmd::execute(DCmdSource source, TRAPS) {
// the local management server
// throw java.lang.NoSuchMethodError if method doesn't exist
loadAgentModule(CHECK);
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
instanceKlassHandle ik (THREAD, k);
@ -843,6 +860,7 @@ void JMXStopRemoteDCmd::execute(DCmdSource source, TRAPS) {
// management server
// throw java.lang.NoSuchMethodError if method doesn't exist
loadAgentModule(CHECK);
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
instanceKlassHandle ik (THREAD, k);
@ -864,6 +882,7 @@ void JMXStatusDCmd::execute(DCmdSource source, TRAPS) {
// invoke getManagementAgentStatus() method to generate the status info
// throw java.lang.NoSuchMethodError if method doesn't exist
loadAgentModule(CHECK);
Handle loader = Handle(THREAD, SystemDictionary::java_system_loader());
Klass* k = SystemDictionary::resolve_or_fail(vmSymbols::jdk_internal_agent_Agent(), loader, Handle(), true, CHECK);
instanceKlassHandle ik (THREAD, k);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -66,7 +66,7 @@ bool SharkIntrinsics::is_intrinsic(ciMethod *target) {
return true;
// Unsafe
case vmIntrinsics::_compareAndSwapInt:
case vmIntrinsics::_compareAndSetInt:
return true;
default:
@ -140,8 +140,8 @@ void SharkIntrinsics::do_intrinsic() {
break;
// Unsafe
case vmIntrinsics::_compareAndSwapInt:
do_Unsafe_compareAndSwapInt();
case vmIntrinsics::_compareAndSetInt:
do_Unsafe_compareAndSetInt();
break;
default:
@ -241,7 +241,7 @@ void SharkIntrinsics::do_Thread_currentThread() {
true));
}
void SharkIntrinsics::do_Unsafe_compareAndSwapInt() {
void SharkIntrinsics::do_Unsafe_compareAndSetInt() {
// Pop the arguments
Value *x = state()->pop()->jint_value();
Value *e = state()->pop()->jint_value();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -58,7 +58,7 @@ class SharkIntrinsics : public SharkTargetInvariants {
void do_Object_getClass();
void do_System_currentTimeMillis();
void do_Thread_currentThread();
void do_Unsafe_compareAndSwapInt();
void do_Unsafe_compareAndSetInt();
};
#endif // SHARE_VM_SHARK_SHARKINTRINSICS_HPP

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, Red Hat, Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -53,7 +54,7 @@ public class TestCAEAntiDep {
}
static int m(TestCAEAntiDep test, Object expected, Object x) {
C old = (C)UNSAFE.compareAndExchangeObjectVolatile(test, O_OFFSET, expected, x);
C old = (C)UNSAFE.compareAndExchangeObject(test, O_OFFSET, expected, x);
int res = old.f1;
old.f1 = 0x42;
return res;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -72,9 +72,8 @@ public class UnsafeTwoCASLong {
}
static void testAccess(Object base, long offset) {
UNSAFE.compareAndSwapLong(base, offset, 1L, 2L);
UNSAFE.compareAndSwapLong(base, offset, 2L, 1L);
UNSAFE.compareAndSetLong(base, offset, 1L, 2L);
UNSAFE.compareAndSetLong(base, offset, 2L, 1L);
}
}

View File

@ -32,7 +32,7 @@
* java.management
* jdk.attach
*
* @run main/othervm compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
* @run main/othervm -Djdk.attach.allowAttachSelf compiler.jsr292.RedefineMethodUsedByMultipleMethodHandles
*/
package compiler.jsr292;

View File

@ -29,7 +29,7 @@
* jdk.internal.vm.ci/jdk.vm.ci.runtime
* jdk.attach
* java.base/jdk.internal.misc
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null jdk.vm.ci.runtime.test.RedefineClassTest
* @run junit/othervm -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -Djvmci.Compiler=null -Djdk.attach.allowAttachSelf jdk.vm.ci.runtime.test.RedefineClassTest
*/
package jdk.vm.ci.runtime.test;

View File

@ -33,7 +33,7 @@
* @run driver compiler.profiling.spectrapredefineclass.Launcher
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
* -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
* -XX:ReservedCodeCacheSize=3M
* -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
* compiler.profiling.spectrapredefineclass.Agent
*/

View File

@ -36,7 +36,7 @@
* @run driver compiler.profiling.spectrapredefineclass_classloaders.Launcher
* @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation
* -XX:-UseOnStackReplacement -XX:TypeProfileLevel=222
* -XX:ReservedCodeCacheSize=3M
* -XX:ReservedCodeCacheSize=3M -Djdk.attach.allowAttachSelf
* compiler.profiling.spectrapredefineclass_classloaders.Agent
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
// Compare
{
boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
assertEquals(r, true, "success compareAndSwap boolean");
boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
assertEquals(r, true, "success compareAndSet boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, false, "success compareAndSwap boolean value");
assertEquals(x, false, "success compareAndSet boolean value");
}
{
boolean r = UNSAFE.compareAndSwapBoolean(base, offset, true, false);
assertEquals(r, false, "failing compareAndSwap boolean");
boolean r = UNSAFE.compareAndSetBoolean(base, offset, true, false);
assertEquals(r, false, "failing compareAndSet boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, false, "failing compareAndSwap boolean value");
assertEquals(x, false, "failing compareAndSet boolean value");
}
// Advanced compare
{
boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, true);
assertEquals(r, false, "success compareAndExchangeVolatile boolean");
boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, true);
assertEquals(r, false, "success compareAndExchange boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, true, "success compareAndExchangeVolatile boolean value");
assertEquals(x, true, "success compareAndExchange boolean value");
}
{
boolean r = UNSAFE.compareAndExchangeBooleanVolatile(base, offset, false, false);
assertEquals(r, true, "failing compareAndExchangeVolatile boolean");
boolean r = UNSAFE.compareAndExchangeBoolean(base, offset, false, false);
assertEquals(r, true, "failing compareAndExchange boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, true, "failing compareAndExchangeVolatile boolean value");
assertEquals(x, true, "failing compareAndExchange boolean value");
}
{
@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapBoolean(base, offset, true, false);
success = UNSAFE.weakCompareAndSetBooleanPlain(base, offset, true, false);
}
assertEquals(success, true, "weakCompareAndSwap boolean");
assertEquals(success, true, "weakCompareAndSetPlain boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, false, "weakCompareAndSwap boolean value");
assertEquals(x, false, "weakCompareAndSetPlain boolean value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapBooleanAcquire(base, offset, false, true);
success = UNSAFE.weakCompareAndSetBooleanAcquire(base, offset, false, true);
}
assertEquals(success, true, "weakCompareAndSwapAcquire boolean");
assertEquals(success, true, "weakCompareAndSetAcquire boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, true, "weakCompareAndSwapAcquire boolean");
assertEquals(x, true, "weakCompareAndSetAcquire boolean");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapBooleanRelease(base, offset, true, false);
success = UNSAFE.weakCompareAndSetBooleanRelease(base, offset, true, false);
}
assertEquals(success, true, "weakCompareAndSwapRelease boolean");
assertEquals(success, true, "weakCompareAndSetRelease boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, false, "weakCompareAndSwapRelease boolean");
assertEquals(x, false, "weakCompareAndSetRelease boolean");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapBooleanVolatile(base, offset, false, true);
success = UNSAFE.weakCompareAndSetBoolean(base, offset, false, true);
}
assertEquals(success, true, "weakCompareAndSwapVolatile boolean");
assertEquals(success, true, "weakCompareAndSet boolean");
boolean x = UNSAFE.getBoolean(base, offset);
assertEquals(x, true, "weakCompareAndSwapVolatile boolean");
assertEquals(x, true, "weakCompareAndSet boolean");
}
UNSAFE.putBoolean(base, offset, false);
@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestBoolean {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestByte {
// Compare
{
boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
assertEquals(r, true, "success compareAndSwap byte");
boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x23);
assertEquals(r, true, "success compareAndSet byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x23, "success compareAndSwap byte value");
assertEquals(x, (byte)0x23, "success compareAndSet byte value");
}
{
boolean r = UNSAFE.compareAndSwapByte(base, offset, (byte)0x01, (byte)0x45);
assertEquals(r, false, "failing compareAndSwap byte");
boolean r = UNSAFE.compareAndSetByte(base, offset, (byte)0x01, (byte)0x45);
assertEquals(r, false, "failing compareAndSet byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x23, "failing compareAndSwap byte value");
assertEquals(x, (byte)0x23, "failing compareAndSet byte value");
}
// Advanced compare
{
byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x01);
assertEquals(r, (byte)0x23, "success compareAndExchangeVolatile byte");
byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x01);
assertEquals(r, (byte)0x23, "success compareAndExchange byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x01, "success compareAndExchangeVolatile byte value");
assertEquals(x, (byte)0x01, "success compareAndExchange byte value");
}
{
byte r = UNSAFE.compareAndExchangeByteVolatile(base, offset, (byte)0x23, (byte)0x45);
assertEquals(r, (byte)0x01, "failing compareAndExchangeVolatile byte");
byte r = UNSAFE.compareAndExchangeByte(base, offset, (byte)0x23, (byte)0x45);
assertEquals(r, (byte)0x01, "failing compareAndExchange byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x01, "failing compareAndExchangeVolatile byte value");
assertEquals(x, (byte)0x01, "failing compareAndExchange byte value");
}
{
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestByte {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapByte(base, offset, (byte)0x01, (byte)0x23);
success = UNSAFE.weakCompareAndSetBytePlain(base, offset, (byte)0x01, (byte)0x23);
}
assertEquals(success, true, "weakCompareAndSwap byte");
assertEquals(success, true, "weakCompareAndSetPlain byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x23, "weakCompareAndSwap byte value");
assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapByteAcquire(base, offset, (byte)0x23, (byte)0x01);
success = UNSAFE.weakCompareAndSetByteAcquire(base, offset, (byte)0x23, (byte)0x01);
}
assertEquals(success, true, "weakCompareAndSwapAcquire byte");
assertEquals(success, true, "weakCompareAndSetAcquire byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x01, "weakCompareAndSwapAcquire byte");
assertEquals(x, (byte)0x01, "weakCompareAndSetAcquire byte");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapByteRelease(base, offset, (byte)0x01, (byte)0x23);
success = UNSAFE.weakCompareAndSetByteRelease(base, offset, (byte)0x01, (byte)0x23);
}
assertEquals(success, true, "weakCompareAndSwapRelease byte");
assertEquals(success, true, "weakCompareAndSetRelease byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x23, "weakCompareAndSwapRelease byte");
assertEquals(x, (byte)0x23, "weakCompareAndSetRelease byte");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapByteVolatile(base, offset, (byte)0x23, (byte)0x01);
success = UNSAFE.weakCompareAndSetByte(base, offset, (byte)0x23, (byte)0x01);
}
assertEquals(success, true, "weakCompareAndSwapVolatile byte");
assertEquals(success, true, "weakCompareAndSet byte");
byte x = UNSAFE.getByte(base, offset);
assertEquals(x, (byte)0x01, "weakCompareAndSwapVolatile byte");
assertEquals(x, (byte)0x01, "weakCompareAndSet byte");
}
UNSAFE.putByte(base, offset, (byte)0x23);
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestByte {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestChar {
// Compare
{
boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u4567');
assertEquals(r, true, "success compareAndSwap char");
boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u4567');
assertEquals(r, true, "success compareAndSet char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u4567', "success compareAndSwap char value");
assertEquals(x, '\u4567', "success compareAndSet char value");
}
{
boolean r = UNSAFE.compareAndSwapChar(base, offset, '\u0123', '\u89AB');
assertEquals(r, false, "failing compareAndSwap char");
boolean r = UNSAFE.compareAndSetChar(base, offset, '\u0123', '\u89AB');
assertEquals(r, false, "failing compareAndSet char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u4567', "failing compareAndSwap char value");
assertEquals(x, '\u4567', "failing compareAndSet char value");
}
// Advanced compare
{
char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u0123');
assertEquals(r, '\u4567', "success compareAndExchangeVolatile char");
char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u0123');
assertEquals(r, '\u4567', "success compareAndExchange char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u0123', "success compareAndExchangeVolatile char value");
assertEquals(x, '\u0123', "success compareAndExchange char value");
}
{
char r = UNSAFE.compareAndExchangeCharVolatile(base, offset, '\u4567', '\u89AB');
assertEquals(r, '\u0123', "failing compareAndExchangeVolatile char");
char r = UNSAFE.compareAndExchangeChar(base, offset, '\u4567', '\u89AB');
assertEquals(r, '\u0123', "failing compareAndExchange char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u0123', "failing compareAndExchangeVolatile char value");
assertEquals(x, '\u0123', "failing compareAndExchange char value");
}
{
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestChar {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapChar(base, offset, '\u0123', '\u4567');
success = UNSAFE.weakCompareAndSetCharPlain(base, offset, '\u0123', '\u4567');
}
assertEquals(success, true, "weakCompareAndSwap char");
assertEquals(success, true, "weakCompareAndSetPlain char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u4567', "weakCompareAndSwap char value");
assertEquals(x, '\u4567', "weakCompareAndSetPlain char value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapCharAcquire(base, offset, '\u4567', '\u0123');
success = UNSAFE.weakCompareAndSetCharAcquire(base, offset, '\u4567', '\u0123');
}
assertEquals(success, true, "weakCompareAndSwapAcquire char");
assertEquals(success, true, "weakCompareAndSetAcquire char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u0123', "weakCompareAndSwapAcquire char");
assertEquals(x, '\u0123', "weakCompareAndSetAcquire char");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapCharRelease(base, offset, '\u0123', '\u4567');
success = UNSAFE.weakCompareAndSetCharRelease(base, offset, '\u0123', '\u4567');
}
assertEquals(success, true, "weakCompareAndSwapRelease char");
assertEquals(success, true, "weakCompareAndSetRelease char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u4567', "weakCompareAndSwapRelease char");
assertEquals(x, '\u4567', "weakCompareAndSetRelease char");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapCharVolatile(base, offset, '\u4567', '\u0123');
success = UNSAFE.weakCompareAndSetChar(base, offset, '\u4567', '\u0123');
}
assertEquals(success, true, "weakCompareAndSwapVolatile char");
assertEquals(success, true, "weakCompareAndSet char");
char x = UNSAFE.getChar(base, offset);
assertEquals(x, '\u0123', "weakCompareAndSwapVolatile char");
assertEquals(x, '\u0123', "weakCompareAndSet char");
}
UNSAFE.putChar(base, offset, '\u4567');
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestChar {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
// Compare
{
boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 2.0d);
assertEquals(r, true, "success compareAndSwap double");
boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 2.0d);
assertEquals(r, true, "success compareAndSet double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 2.0d, "success compareAndSwap double value");
assertEquals(x, 2.0d, "success compareAndSet double value");
}
{
boolean r = UNSAFE.compareAndSwapDouble(base, offset, 1.0d, 3.0d);
assertEquals(r, false, "failing compareAndSwap double");
boolean r = UNSAFE.compareAndSetDouble(base, offset, 1.0d, 3.0d);
assertEquals(r, false, "failing compareAndSet double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 2.0d, "failing compareAndSwap double value");
assertEquals(x, 2.0d, "failing compareAndSet double value");
}
// Advanced compare
{
double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 1.0d);
assertEquals(r, 2.0d, "success compareAndExchangeVolatile double");
double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 1.0d);
assertEquals(r, 2.0d, "success compareAndExchange double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 1.0d, "success compareAndExchangeVolatile double value");
assertEquals(x, 1.0d, "success compareAndExchange double value");
}
{
double r = UNSAFE.compareAndExchangeDoubleVolatile(base, offset, 2.0d, 3.0d);
assertEquals(r, 1.0d, "failing compareAndExchangeVolatile double");
double r = UNSAFE.compareAndExchangeDouble(base, offset, 2.0d, 3.0d);
assertEquals(r, 1.0d, "failing compareAndExchange double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 1.0d, "failing compareAndExchangeVolatile double value");
assertEquals(x, 1.0d, "failing compareAndExchange double value");
}
{
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapDouble(base, offset, 1.0d, 2.0d);
success = UNSAFE.weakCompareAndSetDoublePlain(base, offset, 1.0d, 2.0d);
}
assertEquals(success, true, "weakCompareAndSwap double");
assertEquals(success, true, "weakCompareAndSetPlain double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 2.0d, "weakCompareAndSwap double value");
assertEquals(x, 2.0d, "weakCompareAndSetPlain double value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapDoubleAcquire(base, offset, 2.0d, 1.0d);
success = UNSAFE.weakCompareAndSetDoubleAcquire(base, offset, 2.0d, 1.0d);
}
assertEquals(success, true, "weakCompareAndSwapAcquire double");
assertEquals(success, true, "weakCompareAndSetAcquire double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 1.0d, "weakCompareAndSwapAcquire double");
assertEquals(x, 1.0d, "weakCompareAndSetAcquire double");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapDoubleRelease(base, offset, 1.0d, 2.0d);
success = UNSAFE.weakCompareAndSetDoubleRelease(base, offset, 1.0d, 2.0d);
}
assertEquals(success, true, "weakCompareAndSwapRelease double");
assertEquals(success, true, "weakCompareAndSetRelease double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 2.0d, "weakCompareAndSwapRelease double");
assertEquals(x, 2.0d, "weakCompareAndSetRelease double");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapDoubleVolatile(base, offset, 2.0d, 1.0d);
success = UNSAFE.weakCompareAndSetDouble(base, offset, 2.0d, 1.0d);
}
assertEquals(success, true, "weakCompareAndSwapVolatile double");
assertEquals(success, true, "weakCompareAndSet double");
double x = UNSAFE.getDouble(base, offset);
assertEquals(x, 1.0d, "weakCompareAndSwapVolatile double");
assertEquals(x, 1.0d, "weakCompareAndSet double");
}
UNSAFE.putDouble(base, offset, 2.0d);
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestDouble {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -180,32 +180,32 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
// Compare
{
boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 2.0f);
assertEquals(r, true, "success compareAndSwap float");
boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 2.0f);
assertEquals(r, true, "success compareAndSet float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 2.0f, "success compareAndSwap float value");
assertEquals(x, 2.0f, "success compareAndSet float value");
}
{
boolean r = UNSAFE.compareAndSwapFloat(base, offset, 1.0f, 3.0f);
assertEquals(r, false, "failing compareAndSwap float");
boolean r = UNSAFE.compareAndSetFloat(base, offset, 1.0f, 3.0f);
assertEquals(r, false, "failing compareAndSet float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 2.0f, "failing compareAndSwap float value");
assertEquals(x, 2.0f, "failing compareAndSet float value");
}
// Advanced compare
{
float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 1.0f);
assertEquals(r, 2.0f, "success compareAndExchangeVolatile float");
float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 1.0f);
assertEquals(r, 2.0f, "success compareAndExchange float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 1.0f, "success compareAndExchangeVolatile float value");
assertEquals(x, 1.0f, "success compareAndExchange float value");
}
{
float r = UNSAFE.compareAndExchangeFloatVolatile(base, offset, 2.0f, 3.0f);
assertEquals(r, 1.0f, "failing compareAndExchangeVolatile float");
float r = UNSAFE.compareAndExchangeFloat(base, offset, 2.0f, 3.0f);
assertEquals(r, 1.0f, "failing compareAndExchange float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 1.0f, "failing compareAndExchangeVolatile float value");
assertEquals(x, 1.0f, "failing compareAndExchange float value");
}
{
@ -239,41 +239,41 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapFloat(base, offset, 1.0f, 2.0f);
success = UNSAFE.weakCompareAndSetFloatPlain(base, offset, 1.0f, 2.0f);
}
assertEquals(success, true, "weakCompareAndSwap float");
assertEquals(success, true, "weakCompareAndSetPlain float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 2.0f, "weakCompareAndSwap float value");
assertEquals(x, 2.0f, "weakCompareAndSetPlain float value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapFloatAcquire(base, offset, 2.0f, 1.0f);
success = UNSAFE.weakCompareAndSetFloatAcquire(base, offset, 2.0f, 1.0f);
}
assertEquals(success, true, "weakCompareAndSwapAcquire float");
assertEquals(success, true, "weakCompareAndSetAcquire float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 1.0f, "weakCompareAndSwapAcquire float");
assertEquals(x, 1.0f, "weakCompareAndSetAcquire float");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapFloatRelease(base, offset, 1.0f, 2.0f);
success = UNSAFE.weakCompareAndSetFloatRelease(base, offset, 1.0f, 2.0f);
}
assertEquals(success, true, "weakCompareAndSwapRelease float");
assertEquals(success, true, "weakCompareAndSetRelease float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 2.0f, "weakCompareAndSwapRelease float");
assertEquals(x, 2.0f, "weakCompareAndSetRelease float");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapFloatVolatile(base, offset, 2.0f, 1.0f);
success = UNSAFE.weakCompareAndSetFloat(base, offset, 2.0f, 1.0f);
}
assertEquals(success, true, "weakCompareAndSwapVolatile float");
assertEquals(success, true, "weakCompareAndSet float");
float x = UNSAFE.getFloat(base, offset);
assertEquals(x, 1.0f, "weakCompareAndSwapVolatile float");
assertEquals(x, 1.0f, "weakCompareAndSet float");
}
UNSAFE.putFloat(base, offset, 2.0f);
@ -306,4 +306,3 @@ public class JdkInternalMiscUnsafeAccessTestFloat {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestInt {
// Compare
{
boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
assertEquals(r, true, "success compareAndSwap int");
boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0x89ABCDEF);
assertEquals(r, true, "success compareAndSet int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x89ABCDEF, "success compareAndSwap int value");
assertEquals(x, 0x89ABCDEF, "success compareAndSet int value");
}
{
boolean r = UNSAFE.compareAndSwapInt(base, offset, 0x01234567, 0xCAFEBABE);
assertEquals(r, false, "failing compareAndSwap int");
boolean r = UNSAFE.compareAndSetInt(base, offset, 0x01234567, 0xCAFEBABE);
assertEquals(r, false, "failing compareAndSet int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x89ABCDEF, "failing compareAndSwap int value");
assertEquals(x, 0x89ABCDEF, "failing compareAndSet int value");
}
// Advanced compare
{
int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
assertEquals(r, 0x89ABCDEF, "success compareAndExchangeVolatile int");
int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0x01234567);
assertEquals(r, 0x89ABCDEF, "success compareAndExchange int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x01234567, "success compareAndExchangeVolatile int value");
assertEquals(x, 0x01234567, "success compareAndExchange int value");
}
{
int r = UNSAFE.compareAndExchangeIntVolatile(base, offset, 0x89ABCDEF, 0xCAFEBABE);
assertEquals(r, 0x01234567, "failing compareAndExchangeVolatile int");
int r = UNSAFE.compareAndExchangeInt(base, offset, 0x89ABCDEF, 0xCAFEBABE);
assertEquals(r, 0x01234567, "failing compareAndExchange int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x01234567, "failing compareAndExchangeVolatile int value");
assertEquals(x, 0x01234567, "failing compareAndExchange int value");
}
{
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestInt {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapInt(base, offset, 0x01234567, 0x89ABCDEF);
success = UNSAFE.weakCompareAndSetIntPlain(base, offset, 0x01234567, 0x89ABCDEF);
}
assertEquals(success, true, "weakCompareAndSwap int");
assertEquals(success, true, "weakCompareAndSetPlain int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x89ABCDEF, "weakCompareAndSwap int value");
assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
success = UNSAFE.weakCompareAndSetIntAcquire(base, offset, 0x89ABCDEF, 0x01234567);
}
assertEquals(success, true, "weakCompareAndSwapAcquire int");
assertEquals(success, true, "weakCompareAndSetAcquire int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x01234567, "weakCompareAndSwapAcquire int");
assertEquals(x, 0x01234567, "weakCompareAndSetAcquire int");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
success = UNSAFE.weakCompareAndSetIntRelease(base, offset, 0x01234567, 0x89ABCDEF);
}
assertEquals(success, true, "weakCompareAndSwapRelease int");
assertEquals(success, true, "weakCompareAndSetRelease int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x89ABCDEF, "weakCompareAndSwapRelease int");
assertEquals(x, 0x89ABCDEF, "weakCompareAndSetRelease int");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapIntVolatile(base, offset, 0x89ABCDEF, 0x01234567);
success = UNSAFE.weakCompareAndSetInt(base, offset, 0x89ABCDEF, 0x01234567);
}
assertEquals(success, true, "weakCompareAndSwapVolatile int");
assertEquals(success, true, "weakCompareAndSet int");
int x = UNSAFE.getInt(base, offset);
assertEquals(x, 0x01234567, "weakCompareAndSwapVolatile int");
assertEquals(x, 0x01234567, "weakCompareAndSet int");
}
UNSAFE.putInt(base, offset, 0x89ABCDEF);
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestInt {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestLong {
// Compare
{
boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
assertEquals(r, true, "success compareAndSwap long");
boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
assertEquals(r, true, "success compareAndSet long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSwap long value");
assertEquals(x, 0xCAFEBABECAFEBABEL, "success compareAndSet long value");
}
{
boolean r = UNSAFE.compareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, false, "failing compareAndSwap long");
boolean r = UNSAFE.compareAndSetLong(base, offset, 0x0123456789ABCDEFL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, false, "failing compareAndSet long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSwap long value");
assertEquals(x, 0xCAFEBABECAFEBABEL, "failing compareAndSet long value");
}
// Advanced compare
{
long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchangeVolatile long");
long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
assertEquals(r, 0xCAFEBABECAFEBABEL, "success compareAndExchange long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchangeVolatile long value");
assertEquals(x, 0x0123456789ABCDEFL, "success compareAndExchange long value");
}
{
long r = UNSAFE.compareAndExchangeLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long");
long r = UNSAFE.compareAndExchangeLong(base, offset, 0xCAFEBABECAFEBABEL, 0xDEADBEEFDEADBEEFL);
assertEquals(r, 0x0123456789ABCDEFL, "failing compareAndExchange long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchangeVolatile long value");
assertEquals(x, 0x0123456789ABCDEFL, "failing compareAndExchange long value");
}
{
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestLong {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapLong(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
success = UNSAFE.weakCompareAndSetLongPlain(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
}
assertEquals(success, true, "weakCompareAndSwap long");
assertEquals(success, true, "weakCompareAndSetPlain long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwap long value");
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
success = UNSAFE.weakCompareAndSetLongAcquire(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
}
assertEquals(success, true, "weakCompareAndSwapAcquire long");
assertEquals(success, true, "weakCompareAndSetAcquire long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapAcquire long");
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetAcquire long");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
success = UNSAFE.weakCompareAndSetLongRelease(base, offset, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL);
}
assertEquals(success, true, "weakCompareAndSwapRelease long");
assertEquals(success, true, "weakCompareAndSetRelease long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSwapRelease long");
assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetRelease long");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapLongVolatile(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
success = UNSAFE.weakCompareAndSetLong(base, offset, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL);
}
assertEquals(success, true, "weakCompareAndSwapVolatile long");
assertEquals(success, true, "weakCompareAndSet long");
long x = UNSAFE.getLong(base, offset);
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSwapVolatile long");
assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long");
}
UNSAFE.putLong(base, offset, 0xCAFEBABECAFEBABEL);
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestLong {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -151,32 +151,32 @@ public class JdkInternalMiscUnsafeAccessTestObject {
// Compare
{
boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "bar");
assertEquals(r, true, "success compareAndSwap Object");
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "bar");
assertEquals(r, true, "success compareAndSet Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "bar", "success compareAndSwap Object value");
assertEquals(x, "bar", "success compareAndSet Object value");
}
{
boolean r = UNSAFE.compareAndSwapObject(base, offset, "foo", "baz");
assertEquals(r, false, "failing compareAndSwap Object");
boolean r = UNSAFE.compareAndSetObject(base, offset, "foo", "baz");
assertEquals(r, false, "failing compareAndSet Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "bar", "failing compareAndSwap Object value");
assertEquals(x, "bar", "failing compareAndSet Object value");
}
// Advanced compare
{
Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchangeVolatile Object");
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "foo");
assertEquals(r, "bar", "success compareAndExchange Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "foo", "success compareAndExchangeVolatile Object value");
assertEquals(x, "foo", "success compareAndExchange Object value");
}
{
Object r = UNSAFE.compareAndExchangeObjectVolatile(base, offset, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchangeVolatile Object");
Object r = UNSAFE.compareAndExchangeObject(base, offset, "bar", "baz");
assertEquals(r, "foo", "failing compareAndExchange Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "foo", "failing compareAndExchangeVolatile Object value");
assertEquals(x, "foo", "failing compareAndExchange Object value");
}
{
@ -210,41 +210,41 @@ public class JdkInternalMiscUnsafeAccessTestObject {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapObject(base, offset, "foo", "bar");
success = UNSAFE.weakCompareAndSetObjectPlain(base, offset, "foo", "bar");
}
assertEquals(success, true, "weakCompareAndSwap Object");
assertEquals(success, true, "weakCompareAndSetPlain Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "bar", "weakCompareAndSwap Object value");
assertEquals(x, "bar", "weakCompareAndSetPlain Object value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapObjectAcquire(base, offset, "bar", "foo");
success = UNSAFE.weakCompareAndSetObjectAcquire(base, offset, "bar", "foo");
}
assertEquals(success, true, "weakCompareAndSwapAcquire Object");
assertEquals(success, true, "weakCompareAndSetAcquire Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "foo", "weakCompareAndSwapAcquire Object");
assertEquals(x, "foo", "weakCompareAndSetAcquire Object");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapObjectRelease(base, offset, "foo", "bar");
success = UNSAFE.weakCompareAndSetObjectRelease(base, offset, "foo", "bar");
}
assertEquals(success, true, "weakCompareAndSwapRelease Object");
assertEquals(success, true, "weakCompareAndSetRelease Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "bar", "weakCompareAndSwapRelease Object");
assertEquals(x, "bar", "weakCompareAndSetRelease Object");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapObjectVolatile(base, offset, "bar", "foo");
success = UNSAFE.weakCompareAndSetObject(base, offset, "bar", "foo");
}
assertEquals(success, true, "weakCompareAndSwapVolatile Object");
assertEquals(success, true, "weakCompareAndSet Object");
Object x = UNSAFE.getObject(base, offset);
assertEquals(x, "foo", "weakCompareAndSwapVolatile Object");
assertEquals(x, "foo", "weakCompareAndSet Object");
}
UNSAFE.putObject(base, offset, "bar");
@ -260,4 +260,3 @@ public class JdkInternalMiscUnsafeAccessTestObject {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -198,32 +198,32 @@ public class JdkInternalMiscUnsafeAccessTestShort {
// Compare
{
boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
assertEquals(r, true, "success compareAndSwap short");
boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x4567);
assertEquals(r, true, "success compareAndSet short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x4567, "success compareAndSwap short value");
assertEquals(x, (short)0x4567, "success compareAndSet short value");
}
{
boolean r = UNSAFE.compareAndSwapShort(base, offset, (short)0x0123, (short)0x89AB);
assertEquals(r, false, "failing compareAndSwap short");
boolean r = UNSAFE.compareAndSetShort(base, offset, (short)0x0123, (short)0x89AB);
assertEquals(r, false, "failing compareAndSet short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x4567, "failing compareAndSwap short value");
assertEquals(x, (short)0x4567, "failing compareAndSet short value");
}
// Advanced compare
{
short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x0123);
assertEquals(r, (short)0x4567, "success compareAndExchangeVolatile short");
short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x0123);
assertEquals(r, (short)0x4567, "success compareAndExchange short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x0123, "success compareAndExchangeVolatile short value");
assertEquals(x, (short)0x0123, "success compareAndExchange short value");
}
{
short r = UNSAFE.compareAndExchangeShortVolatile(base, offset, (short)0x4567, (short)0x89AB);
assertEquals(r, (short)0x0123, "failing compareAndExchangeVolatile short");
short r = UNSAFE.compareAndExchangeShort(base, offset, (short)0x4567, (short)0x89AB);
assertEquals(r, (short)0x0123, "failing compareAndExchange short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x0123, "failing compareAndExchangeVolatile short value");
assertEquals(x, (short)0x0123, "failing compareAndExchange short value");
}
{
@ -257,41 +257,41 @@ public class JdkInternalMiscUnsafeAccessTestShort {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapShort(base, offset, (short)0x0123, (short)0x4567);
success = UNSAFE.weakCompareAndSetShortPlain(base, offset, (short)0x0123, (short)0x4567);
}
assertEquals(success, true, "weakCompareAndSwap short");
assertEquals(success, true, "weakCompareAndSetPlain short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x4567, "weakCompareAndSwap short value");
assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapShortAcquire(base, offset, (short)0x4567, (short)0x0123);
success = UNSAFE.weakCompareAndSetShortAcquire(base, offset, (short)0x4567, (short)0x0123);
}
assertEquals(success, true, "weakCompareAndSwapAcquire short");
assertEquals(success, true, "weakCompareAndSetAcquire short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x0123, "weakCompareAndSwapAcquire short");
assertEquals(x, (short)0x0123, "weakCompareAndSetAcquire short");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapShortRelease(base, offset, (short)0x0123, (short)0x4567);
success = UNSAFE.weakCompareAndSetShortRelease(base, offset, (short)0x0123, (short)0x4567);
}
assertEquals(success, true, "weakCompareAndSwapRelease short");
assertEquals(success, true, "weakCompareAndSetRelease short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x4567, "weakCompareAndSwapRelease short");
assertEquals(x, (short)0x4567, "weakCompareAndSetRelease short");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwapShortVolatile(base, offset, (short)0x4567, (short)0x0123);
success = UNSAFE.weakCompareAndSetShort(base, offset, (short)0x4567, (short)0x0123);
}
assertEquals(success, true, "weakCompareAndSwapVolatile short");
assertEquals(success, true, "weakCompareAndSet short");
short x = UNSAFE.getShort(base, offset);
assertEquals(x, (short)0x0123, "weakCompareAndSwapVolatile short");
assertEquals(x, (short)0x0123, "weakCompareAndSet short");
}
UNSAFE.putShort(base, offset, (short)0x4567);
@ -324,4 +324,3 @@ public class JdkInternalMiscUnsafeAccessTestShort {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -138,4 +138,3 @@ public class SunMiscUnsafeAccessTestBoolean {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestByte {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestChar {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestDouble {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestFloat {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestInt {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -216,4 +216,3 @@ public class SunMiscUnsafeAccessTestLong {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -170,4 +170,3 @@ public class SunMiscUnsafeAccessTestObject {
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -175,4 +175,3 @@ public class SunMiscUnsafeAccessTestShort {
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,11 @@
* @bug 8143628
* @summary Test unsafe access for $type$
*
#if[JdkInternalMisc]
* @modules $module$/$package$:+open
#else[JdkInternalMisc]
* @modules $module$/$package$
#end[JdkInternalMisc]
* @run testng/othervm -Diters=100 -Xint compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
* @run testng/othervm -Diters=20000 -XX:TieredStopAtLevel=1 compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
* @run testng/othervm -Diters=20000 -XX:-TieredCompilation compiler.unsafe.$Qualifier$UnsafeAccessTest$Type$
@ -219,33 +223,51 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
// Compare
{
#if[JdkInternalMisc]
boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value2$);
assertEquals(r, true, "success compareAndSet $type$");
#else[JdkInternalMisc]
boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value2$);
assertEquals(r, true, "success compareAndSwap $type$");
#end[JdkInternalMisc]
$type$ x = UNSAFE.get$Type$(base, offset);
#if[JdkInternalMisc]
assertEquals(x, $value2$, "success compareAndSet $type$ value");
#else[JdkInternalMisc]
assertEquals(x, $value2$, "success compareAndSwap $type$ value");
#end[JdkInternalMisc]
}
{
#if[JdkInternalMisc]
boolean r = UNSAFE.compareAndSet$Type$(base, offset, $value1$, $value3$);
assertEquals(r, false, "failing compareAndSet $type$");
#else[JdkInternalMisc]
boolean r = UNSAFE.compareAndSwap$Type$(base, offset, $value1$, $value3$);
assertEquals(r, false, "failing compareAndSwap $type$");
#end[JdkInternalMisc]
$type$ x = UNSAFE.get$Type$(base, offset);
#if[JdkInternalMisc]
assertEquals(x, $value2$, "failing compareAndSet $type$ value");
#else[JdkInternalMisc]
assertEquals(x, $value2$, "failing compareAndSwap $type$ value");
#end[JdkInternalMisc]
}
#if[JdkInternalMisc]
// Advanced compare
{
$type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchangeVolatile $type$");
$type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value1$);
assertEquals(r, $value2$, "success compareAndExchange $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value1$, "success compareAndExchangeVolatile $type$ value");
assertEquals(x, $value1$, "success compareAndExchange $type$ value");
}
{
$type$ r = UNSAFE.compareAndExchange$Type$Volatile(base, offset, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchangeVolatile $type$");
$type$ r = UNSAFE.compareAndExchange$Type$(base, offset, $value2$, $value3$);
assertEquals(r, $value1$, "failing compareAndExchange $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value1$, "failing compareAndExchangeVolatile $type$ value");
assertEquals(x, $value1$, "failing compareAndExchange $type$ value");
}
{
@ -279,41 +301,41 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwap$Type$(base, offset, $value1$, $value2$);
success = UNSAFE.weakCompareAndSet$Type$Plain(base, offset, $value1$, $value2$);
}
assertEquals(success, true, "weakCompareAndSwap $type$");
assertEquals(success, true, "weakCompareAndSetPlain $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value2$, "weakCompareAndSwap $type$ value");
assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwap$Type$Acquire(base, offset, $value2$, $value1$);
success = UNSAFE.weakCompareAndSet$Type$Acquire(base, offset, $value2$, $value1$);
}
assertEquals(success, true, "weakCompareAndSwapAcquire $type$");
assertEquals(success, true, "weakCompareAndSetAcquire $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value1$, "weakCompareAndSwapAcquire $type$");
assertEquals(x, $value1$, "weakCompareAndSetAcquire $type$");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwap$Type$Release(base, offset, $value1$, $value2$);
success = UNSAFE.weakCompareAndSet$Type$Release(base, offset, $value1$, $value2$);
}
assertEquals(success, true, "weakCompareAndSwapRelease $type$");
assertEquals(success, true, "weakCompareAndSetRelease $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value2$, "weakCompareAndSwapRelease $type$");
assertEquals(x, $value2$, "weakCompareAndSetRelease $type$");
}
{
boolean success = false;
for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
success = UNSAFE.weakCompareAndSwap$Type$Volatile(base, offset, $value2$, $value1$);
success = UNSAFE.weakCompareAndSet$Type$(base, offset, $value2$, $value1$);
}
assertEquals(success, true, "weakCompareAndSwapVolatile $type$");
assertEquals(success, true, "weakCompareAndSet $type$");
$type$ x = UNSAFE.get$Type$(base, offset);
assertEquals(x, $value1$, "weakCompareAndSwapVolatile $type$");
assertEquals(x, $value1$, "weakCompareAndSet $type$");
}
#end[JdkInternalMisc]
@ -354,4 +376,3 @@ public class $Qualifier$UnsafeAccessTest$Type$ {
#end[!boolean]
#end[!Object]
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reqserved.
* Copyright (c) 2016, 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

View File

@ -10,7 +10,7 @@
* 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
* ac_heapanied this code).
* 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,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 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

View File

@ -28,7 +28,7 @@
* @modules java.base/jdk.internal.misc
* jdk.attach/sun.tools.attach
* java.management
* @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestOptionsWithRangesDynamic
* @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Djdk.attach.allowAttachSelf TestOptionsWithRangesDynamic
*/
import java.util.List;

View File

@ -8,7 +8,7 @@
*
* 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
* 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).
*

View File

@ -41,8 +41,8 @@
* @run main/othervm -XX:+UnlockDiagnosticVMOptions
-XX:-UnsyncloadClass -XX:-AllowParallelDefineClass
test.DefineClass defineClassParallel
* @run main/othervm test.DefineClass redefineClass
* @run main/othervm test.DefineClass redefineClassWithError
* @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClass
* @run main/othervm -Djdk.attach.allowAttachSelf test.DefineClass redefineClassWithError
* @author volker.simonis@gmail.com
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
/*
* @test
* @summary modules=debug should have logging from statements in the code
* @summary -Xlog:module should emit logging output
* @library /test/lib
* @modules java.base/jdk.internal.misc
* java.management
@ -35,9 +35,16 @@ import jdk.test.lib.process.ProcessTools;
public class ModulesTest {
public static void main(String[] args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xlog:modules=trace", "-version");
OutputAnalyzer output = new OutputAnalyzer(pb.start());
testModuleTrace("-Xlog:module=trace", "-version");
testModuleLoad("-Xlog:module+load", "-version");
testModuleUnload("-Xlog:module+unload", "-version");
// same as -Xlog:module+load -Xlog:module+unload
testModuleLoad("-verbose:module", "-version");
}
static void testModuleTrace(String... args) throws Exception {
OutputAnalyzer output = run(args);
output.shouldContain("define_javabase_module(): Definition of module:");
output.shouldContain("define_javabase_module(): creation of package");
output.shouldContain("define_module(): creation of module");
@ -48,5 +55,22 @@ public class ModulesTest {
output.shouldContain("Setting package: class:");
output.shouldHaveExitValue(0);
}
static void testModuleLoad(String... args) throws Exception {
OutputAnalyzer output = run(args);
output.shouldContain("java.base location:");
output.shouldContain("java.management location:");
output.shouldHaveExitValue(0);
}
static void testModuleUnload(String... args) throws Exception {
OutputAnalyzer output = run(args);
output.shouldHaveExitValue(0);
}
static OutputAnalyzer run(String... args) throws Exception {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
return new OutputAnalyzer(pb.start());
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -57,7 +57,7 @@ public class StartupTimeTest {
static void analyzeModulesOutputOff(ProcessBuilder pb) throws Exception {
OutputAnalyzer output = new OutputAnalyzer(pb.start());
output.shouldNotContain("[modules,startuptime]");
output.shouldNotContain("[module,startuptime]");
output.shouldHaveExitValue(0);
}
@ -70,11 +70,11 @@ public class StartupTimeTest {
InnerClass.class.getName());
analyzeOutputOff(pb);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules",
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module",
InnerClass.class.getName());
analyzeModulesOutputOn(pb);
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+modules=off",
pb = ProcessTools.createJavaProcessBuilder("-Xlog:startuptime+module=off",
InnerClass.class.getName());
analyzeModulesOutputOff(pb);
}

View File

@ -9,7 +9,7 @@
*
* 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
* 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).
*

View File

@ -8,7 +8,7 @@
*
* 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
* 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).
*

View File

@ -41,12 +41,12 @@ public class JVMAddModuleExports {
MyClassLoader to_cl = new MyClassLoader();
Module from_module, to_module;
from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "this/package" });
from_module = ModuleHelper.ModuleObject("from_module", from_cl, new String[] { "mypackage", "x/apackage" });
assertNotNull(from_module, "Module should not be null");
ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "this/package" });
to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/package" });
ModuleHelper.DefineModule(from_module, "9.0", "from_module/here", new String[] { "mypackage", "x/apackage" });
to_module = ModuleHelper.ModuleObject("to_module", to_cl, new String[] { "yourpackage", "that/apackage" });
assertNotNull(to_module, "Module should not be null");
ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/package" });
ModuleHelper.DefineModule(to_module, "9.0", "to_module/here", new String[] { "yourpackage", "that/apackage" });
// Null from_module argument, expect an NPE
try {
@ -117,19 +117,19 @@ public class JVMAddModuleExports {
// Export a package, that is not in from_module, to from_module
try {
ModuleHelper.AddModuleExports(from_module, "that/package", from_module);
ModuleHelper.AddModuleExports(from_module, "that/apackage", from_module);
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
}
// Export the same package twice to the same module
ModuleHelper.AddModuleExports(from_module, "this/package", to_module);
ModuleHelper.AddModuleExports(from_module, "this/package", to_module);
ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module);
ModuleHelper.AddModuleExports(from_module, "x/apackage", to_module);
// Export a package, using '.' instead of '/'
try {
ModuleHelper.AddModuleExports(from_module, "this.package", to_module);
ModuleHelper.AddModuleExports(from_module, "x.apackage", to_module);
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -137,8 +137,8 @@ public class JVMAddModuleExports {
// Export a package to the unnamed module and then to a specific module.
// The qualified export should be ignored.
ModuleHelper.AddModuleExportsToAll(to_module, "that/package");
ModuleHelper.AddModuleExports(to_module, "that/package", from_module);
ModuleHelper.AddModuleExportsToAll(to_module, "that/apackage");
ModuleHelper.AddModuleExports(to_module, "that/apackage", from_module);
}
static class MyClassLoader extends ClassLoader { }

View File

@ -49,16 +49,16 @@ public class JVMAddModulePackage {
module_two = ModuleHelper.ModuleObject("module_two", cl1, new String[] { "yourpackage" });
assertNotNull(module_two, "Module should not be null");
ModuleHelper.DefineModule(module_two, "9.0", "module_two/here", new String[] { "yourpackage" });
module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "package/num3" });
module_three = ModuleHelper.ModuleObject("module_three", cl3, new String[] { "apackage/num3" });
assertNotNull(module_three, "Module should not be null");
ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "package/num3" });
ModuleHelper.DefineModule(module_three, "9.0", "module_three/here", new String[] { "apackage/num3" });
// Simple call
ModuleHelper.AddModulePackage(module_one, "new_package");
// Add a package and export it
ModuleHelper.AddModulePackage(module_one, "package/num3");
ModuleHelper.AddModuleExportsToAll(module_one, "package/num3");
ModuleHelper.AddModulePackage(module_one, "apackage/num3");
ModuleHelper.AddModuleExportsToAll(module_one, "apackage/num3");
// Null module argument, expect an NPE
try {
@ -94,7 +94,7 @@ public class JVMAddModulePackage {
// Invalid package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module_one, "your.package");
ModuleHelper.AddModulePackage(module_one, "your.apackage");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected
@ -102,7 +102,7 @@ public class JVMAddModulePackage {
// Invalid package name, expect an IAE
try {
ModuleHelper.AddModulePackage(module_one, ";your/package");
ModuleHelper.AddModulePackage(module_one, ";your/apackage");
throw new RuntimeException("Failed to get the expected IAE");
} catch(IllegalArgumentException e) {
// Expected

View File

@ -207,10 +207,10 @@ public class JVMDefineModule {
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { });
// Invalid package name, expect an IAE
m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.package" });
m = ModuleHelper.ModuleObject("moduleFive", cl, new String[] { "your.apackage" });
try {
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.package" });
throw new RuntimeException("Failed to get expected IAE for your.package");
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { "your.apackage" });
throw new RuntimeException("Failed to get expected IAE for your.apackage");
} catch(IllegalArgumentException e) {
if (!e.getMessage().contains("Invalid package name")) {
throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage());
@ -220,8 +220,8 @@ public class JVMDefineModule {
// Invalid package name, expect an IAE
m = ModuleHelper.ModuleObject("moduleSix", cl, new String[] { "foo" }); // Name irrelevant
try {
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/package" });
throw new RuntimeException("Failed to get expected IAE for ;your.package");
ModuleHelper.DefineModule(m, "9.0", "module.name/here", new String[] { ";your/apackage" });
throw new RuntimeException("Failed to get expected IAE for ;your.apackage");
} catch(IllegalArgumentException e) {
if (!e.getMessage().contains("Invalid package name")) {
throw new RuntimeException("Failed to get expected IAE message for bad package name: " + e.getMessage());

View File

@ -53,7 +53,7 @@ public class ModuleStress {
// those loaders never die.
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xbootclasspath/a:.",
"-Xlog:modules=trace",
"-Xlog:module=trace",
"-version");
OutputAnalyzer oa = new OutputAnalyzer(pb.start());
@ -88,7 +88,7 @@ public class ModuleStress {
// the same loader and thus have the exact same life cycle.
pb = ProcessTools.createJavaProcessBuilder(
"-Xbootclasspath/a:.",
"-Xlog:modules=trace",
"-Xlog:module=trace",
"ModuleSameCLMain");
oa = new OutputAnalyzer(pb.start());
@ -102,7 +102,7 @@ public class ModuleStress {
// class loaders which could die and thus be unloaded.
pb = ProcessTools.createJavaProcessBuilder(
"-Xbootclasspath/a:.",
"-Xlog:modules=trace",
"-Xlog:module=trace",
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());
@ -120,7 +120,7 @@ public class ModuleStress {
pb = ProcessTools.createJavaProcessBuilder(
"-Djava.system.class.loader=CustomSystemClassLoader",
"-Xbootclasspath/a:.",
"-Xlog:modules=trace",
"-Xlog:module=trace",
"ModuleNonBuiltinCLMain");
oa = new OutputAnalyzer(pb.start());

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -73,7 +73,7 @@ public class ModuleStressGC {
// test's, defined to module jdk.translet, export list at
// GC safepoints.
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
"-Xlog:modules=trace",
"-Xlog:module=trace",
"-p", MODS_DIR.toString(),
"-m", "jdk.test/test.MainGC");
OutputAnalyzer oa = new OutputAnalyzer(pb.start());

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2013, 2016. Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2013, 2016, 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

View File

@ -418,3 +418,4 @@ d1436b2945383cef15edbdba9bb41ef1656c987b jdk-10+5
329609d00aef2443cf1e44ded94637c5ed55a143 jdk-10+6
7828aedcb525df40b7c8122bcc3f997c75ebaf7f jdk-9+167
e78da9db6299b3fcba49300d52e2359e82fdd218 jdk-9+168
177436a54ca13730ffc725a6e5dbfcd9486f3da3 jdk-9+169

View File

@ -0,0 +1,129 @@
/*
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
body {
margin: 2em 2em;
font-family: DejaVu Sans, Bitstream Vera Sans, Luxi Sans, Verdana, Arial, Helvetica;
font-size: 10pt;
line-height: 1.4;
}
pre, code, tt {
font-family: DejaVu Sans Mono, Bitstream Vera Sans Mono, Luxi Mono,
Courier New, monospace;
}
blockquote {
margin: 1.5ex 0em 1.5ex 2em;
}
p {
padding: 0pt;
margin: 1ex 0em;
}
p:first-child, pre:first-child { margin-top: 0pt; }
h1 {
font-weight: bold;
padding: 0pt;
margin: 2ex .5ex 1ex 0pt;
}
h1:first-child, h2:first-child {
margin-top: 0ex;
}
h2 {
font-weight: bold;
padding: 0pt;
margin: 2ex 0pt 1ex 0pt;
}
h3 {
font-weight: bold;
padding: 0pt;
margin: 1.5ex 0pt 1ex 0pt;
}
h4 {
font-weight: bold;
padding: 0pt;
margin: 1.5ex 0pt 1ex 0pt;
}
a:link {
color: #437291;
}
a:visited {
color: #666666;
}
a[href]:hover {
color: #e76f00;
}
a img {
border-width: 0px;
}
img {
background: white;
}
table {
border-collapse: collapse;
margin-left: 15px;
margin-right: 15px;
}
th, td {
padding: 3px;
vertical-align: top;
}
table, th, td {
border: 1px solid black;
}
caption {
text-align: left;
font-style: italic;
text-indent: 15px;
margin-bottom:10px;
}
tr:nth-child(even) {
background: #DDD;
}
tr:nth-child(odd) {
background: #FFF;
}
th {
background: #DDF;
}

View File

@ -39,6 +39,7 @@ SUNWprivate_1.1 {
Java_sun_instrument_InstrumentationImpl_getObjectSize0;
Java_sun_instrument_InstrumentationImpl_appendToClassLoaderSearch0;
Java_sun_instrument_InstrumentationImpl_setNativeMethodPrefixes;
Java_sun_instrument_InstrumentationImpl_loadAgent0;
local:
*;
};

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, SAP SE and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016, 2017, SAP SE 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
@ -65,6 +65,8 @@
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include "jvm.h"
#include "net_util.h"
/*
* Stack allocated by thread when doing blocking operation
@ -507,9 +509,9 @@ int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
* Auto restarts with adjusted timeout if interrupted by
* signal other than our wakeup signal.
*/
int NET_Timeout0(int s, long timeout, long currentTime) {
long prevtime = currentTime, newtime;
struct timeval t;
int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) {
jlong prevNanoTime = nanoTimeStamp;
jlong nanoTimeout = (jlong) timeout * NET_NSEC_PER_MSEC;
fdEntry_t *fdEntry = getFdEntry(s);
/*
@ -533,7 +535,7 @@ int NET_Timeout0(int s, long timeout, long currentTime) {
pfd.events = POLLIN | POLLERR;
startOp(fdEntry, &self);
rv = poll(&pfd, 1, timeout);
rv = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC);
endOp(fdEntry, &self);
/*
@ -541,18 +543,14 @@ int NET_Timeout0(int s, long timeout, long currentTime) {
* has expired return 0 (indicating timeout expired).
*/
if (rv < 0 && errno == EINTR) {
if (timeout > 0) {
gettimeofday(&t, NULL);
newtime = t.tv_sec * 1000 + t.tv_usec / 1000;
timeout -= newtime - prevtime;
if (timeout <= 0) {
return 0;
}
prevtime = newtime;
jlong newNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= newNanoTime - prevNanoTime;
if (nanoTimeout < NET_NSEC_PER_MSEC) {
return 0;
}
prevNanoTime = newNanoTime;
} else {
return rv;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -37,6 +37,8 @@
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include "jvm.h"
#include "net_util.h"
/*
* Stack allocated by thread when doing blocking operation
@ -410,9 +412,9 @@ int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
* Auto restarts with adjusted timeout if interrupted by
* signal other than our wakeup signal.
*/
int NET_Timeout0(int s, long timeout, long currentTime) {
long prevtime = currentTime, newtime;
struct timeval t;
int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) {
jlong prevNanoTime = nanoTimeStamp;
jlong nanoTimeout = (jlong)timeout * NET_NSEC_PER_MSEC;
fdEntry_t *fdEntry = getFdEntry(s);
/*
@ -436,26 +438,21 @@ int NET_Timeout0(int s, long timeout, long currentTime) {
pfd.events = POLLIN | POLLERR;
startOp(fdEntry, &self);
rv = poll(&pfd, 1, timeout);
rv = poll(&pfd, 1, nanoTimeout / NET_NSEC_PER_MSEC);
endOp(fdEntry, &self);
/*
* If interrupted then adjust timeout. If timeout
* has expired return 0 (indicating timeout expired).
*/
if (rv < 0 && errno == EINTR) {
if (timeout > 0) {
gettimeofday(&t, NULL);
newtime = t.tv_sec * 1000 + t.tv_usec / 1000;
timeout -= newtime - prevtime;
if (timeout <= 0) {
return 0;
}
prevtime = newtime;
jlong newNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= newNanoTime - prevNanoTime;
if (nanoTimeout < NET_NSEC_PER_MSEC) {
return 0;
}
prevNanoTime = newNanoTime;
} else {
return rv;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -136,8 +136,7 @@ struct NSAppArgs {
* |
* \|/
* ParseArguments
* (removes -d32 and -d64 if any,
* processes version options,
* (processes version options,
* creates argument list for vm,
* etc.)
* |
@ -147,20 +146,20 @@ struct NSAppArgs {
* |
* |
* \|/
* Path is desired JRE ? YES --> Have Desired Model ? NO --> Re-exec --> Main
* NO YES --> Continue
* Path is desired JRE ? YES --> Continue
* NO
* |
* |
* \|/
* Paths have well known
* jvm paths ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
* YES YES --> Continue
* jvm paths ? --> NO --> Continue
* YES
* |
* |
* \|/
* Does libjvm.so exist
* in any of them ? --> NO --> Have Desired Model ? NO --> Re-exec --> Main
* YES YES --> Continue
* in any of them ? --> NO --> Continue
* YES
* |
* |
* \|/
@ -217,7 +216,7 @@ static InvocationFunctions *GetExportedJNIFunctions() {
}
char jvmPath[PATH_MAX];
jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath), CURRENT_DATA_MODEL);
jboolean gotJVMPath = GetJVMPath(jrePath, preferredJVM, jvmPath, sizeof(jvmPath));
if (!gotJVMPath) {
JLI_ReportErrorMessage("Failed to GetJVMPath()");
return NULL;
@ -362,203 +361,51 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
char jrepath[], jint so_jrepath,
char jvmpath[], jint so_jvmpath,
char jvmcfg[], jint so_jvmcfg) {
/*
* First, determine if we are running the desired data model. If we
* are running the desired data model, all the error messages
* associated with calling GetJREPath, ReadKnownVMs, etc. should be
* output. However, if we are not running the desired data model,
* some of the errors should be suppressed since it is more
* informative to issue an error message based on whether or not the
* os/processor combination has dual mode capabilities.
*/
jboolean jvmpathExists;
/* Compute/set the name of the executable */
SetExecname(*pargv);
/* Check data model flags, and exec process, if needed */
{
char * jvmtype = NULL;
int argc = *pargc;
char **argv = *pargv;
int running = CURRENT_DATA_MODEL;
char * jvmtype = NULL;
int argc = *pargc;
char **argv = *pargv;
int wanted = running; /* What data mode is being
asked for? Current model is
fine unless another model
is asked for */
char** newargv = NULL;
int newargc = 0;
/*
* Starting in 1.5, all unix platforms accept the -d32 and -d64
* options. On platforms where only one data-model is supported
* (e.g. ia-64 Linux), using the flag for the other data model is
* an error and will terminate the program.
*/
{ /* open new scope to declare local variables */
int i;
newargv = (char **)JLI_MemAlloc((argc+1) * sizeof(char*));
newargv[newargc++] = argv[0];
/* scan for data model arguments and remove from argument list;
last occurrence determines desired data model */
for (i=1; i < argc; i++) {
if (JLI_StrCmp(argv[i], "-J-d64") == 0 || JLI_StrCmp(argv[i], "-d64") == 0) {
wanted = 64;
continue;
}
if (JLI_StrCmp(argv[i], "-J-d32") == 0 || JLI_StrCmp(argv[i], "-d32") == 0) {
wanted = 32;
continue;
}
newargv[newargc++] = argv[i];
if (IsJavaArgs()) {
if (argv[i][0] != '-') continue;
} else {
if (JLI_StrCmp(argv[i], "-classpath") == 0 || JLI_StrCmp(argv[i], "-cp") == 0) {
i++;
if (i >= argc) break;
newargv[newargc++] = argv[i];
continue;
}
if (argv[i][0] != '-') { i++; break; }
}
}
/* copy rest of args [i .. argc) */
while (i < argc) {
newargv[newargc++] = argv[i++];
}
newargv[newargc] = NULL;
/*
* newargv has all proper arguments here
*/
argc = newargc;
argv = newargv;
}
/* If the data model is not changing, it is an error if the
jvmpath does not exist */
if (wanted == running) {
/* Find out where the JRE is that we will be using. */
if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
JLI_ReportErrorMessage(JRE_ERROR1);
exit(2);
}
JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
jrepath, FILESEP, FILESEP, "", "");
/* Find the specified JVM type */
if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
JLI_ReportErrorMessage(CFG_ERROR7);
exit(1);
}
jvmpath[0] = '\0';
jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
JLI_ReportErrorMessage(CFG_ERROR9);
exit(4);
}
if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted)) {
JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
exit(4);
}
/*
* Mac OS X requires the Cocoa event loop to be run on the "main"
* thread. Spawn off a new thread to run main() and pass
* this thread off to the Cocoa event loop.
*/
MacOSXStartup(argc, argv);
/*
* we seem to have everything we need, so without further ado
* we return back, otherwise proceed to set the environment.
*/
return;
} else { /* do the same speculatively or exit */
#if defined(DUAL_MODE)
if (running != wanted) {
/* Find out where the JRE is that we will be using. */
if (!GetJREPath(jrepath, so_jrepath, JNI_TRUE)) {
/* give up and let other code report error message */
JLI_ReportErrorMessage(JRE_ERROR2, wanted);
exit(1);
}
JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%s%s%sjvm.cfg",
jrepath, FILESEP, FILESEP, "", "");
/*
* Read in jvm.cfg for target data model and process vm
* selection options.
*/
if (ReadKnownVMs(jvmcfg, JNI_TRUE) < 1) {
/* give up and let other code report error message */
JLI_ReportErrorMessage(JRE_ERROR2, wanted);
exit(1);
}
jvmpath[0] = '\0';
jvmtype = CheckJvmType(pargc, pargv, JNI_TRUE);
if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
JLI_ReportErrorMessage(CFG_ERROR9);
exit(4);
}
/* exec child can do error checking on the existence of the path */
jvmpathExists = GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath, wanted);
}
#else /* ! DUAL_MODE */
JLI_ReportErrorMessage(JRE_ERROR2, wanted);
exit(1);
#endif /* DUAL_MODE */
}
{
char *newexec = execname;
JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
(void) fflush(stdout);
(void) fflush(stderr);
/*
* Use posix_spawn() instead of execv() on Mac OS X.
* This allows us to choose which architecture the child process
* should run as.
*/
{
posix_spawnattr_t attr;
size_t unused_size;
pid_t unused_pid;
#if defined(__i386__) || defined(__x86_64__)
cpu_type_t cpu_type[] = { (wanted == 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86,
(running== 64) ? CPU_TYPE_X86_64 : CPU_TYPE_X86 };
#else
cpu_type_t cpu_type[] = { CPU_TYPE_ANY };
#endif /* __i386 .. */
posix_spawnattr_init(&attr);
posix_spawnattr_setflags(&attr, POSIX_SPAWN_SETEXEC);
posix_spawnattr_setbinpref_np(&attr, sizeof(cpu_type) / sizeof(cpu_type_t),
cpu_type, &unused_size);
posix_spawn(&unused_pid, newexec, NULL, &attr, argv, environ);
}
JLI_ReportErrorMessageSys(JRE_ERROR4, newexec);
#if defined(DUAL_MODE)
if (running != wanted) {
JLI_ReportErrorMessage(JRE_ERROR5, wanted, running);
}
#endif /* DUAL_MODE */
}
/* Find out where the JRE is that we will be using. */
if (!GetJREPath(jrepath, so_jrepath, JNI_FALSE) ) {
JLI_ReportErrorMessage(JRE_ERROR1);
exit(2);
}
JLI_Snprintf(jvmcfg, so_jvmcfg, "%s%slib%sjvm.cfg",
jrepath, FILESEP, FILESEP);
/* Find the specified JVM type */
if (ReadKnownVMs(jvmcfg, JNI_FALSE) < 1) {
JLI_ReportErrorMessage(CFG_ERROR7);
exit(1);
}
jvmpath[0] = '\0';
jvmtype = CheckJvmType(pargc, pargv, JNI_FALSE);
if (JLI_StrCmp(jvmtype, "ERROR") == 0) {
JLI_ReportErrorMessage(CFG_ERROR9);
exit(4);
}
if (!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)) {
JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);
exit(4);
}
/*
* Mac OS X requires the Cocoa event loop to be run on the "main"
* thread. Spawn off a new thread to run main() and pass
* this thread off to the Cocoa event loop.
*/
MacOSXStartup(argc, argv);
/*
* we seem to have everything we need
*/
return;
}
/*
@ -566,7 +413,7 @@ CreateExecutionEnvironment(int *pargc, char ***pargv,
*/
static jboolean
GetJVMPath(const char *jrepath, const char *jvmtype,
char *jvmpath, jint jvmpathsize, int bitsWanted)
char *jvmpath, jint jvmpathsize)
{
struct stat s;
@ -577,8 +424,7 @@ GetJVMPath(const char *jrepath, const char *jvmtype,
* macosx client library is built thin, i386 only.
* 64 bit client requests must load server library
*/
const char *jvmtypeUsed = ((bitsWanted == 64) && (strcmp(jvmtype, "client") == 0)) ? "server" : jvmtype;
JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtypeUsed);
JLI_Snprintf(jvmpath, jvmpathsize, "%s/lib/%s/" JVM_DLL, jrepath, jvmtype);
}
JLI_TraceLauncher("Does `%s' exist ... ", jvmpath);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,6 +39,8 @@
#include <unistd.h>
#include <errno.h>
#include <sys/poll.h>
#include "jvm.h"
#include "net_util.h"
/*
* Stack allocated by thread when doing blocking operation
@ -414,8 +416,7 @@ int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) {
* Auto restarts with adjusted timeout if interrupted by
* signal other than our wakeup signal.
*/
int NET_Timeout0(int s, long timeout, long currentTime) {
long prevtime = currentTime, newtime;
int NET_Timeout(JNIEnv *env, int s, long timeout, jlong nanoTimeStamp) {
struct timeval t, *tp = &t;
fd_set fds;
fd_set* fdsp = NULL;
@ -460,6 +461,8 @@ int NET_Timeout0(int s, long timeout, long currentTime) {
}
FD_SET(s, fdsp);
jlong prevNanoTime = nanoTimeStamp;
jlong nanoTimeout = (jlong) timeout * NET_NSEC_PER_MSEC;
for(;;) {
int rv;
@ -477,25 +480,21 @@ int NET_Timeout0(int s, long timeout, long currentTime) {
* has expired return 0 (indicating timeout expired).
*/
if (rv < 0 && errno == EINTR) {
if (timeout > 0) {
struct timeval now;
gettimeofday(&now, NULL);
newtime = now.tv_sec * 1000 + now.tv_usec / 1000;
timeout -= newtime - prevtime;
if (timeout <= 0) {
if (allocated != 0)
free(fdsp);
return 0;
}
prevtime = newtime;
t.tv_sec = timeout / 1000;
t.tv_usec = (timeout % 1000) * 1000;
jlong newNanoTime = JVM_NanoTime(env, 0);
nanoTimeout -= newNanoTime - prevNanoTime;
if (nanoTimeout < NET_NSEC_PER_MSEC) {
if (allocated != 0)
free(fdsp);
return 0;
}
prevNanoTime = newNanoTime;
t.tv_sec = nanoTimeout / NET_NSEC_PER_SEC;
t.tv_usec = (nanoTimeout % NET_NSEC_PER_SEC) / NET_NSEC_PER_USEC;
} else {
if (allocated != 0)
free(fdsp);
return rv;
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2017 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it

View File

@ -29,6 +29,8 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
@ -62,12 +64,17 @@ final class PropMap implements SortedMap<String, String> {
Properties props = new Properties();
// Allow implementation selected via -Dpack.disable.native=true
String propValue = getPropertyValue(Utils.DEBUG_DISABLE_NATIVE, "false");
props.put(Utils.DEBUG_DISABLE_NATIVE,
String.valueOf(Boolean.getBoolean(Utils.DEBUG_DISABLE_NATIVE)));
String.valueOf(Boolean.parseBoolean(propValue)));
// Set the DEBUG_VERBOSE from system
props.put(Utils.DEBUG_VERBOSE,
String.valueOf(Integer.getInteger(Utils.DEBUG_VERBOSE,0)));
int verbose = 0;
try {
verbose = Integer.decode(getPropertyValue(Utils.DEBUG_VERBOSE, "0"));
} catch (NumberFormatException e) {
}
props.put(Utils.DEBUG_VERBOSE, String.valueOf(verbose));
// The segment size is unlimited
props.put(Pack200.Packer.SEGMENT_LIMIT, "-1");
@ -87,7 +94,7 @@ final class PropMap implements SortedMap<String, String> {
// Pass through files with unrecognized format by default, also
// allow system property to be set
props.put(Utils.CLASS_FORMAT_ERROR,
System.getProperty(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
getPropertyValue(Utils.CLASS_FORMAT_ERROR, Pack200.Packer.PASS));
// Default effort is 5, midway between 1 and 9.
props.put(Pack200.Packer.EFFORT, "5");
@ -97,7 +104,9 @@ final class PropMap implements SortedMap<String, String> {
// to allow override if necessary.
String propFile = "intrinsic.properties";
try (InputStream propStr = PackerImpl.class.getResourceAsStream(propFile)) {
PrivilegedAction<InputStream> pa =
() -> PackerImpl.class.getResourceAsStream(propFile);
try (InputStream propStr = AccessController.doPrivileged(pa)) {
if (propStr == null) {
throw new RuntimeException(propFile + " cannot be loaded");
}
@ -119,6 +128,12 @@ final class PropMap implements SortedMap<String, String> {
defaultProps = temp;
}
private static String getPropertyValue(String key, String defaultValue) {
PrivilegedAction<String> pa = () -> System.getProperty(key);
String s = AccessController.doPrivileged(pa);
return s != null ? s : defaultValue;
}
PropMap() {
theMap.putAll(defaultProps);
}

View File

@ -40,10 +40,8 @@ import sun.nio.cs.StreamEncoder;
*
* <p> Each invocation of a write() method causes the encoding converter to be
* invoked on the given character(s). The resulting bytes are accumulated in a
* buffer before being written to the underlying output stream. The size of
* this buffer may be specified, but by default it is large enough for most
* purposes. Note that the characters passed to the write() methods are not
* buffered.
* buffer before being written to the underlying output stream. Note that the
* characters passed to the write() methods are not buffered.
*
* <p> For top efficiency, consider wrapping an OutputStreamWriter within a
* BufferedWriter so as to avoid frequent converter invocations. For example:

View File

@ -2875,19 +2875,19 @@ public final class Class<T> implements java.io.Serializable,
static <T> boolean casReflectionData(Class<?> clazz,
SoftReference<ReflectionData<T>> oldData,
SoftReference<ReflectionData<T>> newData) {
return unsafe.compareAndSwapObject(clazz, reflectionDataOffset, oldData, newData);
return unsafe.compareAndSetObject(clazz, reflectionDataOffset, oldData, newData);
}
static <T> boolean casAnnotationType(Class<?> clazz,
AnnotationType oldType,
AnnotationType newType) {
return unsafe.compareAndSwapObject(clazz, annotationTypeOffset, oldType, newType);
return unsafe.compareAndSetObject(clazz, annotationTypeOffset, oldType, newType);
}
static <T> boolean casAnnotationData(Class<?> clazz,
AnnotationData oldData,
AnnotationData newData) {
return unsafe.compareAndSwapObject(clazz, annotationDataOffset, oldData, newData);
return unsafe.compareAndSetObject(clazz, annotationDataOffset, oldData, newData);
}
}

View File

@ -119,18 +119,24 @@ import sun.security.util.SecurityConstants;
* The Java run-time has the following built-in class loaders:
*
* <ul>
* <li>Bootstrap class loader.
* <li><p>Bootstrap class loader.
* It is the virtual machine's built-in class loader, typically represented
* as {@code null}, and does not have a parent.</li>
* <li>{@linkplain #getPlatformClassLoader() Platform class loader}.
* <li><p>{@linkplain #getPlatformClassLoader() Platform class loader}.
* All <em>platform classes</em> are visible to the platform class loader
* that can be used as the parent of a {@code ClassLoader} instance.
* Platform classes include Java SE platform APIs, their implementation
* classes and JDK-specific run-time classes that are defined by the
* platform class loader or its ancestors.</li>
* <li>{@linkplain #getSystemClassLoader() System class loader}.
* It is also known as <em>application class
* loader</em> and is distinct from the platform class loader.
* platform class loader or its ancestors.
* <p> To allow for upgrading/overriding of modules defined to the platform
* class loader, and where classes in the upgraded version link to
* classes in modules defined to the application class loader, the
* platform class loader may delegate to the application class loader.
* In other words, classes in named modules defined to the application
* class loader may be visible to the platform class loader. </li>
* <li><p>{@linkplain #getSystemClassLoader() System class loader}.
* It is also known as <em>application class loader</em> and is distinct
* from the platform class loader.
* The system class loader is typically used to define classes on the
* application class path, module path, and JDK-specific tools.
* The platform class loader is a parent or an ancestor of the system class
@ -368,6 +374,10 @@ public abstract class ClassLoader {
* Creates a new class loader of the specified name and using the
* specified parent class loader for delegation.
*
* @apiNote If the parent is specified as {@code null} (for the
* bootstrap class loader) then there is no guarantee that all platform
* classes are visible.
*
* @param name class loader name; or {@code null} if not named
* @param parent the parent class loader
*
@ -390,9 +400,12 @@ public abstract class ClassLoader {
* delegation.
*
* <p> If there is a security manager, its {@link
* SecurityManager#checkCreateClassLoader()
* checkCreateClassLoader} method is invoked. This may result in
* a security exception. </p>
* SecurityManager#checkCreateClassLoader() checkCreateClassLoader} method
* is invoked. This may result in a security exception. </p>
*
* @apiNote If the parent is specified as {@code null} (for the
* bootstrap class loader) then there is no guarantee that all platform
* classes are visible.
*
* @param parent
* The parent class loader
@ -2206,6 +2219,12 @@ public abstract class ClassLoader {
* this class loader are searched recursively (parent by parent)
* for a {@code Package} of the given name.
*
* @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader but the application class
* loader is not its ancestor. When invoked on the platform class loader,
* this method will not find packages defined to the application
* class loader.
*
* @param name
* The <a href="#name">package name</a>
*
@ -2251,6 +2270,14 @@ public abstract class ClassLoader {
* {@code Package} object of the same package name, each defined by
* a different class loader in the class loader hierarchy.
*
* @apiNote The {@link #getPlatformClassLoader() platform class loader}
* may delegate to the application class loader. In other words,
* packages in modules defined to the application class loader may be
* visible to the platform class loader. On the other hand,
* the application class loader is not its ancestor and hence
* when invoked on the platform class loader, this method will not
* return any packages defined to the application class loader.
*
* @return The array of {@code Package} objects defined by this
* class loader and its ancestors
*
@ -2857,7 +2884,7 @@ public abstract class ClassLoader {
} catch (NoSuchFieldException e) {
throw new InternalError(e);
}
return unsafe.compareAndSwapObject(this, offset, null, obj);
return unsafe.compareAndSetObject(this, offset, null, obj);
}
}

View File

@ -57,6 +57,7 @@ import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.BootLoader;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.module.ServicesCatalog;
import jdk.internal.module.Resources;
import jdk.internal.org.objectweb.asm.AnnotationVisitor;
@ -215,8 +216,8 @@ public final class Module implements AnnotatedElement {
}
/**
* Returns the layer that contains this module or {@code null} if this
* module is not in a layer.
* Returns the module layer that contains this module or {@code null} if
* this module is not in a module layer.
*
* A module layer contains named modules and therefore this method always
* returns {@code null} when invoked on an unnamed module.
@ -691,6 +692,13 @@ public final class Module implements AnnotatedElement {
* <p> This method has no effect if the package is already <em>open</em>
* to the given module. </p>
*
* @apiNote This method can be used for cases where a <em>consumer
* module</em> uses a qualified opens to open a package to an <em>API
* module</em> but where the reflective access to the members of classes in
* the consumer module is delegated to code in another module. Code in the
* API module can use this method to open the package in the consumer module
* to the other module.
*
* @param pn
* The package name
* @param other
@ -1077,7 +1085,7 @@ public final class Module implements AnnotatedElement {
if (loader != null) {
moduleToLoader.put(name, loader);
loaders.add(loader);
} else if (!isBootLayer) {
} else if (!(clf instanceof ModuleLoaderMap.Mapper)) {
throw new IllegalArgumentException("loader can't be 'null'");
}
}
@ -1458,11 +1466,11 @@ public final class Module implements AnnotatedElement {
* encapsulated. </li>
*
* <li> A <em>package name</em> is derived from the resource name. If
* the package name is a {@link #getPackages() package} in the module
* then the resource can only be located by the caller of this method
* when the package is {@link #isOpen(String,Module) open} to at least
* the caller's module. If the resource is not in a package in the module
* then the resource is not encapsulated. </li>
* the package name is a {@linkplain #getPackages() package} in the
* module then the resource can only be located by the caller of this
* method when the package is {@linkplain #isOpen(String,Module) open}
* to at least the caller's module. If the resource is not in a
* package in the module then the resource is not encapsulated. </li>
* </ul>
*
* <p> In the above, the <em>package name</em> for a resource is derived
@ -1521,8 +1529,7 @@ public final class Module implements AnnotatedElement {
}
// locate resource in module
JavaLangAccess jla = SharedSecrets.getJavaLangAccess();
URL url = jla.findResource(loader, mn, name);
URL url = loader.findResource(mn, name);
if (url != null) {
try {
return url.openStream();

View File

@ -25,10 +25,10 @@
package java.lang;
import java.lang.RuntimePermission;
import java.lang.module.ModuleDescriptor;
import java.lang.module.ModuleDescriptor.Exports;
import java.lang.module.ModuleDescriptor.Opens;
import java.lang.module.ModuleReference;
import java.lang.reflect.Member;
import java.io.FileDescriptor;
import java.io.File;
@ -42,12 +42,15 @@ import java.security.PrivilegedAction;
import java.security.Security;
import java.security.SecurityPermission;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
import java.util.PropertyPermission;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import jdk.internal.module.ModuleBootstrap;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.reflect.CallerSensitive;
import sun.security.util.SecurityConstants;
@ -1431,30 +1434,30 @@ class SecurityManager {
return packages;
}
// The non-exported packages of the modules in the boot layer that are
// loaded by the platform class loader or its ancestors. A non-exported
// package is a package that either is not exported at all by its containing
// module or is exported in a qualified fashion by its containing module.
private static final Set<String> nonExportedPkgs;
// The non-exported packages in modules defined to the boot or platform
// class loaders. A non-exported package is a package that is not exported
// or is only exported to specific modules.
private static final Map<String, Boolean> nonExportedPkgs = new ConcurrentHashMap<>();
static {
// Get the modules in the boot layer
Stream<Module> bootLayerModules = ModuleLayer.boot().modules().stream();
// Filter out the modules loaded by the boot or platform loader
PrivilegedAction<Set<Module>> pa = () ->
bootLayerModules.filter(SecurityManager::isBootOrPlatformModule)
.collect(Collectors.toSet());
Set<Module> modules = AccessController.doPrivileged(pa);
// Filter out the non-exported packages
nonExportedPkgs = modules.stream()
.map(Module::getDescriptor)
.map(SecurityManager::nonExportedPkgs)
.flatMap(Set::stream)
.collect(Collectors.toSet());
addNonExportedPackages(ModuleLayer.boot());
}
/**
* Record the non-exported packages of the modules in the given layer
*/
static void addNonExportedPackages(ModuleLayer layer) {
Set<String> bootModules = ModuleLoaderMap.bootModules();
Set<String> platformModules = ModuleLoaderMap.platformModules();
layer.modules().stream()
.map(Module::getDescriptor)
.filter(md -> bootModules.contains(md.name())
|| platformModules.contains(md.name()))
.map(SecurityManager::nonExportedPkgs)
.flatMap(Set::stream)
.forEach(pn -> nonExportedPkgs.put(pn, Boolean.TRUE));
}
/**
* Called by java.security.Security
*/
@ -1467,14 +1470,6 @@ class SecurityManager {
}
}
/**
* Returns true if the module's loader is the boot or platform loader.
*/
private static boolean isBootOrPlatformModule(Module m) {
return m.getClassLoader() == null ||
m.getClassLoader() == ClassLoader.getPlatformClassLoader();
}
/**
* Returns the non-exported packages of the specified module.
*/
@ -1535,7 +1530,7 @@ class SecurityManager {
Objects.requireNonNull(pkg, "package name can't be null");
// check if pkg is not exported to all modules
if (nonExportedPkgs.contains(pkg)) {
if (nonExportedPkgs.containsKey(pkg)) {
checkPermission(
new RuntimePermission("accessClassInPackage." + pkg));
return;
@ -1634,7 +1629,7 @@ class SecurityManager {
Objects.requireNonNull(pkg, "package name can't be null");
// check if pkg is not exported to all modules
if (nonExportedPkgs.contains(pkg)) {
if (nonExportedPkgs.containsKey(pkg)) {
checkPermission(
new RuntimePermission("defineClassInPackage." + pkg));
return;

Some files were not shown because too many files have changed in this diff Show More